paste at a point; first translate the point
authorca
Fri, 05 Sep 1997 15:27:18 +0200
changeset 312 386932d91a97
parent 311 52f954630dca
child 313 33d13a59b6f9
paste at a point; first translate the point
UIPainterView.st
--- a/UIPainterView.st	Fri Sep 05 11:03:47 1997 +0200
+++ b/UIPainterView.st	Fri Sep 05 15:27:18 1997 +0200
@@ -225,7 +225,7 @@
 pasteSpecifications:aSpecificationOrList keepLayout:keepLayout at:aPointOrNil
     "add the specs to the object view; returns list of pasted components
     "
-    |paste frame pasteOrigin pasteOffset builder newSel|
+    |paste frame pasteOrigin pasteOffset builder newSel bounds|
 
     (self canPaste:aSpecificationOrList) ifFalse:[
         ^ nil
@@ -250,12 +250,20 @@
 
         keepLayout ifFalse:[
             pasteOffset := 0@0.
+
             aPointOrNil isNil ifTrue:[
                 pasteOrigin := self sensor mousePoint.
-                pasteOrigin := device translatePoint:pasteOrigin from:device rootView id to:frame id.
+                pasteOrigin := device translatePoint:pasteOrigin
+                                            from:device rootView id
+                                              to:frame id.
             ] ifFalse:[
-                pasteOrigin := aPointOrNil
-            ].
+                pasteOrigin := device translatePoint:aPointOrNil
+                                                from:self id
+                                                  to:frame id.
+            ]
+        ].
+        keepLayout ifFalse:[
+            bounds := Rectangle origin:0@0 extent:(frame bounds extent)
         ].
 
         paste do:[:aSpec|
@@ -264,8 +272,8 @@
             view := self addSpec:aSpec builder:builder in:frame.
 
             keepLayout ifFalse:[
-                (frame bounds containsPoint:pasteOrigin) ifFalse:[
-                    self moveObject:view to:pasteOffset.
+                (bounds containsPoint:pasteOrigin) ifFalse:[
+                    self moveObject:view to:pasteOffset.    self halt.
                 ] ifTrue:[
                     self moveObject:view to:pasteOrigin + pasteOffset.
                 ].