The Trunk: Morphic-mt.1027.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1027.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1027.mcz

==================== Summary ====================

Name: Morphic-mt.1027
Author: mt
Time: 5 November 2015, 9:08:06.974 am
UUID: aaa21de5-cebc-4dcf-bf58-8595ba22ee71
Ancestors: Morphic-mt.1026

In lists, update selection before starting drag operation in case the user decides not to drag a not selected item.

=============== Diff against Morphic-mt.1026 ===============

Item was changed:
  ----- Method: PluggableListMorph>>startDrag: (in category 'drag and drop') -----
  startDrag: evt
 
+ | item itemMorph |
- | item itemMorph |
  evt hand hasSubmorphs ifTrue: [^ self].
  self model okToChange ifFalse: [^ self].
 
+ "Ensure selection to save additional click."
+ (self modelIndexFor: (self rowAtLocation: evt position)) in: [:evtIndex |
+ self selectionIndex = evtIndex ifFalse: [self changeModelSelection: evtIndex]].
+
  item := self selection ifNil: [^ self].
  itemMorph := StringMorph contents: item asStringOrText.
 
  [ "Initiate drag."
  (self model dragPassengerFor: itemMorph inMorph: self) ifNotNil: [:passenger | | ddm |
  ddm := (self valueOfProperty: #dragTransferClass ifAbsent: [TransferMorph]) withPassenger: passenger from: self.
  ddm dragTransferType: (self model dragTransferTypeForMorph: self).
  ddm updateFromUserInputEvent: evt.
  self model dragStartedFor: itemMorph transferMorph: ddm.
  evt hand grabMorph: ddm]
  ] ensure: [
  Cursor normal show.
  evt hand releaseMouseFocus: self].!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1027.mcz

Chris Muller-3
I see no difference.  With or without this change, it doesn't seem to
select until after I start the drag..

Also, I'm wondering if this shouldn't honor the "Menu request updates
list/tree selection"..  (maybe we would need to rename it to "Menu or
drag request updates list/tree selection")?  I know it didn't already,
but it just reminded me of that when I was testing it.

On Thu, Nov 5, 2015 at 2:08 AM,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1027.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1027
> Author: mt
> Time: 5 November 2015, 9:08:06.974 am
> UUID: aaa21de5-cebc-4dcf-bf58-8595ba22ee71
> Ancestors: Morphic-mt.1026
>
> In lists, update selection before starting drag operation in case the user decides not to drag a not selected item.
>
> =============== Diff against Morphic-mt.1026 ===============
>
> Item was changed:
>   ----- Method: PluggableListMorph>>startDrag: (in category 'drag and drop') -----
>   startDrag: evt
>
> +       | item itemMorph |
> -       | item itemMorph |
>         evt hand hasSubmorphs ifTrue: [^ self].
>         self model okToChange ifFalse: [^ self].
>
> +       "Ensure selection to save additional click."
> +       (self modelIndexFor: (self rowAtLocation: evt position)) in: [:evtIndex |
> +               self selectionIndex = evtIndex ifFalse: [self changeModelSelection: evtIndex]].
> +
>         item := self selection ifNil: [^ self].
>         itemMorph := StringMorph contents: item asStringOrText.
>
>         [ "Initiate drag."
>                 (self model dragPassengerFor: itemMorph inMorph: self) ifNotNil: [:passenger | | ddm |
>                         ddm := (self valueOfProperty: #dragTransferClass ifAbsent: [TransferMorph]) withPassenger: passenger from: self.
>                         ddm dragTransferType: (self model dragTransferTypeForMorph: self).
>                         ddm updateFromUserInputEvent: evt.
>                         self model dragStartedFor: itemMorph transferMorph: ddm.
>                         evt hand grabMorph: ddm]
>         ] ensure: [
>                 Cursor normal show.
>                 evt hand releaseMouseFocus: self].!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1027.mcz

marcel.taeumel
It usually selects on #mouseUp. Now it also selects on #startDrag: ;-) In my image and prior to this change, it would not change the selection but drag the already selected item. Hmm...

Yes, we could use the same preference for this to avoid the selection update.

Best,
Marcel