--- a/DragAndDropManager.st Tue Apr 22 17:26:01 2008 +0200
+++ b/DragAndDropManager.st Tue Apr 22 17:26:06 2008 +0200
@@ -686,6 +686,28 @@
!DragAndDropManager class methodsFor:'translation'!
+translatePointFromScreen:aPoint to:aView
+ "translate a point from screen to view coordinates"
+
+ |device trans point offset|
+
+ aView isRootView ifTrue:[^ aPoint].
+ device := aView device.
+ "/
+ "/ get device coordinates
+ "/
+ (trans := aView transformation) notNil ifTrue:[
+ point := trans applyInverseTo:aPoint
+ ] ifFalse:[
+ point := aPoint
+ ].
+ "/
+ "/ translate to screen
+ "/
+ offset := device translatePoint:0@0 fromView:(device rootView) toView:aView.
+ ^ offset + point
+!
+
translatePointFromScreen:aPoint toView:aView
"translate a point from screen- to view coordinates"
@@ -734,7 +756,7 @@
buttonMotion:button x:x y:y view:aView
|device screenPoint oldWidget oldId oldPoint newId newWidget oldTarget newTarget
- isDroppable cursor|
+ isDroppable cursor targetPoint|
self isDisabled ifTrue: [ ^ self ].
@@ -753,15 +775,16 @@
oldId := dropContext targetId.
oldPoint := dropContext rootPoint.
- screenPoint := self class translatePointToScreen:(x @ y) from:aView.
-"/ screenPoint := device pointerPosition.
+ screenPoint := self class translatePointToScreen:(x @ y) from:aView.
dropContext rootPoint:screenPoint.
newId := device viewIdFromPoint:screenPoint.
newWidget := device viewFromId:newId.
+ targetPoint := self class translatePointFromScreen:screenPoint to:newWidget.
dropContext rootPoint:screenPoint.
dropContext targetWidget:newWidget id:newId.
+ handler targetView:newWidget.
handler isInterestedInDropTarget ifFalse:[
"/
@@ -1616,7 +1639,7 @@
!DragAndDropManager class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.77 2008-03-28 13:11:12 ab Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/DragAndDropManager.st,v 1.78 2008-04-22 15:26:06 cg Exp $'
! !
DragAndDropManager initialize!