The Trunk: Morphic-mt.982.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.982.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.982.mcz

==================== Summary ====================

Name: Morphic-mt.982
Author: mt
Time: 19 May 2015, 4:22:25.19 pm
UUID: a0f7d55f-83af-db48-9b48-472af0a98f38
Ancestors: Morphic-mt.981

Fixed several bugs related to scrolling in scroll panes, lists, or text fields.

This update makes all tests for scroll panes green.

=============== Diff against Morphic-mt.981 ===============

Item was added:
+ ----- Method: PluggableListMorph>>offsetToShow: (in category 'scrolling') -----
+ offsetToShow: aRectangle
+ "Due to the approximation of the horizontal scroll range and the primary interaction along the vertical axis, we snap back to 0 on the horizontal axis."
+
+ ^ 0 @ (super offsetToShow: aRectangle) y!

Item was changed:
  ----- Method: ScrollPane>>hScrollBarValue: (in category 'scrolling') -----
  hScrollBarValue: scrollValue
 
  scroller hasSubmorphs ifFalse: [^ self].
  lockOffset == true ifFalse: [
+ scroller offset: (scrollValue max: 0) @ scroller offset y].
- scroller offset: scrollValue @scroller offset y].
  !

Item was changed:
  ----- Method: ScrollPane>>handleResizeAction: (in category 'geometry') -----
  handleResizeAction: aBlock
  "Ensure layout properties after resizing takes place."
 
+ | oldExtent |
+ oldExtent := self extent.
- | oldW oldH |
- oldW := self width.
- oldH := self height.
 
  aBlock value ifFalse: [^ self].
 
  "Now reset widget sizes"
+ self extent ~= oldExtent ifTrue: [
+ self
+ resizeScrollBars;
+ resizeScroller;
+ setScrollDeltas].!
- self
- resizeScrollBars;
- resizeScroller;
- hideOrShowScrollBars.
-
- "Now resetScrollDeltas where appropriate."
- self height ~~ oldH ifTrue: [self vSetScrollDelta].
- self width ~~ oldW ifTrue: [self hSetScrollDelta].!

Item was changed:
  ----- Method: ScrollPane>>offsetToShow: (in category 'scrolling') -----
  offsetToShow: aRectangle
  "Calculate the offset necessary to show the rectangle."
 
+ | offset scrollRange target |
- | offset scrollRange |
  offset := scroller offset.
+ scrollRange := self hTotalScrollRange @ self vTotalScrollRange.
+
+ "Normalize the incoming rectangle."
+ target :=
+ (scroller width < aRectangle width
+ ifTrue: [offset x < aRectangle left "Coming from left?"
+ ifTrue: [aRectangle right - scroller width]
+ ifFalse: [aRectangle left]]
+ ifFalse: [aRectangle left])
+ @
+ (scroller height < aRectangle height
+ ifTrue: [offset y < aRectangle top "Coming from top?"
+ ifTrue: [aRectangle bottom - scroller height]
+ ifFalse: [aRectangle top]]
+ ifFalse: [aRectangle top])
+ corner:
+ (scroller width < aRectangle width
+ ifTrue: [offset x + scroller width > aRectangle right "Coming from right?"
+ ifTrue: [aRectangle left + scroller width]
+ ifFalse: [aRectangle right]]
+ ifFalse: [aRectangle right])
+ @
+ (scroller height < aRectangle height
+ ifTrue: [offset y + scroller height > aRectangle bottom "Coming from bottom?"
+ ifTrue: [aRectangle top + scroller height]
+ ifFalse: [aRectangle bottom]]
+ ifFalse: [aRectangle bottom]).
- scrollRange := self hUnadjustedScrollRange @ self vUnadjustedScrollRange.
 
  "Vertical Scrolling"
+ target top < offset y
+ ifTrue: [offset := offset x @ target top].
+ target bottom > (offset y + scroller height)
+ ifTrue: [offset := offset x @ (target bottom - scroller height)].
- (aRectangle top - offset y) < 0
- ifTrue: [offset := offset x @ (
- (aRectangle top min: scrollRange y - scroller height))].
-
- ((aRectangle bottom - offset y) > scroller height and: [aRectangle height <= scroller height])
- ifTrue: [offset := offset x @ (
- (aRectangle top - scroller height + aRectangle height min: scrollRange y - scroller height))].
 
  "Horizontal Scrolling"
+ target left < offset x
+ ifTrue: [offset := target left @ offset y].
+ target right > (offset x + scroller width)
+ ifTrue: [offset := (target right - scroller width) @ offset y].
- (aRectangle left - offset x) < 0
- ifTrue: [offset := (
- (aRectangle left min: scrollRange x - scroller width)) @ offset y].
-
- ((aRectangle right - offset x) > scroller width and: [aRectangle width <= scroller width])
- ifTrue: [offset := (
- (aRectangle left - scroller width + aRectangle width min: scrollRange x - scroller width)) @ offset y].
 
+ ^ (offset min: scrollRange - scroller extent) max: 0@0!
- ^ offset!

Item was changed:
  ----- Method: ScrollPane>>vScrollBarValue: (in category 'scrolling') -----
  vScrollBarValue: scrollValue
 
  scroller hasSubmorphs ifFalse: [^ self].
  lockOffset == true ifFalse: [
+ scroller offset: scroller offset x @ (scrollValue max: 0)].
- scroller offset: scroller offset x @ scrollValue].
  !