Consider a Point or Size null if one of the components is null.

This commit is contained in:
Jürg Lehni 2013-11-01 19:25:41 +01:00
parent 4b97d3a6e0
commit c99d13178b

View file

@ -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