Add support for display=none. Closes #1256

This commit is contained in:
kangax 2014-04-10 17:47:36 -04:00
parent cfd71e9550
commit a48ed5b31b
6 changed files with 34 additions and 7 deletions

View file

@ -36,6 +36,7 @@ fabric.isLikelyNode = typeof Buffer !== 'undefined' &&
* @type array
*/
fabric.SHARED_ATTRIBUTES = [
"display",
"transform",
"fill", "fill-opacity", "fill-rule",
"opacity",

9
dist/fabric.js vendored
View file

@ -37,6 +37,7 @@ fabric.isLikelyNode = typeof Buffer !== 'undefined' &&
* @type array
*/
fabric.SHARED_ATTRIBUTES = [
"display",
"transform",
"fill", "fill-opacity", "fill-rule",
"opacity",
@ -2644,6 +2645,7 @@ if (typeof console !== 'undefined') {
r: 'radius',
cy: 'top',
y: 'top',
display: 'visible',
transform: 'transformMatrix',
'fill-opacity': 'fillOpacity',
'fill-rule': 'fillRule',
@ -2694,6 +2696,13 @@ if (typeof console !== 'undefined') {
value = fabric.parseTransformAttribute(value);
}
}
else if (attr === 'visible') {
value = value === 'none' ? false : true;
// display=none on parent element always takes precedence over child element
if (parentAttributes.visible === false) {
value = false;
}
}
isArray = Object.prototype.toString.call(value) === '[object Array]';

14
dist/fabric.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/fabric.min.js.gz vendored

Binary file not shown.

View file

@ -37,6 +37,7 @@ fabric.isLikelyNode = typeof Buffer !== 'undefined' &&
* @type array
*/
fabric.SHARED_ATTRIBUTES = [
"display",
"transform",
"fill", "fill-opacity", "fill-rule",
"opacity",
@ -2644,6 +2645,7 @@ if (typeof console !== 'undefined') {
r: 'radius',
cy: 'top',
y: 'top',
display: 'visible',
transform: 'transformMatrix',
'fill-opacity': 'fillOpacity',
'fill-rule': 'fillRule',
@ -2694,6 +2696,13 @@ if (typeof console !== 'undefined') {
value = fabric.parseTransformAttribute(value);
}
}
else if (attr === 'visible') {
value = value === 'none' ? false : true;
// display=none on parent element always takes precedence over child element
if (parentAttributes.visible === false) {
value = false;
}
}
isArray = Object.prototype.toString.call(value) === '[object Array]';

View file

@ -20,6 +20,7 @@
r: 'radius',
cy: 'top',
y: 'top',
display: 'visible',
transform: 'transformMatrix',
'fill-opacity': 'fillOpacity',
'fill-rule': 'fillRule',
@ -70,6 +71,13 @@
value = fabric.parseTransformAttribute(value);
}
}
else if (attr === 'visible') {
value = value === 'none' ? false : true;
// display=none on parent element always takes precedence over child element
if (parentAttributes.visible === false) {
value = false;
}
}
isArray = Object.prototype.toString.call(value) === '[object Array]';