Skip to content

Commit

Permalink
🎨: remove dom measuring request from tiling and constraint layout
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman authored and linusha committed Jul 22, 2024
1 parent d529a90 commit 1dd1731
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 2 additions & 5 deletions lively.morphic/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ export class TilingLayout extends Layout {
attach () {
this.initializeResizePolicies();
super.attach();
this.measureAfterRender(this.container); // no longer needed with yoga??
}

initializeResizePolicies (_initializingPoliciesAfterwards = false) {
Expand Down Expand Up @@ -1785,8 +1784,7 @@ export class ConstraintLayout extends Layout {
}
if (change.prop === 'extent' &&
!change.value.equals(change.prevValue)) {
if (change.meta?.isLayoutAction) this.measureAfterRender(submorph);
else {
if (!change.meta?.isLayoutAction) {
let config = this._morphConfigurations?.get(submorph);
if (config) {
this.adjustConfigViaExtentDelta(config, change.value.subPt(change.prevValue), submorph);
Expand All @@ -1796,8 +1794,7 @@ export class ConstraintLayout extends Layout {
}
if (change.prop === 'position' &&
!change.value.equals(change.prevValue)) {
if (change.meta?.isLayoutAction) this.measureAfterRender(submorph);
else {
if (!change.meta?.isLayoutAction) {
let config = this._morphConfigurations?.get(submorph);
if (config) {
this.adjustConfigViaPositionDelta(config, change.value.subPt(change.prevValue), submorph);
Expand Down
2 changes: 0 additions & 2 deletions lively.morphic/tests/layout-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ describe('layout', () => {
]
});
world.addMorph(m1);
expect(!!m1.renderingState.cssLayoutToMeasureWith).not.to.be.false;
env.forceUpdate();
expect(!!m1.renderingState.cssLayoutToMeasureWith, 'all layouts have finished measuring').to.be.false;
expect(m1.width).to.equal(m2.width + m3.width + 3 * padDist);
expect(m1.height).to.equal(m1.submorphBounds().height + m1.layout.padding.top() + m1.layout.padding.bottom());
expect(m1.width).to.equal(m1.submorphBounds().width + m1.layout.padding.left() + m1.layout.padding.right());
Expand Down

0 comments on commit 1dd1731

Please sign in to comment.