--- a/ImageView.st Mon May 19 19:25:54 2008 +0200
+++ b/ImageView.st Mon May 19 21:15:57 2008 +0200
@@ -9,7 +9,6 @@
other person. No title to or ownership of the software is
hereby transferred.
"
-
"{ Package: 'stx:libwidg2' }"
View subclass:#ImageView
@@ -243,6 +242,11 @@
self setImage:anImage scroll:doScroll
!
+magnification
+ magnifiedImage isNil ifTrue:[^ 1@1].
+ ^ magnifiedImage extent / image extent
+!
+
setImage:anImage
"set the image - show a wait cursor, since image dithering may take a while"
@@ -516,10 +520,22 @@
^ (magnifiedImage ? image) width
! !
+!ImageView methodsFor:'scrolling'!
+
+scrollToMakeVisible:aPoint
+ "try to arrange for aPoint to be visible (at the center, if possible)"
+
+ |mag pos|
+
+ mag := self magnification.
+ pos := aPoint * mag.
+ self scrollTo:(pos - (self extent / 2)).
+! !
+
!ImageView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.63 2006-02-10 15:44:02 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.64 2008-05-19 19:15:57 cg Exp $'
! !
ImageView initialize!