UIGalleryView.st
changeset 1673 5ec4b63a862a
parent 1671 493e0430518e
child 1674 ed8aa80a11a9
equal deleted inserted replaced
1672:5e89f5959780 1673:5ec4b63a862a
   410 !UIGalleryView::Canvas methodsFor:'drag & drop'!
   410 !UIGalleryView::Canvas methodsFor:'drag & drop'!
   411 
   411 
   412 startDragFrom:aPoint
   412 startDragFrom:aPoint
   413     "start drag at a point
   413     "start drag at a point
   414     "
   414     "
   415     |spec dragObj offset clickPos|
   415     |spec dragObj offset clickPos oldSelect|
   416 
   416 
   417     clickPos := lastClickPoint.
   417     clickPos := lastClickPoint.
   418     clickPos isNil ifTrue:[^ self].
   418     clickPos isNil ifTrue:[^ self].
   419     lastClickPoint := nil.
   419     lastClickPoint := nil.
   420 
   420 
       
   421     oldSelect := selection.
   421     self selection:(self findObjectAtX:(clickPos x) y:(clickPos y)).
   422     self selection:(self findObjectAtX:(clickPos x) y:(clickPos y)).
   422 
   423 
   423     spec := self findSpecFor:selection.
   424     spec := self findSpecFor:selection.
   424     spec isNil ifTrue:[^ self].
   425     spec isNil ifTrue:[^ self].
   425 
   426 
       
   427     oldSelect == selection ifTrue:[
       
   428         self hideSelection
       
   429     ].
   426     dragMode := true.
   430     dragMode := true.
   427     spec := self buildSpecFrom:spec.
   431     spec := self buildSpecFrom:spec.
   428     spec name:(spec copy userFriendlyName, $1).
   432     spec name:(spec copy userFriendlyName, $1).
   429 
   433 
   430     dragObj := DropSpec for:selection specification:spec.
   434     dragObj := DropSpec for:selection specification:spec.
   476     anEvent isButtonEvent ifFalse:[^ true].
   480     anEvent isButtonEvent ifFalse:[^ true].
   477 
   481 
   478     x := anEvent x.
   482     x := anEvent x.
   479     y := anEvent y.
   483     y := anEvent y.
   480     p := device translatePoint:(x@y) fromView:evView toView:self.
   484     p := device translatePoint:(x@y) fromView:evView toView:self.
       
   485     x := p x.
       
   486     y := p y.
   481 
   487 
   482     anEvent isButtonPressEvent ifTrue:[ |button application|
   488     anEvent isButtonPressEvent ifTrue:[ |button application|
   483         button := anEvent button.
   489         button := anEvent button.
   484         x := p x.
   490         x := p x.
   485         y := p y.
   491         y := p y.
   555 findObjectAtX:x y:y
   561 findObjectAtX:x y:y
   556     "find the origin/corner of the currentWidget
   562     "find the origin/corner of the currentWidget
   557     "
   563     "
   558     |point p|
   564     |point p|
   559 
   565 
       
   566     subViews size == 0 ifTrue:[^ nil].
   560     point := Point x:x y:y.
   567     point := Point x:x y:y.
   561 
   568 
   562     subViews do:[:v|
   569     subViews do:[:v|
   563         |pX pY|
   570         |pX pY|
   564 
   571