The Trunk: Morphic-mt.807.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.807.mcz

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

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

Name: Morphic-mt.807
Author: mt
Time: 2 April 2015, 9:22:53.044 am
UUID: bfd9d718-68d4-f749-932e-755c12a3928d
Ancestors: Morphic-mt.806

Fixed #scrollToShow:, which needed an additional offset-lock, because scroll bars tend to call back their float values to the pane, which then tries to calculate pixels again.

=============== Diff against Morphic-mt.806 ===============

Item was changed:
  MorphicModel subclass: #ScrollPane
+ instanceVariableNames: 'scrollBar scroller retractableScrollBar scrollBarOnLeft getMenuSelector getMenuTitleSelector scrollBarHidden hasFocus hScrollBar lockOffset'
- instanceVariableNames: 'scrollBar scroller retractableScrollBar scrollBarOnLeft getMenuSelector getMenuTitleSelector scrollBarHidden hasFocus hScrollBar'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Windows'!
 
  !ScrollPane commentStamp: 'mk 8/9/2005 10:34' prior: 0!
  The scroller (a transform) of a scrollPane is driven by the scrollBar.  The scroll values vary from 0.0, meaning zero offset to 1.0 meaning sufficient offset such that the bottom of the scrollable material appears 3/4 of the way down the pane.  The total distance to achieve this range is called the totalScrollRange.
 
  Basic clue about utilization of the ScrollPane class is given in:
  ScrollPane example1.
  ScrollPane example2.!

Item was changed:
  ----- Method: ScrollPane>>hScrollBarValue: (in category 'scrolling') -----
  hScrollBarValue: scrollValue
 
  | x |
+ lockOffset == true ifTrue: [^ self].
+
  self hIsScrollbarShowing ifFalse:
  [^scroller offset: (0 - self hMargin)@scroller offset y].
  ((x := self hLeftoverScrollRange * scrollValue) <= 0)
  ifTrue:[x := 0 - self hMargin].
  scroller offset: (x@scroller offset y)
  !

Item was changed:
  ----- Method: ScrollPane>>scrollToShow: (in category 'scrolling') -----
  scrollToShow: aRectangle
+ "We have to lock the callback into me because rounding errors in scrollbar values would reset the offset to a different value. The given rectangle may not be visible anymore."
 
  scroller offset: (self offsetToShow: aRectangle).
+ lockOffset := true.
+ self setScrollDeltas.
+ lockOffset := false.!
- self setScrollDeltas.!

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