mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-05 01:10:27 -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) {
|
function getPoint(node, x, y, allowNull) {
|
||||||
x = getValue(node, x, false, allowNull);
|
x = getValue(node, x, false, allowNull);
|
||||||
y = getValue(node, y, false, allowNull);
|
y = getValue(node, y, false, allowNull);
|
||||||
return allowNull && x == null && y == null ? null
|
return allowNull && (x == null || y == null) ? null
|
||||||
: new Point(x || 0, y || 0);
|
: new Point(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSize(node, w, h, allowNull) {
|
function getSize(node, w, h, allowNull) {
|
||||||
w = getValue(node, w, false, allowNull);
|
w = getValue(node, w, false, allowNull);
|
||||||
h = getValue(node, h, false, allowNull);
|
h = getValue(node, h, false, allowNull);
|
||||||
return allowNull && w == null && h == null ? null
|
return allowNull && (w == null || h == null) ? null
|
||||||
: new Size(w || 0, h || 0);
|
: new Size(w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a string attribute value to the specified type
|
// Converts a string attribute value to the specified type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue