Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport changes making #recalculatePageWidths and #recalculatePageHeights on SpMorphicMillerAdapter set the coordinates and dimensions to integral numbers #1694

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading