mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Some code cleanup in View#setViewSize()
This commit is contained in:
parent
91371c1b47
commit
79661c35e6
1 changed files with 3 additions and 8 deletions
|
@ -382,19 +382,14 @@ var View = Base.extend(Emitter, /** @lends View# */{
|
||||||
|
|
||||||
setViewSize: function(/* size */) {
|
setViewSize: function(/* size */) {
|
||||||
var size = Size.read(arguments),
|
var size = Size.read(arguments),
|
||||||
width = size.width,
|
|
||||||
height = size.height,
|
|
||||||
delta = size.subtract(this._viewSize);
|
delta = size.subtract(this._viewSize);
|
||||||
if (delta.isZero())
|
if (delta.isZero())
|
||||||
return;
|
return;
|
||||||
this._setElementSize(width, height);
|
this._setElementSize(size.width, size.height);
|
||||||
this._viewSize._set(width, height);
|
this._viewSize.set(size);
|
||||||
this._changed();
|
this._changed();
|
||||||
// Emit resize event on any size changes.
|
// Emit resize event on any size changes.
|
||||||
this.emit('resize', {
|
this.emit('resize', { size: size, delta: delta });
|
||||||
size: size,
|
|
||||||
delta: delta
|
|
||||||
});
|
|
||||||
if (this._autoUpdate) {
|
if (this._autoUpdate) {
|
||||||
// Update right away, don't wait for the next animation frame as
|
// Update right away, don't wait for the next animation frame as
|
||||||
// otherwise the view would flicker during resizes, see #1126
|
// otherwise the view would flicker during resizes, see #1126
|
||||||
|
|
Loading…
Reference in a new issue