--- a/Rectangle.st Sat Nov 13 13:19:42 1999 +0100
+++ b/Rectangle.st Sat Nov 13 13:21:02 1999 +0100
@@ -283,6 +283,29 @@
!Rectangle methodsFor:'Compatibility - Squeak'!
+amountToTranslateWithin: aRectangle
+ "Answer a Point, delta, such that self + delta is forced within aRectangle."
+ "Altered so as to prefer to keep self topLeft inside when all of self
+ cannot be made to fit 7/27/96 di"
+ | dx dy |
+ dx _ 0. dy _ 0.
+ self right > aRectangle right ifTrue: [dx _ aRectangle right - self right].
+ self bottom > aRectangle bottom ifTrue: [dy _ aRectangle bottom - self bottom].
+ (self left + dx) < aRectangle left ifTrue: [dx _ aRectangle left - self left].
+ (self top + dy) < aRectangle top ifTrue: [dy _ aRectangle top - self top].
+ ^ dx@dy!
+
+containsRect:aRect
+ "Answer whether aRect is within the receiver (OK to coincide)."
+
+ ^ self contains:aRect
+!
+
+translatedToBeWithin: aRectangle
+ "Answer a copy of the receiver that does not extend beyond aRectangle. 7/8/96 sw"
+
+ ^ self translateBy: (self amountToTranslateWithin: aRectangle)!
+
withHeight:height
"Return a copy of me with a different height"
@@ -1164,12 +1187,6 @@
"
!
-amountToTranslateWithin: aRectangle
- "for GNU-ST compatibility"
-
- ^(aRectangle origin) - self origin
-!
-
areasOutside: aRectangle
"Answer an Array of Rectangles comprising the parts of the receiver not
intersecting aRectangle."
@@ -1729,5 +1746,5 @@
!Rectangle class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.68 1999-11-09 09:32:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Rectangle.st,v 1.69 1999-11-13 12:21:02 cg Exp $'
! !