--- a/Scroller.st Tue Sep 08 22:09:00 1998 +0200
+++ b/Scroller.st Tue Sep 08 22:30:21 1998 +0200
@@ -1908,11 +1908,11 @@
newPos1 := (self absFromPercent:thumbOrigin) + margin.
newSize1 := computedSize := self absFromPercent:thumbHeight.
(orientation == #vertical) ifTrue:[
- sz1 := height.
- sz2 := width
+ sz1 := height.
+ sz2 := width
] ifFalse:[
- sz1 := width.
- sz2 := height
+ sz1 := width.
+ sz2 := height
].
"
@@ -1920,73 +1920,80 @@
"
newPos2 := margin + inset.
newSize2 := sz2 - (2 * newPos2).
+
"/ (style ~~ #normal) ifTrue:[
thumbLevel ~~ 0 ifTrue:[
- "
- do not make thumb too small (for handle & to be catchable)
- "
- minSz := 10 + (2 * thumbLevel)
+ "
+ do not make thumb too small (for handle & to be catchable)
+ "
+ minSz := 10 + (2 * thumbLevel)
] ifFalse:[
- "
- do not make thumb too small (uncatchable)
- "
- minSz := 4
+ "
+ do not make thumb too small (uncatchable)
+ "
+ minSz := 4
].
(newSize1 < minSz) ifTrue:[
- newSize1 := minSz.
- thumbFrameSizeDifference := newSize1 - computedSize
+ newSize1 := minSz.
+ thumbFrameSizeDifference := newSize1 - computedSize
] ifFalse:[
- thumbFrameSizeDifference := 0.
+ thumbFrameSizeDifference := 0.
].
fixThumbHeight ifTrue:[
- "have a fix-size thumb (i.e. mswindows style)"
+ "have a fix-size thumb (i.e. mswindows style)"
- newSize1 := sz2 - (2 * inset). "make it square"
- thumbImage notNil ifTrue:[
- newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
- ].
- thumbFrameSizeDifference := newSize1 - computedSize.
+ newSize1 := sz2 - (2 * inset). "make it square"
+ thumbImage notNil ifTrue:[
+ newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width)
+ ].
+ thumbFrameSizeDifference := newSize1 - computedSize.
].
"
oops - if height does not relect real visibible area, we have to adjust the origin
"
(thumbFrameSizeDifference == 0) ifFalse:[
- newPos1 := (self absFromPercent:thumbOrigin) + margin.
+ newPos1 := (self absFromPercent:thumbOrigin) + margin.
"/ newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin
].
(orientation == #vertical) ifTrue:[
- ny := newPos1.
- nx := newPos2.
- nh := newSize1.
- nw := newSize2.
- ny + nh + margin > height ifTrue:[
- ny := height - margin - nh
- ]
+ ny := newPos1.
+ nx := newPos2.
+ nh := newSize1.
+ nw := newSize2 max:2.
+ ny + nh + margin > height ifTrue:[
+ ny := height - margin - nh
+ ].
+ (nx+nw) >= width ifTrue:[
+ nx := ((width - nw) // 2) max:0.
+ ].
] ifFalse:[
- nx := newPos1.
- ny := newPos2.
- nw := newSize1.
- nh := newSize2.
- nx + nw + margin > width ifTrue:[
- nx := width - margin - nw
- ]
+ nx := newPos1.
+ ny := newPos2.
+ nw := newSize1.
+ nh := newSize2 max:2.
+ nx + nw + margin > width ifTrue:[
+ nx := width - margin - nw
+ ].
+ (ny+nh) >= height ifTrue:[
+ ny := ((height - nh) // 2) max:0.
+ ].
].
"
do not create new Rectangle if its the same anyway
"
thumbFrame notNil ifTrue:[
- (ny == thumbFrame top) ifTrue:[
- (nx == thumbFrame left) ifTrue:[
- (nh == thumbFrame height) ifTrue:[
- (nw == thumbFrame width) ifTrue:[ ^ self]
- ]
- ]
- ]
+ (ny == thumbFrame top) ifTrue:[
+ (nx == thumbFrame left) ifTrue:[
+ (nh == thumbFrame height) ifTrue:[
+ (nw == thumbFrame width) ifTrue:[ ^ self]
+ ]
+ ]
+ ]
].
thumbFrame := Rectangle left:nx top:ny width:nw height:nh
@@ -2211,5 +2218,5 @@
!Scroller class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.107 1998-09-08 10:14:22 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.108 1998-09-08 20:30:21 cg Exp $'
! !