ObjectView.st
changeset 3421 ed1db967fa82
parent 3420 d1d2631c48a6
child 3489 2611d54611ee
--- a/ObjectView.st	Fri Oct 27 14:32:02 2006 +0200
+++ b/ObjectView.st	Fri Oct 27 17:25:22 2006 +0200
@@ -3068,6 +3068,25 @@
 
 !ObjectView methodsFor:'testing objects'!
 
+allObjectsHitAt:aPoint do:aBlock
+    "for all objects (by enumerating from back to front) which are hit by
+     the argument, aPoint, evaluate aBlock"
+
+    |hdelta|
+
+    contents notEmptyOrNil ifTrue:[
+        hdelta := self hitDelta / self scale x.
+        contents reverseDo:[:object |
+            (object isHitBy:aPoint withDelta:hdelta) ifTrue:[
+                aBlock value:object
+            ]
+        ]
+    ].
+    ^ nil
+
+    "Created: / 27-10-2006 / 16:58:34 / cg"
+!
+
 canMove:something
     "return true, if the argument, anObject or a collection can be moved"
 
@@ -3101,50 +3120,32 @@
     "find the last object (by looking from back to front) which is hit by
      the argument, aPoint - this is the topmost object hit"
 
-    |hdelta|
-
-    contents isEmptyOrNil ifTrue:[^ nil].
-
-    hdelta := self hitDelta.
-    contents reverseDo:[:object |
-        (object isHitBy:aPoint withDelta:hdelta) ifTrue:[^ object]
-    ].
+    self allObjectsHitAt:aPoint do:[:object | ^ object].
     ^ nil
+
+    "Modified: / 27-10-2006 / 16:58:54 / cg"
 !
 
 findObjectAt:aPoint forWhich:aBlock
     "find the last object (by looking from back to front) which is hit by
      the argument, aPoint - this is the topmost object hit"
 
-    |hdelta|
-
-    contents isEmptyOrNil ifTrue:[^ nil].
-
-    hdelta := self hitDelta.
-    contents reverseDo:[:object |
-        (object isHitBy:aPoint withDelta:hdelta) ifTrue:[
-            (aBlock value:object) ifTrue:[
-                ^ object
-            ]
-        ]
-    ].
+    self allObjectsHitAt:aPoint do:[:object | (aBlock value:object) ifTrue:[^ object]].
     ^ nil
+
+    "Modified: / 27-10-2006 / 16:59:26 / cg"
 !
 
 findObjectAt:aPoint suchThat:aBlock
     "find the last object (back to front ) which is hit by
-     the argument, aPoint and for which the testBlock, aBlock evaluates to
-     true"
-
-    |hdelta|
-
-    hdelta := self hitDelta.
-    contents reverseDo:[:object |
-	(object isHitBy:aPoint withDelta:hdelta) ifTrue:[
-	    (aBlock value:object) ifTrue:[^ object]
-	]
-    ].
-    ^ nil
+     the argument, aPoint and for which the testBlock, aBlock evaluates to true.
+     This is a leftOver from times when scrolling was not transparent.
+     Please use findObjectAt:forWhich:, since this will vanish."
+
+    self obsoleteMethodWarning:'use findObjectAt:forWhich:'.
+    ^ self findObjectAt:aPoint forWhich:aBlock
+
+    "Modified: / 27-10-2006 / 17:01:42 / cg"
 !
 
 findObjectAtVisible:aPoint
@@ -3153,7 +3154,10 @@
      This is a leftOver from times when scrolling was not transparent.
      Please use findObjectAt:, since this will vanish."
 
+    self obsoleteMethodWarning:'use findObjectAt:'.
     ^ self findObjectAt:aPoint
+
+    "Modified: / 27-10-2006 / 17:02:08 / cg"
 !
 
 findObjectAtVisible:aPoint suchThat:aBlock
@@ -3161,9 +3165,12 @@
      the argument, aPoint and for which the testBlock, aBlock evaluates to
      true.
      This is a leftOver from times when scrolling was not transparent.
-     Please use findObjectAt:suchThat:, since this will vanish."
-
+     Please use findObjectAt:forWhich:, since this will vanish."
+
+    self obsoleteMethodWarning:'use findObjectAt:forWhich:'.
     ^ self findObjectAt:aPoint suchThat:aBlock
+
+    "Modified: / 27-10-2006 / 17:01:47 / cg"
 !
 
 frameIncludesSelectionHandlesOn:anObject
@@ -3184,16 +3191,19 @@
     |first frameAll|
 
     anObjectOrCollection isNil ifTrue:[^ nil ].
+
     first := true.
     self forEach:anObjectOrCollection do:[:theObject |
-	first ifTrue:[
-	    frameAll := theObject frame.
-	    first := false
-	] ifFalse:[
-	    frameAll := frameAll merge:(theObject frame)
-	]
+        first ifTrue:[
+            frameAll := theObject frame.
+            first := false
+        ] ifFalse:[
+            frameAll := frameAll merge:(theObject frame)
+        ]
     ].
     ^ frameAll
+
+    "Modified: / 27-10-2006 / 17:02:16 / cg"
 !
 
 isObscured:something
@@ -3431,5 +3441,5 @@
 !ObjectView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.123 2006-10-27 12:32:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/ObjectView.st,v 1.124 2006-10-27 15:25:22 cg Exp $'
 ! !