mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-06-09 19:50:50 -04:00
Consider a Point or Size null if one of the components is null.
This commit is contained in:
parent
4b97d3a6e0
commit
c99d13178b
1 changed files with 4 additions and 4 deletions
|
@ -43,15 +43,15 @@ new function() {
|
|||
function getPoint(node, x, y, allowNull) {
|
||||
x = getValue(node, x, false, allowNull);
|
||||
y = getValue(node, y, false, allowNull);
|
||||
return allowNull && x == null && y == null ? null
|
||||
: new Point(x || 0, y || 0);
|
||||
return allowNull && (x == null || y == null) ? null
|
||||
: new Point(x, y);
|
||||
}
|
||||
|
||||
function getSize(node, w, h, allowNull) {
|
||||
w = getValue(node, w, false, allowNull);
|
||||
h = getValue(node, h, false, allowNull);
|
||||
return allowNull && w == null && h == null ? null
|
||||
: new Size(w || 0, h || 0);
|
||||
return allowNull && (w == null || h == null) ? null
|
||||
: new Size(w, h);
|
||||
}
|
||||
|
||||
// Converts a string attribute value to the specified type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue