Comparing version 3.6.0 to 3.6.1
@@ -599,3 +599,3 @@ /** | ||
removeKey: function (key) { | ||
delete this[key]; | ||
delete this[HASH_MAP_PREFIX + key]; | ||
} | ||
@@ -602,0 +602,0 @@ }; |
@@ -71,3 +71,3 @@ /** | ||
*/ | ||
fill: '#000000', | ||
fill: '#000', | ||
@@ -352,6 +352,2 @@ /** | ||
normalize: function () { | ||
textHelper.normalizeTextStyle(this); | ||
}, | ||
/** | ||
@@ -358,0 +354,0 @@ * @param {CanvasRenderingContext2D} ctx |
@@ -115,2 +115,5 @@ 'use strict'; | ||
/** | ||
* Caution: this method will stop previous animation. | ||
* So do not use this method to one element twice before | ||
* animation starts, unless you know what you are doing. | ||
* @param {Object} target | ||
@@ -117,0 +120,0 @@ * @param {number} [time=500] Time in ms |
@@ -64,3 +64,25 @@ // TODO | ||
if (pathHasFill(style, isText)) { | ||
attr(svgEl, 'fill', isText ? style.textFill : style.fill); | ||
var fill = isText ? style.textFill : style.fill; | ||
fill = fill === 'transparent' ? NONE : fill; | ||
/** | ||
* FIXME: | ||
* This is a temporary fix for Chrome's clipping bug | ||
* that happens when a clip-path is referring another one. | ||
* This fix should be used before Chrome's bug is fixed. | ||
* For an element that has clip-path, and fill is none, | ||
* set it to be "rgba(0, 0, 0, 0.002)" will hide the element. | ||
* Otherwise, it will show black fill color. | ||
* 0.002 is used because this won't work for alpha values smaller | ||
* than 0.002. | ||
* | ||
* See | ||
* https://bugs.chromium.org/p/chromium/issues/detail?id=659790 | ||
* for more information. | ||
*/ | ||
if (svgEl.getAttribute('clip-path') !== 'none' && fill === NONE) { | ||
fill = 'rgba(0, 0, 0, 0.002)'; | ||
} | ||
attr(svgEl, 'fill', fill); | ||
attr(svgEl, 'fill-opacity', style.opacity); | ||
@@ -73,3 +95,5 @@ } | ||
if (pathHasStroke(style, isText)) { | ||
attr(svgEl, 'stroke', isText ? style.textStroke : style.stroke); | ||
var stroke = isText ? style.textStroke : style.stroke; | ||
stroke = stroke === 'transparent' ? NONE : stroke; | ||
attr(svgEl, 'stroke', stroke); | ||
var strokeWidth = isText | ||
@@ -341,4 +365,15 @@ ? style.textLineWidth | ||
var align = style.textAlign || 'left'; | ||
var font = style.font || textContain.DEFAULT_FONT; | ||
if (typeof style.fontSize === 'number') { | ||
style.fontSize += 'px'; | ||
} | ||
var font = style.font | ||
|| [ | ||
style.fontStyle || '', | ||
style.fontWeight || '', | ||
style.fontSize || '', | ||
style.fontFamily || '' | ||
].join(' ') | ||
|| textContain.DEFAULT_FONT; | ||
var verticalAlign = getVerticalAlignForSvg(style.textVerticalAlign); | ||
@@ -362,2 +397,3 @@ | ||
verticalAlign = getVerticalAlignForSvg(newPos.textVerticalAlign); | ||
align = newPos.textAlign; | ||
} | ||
@@ -364,0 +400,0 @@ |
@@ -9,2 +9,3 @@ /** | ||
var zrLog = require('../core/log'); | ||
var matrix = require('../core/matrix'); | ||
var Path = require('../graphic/Path'); | ||
@@ -24,6 +25,8 @@ var ZImage = require('../graphic/Image'); | ||
var GRADIENT_MARK = '_gradientInUse'; | ||
var GRADIENT_MARK_UNUSED = '0'; | ||
var GRADIENT_MARK_USED = '1'; | ||
var CLIPPATH_MARK = '_clipPathInUse'; | ||
var MARK_UNUSED = '0'; | ||
var MARK_USED = '1'; | ||
var nextGradientId = 1; | ||
var nextClippathId = 1; | ||
@@ -44,2 +47,5 @@ function parseInt10(val) { | ||
} | ||
else { | ||
return svgPath; | ||
} | ||
} | ||
@@ -139,2 +145,3 @@ | ||
this._markGradientsUnused(); | ||
this._markClipPathsUnused(); | ||
@@ -153,2 +160,5 @@ var svgRoot = this._svgRoot; | ||
svgProxy && svgProxy.brush(displayable); | ||
var el = getSvgElement(displayable) | ||
|| getTextSvgElement(displayable); | ||
this._doClip(displayable, el); | ||
@@ -189,4 +199,5 @@ // Update gradient | ||
= getTextSvgElement(displayable) | ||
|| getSvgElement(displayable); | ||
|| getSvgElement(displayable); | ||
this._markGradientUsed(displayable); | ||
this._markClipPathUsed(displayable); | ||
break; | ||
@@ -211,3 +222,3 @@ case '+': | ||
prevSvgElement = textSvgElement || svgElement; | ||
this._markClipPathUsed(displayable); | ||
break; | ||
@@ -226,3 +237,4 @@ // case '^': | ||
this._removeUnusedGradient(); | ||
this._removeUnusedGradients(); | ||
this._removeUnusedClipPaths(); | ||
@@ -244,3 +256,3 @@ this._visibleList = newVisibleList; | ||
&& (displayable.style[fillOrStroke].type === 'linear' | ||
|| displayable.style[fillOrStroke].type === 'radial') | ||
|| displayable.style[fillOrStroke].type === 'radial') | ||
) { | ||
@@ -265,3 +277,3 @@ var gradient = displayable.style[fillOrStroke]; | ||
// Mark gradient to be used | ||
dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
dom[GRADIENT_MARK] = MARK_USED; | ||
@@ -413,3 +425,3 @@ var id = dom.getAttribute('id'); | ||
util.each(doms, function (dom) { | ||
dom[GRADIENT_MARK] = GRADIENT_MARK_UNUSED; | ||
dom[GRADIENT_MARK] = MARK_UNUSED; | ||
}); | ||
@@ -421,3 +433,3 @@ }, | ||
*/ | ||
_removeUnusedGradient: function () { | ||
_removeUnusedGradients: function () { | ||
var defs = this._getDefs(false); | ||
@@ -431,3 +443,3 @@ if (!defs) { | ||
util.each(doms, function (dom) { | ||
if (dom[GRADIENT_MARK] !== GRADIENT_MARK_USED) { | ||
if (dom[GRADIENT_MARK] !== MARK_USED) { | ||
// Remove gradient | ||
@@ -448,3 +460,3 @@ defs.removeChild(dom); | ||
if (gradient && gradient.__dom) { | ||
gradient.__dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
gradient.__dom[GRADIENT_MARK] = MARK_USED; | ||
} | ||
@@ -454,3 +466,3 @@ | ||
if (gradient && gradient.__dom) { | ||
gradient.__dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
gradient.__dom[GRADIENT_MARK] = MARK_USED; | ||
} | ||
@@ -473,6 +485,22 @@ } | ||
if (isForceCreating) { | ||
return svgRoot.insertBefore( | ||
var defs = svgRoot.insertBefore( | ||
createElement('defs'), // Create new tag | ||
svgRoot.firstChild // Insert in the front of svg | ||
); | ||
if (!defs.contains) { | ||
// IE doesn't support contains method | ||
defs.contains = function (el) { | ||
var children = defs.children; | ||
if (!children) { | ||
return false; | ||
} | ||
for (var i = children.length - 1; i >= 0; --i) { | ||
if (children[i] === el) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
} | ||
return defs; | ||
} | ||
@@ -502,3 +530,3 @@ else { | ||
// rather than real array. | ||
// So`doms.concat(tags)` add tags as one object. | ||
// So `doms.concat(tags)` add tags as one object. | ||
doms = doms.concat([].slice.call(tags)); | ||
@@ -510,2 +538,147 @@ }); | ||
_doClip: function (el, svgElement) { | ||
this._doClipEl(svgElement, el.__clipPaths, false); | ||
var textEl = getTextSvgElement(el); | ||
if (textEl) { | ||
// Make another clipPath for text, since it's transform | ||
// matrix is not the same with svgElement | ||
this._doClipEl(textEl, el.__clipPaths, true); | ||
} | ||
this._markClipPathUsed(el); | ||
}, | ||
/** | ||
* Create an SVGElement of displayable and create a <clipPath> of its | ||
* clipPath | ||
*/ | ||
_doClipEl: function (parentEl, clipPaths, isText) { | ||
if (clipPaths && clipPaths.length > 0) { | ||
// Has clipPath, create <clipPath> with the first clipPath | ||
var defs = this._getDefs(true); | ||
var clipPath = clipPaths[0]; | ||
var clipPathEl; | ||
var id; | ||
var dom = isText ? '__textDom' : '__dom'; | ||
if (clipPath[dom]) { | ||
// Use a dom that is already in <defs> | ||
id = clipPath[dom].getAttribute('id'); | ||
clipPathEl = clipPath[dom]; | ||
// Use a dom that is already in <defs> | ||
if (!defs.contains(clipPathEl)) { | ||
// This happens when set old clipPath that has | ||
// been previously removed | ||
defs.appendChild(clipPathEl); | ||
} | ||
} | ||
else { | ||
// New <clipPath> | ||
id = 'zr-clip-' + nextClippathId; | ||
++nextClippathId; | ||
clipPathEl = createElement('clipPath'); | ||
clipPathEl.setAttribute('id', id); | ||
defs.appendChild(clipPathEl); | ||
clipPath[dom] = clipPathEl; | ||
} | ||
// Build path and add to <clipPath> | ||
var svgProxy = getSvgProxy(clipPath); | ||
if (clipPath.transform | ||
&& clipPath.parent.invTransform | ||
&& !isText | ||
) { | ||
/** | ||
* If a clipPath has a parent with transform, the transform | ||
* of parent should not be considered when setting transform | ||
* of clipPath. So we need to transform back from parent's | ||
* transform, which is done by multiplying parent's inverse | ||
* transform. | ||
*/ | ||
// Store old transform | ||
var transform = Array.prototype.slice.call( | ||
clipPath.transform | ||
); | ||
// Transform back from parent, and brush path | ||
matrix.mul( | ||
clipPath.transform, | ||
clipPath.parent.invTransform, | ||
clipPath.transform | ||
); | ||
svgProxy.brush(clipPath); | ||
// Set back transform of clipPath | ||
clipPath.transform = transform; | ||
} | ||
else { | ||
svgProxy.brush(clipPath); | ||
} | ||
var pathEl = getSvgElement(clipPath); | ||
clipPathEl.appendChild(pathEl); | ||
parentEl.setAttribute('clip-path', 'url(#' + id + ')'); | ||
if (clipPaths.length > 1) { | ||
// Make the other clipPaths recursively | ||
this._doClipEl(clipPathEl, clipPaths.slice(1), isText); | ||
} | ||
} | ||
else { | ||
// No clipPath | ||
parentEl.setAttribute('clip-path', 'none'); | ||
} | ||
}, | ||
_markClipPathsUnused: function () { | ||
var tags = this._getClipPaths(); | ||
util.each(tags, function (tag) { | ||
tag[CLIPPATH_MARK] = MARK_UNUSED; | ||
}); | ||
}, | ||
_markClipPathUsed: function (displayable) { | ||
if (displayable.__clipPaths && displayable.__clipPaths.length > 0) { | ||
util.each(displayable.__clipPaths, function (clipPath) { | ||
if (clipPath.__dom) { | ||
clipPath.__dom[CLIPPATH_MARK] = MARK_USED; | ||
} | ||
if (clipPath.__textDom) { | ||
clipPath.__textDom[CLIPPATH_MARK] = MARK_USED; | ||
} | ||
}); | ||
} | ||
}, | ||
_getClipPaths: function () { | ||
var defs = this._getDefs(false); | ||
if (!defs) { | ||
return []; | ||
} | ||
var tags = defs.getElementsByTagName('clipPath'); | ||
return [].slice.call(tags); | ||
}, | ||
_removeUnusedClipPaths: function () { | ||
var defs = this._getDefs(false); | ||
if (!defs) { | ||
// Nothing to remove | ||
return; | ||
} | ||
var doms = this._getClipPaths(); | ||
util.each(doms, function (dom) { | ||
if (dom[CLIPPATH_MARK] !== MARK_USED) { | ||
defs.removeChild(dom); | ||
} | ||
}); | ||
}, | ||
resize: function () { | ||
@@ -569,3 +742,3 @@ var width = this._getWidth(); | ||
} | ||
} | ||
}; | ||
@@ -572,0 +745,0 @@ // Not supported methods |
@@ -1014,7 +1014,7 @@ // http://www.w3.org/TR/NOTE-VML | ||
updateFillAndStroke(textVmlEl, 'fill', { | ||
fill: fromTextEl ? style.fill : style.textFill, | ||
fill: style.textFill, | ||
opacity: style.opacity | ||
}, this); | ||
updateFillAndStroke(textVmlEl, 'stroke', { | ||
stroke: fromTextEl ? style.stroke : style.textStroke, | ||
stroke: style.textStroke, | ||
opacity: style.opacity, | ||
@@ -1021,0 +1021,0 @@ lineDash: style.lineDash |
@@ -34,3 +34,3 @@ /*! | ||
*/ | ||
zrender.version = '3.6.0'; | ||
zrender.version = '3.6.1'; | ||
@@ -37,0 +37,0 @@ /** |
{ | ||
"name": "zrender", | ||
"version": "3.6.0", | ||
"version": "3.6.1", | ||
"description": "A lightweight canvas library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -599,3 +599,3 @@ /** | ||
removeKey: function (key) { | ||
delete this[key]; | ||
delete this[HASH_MAP_PREFIX + key]; | ||
} | ||
@@ -602,0 +602,0 @@ }; |
@@ -71,3 +71,3 @@ /** | ||
*/ | ||
fill: '#000000', | ||
fill: '#000', | ||
@@ -352,6 +352,2 @@ /** | ||
normalize: function () { | ||
textHelper.normalizeTextStyle(this); | ||
}, | ||
/** | ||
@@ -358,0 +354,0 @@ * @param {CanvasRenderingContext2D} ctx |
@@ -116,2 +116,5 @@ /** | ||
/** | ||
* Caution: this method will stop previous animation. | ||
* So do not use this method to one element twice before | ||
* animation starts, unless you know what you are doing. | ||
* @param {Object} target | ||
@@ -118,0 +121,0 @@ * @param {number} [time=500] Time in ms |
@@ -64,3 +64,25 @@ // TODO | ||
if (pathHasFill(style, isText)) { | ||
attr(svgEl, 'fill', isText ? style.textFill : style.fill); | ||
var fill = isText ? style.textFill : style.fill; | ||
fill = fill === 'transparent' ? NONE : fill; | ||
/** | ||
* FIXME: | ||
* This is a temporary fix for Chrome's clipping bug | ||
* that happens when a clip-path is referring another one. | ||
* This fix should be used before Chrome's bug is fixed. | ||
* For an element that has clip-path, and fill is none, | ||
* set it to be "rgba(0, 0, 0, 0.002)" will hide the element. | ||
* Otherwise, it will show black fill color. | ||
* 0.002 is used because this won't work for alpha values smaller | ||
* than 0.002. | ||
* | ||
* See | ||
* https://bugs.chromium.org/p/chromium/issues/detail?id=659790 | ||
* for more information. | ||
*/ | ||
if (svgEl.getAttribute('clip-path') !== 'none' && fill === NONE) { | ||
fill = 'rgba(0, 0, 0, 0.002)'; | ||
} | ||
attr(svgEl, 'fill', fill); | ||
attr(svgEl, 'fill-opacity', style.opacity); | ||
@@ -73,3 +95,5 @@ } | ||
if (pathHasStroke(style, isText)) { | ||
attr(svgEl, 'stroke', isText ? style.textStroke : style.stroke); | ||
var stroke = isText ? style.textStroke : style.stroke; | ||
stroke = stroke === 'transparent' ? NONE : stroke; | ||
attr(svgEl, 'stroke', stroke); | ||
var strokeWidth = isText | ||
@@ -341,4 +365,15 @@ ? style.textLineWidth | ||
var align = style.textAlign || 'left'; | ||
var font = style.font || textContain.DEFAULT_FONT; | ||
if (typeof style.fontSize === 'number') { | ||
style.fontSize += 'px'; | ||
} | ||
var font = style.font | ||
|| [ | ||
style.fontStyle || '', | ||
style.fontWeight || '', | ||
style.fontSize || '', | ||
style.fontFamily || '' | ||
].join(' ') | ||
|| textContain.DEFAULT_FONT; | ||
var verticalAlign = getVerticalAlignForSvg(style.textVerticalAlign); | ||
@@ -362,2 +397,3 @@ | ||
verticalAlign = getVerticalAlignForSvg(newPos.textVerticalAlign); | ||
align = newPos.textAlign; | ||
} | ||
@@ -364,0 +400,0 @@ |
@@ -9,2 +9,3 @@ /** | ||
var zrLog = require('../core/log'); | ||
var matrix = require('../core/matrix'); | ||
var Path = require('../graphic/Path'); | ||
@@ -24,6 +25,8 @@ var ZImage = require('../graphic/Image'); | ||
var GRADIENT_MARK = '_gradientInUse'; | ||
var GRADIENT_MARK_UNUSED = '0'; | ||
var GRADIENT_MARK_USED = '1'; | ||
var CLIPPATH_MARK = '_clipPathInUse'; | ||
var MARK_UNUSED = '0'; | ||
var MARK_USED = '1'; | ||
var nextGradientId = 1; | ||
var nextClippathId = 1; | ||
@@ -44,2 +47,5 @@ function parseInt10(val) { | ||
} | ||
else { | ||
return svgPath; | ||
} | ||
} | ||
@@ -139,2 +145,3 @@ | ||
this._markGradientsUnused(); | ||
this._markClipPathsUnused(); | ||
@@ -153,2 +160,5 @@ var svgRoot = this._svgRoot; | ||
svgProxy && svgProxy.brush(displayable); | ||
var el = getSvgElement(displayable) | ||
|| getTextSvgElement(displayable); | ||
this._doClip(displayable, el); | ||
@@ -189,4 +199,5 @@ // Update gradient | ||
= getTextSvgElement(displayable) | ||
|| getSvgElement(displayable); | ||
|| getSvgElement(displayable); | ||
this._markGradientUsed(displayable); | ||
this._markClipPathUsed(displayable); | ||
break; | ||
@@ -211,3 +222,3 @@ case '+': | ||
prevSvgElement = textSvgElement || svgElement; | ||
this._markClipPathUsed(displayable); | ||
break; | ||
@@ -226,3 +237,4 @@ // case '^': | ||
this._removeUnusedGradient(); | ||
this._removeUnusedGradients(); | ||
this._removeUnusedClipPaths(); | ||
@@ -244,3 +256,3 @@ this._visibleList = newVisibleList; | ||
&& (displayable.style[fillOrStroke].type === 'linear' | ||
|| displayable.style[fillOrStroke].type === 'radial') | ||
|| displayable.style[fillOrStroke].type === 'radial') | ||
) { | ||
@@ -265,3 +277,3 @@ var gradient = displayable.style[fillOrStroke]; | ||
// Mark gradient to be used | ||
dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
dom[GRADIENT_MARK] = MARK_USED; | ||
@@ -413,3 +425,3 @@ var id = dom.getAttribute('id'); | ||
util.each(doms, function (dom) { | ||
dom[GRADIENT_MARK] = GRADIENT_MARK_UNUSED; | ||
dom[GRADIENT_MARK] = MARK_UNUSED; | ||
}); | ||
@@ -421,3 +433,3 @@ }, | ||
*/ | ||
_removeUnusedGradient: function () { | ||
_removeUnusedGradients: function () { | ||
var defs = this._getDefs(false); | ||
@@ -431,3 +443,3 @@ if (!defs) { | ||
util.each(doms, function (dom) { | ||
if (dom[GRADIENT_MARK] !== GRADIENT_MARK_USED) { | ||
if (dom[GRADIENT_MARK] !== MARK_USED) { | ||
// Remove gradient | ||
@@ -448,3 +460,3 @@ defs.removeChild(dom); | ||
if (gradient && gradient.__dom) { | ||
gradient.__dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
gradient.__dom[GRADIENT_MARK] = MARK_USED; | ||
} | ||
@@ -454,3 +466,3 @@ | ||
if (gradient && gradient.__dom) { | ||
gradient.__dom[GRADIENT_MARK] = GRADIENT_MARK_USED; | ||
gradient.__dom[GRADIENT_MARK] = MARK_USED; | ||
} | ||
@@ -473,6 +485,22 @@ } | ||
if (isForceCreating) { | ||
return svgRoot.insertBefore( | ||
var defs = svgRoot.insertBefore( | ||
createElement('defs'), // Create new tag | ||
svgRoot.firstChild // Insert in the front of svg | ||
); | ||
if (!defs.contains) { | ||
// IE doesn't support contains method | ||
defs.contains = function (el) { | ||
var children = defs.children; | ||
if (!children) { | ||
return false; | ||
} | ||
for (var i = children.length - 1; i >= 0; --i) { | ||
if (children[i] === el) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
}; | ||
} | ||
return defs; | ||
} | ||
@@ -502,3 +530,3 @@ else { | ||
// rather than real array. | ||
// So`doms.concat(tags)` add tags as one object. | ||
// So `doms.concat(tags)` add tags as one object. | ||
doms = doms.concat([].slice.call(tags)); | ||
@@ -510,2 +538,147 @@ }); | ||
_doClip: function (el, svgElement) { | ||
this._doClipEl(svgElement, el.__clipPaths, false); | ||
var textEl = getTextSvgElement(el); | ||
if (textEl) { | ||
// Make another clipPath for text, since it's transform | ||
// matrix is not the same with svgElement | ||
this._doClipEl(textEl, el.__clipPaths, true); | ||
} | ||
this._markClipPathUsed(el); | ||
}, | ||
/** | ||
* Create an SVGElement of displayable and create a <clipPath> of its | ||
* clipPath | ||
*/ | ||
_doClipEl: function (parentEl, clipPaths, isText) { | ||
if (clipPaths && clipPaths.length > 0) { | ||
// Has clipPath, create <clipPath> with the first clipPath | ||
var defs = this._getDefs(true); | ||
var clipPath = clipPaths[0]; | ||
var clipPathEl; | ||
var id; | ||
var dom = isText ? '__textDom' : '__dom'; | ||
if (clipPath[dom]) { | ||
// Use a dom that is already in <defs> | ||
id = clipPath[dom].getAttribute('id'); | ||
clipPathEl = clipPath[dom]; | ||
// Use a dom that is already in <defs> | ||
if (!defs.contains(clipPathEl)) { | ||
// This happens when set old clipPath that has | ||
// been previously removed | ||
defs.appendChild(clipPathEl); | ||
} | ||
} | ||
else { | ||
// New <clipPath> | ||
id = 'zr-clip-' + nextClippathId; | ||
++nextClippathId; | ||
clipPathEl = createElement('clipPath'); | ||
clipPathEl.setAttribute('id', id); | ||
defs.appendChild(clipPathEl); | ||
clipPath[dom] = clipPathEl; | ||
} | ||
// Build path and add to <clipPath> | ||
var svgProxy = getSvgProxy(clipPath); | ||
if (clipPath.transform | ||
&& clipPath.parent.invTransform | ||
&& !isText | ||
) { | ||
/** | ||
* If a clipPath has a parent with transform, the transform | ||
* of parent should not be considered when setting transform | ||
* of clipPath. So we need to transform back from parent's | ||
* transform, which is done by multiplying parent's inverse | ||
* transform. | ||
*/ | ||
// Store old transform | ||
var transform = Array.prototype.slice.call( | ||
clipPath.transform | ||
); | ||
// Transform back from parent, and brush path | ||
matrix.mul( | ||
clipPath.transform, | ||
clipPath.parent.invTransform, | ||
clipPath.transform | ||
); | ||
svgProxy.brush(clipPath); | ||
// Set back transform of clipPath | ||
clipPath.transform = transform; | ||
} | ||
else { | ||
svgProxy.brush(clipPath); | ||
} | ||
var pathEl = getSvgElement(clipPath); | ||
clipPathEl.appendChild(pathEl); | ||
parentEl.setAttribute('clip-path', 'url(#' + id + ')'); | ||
if (clipPaths.length > 1) { | ||
// Make the other clipPaths recursively | ||
this._doClipEl(clipPathEl, clipPaths.slice(1), isText); | ||
} | ||
} | ||
else { | ||
// No clipPath | ||
parentEl.setAttribute('clip-path', 'none'); | ||
} | ||
}, | ||
_markClipPathsUnused: function () { | ||
var tags = this._getClipPaths(); | ||
util.each(tags, function (tag) { | ||
tag[CLIPPATH_MARK] = MARK_UNUSED; | ||
}); | ||
}, | ||
_markClipPathUsed: function (displayable) { | ||
if (displayable.__clipPaths && displayable.__clipPaths.length > 0) { | ||
util.each(displayable.__clipPaths, function (clipPath) { | ||
if (clipPath.__dom) { | ||
clipPath.__dom[CLIPPATH_MARK] = MARK_USED; | ||
} | ||
if (clipPath.__textDom) { | ||
clipPath.__textDom[CLIPPATH_MARK] = MARK_USED; | ||
} | ||
}); | ||
} | ||
}, | ||
_getClipPaths: function () { | ||
var defs = this._getDefs(false); | ||
if (!defs) { | ||
return []; | ||
} | ||
var tags = defs.getElementsByTagName('clipPath'); | ||
return [].slice.call(tags); | ||
}, | ||
_removeUnusedClipPaths: function () { | ||
var defs = this._getDefs(false); | ||
if (!defs) { | ||
// Nothing to remove | ||
return; | ||
} | ||
var doms = this._getClipPaths(); | ||
util.each(doms, function (dom) { | ||
if (dom[CLIPPATH_MARK] !== MARK_USED) { | ||
defs.removeChild(dom); | ||
} | ||
}); | ||
}, | ||
resize: function () { | ||
@@ -569,3 +742,3 @@ var width = this._getWidth(); | ||
} | ||
} | ||
}; | ||
@@ -572,0 +745,0 @@ // Not supported methods |
@@ -1014,7 +1014,7 @@ // http://www.w3.org/TR/NOTE-VML | ||
updateFillAndStroke(textVmlEl, 'fill', { | ||
fill: fromTextEl ? style.fill : style.textFill, | ||
fill: style.textFill, | ||
opacity: style.opacity | ||
}, this); | ||
updateFillAndStroke(textVmlEl, 'stroke', { | ||
stroke: fromTextEl ? style.stroke : style.textStroke, | ||
stroke: style.textStroke, | ||
opacity: style.opacity, | ||
@@ -1021,0 +1021,0 @@ lineDash: style.lineDash |
@@ -34,3 +34,3 @@ /*! | ||
*/ | ||
zrender.version = '3.6.0'; | ||
zrender.version = '3.6.1'; | ||
@@ -37,0 +37,0 @@ /** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1154322
32488