mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Some minor changes to Item.
This commit is contained in:
parent
81a15379e5
commit
55fc2bc99c
1 changed files with 5 additions and 7 deletions
|
@ -221,28 +221,28 @@ var Item = this.Item = Base.extend({
|
|||
* The first item contained within this item.
|
||||
*/
|
||||
getFirstChild: function() {
|
||||
return this.children && this.children[0] || null;
|
||||
return this.children ? this.children[0] : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The last item contained within this item.
|
||||
*/
|
||||
getLastChild: function() {
|
||||
return this.children && this.children[this.children.length - 1] || null;
|
||||
return this.children ? this.children[this.children.length - 1] : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The next item on the same level as this item.
|
||||
*/
|
||||
getNextSibling: function() {
|
||||
return this.parent && this.parent.children[this.getIndex() + 1] || null;
|
||||
return this.parent ? this.parent.children[this.getIndex() + 1] : null;
|
||||
},
|
||||
|
||||
/**
|
||||
* The previous item on the same level as this item.
|
||||
*/
|
||||
getPreviousSibling: function() {
|
||||
return this.parent && this.parent.children[this.getIndex() - 1] || null;
|
||||
return this.parent ? this.parent.children[this.getIndex() - 1] : null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -478,10 +478,8 @@ var Item = this.Item = Base.extend({
|
|||
// weird results on Scriptographer. Also we can't use antialiasing, since
|
||||
// Canvas doesn't support it yet. Document colorMode is also out of the
|
||||
// question for now.
|
||||
if (!resolution)
|
||||
resolution = 72;
|
||||
var bounds = this.getStrokeBounds();
|
||||
var scale = resolution / 72;
|
||||
var scale = resolution ? resolution / 72 : 1;
|
||||
var canvas = CanvasProvider.getCanvas(bounds.getSize().multiply(scale));
|
||||
var ctx = canvas.getContext('2d');
|
||||
var matrix = new Matrix().scale(scale).translate(-bounds.x, -bounds.y);
|
||||
|
|
Loading…
Reference in a new issue