Skip to content

Commit b33a71f

Browse files
merrymanlinusha
authored andcommitted
🎨: fix scrollExtent and scrollbarVisible prop when scrollbars hidden
Previously the hideScrollbars property would not be considered when calculating the scroll extent or the visibility of the scrollbar, leading to weird errors in calculating layouts on systems with larger scrollbars.
1 parent 5286370 commit b33a71f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lively.morphic/morph.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,12 +1344,15 @@ export class Morph {
13441344
to the rendered div container of a scrollable morph, such that HTML will end up with the
13451345
same scrollable area as morphic, but that somehow does not work.
13461346
*/
1347-
return (this.submorphs.length
1347+
const scrollDefinedBySubmorphs = (this.submorphs.length
13481348
? this.innerBounds().union(this.submorphBounds())
1349-
: this.innerBounds()).extent().addPt(this.scrollbarOffset);
1349+
: this.innerBounds()).extent();
1350+
if (!this.hideScrollbars) { return scrollDefinedBySubmorphs.addPt(this.scrollbarOffset); }
1351+
return scrollDefinedBySubmorphs;
13501352
}
13511353

13521354
get scrollbarVisible () {
1355+
if (this.hideScrollbars) return { horizontal: false, vertical: false };
13531356
if (this.clipMode === 'visible' || this.clipMode === 'hidden') return { horizontal: false, vertical: false };
13541357
if (this.clipMode === 'scroll') return { horizontal: true, vertical: true };
13551358
const extent = this.extent;

0 commit comments

Comments
 (0)