Comparing version 3.2.2 to 3.3.0
@@ -237,2 +237,3 @@ 'use strict'; | ||
options = options || {}; | ||
var animator = new Animator( | ||
@@ -245,2 +246,4 @@ target, | ||
this.addAnimator(animator); | ||
return animator; | ||
@@ -247,0 +250,0 @@ } |
@@ -122,6 +122,8 @@ /** | ||
pointerEventsSupported: 'onpointerdown' in window | ||
// Firefox supports pointer but not by default, | ||
// only MS browsers are reliable on pointer events currently. | ||
&& (browser.edge || (browser.ie && browser.version >= 10)) | ||
// Firefox supports pointer but not by default, only MS browsers are reliable on pointer | ||
// events currently. So we dont use that on other browsers unless tested sufficiently. | ||
// Although IE 10 supports pointer event, it use old style and is different from the | ||
// standard. So we exclude that. (IE 10 is hardly used on touch device) | ||
&& (browser.edge || (browser.ie && browser.version >= 11)) | ||
}; | ||
} |
@@ -116,3 +116,6 @@ 'use strict'; | ||
/** | ||
* 停止冒泡和阻止默认行为 | ||
* preventDefault and stopPropagation. | ||
* Notice: do not do that in zrender. Upper application | ||
* do that if necessary. | ||
* | ||
* @memberOf module:zrender/core/event | ||
@@ -119,0 +122,0 @@ * @method |
@@ -223,3 +223,3 @@ 'use strict'; | ||
this._xi = mathCos(endAngle) * r + cx; | ||
this._xi = mathSin(endAngle) * r + cx; | ||
this._yi = mathSin(endAngle) * r + cx; | ||
return this; | ||
@@ -226,0 +226,0 @@ }, |
@@ -453,2 +453,11 @@ /** | ||
/** | ||
* Whether is exactly NaN. Notice isNaN('a') returns true. | ||
* @param {*} value | ||
* @return {boolean} | ||
*/ | ||
function eqNaN(value) { | ||
return value !== value; | ||
} | ||
/** | ||
* If value1 is not null, then return value1, otherwise judget rest of values. | ||
@@ -514,2 +523,3 @@ * @memberOf module:zrender/core/util | ||
isDom: isDom, | ||
eqNaN: eqNaN, | ||
retrieve: retrieve, | ||
@@ -516,0 +526,0 @@ assert: assert, |
@@ -24,2 +24,11 @@ | ||
var pointerEventNames = { | ||
pointerdown: 1, pointerup: 1, pointermove: 1, pointerout: 1 | ||
}; | ||
var pointerHandlerNames = zrUtil.map(mouseHandlerNames, function (name) { | ||
var nm = name.replace('mouse', 'pointer'); | ||
return pointerEventNames[nm] ? nm : name; | ||
}); | ||
function eventNameFix(name) { | ||
@@ -42,4 +51,4 @@ return (name === 'mousewheel' && env.browser.firefox) ? 'DOMMouseScroll' : name; | ||
// Do not do any preventDefault here. Upper application do that if necessary. | ||
if (gestureInfo) { | ||
// eventTool.stop(event); | ||
var type = gestureInfo.type; | ||
@@ -52,2 +61,15 @@ event.gestureEvent = type; | ||
// function onMSGestureChange(proxy, event) { | ||
// if (event.translationX || event.translationY) { | ||
// // mousemove is carried by MSGesture to reduce the sensitivity. | ||
// proxy.handler.dispatchToElement(event.target, 'mousemove', event); | ||
// } | ||
// if (event.scale !== 1) { | ||
// event.pinchX = event.offsetX; | ||
// event.pinchY = event.offsetY; | ||
// event.pinchScale = event.scale; | ||
// proxy.handler.dispatchToElement(event.target, 'pinch', event); | ||
// } | ||
// } | ||
/** | ||
@@ -68,5 +90,2 @@ * Prevent mouse event from being dispatched after Touch Events action | ||
function useTouchEvent() { | ||
return env.touchEventsSupported; | ||
} | ||
@@ -116,3 +135,2 @@ var domHandlers = { | ||
// For example, page may needs to be slided. | ||
event = normalizeEvent(this.dom, event); | ||
@@ -129,3 +147,3 @@ | ||
// In touch device, trigger `mousemove`(`mouseover`) should | ||
// be triggered. | ||
// be triggered, and must before `mousedown` triggered. | ||
domHandlers.mousemove.call(this, event); | ||
@@ -193,5 +211,48 @@ | ||
setTouchTimer(this); | ||
}, | ||
pointerdown: function (event) { | ||
domHandlers.mousedown.call(this, event); | ||
// if (useMSGuesture(this, event)) { | ||
// this._msGesture.addPointer(event.pointerId); | ||
// } | ||
}, | ||
pointermove: function (event) { | ||
// FIXME | ||
// pointermove is so sensitive that it always triggered when | ||
// tap(click) on touch screen, which affect some judgement in | ||
// upper application. So, we dont support mousemove on MS touch | ||
// device yet. | ||
if (!isPointerFromTouch(event)) { | ||
domHandlers.mousemove.call(this, event); | ||
} | ||
}, | ||
pointerup: function (event) { | ||
domHandlers.mouseup.call(this, event); | ||
}, | ||
pointerout: function (event) { | ||
// pointerout will be triggered when tap on touch screen | ||
// (IE11+/Edge on MS Surface) after click event triggered, | ||
// which is inconsistent with the mousout behavior we defined | ||
// in touchend. So we unify them. | ||
// (check domHandlers.touchend for detailed explanation) | ||
if (!isPointerFromTouch(event)) { | ||
domHandlers.mouseout.call(this, event); | ||
} | ||
} | ||
}; | ||
function isPointerFromTouch(event) { | ||
var pointerType = event.pointerType; | ||
return pointerType === 'pen' || pointerType === 'touch'; | ||
} | ||
// function useMSGuesture(handlerProxy, event) { | ||
// return isPointerFromTouch(event) && !!handlerProxy._msGesture; | ||
// } | ||
// Common handlers | ||
@@ -212,11 +273,13 @@ zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) { | ||
function initDomHandler(instance) { | ||
for (var i = 0; i < touchHandlerNames.length; i++) { | ||
var name = touchHandlerNames[i]; | ||
zrUtil.each(touchHandlerNames, function (name) { | ||
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance); | ||
} | ||
}); | ||
for (var i = 0; i < mouseHandlerNames.length; i++) { | ||
var name = mouseHandlerNames[i]; | ||
zrUtil.each(pointerHandlerNames, function (name) { | ||
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance); | ||
}); | ||
zrUtil.each(mouseHandlerNames, function (name) { | ||
instance._handlers[name] = makeMouseHandler(domHandlers[name], instance); | ||
} | ||
}); | ||
@@ -261,13 +324,40 @@ function makeMouseHandler(fn, instance) { | ||
if (useTouchEvent()) { | ||
mountHandlers(touchHandlerNames, this); | ||
if (env.pointerEventsSupported) { // Only IE11+/Edge | ||
// 1. On devices that both enable touch and mouse (e.g., MS Surface and lenovo X240), | ||
// IE11+/Edge do not trigger touch event, but trigger pointer event and mouse event | ||
// at the same time. | ||
// 2. On MS Surface, it probablely only trigger mousedown but no mouseup when tap on | ||
// screen, which do not occurs in pointer event. | ||
// So we use pointer event to both detect touch gesture and mouse behavior. | ||
mountHandlers(pointerHandlerNames, this); | ||
// Handler of 'mouseout' event is needed in touch mode, which will be mounted below. | ||
// addEventListener(root, 'mouseout', this._mouseoutHandler); | ||
// FIXME | ||
// Note: MS Gesture require CSS touch-action set. But touch-action is not reliable, | ||
// which does not prevent defuault behavior occasionally (which may cause view port | ||
// zoomed in but use can not zoom it back). And event.preventDefault() does not work. | ||
// So we have to not to use MSGesture and not to support touchmove and pinch on MS | ||
// touch screen. And we only support click behavior on MS touch screen now. | ||
// MS Gesture Event is only supported on IE11+/Edge and on Windows 8+. | ||
// We dont support touch on IE on win7. | ||
// See <https://msdn.microsoft.com/en-us/library/dn433243(v=vs.85).aspx> | ||
// if (typeof MSGesture === 'function') { | ||
// (this._msGesture = new MSGesture()).target = dom; // jshint ignore:line | ||
// dom.addEventListener('MSGestureChange', onMSGestureChange); | ||
// } | ||
} | ||
else { | ||
if (env.touchEventsSupported) { | ||
mountHandlers(touchHandlerNames, this); | ||
// Handler of 'mouseout' event is needed in touch mode, which will be mounted below. | ||
// addEventListener(root, 'mouseout', this._mouseoutHandler); | ||
} | ||
// Considering some devices that both enable touch and mouse event (like MS Surface | ||
// and lenovo X240, @see #2350), we make mouse event be always listened, otherwise | ||
// mouse event can not be handle in those devices. | ||
mountHandlers(mouseHandlerNames, this); | ||
// 1. Considering some devices that both enable touch and mouse event (like on MS Surface | ||
// and lenovo X240, @see #2350), we make mouse event be always listened, otherwise | ||
// mouse event can not be handle in those devices. | ||
// 2. On MS Surface, Chrome will trigger both touch event and mouse event. How to prevent | ||
// mouseevent after touch event triggered, see `setTouchTimer`. | ||
mountHandlers(mouseHandlerNames, this); | ||
} | ||
@@ -274,0 +364,0 @@ function mountHandlers(handlerNames, instance) { |
@@ -50,2 +50,3 @@ /** | ||
var textPosition = style.textPosition; | ||
var textOffset = style.textOffset; | ||
var distance = style.textDistance; | ||
@@ -106,2 +107,7 @@ var align = style.textAlign; | ||
if (textOffset) { | ||
x += textOffset[0]; | ||
y += textOffset[1]; | ||
} | ||
// Use canvas default left textAlign. Giving invalid value will cause state not change | ||
@@ -108,0 +114,0 @@ ctx.textAlign = align || 'left'; |
@@ -8,4 +8,14 @@ /** | ||
module.exports = require('../Path').extend({ | ||
var env = require('../../core/env'); | ||
var Path = require('../Path'); | ||
var shadowTemp = [ | ||
['shadowBlur', 0], | ||
['shadowColor', '#000'], | ||
['shadowOffsetX', 0], | ||
['shadowOffsetY', 0] | ||
]; | ||
module.exports = Path.extend({ | ||
type: 'sector', | ||
@@ -30,2 +40,45 @@ | ||
brush: (env.browser.ie && env.browser.version >= 11) // version: '11.0' | ||
// Fix weird bug in some version of IE11 (like 11.0.9600.17801), | ||
// where exception "unexpected call to method or property access" | ||
// might be thrown when calling ctx.fill after a path whose area size | ||
// is zero is drawn and ctx.clip() is called and shadowBlur is set. | ||
// (e.g., | ||
// ctx.moveTo(10, 10); | ||
// ctx.lineTo(20, 10); | ||
// ctx.closePath(); | ||
// ctx.clip(); | ||
// ctx.shadowBlur = 10; | ||
// ... | ||
// ctx.fill(); | ||
// ) | ||
? function () { | ||
var clipPaths = this.__clipPaths; | ||
var style = this.style; | ||
var modified; | ||
if (clipPaths) { | ||
for (var i = 0; i < clipPaths.length; i++) { | ||
var shape = clipPaths[i] && clipPaths[i].shape; | ||
if (shape && shape.startAngle === shape.endAngle) { | ||
for (var j = 0; j < shadowTemp.length; j++) { | ||
shadowTemp[j][2] = style[shadowTemp[j][0]]; | ||
style[shadowTemp[j][0]] = shadowTemp[j][1]; | ||
} | ||
modified = true; | ||
break; | ||
} | ||
} | ||
} | ||
Path.prototype.brush.apply(this, arguments); | ||
if (modified) { | ||
for (var j = 0; j < shadowTemp.length; j++) { | ||
style[shadowTemp[j][0]] = shadowTemp[j][2]; | ||
} | ||
} | ||
} | ||
: Path.prototype.brush, | ||
buildPath: function (ctx, shape) { | ||
@@ -32,0 +85,0 @@ |
@@ -138,2 +138,8 @@ /** | ||
/** | ||
* [x, y] | ||
* @type {Array.<number>} | ||
*/ | ||
textOffset: null, | ||
/** | ||
* @type {string} | ||
@@ -140,0 +146,0 @@ */ |
@@ -204,2 +204,4 @@ 'use strict'; | ||
zlevelList.push(0); | ||
this._domRoot = root; | ||
} | ||
@@ -236,3 +238,3 @@ | ||
getViewportRoot: function () { | ||
return this._singleCanvas ? this._layers[0].dom : this._domRoot; | ||
return this._domRoot; | ||
}, | ||
@@ -239,0 +241,0 @@ |
@@ -120,7 +120,4 @@ 'use strict'; | ||
var clipPath = el.clipPath; | ||
if (clipPath) { | ||
// clipPath 的变换是基于 group 的变换 | ||
clipPath.parent = el; | ||
clipPath.updateTransform(); | ||
var userSetClipPath = el.clipPath; | ||
if (userSetClipPath) { | ||
@@ -130,7 +127,20 @@ // FIXME 效率影响 | ||
clipPaths = clipPaths.slice(); | ||
clipPaths.push(clipPath); | ||
} | ||
else { | ||
clipPaths = [clipPath]; | ||
clipPaths = []; | ||
} | ||
var currentClipPath = userSetClipPath; | ||
var parentClipPath = el; | ||
// Recursively add clip path | ||
while (currentClipPath) { | ||
// clipPath 的变换是基于使用这个 clipPath 的元素 | ||
currentClipPath.parent = parentClipPath; | ||
currentClipPath.updateTransform(); | ||
clipPaths.push(currentClipPath); | ||
parentClipPath = currentClipPath; | ||
currentClipPath = currentClipPath.clipPath; | ||
} | ||
} | ||
@@ -137,0 +147,0 @@ |
@@ -359,3 +359,3 @@ // http://www.w3.org/TR/NOTE-VML | ||
var type = clockwise ? ' wa ' : ' at '; | ||
if (Math.abs(x0 - x1) < 1e-10) { | ||
if (Math.abs(x0 - x1) < 1e-4) { | ||
// IE won't render arches drawn counter clockwise if x0 == x1. | ||
@@ -371,3 +371,3 @@ if (Math.abs(endAngle - startAngle) > 1e-2) { | ||
// Avoid case draw full circle | ||
if (Math.abs(y0 - cy) < 1e-10) { | ||
if (Math.abs(y0 - cy) < 1e-4) { | ||
if ((clockwise && x0 < cx) || (!clockwise && x0 > cx)) { | ||
@@ -374,0 +374,0 @@ y1 -= 270 / Z; |
@@ -34,3 +34,3 @@ /*! | ||
*/ | ||
zrender.version = '3.2.2'; | ||
zrender.version = '3.3.0'; | ||
@@ -37,0 +37,0 @@ /** |
{ | ||
"name": "zrender", | ||
"version": "3.2.2", | ||
"version": "3.3.0", | ||
"description": "A lightweight canvas library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -238,2 +238,3 @@ /** | ||
options = options || {}; | ||
var animator = new Animator( | ||
@@ -246,2 +247,4 @@ target, | ||
this.addAnimator(animator); | ||
return animator; | ||
@@ -248,0 +251,0 @@ } |
@@ -122,7 +122,9 @@ /** | ||
pointerEventsSupported: 'onpointerdown' in window | ||
// Firefox supports pointer but not by default, | ||
// only MS browsers are reliable on pointer events currently. | ||
&& (browser.edge || (browser.ie && browser.version >= 10)) | ||
// Firefox supports pointer but not by default, only MS browsers are reliable on pointer | ||
// events currently. So we dont use that on other browsers unless tested sufficiently. | ||
// Although IE 10 supports pointer event, it use old style and is different from the | ||
// standard. So we exclude that. (IE 10 is hardly used on touch device) | ||
&& (browser.edge || (browser.ie && browser.version >= 11)) | ||
}; | ||
} | ||
}); |
@@ -117,3 +117,6 @@ /** | ||
/** | ||
* 停止冒泡和阻止默认行为 | ||
* preventDefault and stopPropagation. | ||
* Notice: do not do that in zrender. Upper application | ||
* do that if necessary. | ||
* | ||
* @memberOf module:zrender/core/event | ||
@@ -120,0 +123,0 @@ * @method |
@@ -223,3 +223,3 @@ /** | ||
this._xi = mathCos(endAngle) * r + cx; | ||
this._xi = mathSin(endAngle) * r + cx; | ||
this._yi = mathSin(endAngle) * r + cx; | ||
return this; | ||
@@ -226,0 +226,0 @@ }, |
@@ -453,2 +453,11 @@ /** | ||
/** | ||
* Whether is exactly NaN. Notice isNaN('a') returns true. | ||
* @param {*} value | ||
* @return {boolean} | ||
*/ | ||
function eqNaN(value) { | ||
return value !== value; | ||
} | ||
/** | ||
* If value1 is not null, then return value1, otherwise judget rest of values. | ||
@@ -514,2 +523,3 @@ * @memberOf module:zrender/core/util | ||
isDom: isDom, | ||
eqNaN: eqNaN, | ||
retrieve: retrieve, | ||
@@ -516,0 +526,0 @@ assert: assert, |
@@ -24,2 +24,11 @@ define(function (require) { | ||
var pointerEventNames = { | ||
pointerdown: 1, pointerup: 1, pointermove: 1, pointerout: 1 | ||
}; | ||
var pointerHandlerNames = zrUtil.map(mouseHandlerNames, function (name) { | ||
var nm = name.replace('mouse', 'pointer'); | ||
return pointerEventNames[nm] ? nm : name; | ||
}); | ||
function eventNameFix(name) { | ||
@@ -42,4 +51,4 @@ return (name === 'mousewheel' && env.browser.firefox) ? 'DOMMouseScroll' : name; | ||
// Do not do any preventDefault here. Upper application do that if necessary. | ||
if (gestureInfo) { | ||
// eventTool.stop(event); | ||
var type = gestureInfo.type; | ||
@@ -52,2 +61,15 @@ event.gestureEvent = type; | ||
// function onMSGestureChange(proxy, event) { | ||
// if (event.translationX || event.translationY) { | ||
// // mousemove is carried by MSGesture to reduce the sensitivity. | ||
// proxy.handler.dispatchToElement(event.target, 'mousemove', event); | ||
// } | ||
// if (event.scale !== 1) { | ||
// event.pinchX = event.offsetX; | ||
// event.pinchY = event.offsetY; | ||
// event.pinchScale = event.scale; | ||
// proxy.handler.dispatchToElement(event.target, 'pinch', event); | ||
// } | ||
// } | ||
/** | ||
@@ -68,5 +90,2 @@ * Prevent mouse event from being dispatched after Touch Events action | ||
function useTouchEvent() { | ||
return env.touchEventsSupported; | ||
} | ||
@@ -116,3 +135,2 @@ var domHandlers = { | ||
// For example, page may needs to be slided. | ||
event = normalizeEvent(this.dom, event); | ||
@@ -129,3 +147,3 @@ | ||
// In touch device, trigger `mousemove`(`mouseover`) should | ||
// be triggered. | ||
// be triggered, and must before `mousedown` triggered. | ||
domHandlers.mousemove.call(this, event); | ||
@@ -193,5 +211,48 @@ | ||
setTouchTimer(this); | ||
}, | ||
pointerdown: function (event) { | ||
domHandlers.mousedown.call(this, event); | ||
// if (useMSGuesture(this, event)) { | ||
// this._msGesture.addPointer(event.pointerId); | ||
// } | ||
}, | ||
pointermove: function (event) { | ||
// FIXME | ||
// pointermove is so sensitive that it always triggered when | ||
// tap(click) on touch screen, which affect some judgement in | ||
// upper application. So, we dont support mousemove on MS touch | ||
// device yet. | ||
if (!isPointerFromTouch(event)) { | ||
domHandlers.mousemove.call(this, event); | ||
} | ||
}, | ||
pointerup: function (event) { | ||
domHandlers.mouseup.call(this, event); | ||
}, | ||
pointerout: function (event) { | ||
// pointerout will be triggered when tap on touch screen | ||
// (IE11+/Edge on MS Surface) after click event triggered, | ||
// which is inconsistent with the mousout behavior we defined | ||
// in touchend. So we unify them. | ||
// (check domHandlers.touchend for detailed explanation) | ||
if (!isPointerFromTouch(event)) { | ||
domHandlers.mouseout.call(this, event); | ||
} | ||
} | ||
}; | ||
function isPointerFromTouch(event) { | ||
var pointerType = event.pointerType; | ||
return pointerType === 'pen' || pointerType === 'touch'; | ||
} | ||
// function useMSGuesture(handlerProxy, event) { | ||
// return isPointerFromTouch(event) && !!handlerProxy._msGesture; | ||
// } | ||
// Common handlers | ||
@@ -212,11 +273,13 @@ zrUtil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name) { | ||
function initDomHandler(instance) { | ||
for (var i = 0; i < touchHandlerNames.length; i++) { | ||
var name = touchHandlerNames[i]; | ||
zrUtil.each(touchHandlerNames, function (name) { | ||
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance); | ||
} | ||
}); | ||
for (var i = 0; i < mouseHandlerNames.length; i++) { | ||
var name = mouseHandlerNames[i]; | ||
zrUtil.each(pointerHandlerNames, function (name) { | ||
instance._handlers[name] = zrUtil.bind(domHandlers[name], instance); | ||
}); | ||
zrUtil.each(mouseHandlerNames, function (name) { | ||
instance._handlers[name] = makeMouseHandler(domHandlers[name], instance); | ||
} | ||
}); | ||
@@ -261,13 +324,40 @@ function makeMouseHandler(fn, instance) { | ||
if (useTouchEvent()) { | ||
mountHandlers(touchHandlerNames, this); | ||
if (env.pointerEventsSupported) { // Only IE11+/Edge | ||
// 1. On devices that both enable touch and mouse (e.g., MS Surface and lenovo X240), | ||
// IE11+/Edge do not trigger touch event, but trigger pointer event and mouse event | ||
// at the same time. | ||
// 2. On MS Surface, it probablely only trigger mousedown but no mouseup when tap on | ||
// screen, which do not occurs in pointer event. | ||
// So we use pointer event to both detect touch gesture and mouse behavior. | ||
mountHandlers(pointerHandlerNames, this); | ||
// Handler of 'mouseout' event is needed in touch mode, which will be mounted below. | ||
// addEventListener(root, 'mouseout', this._mouseoutHandler); | ||
// FIXME | ||
// Note: MS Gesture require CSS touch-action set. But touch-action is not reliable, | ||
// which does not prevent defuault behavior occasionally (which may cause view port | ||
// zoomed in but use can not zoom it back). And event.preventDefault() does not work. | ||
// So we have to not to use MSGesture and not to support touchmove and pinch on MS | ||
// touch screen. And we only support click behavior on MS touch screen now. | ||
// MS Gesture Event is only supported on IE11+/Edge and on Windows 8+. | ||
// We dont support touch on IE on win7. | ||
// See <https://msdn.microsoft.com/en-us/library/dn433243(v=vs.85).aspx> | ||
// if (typeof MSGesture === 'function') { | ||
// (this._msGesture = new MSGesture()).target = dom; // jshint ignore:line | ||
// dom.addEventListener('MSGestureChange', onMSGestureChange); | ||
// } | ||
} | ||
else { | ||
if (env.touchEventsSupported) { | ||
mountHandlers(touchHandlerNames, this); | ||
// Handler of 'mouseout' event is needed in touch mode, which will be mounted below. | ||
// addEventListener(root, 'mouseout', this._mouseoutHandler); | ||
} | ||
// Considering some devices that both enable touch and mouse event (like MS Surface | ||
// and lenovo X240, @see #2350), we make mouse event be always listened, otherwise | ||
// mouse event can not be handle in those devices. | ||
mountHandlers(mouseHandlerNames, this); | ||
// 1. Considering some devices that both enable touch and mouse event (like on MS Surface | ||
// and lenovo X240, @see #2350), we make mouse event be always listened, otherwise | ||
// mouse event can not be handle in those devices. | ||
// 2. On MS Surface, Chrome will trigger both touch event and mouse event. How to prevent | ||
// mouseevent after touch event triggered, see `setTouchTimer`. | ||
mountHandlers(mouseHandlerNames, this); | ||
} | ||
@@ -274,0 +364,0 @@ function mountHandlers(handlerNames, instance) { |
@@ -50,2 +50,3 @@ /** | ||
var textPosition = style.textPosition; | ||
var textOffset = style.textOffset; | ||
var distance = style.textDistance; | ||
@@ -106,2 +107,7 @@ var align = style.textAlign; | ||
if (textOffset) { | ||
x += textOffset[0]; | ||
y += textOffset[1]; | ||
} | ||
// Use canvas default left textAlign. Giving invalid value will cause state not change | ||
@@ -108,0 +114,0 @@ ctx.textAlign = align || 'left'; |
@@ -8,4 +8,14 @@ /** | ||
return require('../Path').extend({ | ||
var env = require('../../core/env'); | ||
var Path = require('../Path'); | ||
var shadowTemp = [ | ||
['shadowBlur', 0], | ||
['shadowColor', '#000'], | ||
['shadowOffsetX', 0], | ||
['shadowOffsetY', 0] | ||
]; | ||
return Path.extend({ | ||
type: 'sector', | ||
@@ -30,2 +40,45 @@ | ||
brush: (env.browser.ie && env.browser.version >= 11) // version: '11.0' | ||
// Fix weird bug in some version of IE11 (like 11.0.9600.17801), | ||
// where exception "unexpected call to method or property access" | ||
// might be thrown when calling ctx.fill after a path whose area size | ||
// is zero is drawn and ctx.clip() is called and shadowBlur is set. | ||
// (e.g., | ||
// ctx.moveTo(10, 10); | ||
// ctx.lineTo(20, 10); | ||
// ctx.closePath(); | ||
// ctx.clip(); | ||
// ctx.shadowBlur = 10; | ||
// ... | ||
// ctx.fill(); | ||
// ) | ||
? function () { | ||
var clipPaths = this.__clipPaths; | ||
var style = this.style; | ||
var modified; | ||
if (clipPaths) { | ||
for (var i = 0; i < clipPaths.length; i++) { | ||
var shape = clipPaths[i] && clipPaths[i].shape; | ||
if (shape && shape.startAngle === shape.endAngle) { | ||
for (var j = 0; j < shadowTemp.length; j++) { | ||
shadowTemp[j][2] = style[shadowTemp[j][0]]; | ||
style[shadowTemp[j][0]] = shadowTemp[j][1]; | ||
} | ||
modified = true; | ||
break; | ||
} | ||
} | ||
} | ||
Path.prototype.brush.apply(this, arguments); | ||
if (modified) { | ||
for (var j = 0; j < shadowTemp.length; j++) { | ||
style[shadowTemp[j][0]] = shadowTemp[j][2]; | ||
} | ||
} | ||
} | ||
: Path.prototype.brush, | ||
buildPath: function (ctx, shape) { | ||
@@ -32,0 +85,0 @@ |
@@ -138,2 +138,8 @@ /** | ||
/** | ||
* [x, y] | ||
* @type {Array.<number>} | ||
*/ | ||
textOffset: null, | ||
/** | ||
* @type {string} | ||
@@ -140,0 +146,0 @@ */ |
@@ -204,2 +204,4 @@ /** | ||
zlevelList.push(0); | ||
this._domRoot = root; | ||
} | ||
@@ -236,3 +238,3 @@ | ||
getViewportRoot: function () { | ||
return this._singleCanvas ? this._layers[0].dom : this._domRoot; | ||
return this._domRoot; | ||
}, | ||
@@ -239,0 +241,0 @@ |
@@ -121,7 +121,4 @@ /** | ||
var clipPath = el.clipPath; | ||
if (clipPath) { | ||
// clipPath 的变换是基于 group 的变换 | ||
clipPath.parent = el; | ||
clipPath.updateTransform(); | ||
var userSetClipPath = el.clipPath; | ||
if (userSetClipPath) { | ||
@@ -131,7 +128,20 @@ // FIXME 效率影响 | ||
clipPaths = clipPaths.slice(); | ||
clipPaths.push(clipPath); | ||
} | ||
else { | ||
clipPaths = [clipPath]; | ||
clipPaths = []; | ||
} | ||
var currentClipPath = userSetClipPath; | ||
var parentClipPath = el; | ||
// Recursively add clip path | ||
while (currentClipPath) { | ||
// clipPath 的变换是基于使用这个 clipPath 的元素 | ||
currentClipPath.parent = parentClipPath; | ||
currentClipPath.updateTransform(); | ||
clipPaths.push(currentClipPath); | ||
parentClipPath = currentClipPath; | ||
currentClipPath = currentClipPath.clipPath; | ||
} | ||
} | ||
@@ -138,0 +148,0 @@ |
@@ -359,3 +359,3 @@ // http://www.w3.org/TR/NOTE-VML | ||
var type = clockwise ? ' wa ' : ' at '; | ||
if (Math.abs(x0 - x1) < 1e-10) { | ||
if (Math.abs(x0 - x1) < 1e-4) { | ||
// IE won't render arches drawn counter clockwise if x0 == x1. | ||
@@ -371,3 +371,3 @@ if (Math.abs(endAngle - startAngle) > 1e-2) { | ||
// Avoid case draw full circle | ||
if (Math.abs(y0 - cy) < 1e-10) { | ||
if (Math.abs(y0 - cy) < 1e-4) { | ||
if ((clockwise && x0 < cx) || (!clockwise && x0 > cx)) { | ||
@@ -374,0 +374,0 @@ y1 -= 270 / Z; |
@@ -34,3 +34,3 @@ /*! | ||
*/ | ||
zrender.version = '3.2.2'; | ||
zrender.version = '3.3.0'; | ||
@@ -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
1002386
28800