Skip to content

Commit 2e8b528

Browse files
authored
Merge pull request #1714 from Rinzwind/pharo11-morphicmilleradapter-recalculatepages
Backport changes making #recalculatePageWidths and #recalculatePageHeights on SpMorphicMillerAdapter set the coordinates and dimensions to integral numbers to Pharo 11
2 parents f8c9b76 + e6d114a commit 2e8b528

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/Spec2-Adapters-Morphic/SpMorphicMillerAdapter.class.st

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,33 +153,37 @@ SpMorphicMillerAdapter >> newVertical [
153153
{ #category : #private }
154154
SpMorphicMillerAdapter >> recalculatePageHeights [
155155

156-
| newHeight widgets height |
156+
| newHeight widgets height bottom |
157157
height := self widget height.
158158
widgets := self childrenWidgets.
159159
newHeight := widgets size = 1
160160
ifTrue: [ height ]
161161
ifFalse: [ height / (layout visiblePages min: widgets size) - (layout spacing / (layout visiblePages min: widgets size)) ].
162162

163+
bottom := (widgets size * newHeight) floor.
163164
widgets reverseWithIndexDo: [ :each :index |
164-
each
165-
top: (index - 1) * newHeight;
166-
height: newHeight ]
165+
| top |
166+
top := ((index - 1) * newHeight) floor.
167+
each top: top; height: bottom - top.
168+
bottom := top ]
167169
]
168170

169171
{ #category : #private }
170172
SpMorphicMillerAdapter >> recalculatePageWidths [
171173

172-
| newWidth widgets width |
174+
| newWidth widgets width right |
173175
widgets := self childrenWidgets.
174176
width := self widget width.
175177
newWidth := widgets size = 1
176178
ifTrue: [ width ]
177179
ifFalse: [ (width / (layout visiblePages min: widgets size)) - (layout spacing / (layout visiblePages min: widgets size)) ].
178180

181+
right := (widgets size * newWidth) floor.
179182
widgets reverseWithIndexDo: [ :each :index |
180-
each
181-
left: (index - 1) * newWidth;
182-
width: newWidth ]
183+
| left |
184+
left := ((index - 1) * newWidth) floor.
185+
each left: left; width: right - left.
186+
right := left ]
183187
]
184188

185189
{ #category : #private }

0 commit comments

Comments
 (0)