mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-10 21:19:10 -04:00
Move view redrawing from resize handler to #setViewSize().
This commit is contained in:
parent
ce9700dc4d
commit
ee23877fd1
1 changed files with 9 additions and 7 deletions
|
@ -54,15 +54,9 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
if (!DomElement.isInvisible(canvas))
|
if (!DomElement.isInvisible(canvas))
|
||||||
offset = DomElement.getOffset(canvas, false, true);
|
offset = DomElement.getOffset(canvas, false, true);
|
||||||
// Set the size now, which internally calls onResize
|
// Set the size now, which internally calls onResize
|
||||||
|
// and redraws the view
|
||||||
that.setViewSize(DomElement.getViewportSize(canvas)
|
that.setViewSize(DomElement.getViewportSize(canvas)
|
||||||
.subtract(offset));
|
.subtract(offset));
|
||||||
// If there's a _onFrameCallback, call it staight away,
|
|
||||||
// but without requesting another animation frame.
|
|
||||||
if (that._onFrameCallback) {
|
|
||||||
that._onFrameCallback(0, true);
|
|
||||||
} else {
|
|
||||||
that.draw(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -151,6 +145,14 @@ var View = this.View = Base.extend(/** @lends View# */{
|
||||||
// Force recalculation
|
// Force recalculation
|
||||||
this._bounds = null;
|
this._bounds = null;
|
||||||
this._redrawNeeded = true;
|
this._redrawNeeded = true;
|
||||||
|
if (this._onFrameCallback) {
|
||||||
|
// If there's a _onFrameCallback, call it staight away,
|
||||||
|
// but without requesting another animation frame.
|
||||||
|
this._onFrameCallback(0, true);
|
||||||
|
} else {
|
||||||
|
// Otherwise simply redraw the view now
|
||||||
|
this.draw(true);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue