Skip to content

Commit

Permalink
Merge pull request #1694 from Rinzwind/pharo12-morphicmilleradapter-r…
Browse files Browse the repository at this point in the history
…ecalculatepages

Backport changes making #recalculatePageWidths and #recalculatePageHeights on SpMorphicMillerAdapter set the coordinates and dimensions to integral numbers
  • Loading branch information
Ducasse authored Jan 13, 2025
2 parents d49fe07 + d11298d commit 02ebd1b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/Spec2-Adapters-Morphic/SpMorphicMillerAdapter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -155,22 +155,24 @@ SpMorphicMillerAdapter >> newVertical [
{ #category : 'private' }
SpMorphicMillerAdapter >> recalculatePageHeights [

| newHeight widgets height |
| newHeight widgets height bottom |
height := self widget height.
widgets := self childrenWidgets.
newHeight := widgets size = 1
ifTrue: [ height ]
ifFalse: [ height / (layout visiblePages min: widgets size) - (layout spacing / (layout visiblePages min: widgets size)) ].

bottom := (widgets size * newHeight) floor.
widgets reverseWithIndexDo: [ :each :index |
each
top: (index - 1) * newHeight;
height: newHeight ]
| top |
top := ((index - 1) * newHeight) floor.
each top: top; height: bottom - top.
bottom := top ]
]

{ #category : 'private' }
SpMorphicMillerAdapter >> recalculatePageWidths [
| newWidth widgets width |
| newWidth widgets width right |

widgets := self childrenWidgets.
width := self widget width.
Expand All @@ -181,10 +183,12 @@ SpMorphicMillerAdapter >> recalculatePageWidths [
visiblePages := layout visiblePages min: widgets size.
(width / visiblePages) - (layout spacing / visiblePages) ].

right := (widgets size * newWidth) floor.
widgets reverseWithIndexDo: [ :each :index |
each
left: (index - 1) * newWidth;
width: newWidth ]
| left |
left := ((index - 1) * newWidth) floor.
each left: left; width: right - left.
right := left ]
]

{ #category : 'private' }
Expand Down

0 comments on commit 02ebd1b

Please sign in to comment.