--- a/ImageView.st Fri Jan 19 12:16:49 2018 +0100
+++ b/ImageView.st Sat Jan 20 10:35:44 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -1027,7 +1029,12 @@
"try to arrange for aPoint (in logical image coordinates)
to be visible (at the center, if possible)"
- |mag magPos newOffset|
+ |mag magPos imgExtent newOffset|
+
+ imgExtent := 0@0.
+ image isNil ifTrue:[
+ imgExtent := image extent.
+ ].
mag := self magnification.
magPos := aPoint * mag.
@@ -1035,7 +1042,7 @@
((self bounds + self viewOrigin) containsPoint:magPos) ifFalse:[
newOffset := magPos - (self extent / 2).
newOffset := newOffset max:(0@0).
- newOffset := newOffset min:((image extent * mag) - (self extent / 2)).
+ newOffset := newOffset min:((imgExtent * mag) - (self extent / 2)).
newOffset := newOffset rounded.
self scrollTo:newOffset waitForDrawingFinished:true.
].