--- a/Scroller.st Wed Mar 19 11:22:45 1997 +0100
+++ b/Scroller.st Wed Mar 19 11:31:08 1997 +0100
@@ -18,7 +18,7 @@
thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference
tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor
ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered
- thumbActiveLevel'
+ thumbActiveLevel originBeforeMove'
classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground
DefaultShadowColor DefaultLightColor DefaultThumbColor
DefaultThumbShadowColor DefaultThumbLightColor
@@ -1050,7 +1050,7 @@
redraw thumb at its new position and, if scroll-mode is asynchronous,
the scroll action is performed"
- |pos curr limit prevOrigin newOrigin in|
+ |pos curr limit prevOrigin newOrigin in snap|
scrolling ifFalse: [
self highlightThumbForPointerX:x y:y.
@@ -1059,6 +1059,8 @@
entered := true.
frameBeforeMove isNil ifTrue:[
+ originBeforeMove := thumbOrigin.
+
(ghostColor notNil
or:[ghostFrameColor notNil
or:[ghostLevel ~~ 0]]) ifTrue:[
@@ -1068,10 +1070,12 @@
(orientation == #vertical) ifTrue:[
curr := y.
- limit := height
+ limit := height.
+ snap := (x < -50) or:[x > (width + 50)].
] ifFalse:[
curr := x.
- limit := width
+ limit := width.
+ snap := (y < -50) or:[y > (height + 50)].
].
(curr < 0) ifTrue:[ "check against limits"
@@ -1086,6 +1090,13 @@
prevOrigin := self thumbOrigin.
newOrigin := self percentFromAbs:(pos - pressOffset).
+
+ snap ifTrue:[
+ (styleSheet at:'scrollerSnapBack' default:false) ifTrue:[
+ newOrigin := originBeforeMove.
+ ]
+ ].
+
prevOrigin ~= newOrigin ifTrue:[
self thumbOrigin:newOrigin.
@@ -1094,7 +1105,7 @@
]
]
- "Modified: 6.3.1996 / 17:35:26 / cg"
+ "Modified: 19.3.1997 / 11:30:12 / cg"
!
buttonMultiPress:button x:x y:y
@@ -1208,6 +1219,7 @@
].
frameBeforeMove := thumbFrame insetBy:1@1.
+ originBeforeMove := thumbOrigin.
self thumbOrigin:(self percentFromAbs:pos).
self tellOthers.
@@ -1219,6 +1231,8 @@
].
pressOffset := curr - limit2.
scrolling := true
+
+ "Modified: 19.3.1997 / 11:29:08 / cg"
!
highlightThumbForPointerX:x y:y
@@ -1902,5 +1916,5 @@
!Scroller class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.78 1997-03-07 22:00:49 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.79 1997-03-19 10:31:08 cg Exp $'
! !