--- a/ModalBox.st Wed Mar 15 12:59:17 2017 +0100
+++ b/ModalBox.st Wed Mar 15 19:37:59 2017 +0100
@@ -433,27 +433,52 @@
This is used for self-resizing enterBoxes, to avoid moving
the box away from the cursor."
- |newExtent newLeft delta screenWidth|
+ |newExtent newWidth newHeight newLeft newRight newTop newBottom delta screenWidth|
newExtent := self preferredExtent.
newExtent = self extent ifTrue:[^ self].
shown ifTrue:[
- delta := width - newExtent x.
- newLeft := left + delta.
- (((newLeft @ top) extent:newExtent) containsPoint:device pointerPosition
- ) ifFalse:[
- newLeft := left
+ "/ new code (after 15.3.2017)
+
+ newWidth := newExtent x.
+ newHeight := newExtent y.
+ newLeft := left.
+ newTop := top.
+ newRight := left + newWidth.
+ newBottom := top + newHeight.
+ newRight > device usableWidth ifTrue:[
+ newLeft := device usableWidth - newWidth.
+ newLeft < 0 ifTrue:[
+ newLeft := 0.
+ newRight := newWidth := device usableWidth.
+ ].
].
- newLeft < 0 ifTrue:[newLeft := 0].
- screenWidth := device usableWidth.
- newLeft + newExtent x > screenWidth ifTrue:[
- newLeft := screenWidth - newExtent x
+ newBottom > device usableHeight ifTrue:[
+ newTop := device usableHeight - newHeight.
+ newTop < 0 ifTrue:[
+ newTop := 0.
+ newBottom := newHeight := device usableHeight.
+ ].
].
+ newExtent := newWidth @ newHeight.
+
+"/ old code (before 15.3.2017).
+"/ delta := width - newExtent x.
+"/ newLeft := left + delta.
+"/ (((newLeft @ top) extent:newExtent) containsPoint:device pointerPosition
+"/ ) ifFalse:[
+"/ newLeft := left
+"/ ].
+"/ newLeft < 0 ifTrue:[newLeft := 0].
+"/ screenWidth := device usableWidth.
+"/ newLeft + newExtent x > screenWidth ifTrue:[
+"/ newLeft := screenWidth - newExtent x
+"/ ].
shadowView notNil ifTrue:[
shadowView unmap.
].
- self origin:(newLeft @ top) extent:newExtent.
+ self origin:(newLeft @ newTop) extent:newExtent.
shadowView notNil ifTrue:[
shadowView realize.
self raise.
@@ -462,8 +487,9 @@
self extent:newExtent.
].
- "Modified: 6.9.1995 / 15:31:21 / claus"
- "Modified: 3.5.1996 / 23:48:17 / stefan"
+ "Modified: / 06-09-1995 / 15:31:21 / claus"
+ "Modified: / 03-05-1996 / 23:48:17 / stefan"
+ "Modified (comment): / 15-03-2017 / 19:37:03 / cg"
! !
!ModalBox methodsFor:'move & resize'!