mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Only resize image rasters if the new size is different from the old.
This commit is contained in:
parent
50f810a1ad
commit
a3a7545cb0
1 changed files with 8 additions and 6 deletions
|
@ -96,13 +96,15 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{
|
|||
},
|
||||
|
||||
setSize: function() {
|
||||
var size = Size.read(arguments),
|
||||
var size = Size.read(arguments);
|
||||
if (!this._size.equals(size)) {
|
||||
// Get reference to image before changing canvas
|
||||
image = this.getImage();
|
||||
// Setting canvas internally sets _size
|
||||
this.setCanvas(CanvasProvider.getCanvas(size));
|
||||
// Draw image back onto new canvas
|
||||
this.getContext(true).drawImage(image, 0, 0, size.width, size.height);
|
||||
var image = this.getImage();
|
||||
// Setting canvas internally sets _size
|
||||
this.setCanvas(CanvasProvider.getCanvas(size));
|
||||
// Draw image back onto new canvas
|
||||
this.getContext(true).drawImage(image, 0, 0, size.width, size.height);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue