From b9156fc7e4e3d43503938f430a5b511e1fc3c221 Mon Sep 17 00:00:00 2001 From: plainheart Date: Tue, 10 Dec 2024 17:58:12 +0800 Subject: [PATCH] release: v5.6.1 --- dist/zrender.js | 8 ++++---- dist/zrender.js.map | 2 +- dist/zrender.min.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/zrender.js b/dist/zrender.js index b5a09df5..a585eeaf 100644 --- a/dist/zrender.js +++ b/dist/zrender.js @@ -292,7 +292,7 @@ } function defaults(target, source, overlay) { var keysArr = keys(source); - for (var i = 0; i < keysArr.length; i++) { + for (var i = 0, len = keysArr.length; i < len; i++) { var key = keysArr[i]; if ((overlay ? source[key] != null : target[key] == null)) { target[key] = source[key]; @@ -368,7 +368,7 @@ } else { for (var key in arr) { - if (arr.hasOwnProperty(key)) { + if (arr.hasOwnProperty(key) && key !== protoKey) { cb.call(context, arr[key], key, arr); } } @@ -436,11 +436,11 @@ return []; } if (Object.keys) { - return Object.keys(obj); + return filter(Object.keys(obj), function (key) { return key !== protoKey; }); } var keyList = []; for (var key in obj) { - if (obj.hasOwnProperty(key)) { + if (obj.hasOwnProperty(key) && key !== protoKey) { keyList.push(key); } } diff --git a/dist/zrender.js.map b/dist/zrender.js.map index 465afa74..828e7540 100644 --- a/dist/zrender.js.map +++ b/dist/zrender.js.map @@ -1 +1 @@ -{"version":3,"file":"zrender.js","sources":["../src/core/env.ts","../src/core/platform.ts","../src/core/util.ts","../src/core/vector.ts","../src/mixin/Draggable.ts","../src/core/Eventful.ts","../src/core/fourPointsTransform.ts","../src/core/dom.ts","../src/core/event.ts","../src/core/GestureMgr.ts","../src/core/matrix.ts","../src/core/Point.ts","../src/core/BoundingRect.ts","../src/Handler.ts","../src/core/timsort.ts","../src/graphic/constants.ts","../src/Storage.ts","../src/animation/requestAnimationFrame.ts","../src/animation/easing.ts","../src/core/curve.ts","../src/animation/cubicEasing.ts","../src/animation/Clip.ts","../src/core/LRU.ts","../src/tool/color.ts","../src/svg/helper.ts","../src/animation/Animator.ts","../src/animation/Animation.ts","../src/dom/HandlerProxy.ts","../src/config.ts","../src/core/Transformable.ts","../src/contain/text.ts","../src/Element.ts","../src/graphic/Group.ts","../src/zrender.ts","../src/graphic/Displayable.ts","../src/core/bbox.ts","../src/core/PathProxy.ts","../src/contain/line.ts","../src/contain/cubic.ts","../src/contain/quadratic.ts","../src/contain/util.ts","../src/contain/arc.ts","../src/contain/windingLine.ts","../src/contain/path.ts","../src/graphic/Path.ts","../src/tool/transformPath.ts","../src/tool/path.ts","../src/graphic/Image.ts","../src/graphic/shape/Circle.ts","../src/graphic/helper/roundRect.ts","../src/graphic/helper/subPixelOptimize.ts","../src/graphic/shape/Rect.ts","../src/graphic/shape/Ellipse.ts","../src/graphic/shape/Line.ts","../src/graphic/helper/smoothBezier.ts","../src/graphic/helper/poly.ts","../src/graphic/shape/Polygon.ts","../src/graphic/shape/Polyline.ts","../src/graphic/Gradient.ts","../src/graphic/LinearGradient.ts","../src/graphic/RadialGradient.ts","../src/graphic/TSpan.ts","../src/tool/parseXML.ts","../src/tool/parseSVG.ts","../src/graphic/helper/roundSector.ts","../src/graphic/shape/Sector.ts","../src/tool/convertPath.ts","../src/tool/dividePath.ts","../src/tool/morphPath.ts","../src/graphic/CompoundPath.ts","../src/graphic/IncrementalDisplayable.ts","../src/graphic/helper/image.ts","../src/graphic/helper/parseText.ts","../src/graphic/Text.ts","../src/graphic/shape/Arc.ts","../src/graphic/shape/BezierCurve.ts","../src/graphic/shape/Droplet.ts","../src/graphic/shape/Heart.ts","../src/graphic/shape/Isogon.ts","../src/graphic/shape/Ring.ts","../src/graphic/shape/Rose.ts","../src/graphic/shape/Star.ts","../src/graphic/shape/Trochoid.ts","../src/graphic/Pattern.ts","../src/core/OrientedBoundingRect.ts","../src/debug/showDebugDirtyRect.ts","../src/canvas/helper.ts","../src/canvas/dashStyle.ts","../src/canvas/graphic.ts","../src/canvas/Layer.ts","../src/canvas/Painter.ts","../src/svg/SVGPathRebuilder.ts","../src/svg/mapStyleToAttrs.ts","../src/svg/core.ts","../src/svg/cssClassId.ts","../src/svg/cssAnimation.ts","../src/svg/cssEmphasis.ts","../src/svg/graphic.ts","../src/svg/domapi.ts","../src/svg/patch.ts","../src/svg/Painter.ts","../src/all.ts"],"sourcesContent":["declare const wx: {\n getSystemInfoSync: Function\n};\n\nclass Browser {\n firefox = false\n ie = false\n edge = false\n newEdge = false\n weChat = false\n version: string | number\n}\n\nclass Env {\n browser = new Browser()\n node = false\n wxa = false\n worker = false\n\n svgSupported = false\n touchEventsSupported = false\n pointerEventsSupported = false\n domSupported = false\n transformSupported = false\n transform3dSupported = false\n\n hasGlobalWindow = typeof window !== 'undefined'\n}\n\nconst env = new Env();\n\nif (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {\n env.wxa = true;\n env.touchEventsSupported = true;\n}\nelse if (typeof document === 'undefined' && typeof self !== 'undefined') {\n // In worker\n env.worker = true;\n}\nelse if (!env.hasGlobalWindow || 'Deno' in window) {\n // In node\n env.node = true;\n env.svgSupported = true;\n}\nelse {\n detect(navigator.userAgent, env);\n}\n\n// Zepto.js\n// (c) 2010-2013 Thomas Fuchs\n// Zepto.js may be freely distributed under the MIT license.\n\nfunction detect(ua: string, env: Env) {\n const browser = env.browser;\n const firefox = ua.match(/Firefox\\/([\\d.]+)/);\n const ie = ua.match(/MSIE\\s([\\d.]+)/)\n // IE 11 Trident/7.0; rv:11.0\n || ua.match(/Trident\\/.+?rv:(([\\d.]+))/);\n const edge = ua.match(/Edge?\\/([\\d.]+)/); // IE 12 and 12+\n\n const weChat = (/micromessenger/i).test(ua);\n\n if (firefox) {\n browser.firefox = true;\n browser.version = firefox[1];\n }\n if (ie) {\n browser.ie = true;\n browser.version = ie[1];\n }\n\n if (edge) {\n browser.edge = true;\n browser.version = edge[1];\n browser.newEdge = +edge[1].split('.')[0] > 18;\n }\n\n // It is difficult to detect WeChat in Win Phone precisely, because ua can\n // not be set on win phone. So we do not consider Win Phone.\n if (weChat) {\n browser.weChat = true;\n }\n\n env.svgSupported = typeof SVGRect !== 'undefined';\n env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;\n env.pointerEventsSupported = 'onpointerdown' in window\n && (browser.edge || (browser.ie && +browser.version >= 11));\n env.domSupported = typeof document !== 'undefined';\n\n const style = document.documentElement.style;\n\n env.transform3dSupported = (\n // IE9 only supports transform 2D\n // transform 3D supported since IE10\n // we detect it by whether 'transition' is in style\n (browser.ie && 'transition' in style)\n // edge\n || browser.edge\n // webkit\n || (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))\n // gecko-based browsers\n || 'MozPerspective' in style\n ) // Opera supports CSS transforms after version 12\n && !('OTransition' in style);\n\n // except IE 6-8 and very old firefox 2-3 & opera 10.1\n // other browsers all support `transform`\n env.transformSupported = env.transform3dSupported\n // transform 2D is supported in IE9\n || (browser.ie && +browser.version >= 9);\n\n}\n\n\nexport default env;\n","export const DEFAULT_FONT_SIZE = 12;\nexport const DEFAULT_FONT_FAMILY = 'sans-serif';\nexport const DEFAULT_FONT = `${DEFAULT_FONT_SIZE}px ${DEFAULT_FONT_FAMILY}`;\n\ninterface Platform {\n // TODO CanvasLike?\n createCanvas(): HTMLCanvasElement\n measureText(text: string, font?: string): { width: number }\n loadImage(\n src: string,\n onload: () => void | HTMLImageElement['onload'],\n onerror: () => void | HTMLImageElement['onerror']\n ): HTMLImageElement\n}\n\n// Text width map used for environment there is no canvas\n// Only common ascii is used for size concern.\n\n// Generated from following code\n//\n// ctx.font = '12px sans-serif';\n// const asciiRange = [32, 126];\n// let mapStr = '';\n// for (let i = asciiRange[0]; i <= asciiRange[1]; i++) {\n// const char = String.fromCharCode(i);\n// const width = ctx.measureText(char).width;\n// const ratio = Math.round(width / 12 * 100);\n// mapStr += String.fromCharCode(ratio + 20))\n// }\n// mapStr.replace(/\\\\/g, '\\\\\\\\');\nconst OFFSET = 20;\nconst SCALE = 100;\n// TODO other basic fonts?\n// eslint-disable-next-line\nconst defaultWidthMapStr = `007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\\\\\WQb\\\\0FWLg\\\\bWb\\\\WQ\\\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\\\FFF5.5N`;\n\nfunction getTextWidthMap(mapStr: string): Record {\n const map: Record = {};\n if (typeof JSON === 'undefined') {\n return map;\n }\n for (let i = 0; i < mapStr.length; i++) {\n const char = String.fromCharCode(i + 32);\n const size = (mapStr.charCodeAt(i) - OFFSET) / SCALE;\n map[char] = size;\n }\n return map;\n}\n\nexport const DEFAULT_TEXT_WIDTH_MAP = getTextWidthMap(defaultWidthMapStr);\n\nexport const platformApi: Platform = {\n // Export methods\n createCanvas() {\n return typeof document !== 'undefined'\n && document.createElement('canvas');\n },\n\n measureText: (function () {\n\n let _ctx: CanvasRenderingContext2D;\n let _cachedFont: string;\n return (text: string, font?: string) => {\n if (!_ctx) {\n const canvas = platformApi.createCanvas();\n _ctx = canvas && canvas.getContext('2d');\n }\n if (_ctx) {\n if (_cachedFont !== font) {\n _cachedFont = _ctx.font = font || DEFAULT_FONT;\n }\n return _ctx.measureText(text);\n }\n else {\n text = text || '';\n font = font || DEFAULT_FONT;\n // Use font size if there is no other method can be used.\n const res = /((?:\\d+)?\\.?\\d*)px/.exec(font);\n const fontSize = res && +res[1] || DEFAULT_FONT_SIZE;\n let width = 0;\n if (font.indexOf('mono') >= 0) { // is monospace\n width = fontSize * text.length;\n }\n else {\n for (let i = 0; i < text.length; i++) {\n const preCalcWidth = DEFAULT_TEXT_WIDTH_MAP[text[i]];\n width += preCalcWidth == null ? fontSize : (preCalcWidth * fontSize);\n }\n }\n return { width };\n }\n };\n })(),\n\n loadImage(src, onload, onerror) {\n const image = new Image();\n image.onload = onload;\n image.onerror = onerror;\n image.src = src;\n return image;\n }\n};\n\nexport function setPlatformAPI(newPlatformApis: Partial) {\n for (let key in platformApi) {\n // Don't assign unknown methods.\n if ((newPlatformApis as any)[key]) {\n (platformApi as any)[key] = (newPlatformApis as any)[key];\n }\n }\n}\n","/* global: defineProperty */\nimport { Dictionary, ArrayLike, KeyOfDistributive } from './types';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport { platformApi } from './platform';\n\n// 用于处理merge时无法遍历Date等对象的问题\nconst BUILTIN_OBJECT: Record = reduce([\n 'Function',\n 'RegExp',\n 'Date',\n 'Error',\n 'CanvasGradient',\n 'CanvasPattern',\n // For node-canvas\n 'Image',\n 'Canvas'\n], (obj, val) => {\n obj['[object ' + val + ']'] = true;\n return obj;\n}, {} as Record);\n\nconst TYPED_ARRAY: Record = reduce([\n 'Int8',\n 'Uint8',\n 'Uint8Clamped',\n 'Int16',\n 'Uint16',\n 'Int32',\n 'Uint32',\n 'Float32',\n 'Float64'\n], (obj, val) => {\n obj['[object ' + val + 'Array]'] = true;\n return obj;\n}, {} as Record);\n\nconst objToString = Object.prototype.toString;\n\nconst arrayProto = Array.prototype;\nconst nativeForEach = arrayProto.forEach;\nconst nativeFilter = arrayProto.filter;\nconst nativeSlice = arrayProto.slice;\nconst nativeMap = arrayProto.map;\n// In case some env may redefine the global variable `Function`.\nconst ctorFunction = function () {}.constructor;\nconst protoFunction = ctorFunction ? ctorFunction.prototype : null;\nconst protoKey = '__proto__';\n\n\nlet idStart = 0x0907;\n\n/**\n * Generate unique id\n */\nexport function guid(): number {\n return idStart++;\n}\n\nexport function logError(...args: any[]) {\n if (typeof console !== 'undefined') {\n console.error.apply(console, args);\n }\n}\n/**\n * Those data types can be cloned:\n * Plain object, Array, TypedArray, number, string, null, undefined.\n * Those data types will be assigned using the original data:\n * BUILTIN_OBJECT\n * Instance of user defined class will be cloned to a plain object, without\n * properties in prototype.\n * Other data types is not supported (not sure what will happen).\n *\n * Caution: do not support clone Date, for performance consideration.\n * (There might be a large number of date in `series.data`).\n * So date should not be modified in and out of echarts.\n */\nexport function clone(source: T): T {\n if (source == null || typeof source !== 'object') {\n return source;\n }\n\n let result = source as any;\n const typeStr = objToString.call(source);\n\n if (typeStr === '[object Array]') {\n if (!isPrimitive(source)) {\n result = [] as any;\n for (let i = 0, len = (source as any[]).length; i < len; i++) {\n result[i] = clone((source as any[])[i]);\n }\n }\n }\n else if (TYPED_ARRAY[typeStr]) {\n if (!isPrimitive(source)) {\n /* eslint-disable-next-line */\n const Ctor = source.constructor as typeof Float32Array;\n if (Ctor.from) {\n result = Ctor.from(source as Float32Array);\n }\n else {\n result = new Ctor((source as Float32Array).length);\n for (let i = 0, len = (source as Float32Array).length; i < len; i++) {\n result[i] = (source as Float32Array)[i];\n }\n }\n }\n }\n else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {\n result = {} as any;\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n result[key] = clone(source[key]);\n }\n }\n }\n\n return result;\n}\n\nexport function merge<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S, overwrite?: boolean): T & S;\nexport function merge<\n T extends any,\n S extends any\n>(target: T, source: S, overwrite?: boolean): T | S;\nexport function merge(target: any, source: any, overwrite?: boolean): any {\n // We should escapse that source is string\n // and enter for ... in ...\n if (!isObject(source) || !isObject(target)) {\n return overwrite ? clone(source) : target;\n }\n\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n const targetProp = target[key];\n const sourceProp = source[key];\n\n if (isObject(sourceProp)\n && isObject(targetProp)\n && !isArray(sourceProp)\n && !isArray(targetProp)\n && !isDom(sourceProp)\n && !isDom(targetProp)\n && !isBuiltInObject(sourceProp)\n && !isBuiltInObject(targetProp)\n && !isPrimitive(sourceProp)\n && !isPrimitive(targetProp)\n ) {\n // 如果需要递归覆盖,就递归调用merge\n merge(targetProp, sourceProp, overwrite);\n }\n else if (overwrite || !(key in target)) {\n // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况\n // NOTE,在 target[key] 不存在的时候也是直接覆盖\n target[key] = clone(source[key]);\n }\n }\n }\n\n return target;\n}\n\n/**\n * @param targetAndSources The first item is target, and the rests are source.\n * @param overwrite\n * @return Merged result\n */\nexport function mergeAll(targetAndSources: any[], overwrite?: boolean): any {\n let result = targetAndSources[0];\n for (let i = 1, len = targetAndSources.length; i < len; i++) {\n result = merge(result, targetAndSources[i], overwrite);\n }\n return result;\n}\n\nexport function extend<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S): T & S {\n // @ts-ignore\n if (Object.assign) {\n // @ts-ignore\n Object.assign(target, source);\n }\n else {\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n (target as S & T)[key] = (source as T & S)[key];\n }\n }\n }\n return target as T & S;\n}\n\nexport function defaults<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S, overlay?: boolean): T & S {\n const keysArr = keys(source);\n for (let i = 0; i < keysArr.length; i++) {\n let key = keysArr[i];\n if ((overlay ? source[key] != null : (target as T & S)[key] == null)) {\n (target as S & T)[key] = (source as T & S)[key];\n }\n }\n return target as T & S;\n}\n\n// Expose createCanvas in util for compatibility\nexport const createCanvas = platformApi.createCanvas;\n\n/**\n * 查询数组中元素的index\n */\nexport function indexOf(array: T[] | readonly T[] | ArrayLike, value: T): number {\n if (array) {\n if ((array as T[]).indexOf) {\n return (array as T[]).indexOf(value);\n }\n for (let i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * 构造类继承关系\n *\n * @param clazz 源类\n * @param baseClazz 基类\n */\nexport function inherits(clazz: Function, baseClazz: Function) {\n const clazzPrototype = clazz.prototype;\n function F() {}\n F.prototype = baseClazz.prototype;\n clazz.prototype = new (F as any)();\n\n for (let prop in clazzPrototype) {\n if (clazzPrototype.hasOwnProperty(prop)) {\n clazz.prototype[prop] = clazzPrototype[prop];\n }\n }\n clazz.prototype.constructor = clazz;\n (clazz as any).superClass = baseClazz;\n}\n\nexport function mixin(target: T | Function, source: S | Function, override?: boolean) {\n target = 'prototype' in target ? target.prototype : target;\n source = 'prototype' in source ? source.prototype : source;\n // If build target is ES6 class. prototype methods is not enumerable. Use getOwnPropertyNames instead\n // TODO: Determine if source is ES6 class?\n if (Object.getOwnPropertyNames) {\n const keyList = Object.getOwnPropertyNames(source);\n for (let i = 0; i < keyList.length; i++) {\n const key = keyList[i];\n if (key !== 'constructor') {\n if ((override ? (source as any)[key] != null : (target as any)[key] == null)) {\n (target as any)[key] = (source as any)[key];\n }\n }\n }\n }\n else {\n defaults(target, source, override);\n }\n}\n\n/**\n * Consider typed array.\n * @param data\n */\nexport function isArrayLike(data: any): data is ArrayLike {\n if (!data) {\n return false;\n }\n if (typeof data === 'string') {\n return false;\n }\n return typeof data.length === 'number';\n}\n\n/**\n * 数组或对象遍历\n */\nexport function each | any[] | readonly any[] | ArrayLike, Context>(\n arr: I,\n cb: (\n this: Context,\n // Use unknown to avoid to infer to \"any\", which may disable typo check.\n value: I extends (infer T)[] | readonly (infer T)[] | ArrayLike ? T\n // Use Dictionary may cause infer fail when I is an interface.\n // So here use a Record to infer type.\n : I extends Dictionary ? I extends Record ? T : unknown : unknown,\n index?: I extends any[] | readonly any[] | ArrayLike ? number : keyof I & string, // keyof Dictionary will return number | string\n arr?: I\n ) => void,\n context?: Context\n) {\n if (!(arr && cb)) {\n return;\n }\n if ((arr as any).forEach && (arr as any).forEach === nativeForEach) {\n (arr as any).forEach(cb, context);\n }\n else if (arr.length === +arr.length) {\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided item be travelled? like `[33,,55]`.\n cb.call(context, (arr as any[])[i], i as any, arr);\n }\n }\n else {\n for (let key in arr) {\n if (arr.hasOwnProperty(key)) {\n cb.call(context, (arr as Dictionary)[key], key as any, arr);\n }\n }\n }\n}\n\n/**\n * Array mapping.\n * @typeparam T Type in Array\n * @typeparam R Type Returned\n * @return Must be an array.\n */\nexport function map(\n arr: readonly T[],\n cb: (this: Context, val: T, index?: number, arr?: readonly T[]) => R,\n context?: Context\n): R[] {\n // Take the same behavior with lodash when !arr and !cb,\n // which might be some common sense.\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr) as unknown[] as R[];\n }\n if (arr.map && arr.map === nativeMap) {\n return arr.map(cb, context);\n }\n else {\n const result = [];\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided item be travelled, like `[33,,55]`.\n result.push(cb.call(context, arr[i], i, arr));\n }\n return result;\n }\n}\n\nexport function reduce(\n arr: readonly T[],\n cb: (this: Context, previousValue: S, currentValue: T, currentIndex?: number, arr?: readonly T[]) => S,\n memo?: S,\n context?: Context\n): S {\n if (!(arr && cb)) {\n return;\n }\n for (let i = 0, len = arr.length; i < len; i++) {\n memo = cb.call(context, memo, arr[i], i, arr);\n }\n return memo;\n}\n\n/**\n * Array filtering.\n * @return Must be an array.\n */\nexport function filter(\n arr: readonly T[],\n cb: (this: Context, value: T, index: number, arr: readonly T[]) => boolean,\n context?: Context\n): T[] {\n // Take the same behavior with lodash when !arr and !cb,\n // which might be some common sense.\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.filter && arr.filter === nativeFilter) {\n return arr.filter(cb, context);\n }\n else {\n const result = [];\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided items be travelled? like `[33,,55]`.\n if (cb.call(context, arr[i], i, arr)) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n}\n\n/**\n * 数组项查找\n */\nexport function find(\n arr: readonly T[],\n cb: (this: Context, value: T, index?: number, arr?: readonly T[]) => boolean,\n context?: Context\n): T {\n if (!(arr && cb)) {\n return;\n }\n for (let i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n return arr[i];\n }\n }\n}\n\n/**\n * Get all object keys\n *\n * Will return an empty array if obj is null/undefined\n */\nexport function keys(obj: T): (KeyOfDistributive & string)[] {\n if (!obj) {\n return [];\n }\n // Return type should be `keyof T` but exclude `number`, becuase\n // `Object.keys` only return string rather than `number | string`.\n type TKeys = KeyOfDistributive & string;\n if (Object.keys) {\n return Object.keys(obj) as TKeys[];\n }\n let keyList: TKeys[] = [];\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n keyList.push(key as any);\n }\n }\n return keyList;\n}\n\n// Remove this type in returned function. Or it will conflicts wicth callback with given context. Like Eventful.\n// According to lib.es5.d.ts\n/* eslint-disable max-len*/\nexport type Bind1 = F extends (this: Ctx, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind2 = F extends (this: Ctx, a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind3 = F extends (this: Ctx, a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind4 = F extends (this: Ctx, a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind5 = F extends (this: Ctx, a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown;\ntype BindFunc = (this: Ctx, ...arg: any[]) => any\n\ninterface FunctionBind {\n , Ctx>(func: F, ctx: Ctx): Bind1\n , Ctx, T1 extends Parameters[0]>(func: F, ctx: Ctx, a: T1): Bind2\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1]>(func: F, ctx: Ctx, a: T1, b: T2): Bind3\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3): Bind4\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3, d: T4): Bind5\n}\nfunction bindPolyfill any>(\n func: Fn, context: Ctx, ...args: any[]\n): (...args: Parameters) => ReturnType {\n return function (this: Ctx) {\n return func.apply(context, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport const bind: FunctionBind = (protoFunction && isFunction(protoFunction.bind))\n ? protoFunction.call.bind(protoFunction.bind)\n : bindPolyfill;\n\nexport type Curry1 = F extends (a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry2 = F extends (a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry3 = F extends (a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry4 = F extends (a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown;\ntype CurryFunc = (...arg: any[]) => any\n\nfunction curry[0]>(func: F, a: T1): Curry1\nfunction curry[0], T2 extends Parameters[1]>(func: F, a: T1, b: T2): Curry2\nfunction curry[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, a: T1, b: T2, c: T3): Curry3\nfunction curry[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, a: T1, b: T2, c: T3, d: T4): Curry4\nfunction curry(func: Function, ...args: any[]): Function {\n return function (this: any) {\n return func.apply(this, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport {curry};\n/* eslint-enable max-len*/\n\nexport function isArray(value: any): value is any[] {\n if (Array.isArray) {\n return Array.isArray(value);\n }\n return objToString.call(value) === '[object Array]';\n}\n\nexport function isFunction(value: any): value is Function {\n return typeof value === 'function';\n}\n\nexport function isString(value: any): value is string {\n // Faster than `objToString.call` several times in chromium and webkit.\n // And `new String()` is rarely used.\n return typeof value === 'string';\n}\n\nexport function isStringSafe(value: any): value is string {\n return objToString.call(value) === '[object String]';\n}\n\nexport function isNumber(value: any): value is number {\n // Faster than `objToString.call` several times in chromium and webkit.\n // And `new Number()` is rarely used.\n return typeof value === 'number';\n}\n\n// Usage: `isObject(xxx)` or `isObject(SomeType)(xxx)`\n// Generic T can be used to avoid \"ts type gruards\" casting the `value` from its original\n// type `Object` implicitly so that loose its original type info in the subsequent code.\nexport function isObject(value: T): value is (object & T) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n const type = typeof value;\n return type === 'function' || (!!value && type === 'object');\n}\n\nexport function isBuiltInObject(value: any): boolean {\n return !!BUILTIN_OBJECT[objToString.call(value)];\n}\n\nexport function isTypedArray(value: any): boolean {\n return !!TYPED_ARRAY[objToString.call(value)];\n}\n\nexport function isDom(value: any): value is HTMLElement {\n return typeof value === 'object'\n && typeof value.nodeType === 'number'\n && typeof value.ownerDocument === 'object';\n}\n\nexport function isGradientObject(value: any): value is GradientObject {\n return (value as GradientObject).colorStops != null;\n}\n\nexport function isImagePatternObject(value: any): value is ImagePatternObject {\n return (value as ImagePatternObject).image != null;\n}\n\nexport function isRegExp(value: unknown): value is RegExp {\n return objToString.call(value) === '[object RegExp]';\n}\n\n/**\n * Whether is exactly NaN. Notice isNaN('a') returns true.\n */\nexport function eqNaN(value: any): boolean {\n /* eslint-disable-next-line no-self-compare */\n return value !== value;\n}\n\n/**\n * If value1 is not null, then return value1, otherwise judget rest of values.\n * Low performance.\n * @return Final value\n */\nexport function retrieve(...args: T[]): T {\n for (let i = 0, len = args.length; i < len; i++) {\n if (args[i] != null) {\n return args[i];\n }\n }\n}\n\nexport function retrieve2(value0: T, value1: R): T | R {\n return value0 != null\n ? value0\n : value1;\n}\n\nexport function retrieve3(value0: T, value1: R, value2: W): T | R | W {\n return value0 != null\n ? value0\n : value1 != null\n ? value1\n : value2;\n}\n\ntype SliceParams = Parameters;\nexport function slice(arr: ArrayLike, ...args: SliceParams): T[] {\n return nativeSlice.apply(arr, args as any[]);\n}\n\n/**\n * Normalize css liked array configuration\n * e.g.\n * 3 => [3, 3, 3, 3]\n * [4, 2] => [4, 2, 4, 2]\n * [4, 3, 2] => [4, 3, 2, 3]\n */\nexport function normalizeCssArray(val: number | number[]) {\n if (typeof (val) === 'number') {\n return [val, val, val, val];\n }\n const len = val.length;\n if (len === 2) {\n // vertical | horizontal\n return [val[0], val[1], val[0], val[1]];\n }\n else if (len === 3) {\n // top | horizontal | bottom\n return [val[0], val[1], val[2], val[1]];\n }\n return val;\n}\n\nexport function assert(condition: any, message?: string) {\n if (!condition) {\n throw new Error(message);\n }\n}\n\n/**\n * @param str string to be trimmed\n * @return trimmed string\n */\nexport function trim(str: string): string {\n if (str == null) {\n return null;\n }\n else if (typeof str.trim === 'function') {\n return str.trim();\n }\n else {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n }\n}\n\nconst primitiveKey = '__ec_primitive__';\n/**\n * Set an object as primitive to be ignored traversing children in clone or merge\n */\nexport function setAsPrimitive(obj: any) {\n obj[primitiveKey] = true;\n}\n\nexport function isPrimitive(obj: any): boolean {\n return obj[primitiveKey];\n}\n\ninterface MapInterface {\n delete(key: KEY): boolean;\n has(key: KEY): boolean;\n get(key: KEY): T | undefined;\n set(key: KEY, value: T): this;\n keys(): KEY[];\n forEach(callback: (value: T, key: KEY) => void): void;\n}\n\nclass MapPolyfill implements MapInterface {\n private data: Record = {} as Record;\n\n delete(key: KEY): boolean {\n const existed = this.has(key);\n if (existed) {\n delete this.data[key];\n }\n return existed;\n }\n has(key: KEY): boolean {\n return this.data.hasOwnProperty(key);\n }\n get(key: KEY): T | undefined {\n return this.data[key];\n }\n set(key: KEY, value: T): this {\n this.data[key] = value;\n return this;\n }\n keys(): KEY[] {\n return keys(this.data);\n }\n forEach(callback: (value: T, key: KEY) => void): void {\n // This is a potential performance bottleneck, see details in\n // https://github.com/ecomfe/zrender/issues/965, however it is now\n // less likely to occur as we default to native maps when possible.\n const data = this.data;\n for (const key in data) {\n if (data.hasOwnProperty(key)) {\n callback(data[key], key);\n }\n }\n }\n}\n\n// We want to use native Map if it is available, but we do not want to polyfill the global scope\n// in case users ship their own polyfills or patch the native map object in any way.\nconst isNativeMapSupported = typeof Map === 'function';\nfunction maybeNativeMap(): MapInterface {\n // Map may be a native class if we are running in an ES6 compatible environment.\n // eslint-disable-next-line\n return (isNativeMapSupported ? new Map() : new MapPolyfill()) as MapInterface;\n}\n\n/**\n * @constructor\n * @param {Object} obj\n */\nexport class HashMap {\n data: MapInterface\n\n constructor(obj?: HashMap | { [key in KEY]?: T } | KEY[]) {\n const isArr = isArray(obj);\n // Key should not be set on this, otherwise\n // methods get/set/... may be overridden.\n this.data = maybeNativeMap();\n const thisMap = this;\n\n (obj instanceof HashMap)\n ? obj.each(visit)\n : (obj && each(obj, visit));\n\n function visit(value: any, key: any) {\n isArr ? thisMap.set(value, key) : thisMap.set(key, value);\n }\n }\n\n // `hasKey` instead of `has` for potential misleading.\n hasKey(key: KEY): boolean {\n return this.data.has(key);\n }\n get(key: KEY): T {\n return this.data.get(key);\n }\n set(key: KEY, value: T): T {\n // Comparing with invocation chaining, `return value` is more commonly\n // used in this case: `const someVal = map.set('a', genVal());`\n this.data.set(key, value);\n return value;\n }\n // Although util.each can be performed on this hashMap directly, user\n // should not use the exposed keys, who are prefixed.\n each(\n cb: (this: Context, value?: T, key?: KEY) => void,\n context?: Context\n ) {\n this.data.forEach((value, key) => {\n cb.call(context, value, key);\n });\n }\n keys(): KEY[] {\n const keys = this.data.keys();\n return isNativeMapSupported\n // Native map returns an iterator so we need to convert it to an array\n ? Array.from(keys)\n : keys;\n }\n // Do not use this method if performance sensitive.\n removeKey(key: KEY): void {\n this.data.delete(key);\n }\n}\n\nexport function createHashMap(\n obj?: HashMap | { [key in KEY]?: T } | KEY[]\n) {\n return new HashMap(obj);\n}\n\nexport function concatArray(a: ArrayLike, b: ArrayLike): ArrayLike {\n const newArray = new (a as any).constructor(a.length + b.length);\n for (let i = 0; i < a.length; i++) {\n newArray[i] = a[i];\n }\n const offset = a.length;\n for (let i = 0; i < b.length; i++) {\n newArray[i + offset] = b[i];\n }\n return newArray;\n}\n\nexport function createObject(proto?: object, properties?: T): T {\n // Performance of Object.create\n // https://jsperf.com/style-strategy-proto-or-others\n let obj: T;\n if (Object.create) {\n obj = Object.create(proto);\n }\n else {\n const StyleCtor = function () {};\n StyleCtor.prototype = proto;\n obj = new (StyleCtor as any)();\n }\n if (properties) {\n extend(obj, properties);\n }\n\n return obj;\n}\n\n\nexport function disableUserSelect(dom: HTMLElement) {\n const domStyle = dom.style;\n domStyle.webkitUserSelect = 'none';\n domStyle.userSelect = 'none';\n // @ts-ignore\n domStyle.webkitTapHighlightColor = 'rgba(0,0,0,0)';\n (domStyle as any)['-webkit-touch-callout'] = 'none';\n}\n\nexport function hasOwn(own: object, prop: string): boolean {\n return own.hasOwnProperty(prop);\n}\n\nexport function noop() {}\n\nexport const RADIAN_TO_DEGREE = 180 / Math.PI;","/**\r\n * @deprecated\r\n * Use zrender.Point class instead\r\n */\r\nimport { MatrixArray } from './matrix';\r\n\r\n/* global Float32Array */\r\n\r\n// const ArrayCtor = typeof Float32Array === 'undefined'\r\n// ? Array\r\n// : Float32Array;\r\n\r\nexport type VectorArray = number[]\r\n/**\r\n * 创建一个向量\r\n */\r\nexport function create(x?: number, y?: number): VectorArray {\r\n if (x == null) {\r\n x = 0;\r\n }\r\n if (y == null) {\r\n y = 0;\r\n }\r\n return [x, y];\r\n}\r\n\r\n/**\r\n * 复制向量数据\r\n */\r\nexport function copy(out: T, v: VectorArray): T {\r\n out[0] = v[0];\r\n out[1] = v[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 克隆一个向量\r\n */\r\nexport function clone(v: VectorArray): VectorArray {\r\n return [v[0], v[1]];\r\n}\r\n\r\n/**\r\n * 设置向量的两个项\r\n */\r\nexport function set(out: T, a: number, b: number): T {\r\n out[0] = a;\r\n out[1] = b;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量相加\r\n */\r\nexport function add(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] + v2[0];\r\n out[1] = v1[1] + v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量缩放后相加\r\n */\r\nexport function scaleAndAdd(out: T, v1: VectorArray, v2: VectorArray, a: number): T {\r\n out[0] = v1[0] + v2[0] * a;\r\n out[1] = v1[1] + v2[1] * a;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量相减\r\n */\r\nexport function sub(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] - v2[0];\r\n out[1] = v1[1] - v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量长度\r\n */\r\nexport function len(v: VectorArray): number {\r\n return Math.sqrt(lenSquare(v));\r\n}\r\nexport const length = len;\r\n\r\n/**\r\n * 向量长度平方\r\n */\r\nexport function lenSquare(v: VectorArray): number {\r\n return v[0] * v[0] + v[1] * v[1];\r\n}\r\nexport const lengthSquare = lenSquare;\r\n\r\n/**\r\n * 向量乘法\r\n */\r\nexport function mul(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] * v2[0];\r\n out[1] = v1[1] * v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量除法\r\n */\r\nexport function div(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] / v2[0];\r\n out[1] = v1[1] / v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量点乘\r\n */\r\nexport function dot(v1: VectorArray, v2: VectorArray) {\r\n return v1[0] * v2[0] + v1[1] * v2[1];\r\n}\r\n\r\n/**\r\n * 向量缩放\r\n */\r\nexport function scale(out: T, v: VectorArray, s: number): T {\r\n out[0] = v[0] * s;\r\n out[1] = v[1] * s;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量归一化\r\n */\r\nexport function normalize(out: T, v: VectorArray): T {\r\n const d = len(v);\r\n if (d === 0) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n }\r\n else {\r\n out[0] = v[0] / d;\r\n out[1] = v[1] / d;\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * 计算向量间距离\r\n */\r\nexport function distance(v1: VectorArray, v2: VectorArray): number {\r\n return Math.sqrt(\r\n (v1[0] - v2[0]) * (v1[0] - v2[0])\r\n + (v1[1] - v2[1]) * (v1[1] - v2[1])\r\n );\r\n}\r\nexport const dist = distance;\r\n\r\n/**\r\n * 向量距离平方\r\n */\r\nexport function distanceSquare(v1: VectorArray, v2: VectorArray): number {\r\n return (v1[0] - v2[0]) * (v1[0] - v2[0])\r\n + (v1[1] - v2[1]) * (v1[1] - v2[1]);\r\n}\r\nexport const distSquare = distanceSquare;\r\n\r\n/**\r\n * 求负向量\r\n */\r\nexport function negate(out: T, v: VectorArray): T {\r\n out[0] = -v[0];\r\n out[1] = -v[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 插值两个点\r\n */\r\nexport function lerp(out: T, v1: VectorArray, v2: VectorArray, t: number): T {\r\n out[0] = v1[0] + t * (v2[0] - v1[0]);\r\n out[1] = v1[1] + t * (v2[1] - v1[1]);\r\n return out;\r\n}\r\n\r\n/**\r\n * 矩阵左乘向量\r\n */\r\nexport function applyTransform(out: T, v: VectorArray, m: MatrixArray): T {\r\n const x = v[0];\r\n const y = v[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n}\r\n\r\n/**\r\n * 求两个向量最小值\r\n */\r\nexport function min(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = Math.min(v1[0], v2[0]);\r\n out[1] = Math.min(v1[1], v2[1]);\r\n return out;\r\n}\r\n\r\n/**\r\n * 求两个向量最大值\r\n */\r\nexport function max(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = Math.max(v1[0], v2[0]);\r\n out[1] = Math.max(v1[1], v2[1]);\r\n return out;\r\n}\r\n","import Handler from '../Handler';\r\nimport Element, { ElementEvent } from '../Element';\r\nimport Displayable from '../graphic/Displayable';\r\n\r\nclass Param {\r\n\r\n target: Element\r\n topTarget: Element\r\n\r\n constructor(target: Element, e?: ElementEvent) {\r\n this.target = target;\r\n this.topTarget = e && e.topTarget;\r\n }\r\n}\r\n\r\n// FIXME Draggable on element which has parent rotation or scale\r\nexport default class Draggable {\r\n\r\n handler: Handler\r\n\r\n _draggingTarget: Element\r\n _dropTarget: Element\r\n\r\n _x: number\r\n _y: number\r\n\r\n constructor(handler: Handler) {\r\n this.handler = handler;\r\n\r\n handler.on('mousedown', this._dragStart, this);\r\n handler.on('mousemove', this._drag, this);\r\n handler.on('mouseup', this._dragEnd, this);\r\n // `mosuemove` and `mouseup` can be continue to fire when dragging.\r\n // See [DRAG_OUTSIDE] in `Handler.js`. So we do not need to trigger\r\n // `_dragEnd` when globalout. That would brings better user experience.\r\n // this.on('globalout', this._dragEnd, this);\r\n\r\n // this._dropTarget = null;\r\n // this._draggingTarget = null;\r\n\r\n // this._x = 0;\r\n // this._y = 0;\r\n }\r\n\r\n _dragStart(e: ElementEvent) {\r\n let draggingTarget = e.target;\r\n // Find if there is draggable in the ancestor\r\n while (draggingTarget && !draggingTarget.draggable) {\r\n draggingTarget = draggingTarget.parent || draggingTarget.__hostTarget;\r\n }\r\n if (draggingTarget) {\r\n this._draggingTarget = draggingTarget;\r\n draggingTarget.dragging = true;\r\n this._x = e.offsetX;\r\n this._y = e.offsetY;\r\n\r\n this.handler.dispatchToElement(\r\n new Param(draggingTarget, e), 'dragstart', e.event\r\n );\r\n }\r\n }\r\n\r\n _drag(e: ElementEvent) {\r\n const draggingTarget = this._draggingTarget;\r\n if (draggingTarget) {\r\n\r\n const x = e.offsetX;\r\n const y = e.offsetY;\r\n\r\n const dx = x - this._x;\r\n const dy = y - this._y;\r\n this._x = x;\r\n this._y = y;\r\n\r\n draggingTarget.drift(dx, dy, e);\r\n this.handler.dispatchToElement(\r\n new Param(draggingTarget, e), 'drag', e.event\r\n );\r\n\r\n const dropTarget = this.handler.findHover(\r\n x, y, draggingTarget as Displayable // PENDING\r\n ).target;\r\n const lastDropTarget = this._dropTarget;\r\n this._dropTarget = dropTarget;\r\n\r\n if (draggingTarget !== dropTarget) {\r\n if (lastDropTarget && dropTarget !== lastDropTarget) {\r\n this.handler.dispatchToElement(\r\n new Param(lastDropTarget, e), 'dragleave', e.event\r\n );\r\n }\r\n if (dropTarget && dropTarget !== lastDropTarget) {\r\n this.handler.dispatchToElement(\r\n new Param(dropTarget, e), 'dragenter', e.event\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n _dragEnd(e: ElementEvent) {\r\n const draggingTarget = this._draggingTarget;\r\n\r\n if (draggingTarget) {\r\n draggingTarget.dragging = false;\r\n }\r\n\r\n this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragend', e.event);\r\n\r\n if (this._dropTarget) {\r\n this.handler.dispatchToElement(new Param(this._dropTarget, e), 'drop', e.event);\r\n }\r\n\r\n this._draggingTarget = null;\r\n this._dropTarget = null;\r\n }\r\n\r\n}","import { Dictionary, WithThisType } from './types';\r\n\r\n// Return true to cancel bubble\r\nexport type EventCallbackSingleParam = EvtParam extends any\r\n ? (params: EvtParam) => boolean | void\r\n : never\r\n\r\nexport type EventCallback = EvtParams extends any[]\r\n ? (...args: EvtParams) => boolean | void\r\n : never\r\nexport type EventQuery = string | Object\r\n\r\ntype CbThis = unknown extends Ctx ? Impl : Ctx;\r\n\r\ntype EventHandler = {\r\n h: EventCallback\r\n ctx: CbThis\r\n query: EventQuery\r\n\r\n callAtLast: boolean\r\n}\r\n\r\ntype DefaultEventDefinition = Dictionary>;\r\n\r\nexport interface EventProcessor {\r\n normalizeQuery?: (query: EventQuery) => EventQuery\r\n filter?: (eventType: keyof EvtDef, query: EventQuery) => boolean\r\n afterTrigger?: (eventType: keyof EvtDef) => void\r\n}\r\n\r\n/**\r\n * Event dispatcher.\r\n *\r\n * Event can be defined in EvtDef to enable type check. For example:\r\n * ```ts\r\n * interface FooEvents {\r\n * // key: event name, value: the first event param in `trigger` and `callback`.\r\n * myevent: {\r\n * aa: string;\r\n * bb: number;\r\n * };\r\n * }\r\n * class Foo extends Eventful {\r\n * fn() {\r\n * // Type check of event name and the first event param is enabled here.\r\n * this.trigger('myevent', {aa: 'xx', bb: 3});\r\n * }\r\n * }\r\n * let foo = new Foo();\r\n * // Type check of event name and the first event param is enabled here.\r\n * foo.on('myevent', (eventParam) => { ... });\r\n * ```\r\n *\r\n * @param eventProcessor The object eventProcessor is the scope when\r\n * `eventProcessor.xxx` called.\r\n * @param eventProcessor.normalizeQuery\r\n * param: {string|Object} Raw query.\r\n * return: {string|Object} Normalized query.\r\n * @param eventProcessor.filter Event will be dispatched only\r\n * if it returns `true`.\r\n * param: {string} eventType\r\n * param: {string|Object} query\r\n * return: {boolean}\r\n * @param eventProcessor.afterTrigger Called after all handlers called.\r\n * param: {string} eventType\r\n */\r\nexport default class Eventful {\r\n\r\n private _$handlers: Dictionary[]>\r\n\r\n protected _$eventProcessor: EventProcessor\r\n\r\n constructor(eventProcessors?: EventProcessor) {\r\n if (eventProcessors) {\r\n this._$eventProcessor = eventProcessors;\r\n }\r\n }\r\n\r\n on(\r\n event: EvtNm,\r\n handler: WithThisType>,\r\n context?: Ctx\r\n ): this\r\n on(\r\n event: EvtNm,\r\n query: EventQuery,\r\n handler: WithThisType>,\r\n context?: Ctx\r\n ): this\r\n /**\r\n * Bind a handler.\r\n *\r\n * @param event The event name.\r\n * @param Condition used on event filter.\r\n * @param handler The event handler.\r\n * @param context\r\n */\r\n on(\r\n event: EvtNm,\r\n query: EventQuery | WithThisType, CbThis>,\r\n handler?: WithThisType, CbThis> | Ctx,\r\n context?: Ctx\r\n ): this {\r\n if (!this._$handlers) {\r\n this._$handlers = {};\r\n }\r\n\r\n const _h = this._$handlers;\r\n\r\n if (typeof query === 'function') {\r\n context = handler as Ctx;\r\n handler = query as (...args: any) => any;\r\n query = null;\r\n }\r\n\r\n if (!handler || !event) {\r\n return this;\r\n }\r\n\r\n const eventProcessor = this._$eventProcessor;\r\n if (query != null && eventProcessor && eventProcessor.normalizeQuery) {\r\n query = eventProcessor.normalizeQuery(query);\r\n }\r\n\r\n if (!_h[event as string]) {\r\n _h[event as string] = [];\r\n }\r\n\r\n for (let i = 0; i < _h[event as string].length; i++) {\r\n if (_h[event as string][i].h === handler) {\r\n return this;\r\n }\r\n }\r\n\r\n const wrap: EventHandler = {\r\n h: handler as EventCallback,\r\n query: query,\r\n ctx: (context || this) as CbThis,\r\n // FIXME\r\n // Do not publish this feature util it is proved that it makes sense.\r\n callAtLast: (handler as any).zrEventfulCallAtLast\r\n };\r\n\r\n const lastIndex = _h[event as string].length - 1;\r\n const lastWrap = _h[event as string][lastIndex];\r\n (lastWrap && lastWrap.callAtLast)\r\n ? _h[event as string].splice(lastIndex, 0, wrap)\r\n : _h[event as string].push(wrap);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Whether any handler has bound.\r\n */\r\n isSilent(eventName: keyof EvtDef): boolean {\r\n const _h = this._$handlers;\r\n return !_h || !_h[eventName as string] || !_h[eventName as string].length;\r\n }\r\n\r\n /**\r\n * Unbind a event.\r\n *\r\n * @param eventType The event name.\r\n * If no `event` input, \"off\" all listeners.\r\n * @param handler The event handler.\r\n * If no `handler` input, \"off\" all listeners of the `event`.\r\n */\r\n off(eventType?: keyof EvtDef, handler?: Function): this {\r\n const _h = this._$handlers;\r\n\r\n if (!_h) {\r\n return this;\r\n }\r\n\r\n if (!eventType) {\r\n this._$handlers = {};\r\n return this;\r\n }\r\n\r\n if (handler) {\r\n if (_h[eventType as string]) {\r\n const newList = [];\r\n for (let i = 0, l = _h[eventType as string].length; i < l; i++) {\r\n if (_h[eventType as string][i].h !== handler) {\r\n newList.push(_h[eventType as string][i]);\r\n }\r\n }\r\n _h[eventType as string] = newList;\r\n }\r\n\r\n if (_h[eventType as string] && _h[eventType as string].length === 0) {\r\n delete _h[eventType as string];\r\n }\r\n }\r\n else {\r\n delete _h[eventType as string];\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispatch a event.\r\n *\r\n * @param {string} eventType The event name.\r\n */\r\n trigger(\r\n eventType: EvtNm,\r\n ...args: Parameters\r\n ): this {\r\n if (!this._$handlers) {\r\n return this;\r\n }\r\n\r\n const _h = this._$handlers[eventType as string];\r\n const eventProcessor = this._$eventProcessor;\r\n\r\n if (_h) {\r\n const argLen = args.length;\r\n\r\n const len = _h.length;\r\n for (let i = 0; i < len; i++) {\r\n const hItem = _h[i];\r\n if (eventProcessor\r\n && eventProcessor.filter\r\n && hItem.query != null\r\n && !eventProcessor.filter(eventType, hItem.query)\r\n ) {\r\n continue;\r\n }\r\n\r\n // Optimize advise from backbone\r\n switch (argLen) {\r\n case 0:\r\n hItem.h.call(hItem.ctx);\r\n break;\r\n case 1:\r\n hItem.h.call(hItem.ctx, args[0]);\r\n break;\r\n case 2:\r\n hItem.h.call(hItem.ctx, args[0], args[1]);\r\n break;\r\n default:\r\n // have more than 2 given arguments\r\n hItem.h.apply(hItem.ctx, args);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n eventProcessor && eventProcessor.afterTrigger\r\n && eventProcessor.afterTrigger(eventType);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispatch a event with context, which is specified at the last parameter.\r\n *\r\n * @param {string} type The event name.\r\n */\r\n triggerWithContext(type: keyof EvtDef, ...args: any[]): this {\r\n if (!this._$handlers) {\r\n return this;\r\n }\r\n\r\n const _h = this._$handlers[type as string];\r\n const eventProcessor = this._$eventProcessor;\r\n\r\n if (_h) {\r\n const argLen = args.length;\r\n const ctx = args[argLen - 1];\r\n\r\n const len = _h.length;\r\n for (let i = 0; i < len; i++) {\r\n const hItem = _h[i];\r\n if (eventProcessor\r\n && eventProcessor.filter\r\n && hItem.query != null\r\n && !eventProcessor.filter(type, hItem.query)\r\n ) {\r\n continue;\r\n }\r\n\r\n // Optimize advise from backbone\r\n switch (argLen) {\r\n case 0:\r\n hItem.h.call(ctx);\r\n break;\r\n case 1:\r\n hItem.h.call(ctx, args[0]);\r\n break;\r\n case 2:\r\n hItem.h.call(ctx, args[0], args[1]);\r\n break;\r\n default:\r\n // have more than 2 given arguments\r\n hItem.h.apply(ctx, args.slice(1, argLen - 1));\r\n break;\r\n }\r\n }\r\n }\r\n\r\n eventProcessor && eventProcessor.afterTrigger\r\n && eventProcessor.afterTrigger(type);\r\n\r\n return this;\r\n }\r\n\r\n}\r\n","/**\r\n * The algoritm is learnt from\r\n * https://franklinta.com/2014/09/08/computing-css-matrix3d-transforms/\r\n * And we made some optimization for matrix inversion.\r\n * Other similar approaches:\r\n * \"cv::getPerspectiveTransform\", \"Direct Linear Transformation\".\r\n */\r\n\r\nconst LN2 = Math.log(2);\r\n\r\nfunction determinant(\r\n rows: number[][],\r\n rank: number,\r\n rowStart: number,\r\n rowMask: number,\r\n colMask: number,\r\n detCache: {[key: string]: number}\r\n) {\r\n const cacheKey = rowMask + '-' + colMask;\r\n const fullRank = rows.length;\r\n\r\n if (detCache.hasOwnProperty(cacheKey)) {\r\n return detCache[cacheKey];\r\n }\r\n\r\n if (rank === 1) {\r\n // In this case the colMask must be like: `11101111`. We can find the place of `0`.\r\n const colStart = Math.round(Math.log(((1 << fullRank) - 1) & ~colMask) / LN2);\r\n return rows[rowStart][colStart];\r\n }\r\n\r\n const subRowMask = rowMask | (1 << rowStart);\r\n let subRowStart = rowStart + 1;\r\n while (rowMask & (1 << subRowStart)) {\r\n subRowStart++;\r\n }\r\n\r\n let sum = 0;\r\n for (let j = 0, colLocalIdx = 0; j < fullRank; j++) {\r\n const colTag = 1 << j;\r\n if (!(colTag & colMask)) {\r\n sum += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j]\r\n // det(subMatrix(0, j))\r\n * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);\r\n colLocalIdx++;\r\n }\r\n }\r\n\r\n detCache[cacheKey] = sum;\r\n\r\n return sum;\r\n}\r\n\r\n/**\r\n * Usage:\r\n * ```js\r\n * const transformer = buildTransformer(\r\n * [10, 44, 100, 44, 100, 300, 10, 300],\r\n * [50, 54, 130, 14, 140, 330, 14, 220]\r\n * );\r\n * const out = [];\r\n * transformer && transformer([11, 33], out);\r\n * ```\r\n *\r\n * Notice: `buildTransformer` may take more than 10ms in some Android device.\r\n *\r\n * @param src source four points, [x0, y0, x1, y1, x2, y2, x3, y3]\r\n * @param dest destination four points, [x0, y0, x1, y1, x2, y2, x3, y3]\r\n * @return transformer If fail, return null/undefined.\r\n */\r\nexport function buildTransformer(src: number[], dest: number[]) {\r\n const mA = [\r\n [src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]],\r\n [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]],\r\n [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]],\r\n [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]],\r\n [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]],\r\n [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]],\r\n [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]],\r\n [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]\r\n ];\r\n\r\n const detCache = {};\r\n const det = determinant(mA, 8, 0, 0, 0, detCache);\r\n if (det === 0) {\r\n // can not make transformer when and only when\r\n // any three of the markers are collinear.\r\n return;\r\n }\r\n\r\n // `invert(mA) * dest`, that is, `adj(mA) / det * dest`.\r\n const vh: number[] = [];\r\n for (let i = 0; i < 8; i++) {\r\n for (let j = 0; j < 8; j++) {\r\n vh[j] == null && (vh[j] = 0);\r\n vh[j] += ((i + j) % 2 ? -1 : 1)\r\n // det(subMatrix(i, j))\r\n * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache)\r\n / det * dest[i];\r\n }\r\n }\r\n\r\n return function (out: number[], srcPointX: number, srcPointY: number) {\r\n const pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;\r\n out[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;\r\n out[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;\r\n };\r\n}\r\n","\r\nimport env from './env';\r\nimport {buildTransformer} from './fourPointsTransform';\r\nimport {Dictionary} from './types';\r\n\r\nconst EVENT_SAVED_PROP = '___zrEVENTSAVED';\r\nconst _calcOut: number[] = [];\r\n\r\ntype SavedInfo = {\r\n markers?: HTMLDivElement[]\r\n trans?: ReturnType\r\n invTrans?: ReturnType\r\n srcCoords?: number[]\r\n}\r\n\r\n/**\r\n * Transform \"local coord\" from `elFrom` to `elTarget`.\r\n * \"local coord\": the coord based on the input `el`. The origin point is at\r\n * the position of \"left: 0; top: 0;\" in the `el`.\r\n *\r\n * Support when CSS transform is used.\r\n *\r\n * Having the `out` (that is, `[outX, outY]`), we can create an DOM element\r\n * and set the CSS style as \"left: outX; top: outY;\" and append it to `elTarge`\r\n * to locate the element.\r\n *\r\n * For example, this code below positions a child of `document.body` on the event\r\n * point, no matter whether `body` has `margin`/`paddin`/`transfrom`/... :\r\n * ```js\r\n * transformLocalCoord(out, container, document.body, event.offsetX, event.offsetY);\r\n * if (!eqNaN(out[0])) {\r\n * // Then locate the tip element on the event point.\r\n * var tipEl = document.createElement('div');\r\n * tipEl.style.cssText = 'position: absolute; left:' + out[0] + ';top:' + out[1] + ';';\r\n * document.body.appendChild(tipEl);\r\n * }\r\n * ```\r\n *\r\n * Notice: In some env this method is not supported. If called, `out` will be `[NaN, NaN]`.\r\n *\r\n * @param {Array.} out [inX: number, inY: number] The output..\r\n * If can not transform, `out` will not be modified but return `false`.\r\n * @param {HTMLElement} elFrom The `[inX, inY]` is based on elFrom.\r\n * @param {HTMLElement} elTarget The `out` is based on elTarget.\r\n * @param {number} inX\r\n * @param {number} inY\r\n * @return {boolean} Whether transform successfully.\r\n */\r\nexport function transformLocalCoord(\r\n out: number[],\r\n elFrom: HTMLElement,\r\n elTarget: HTMLElement,\r\n inX: number,\r\n inY: number\r\n) {\r\n return transformCoordWithViewport(_calcOut, elFrom, inX, inY, true)\r\n && transformCoordWithViewport(out, elTarget, _calcOut[0], _calcOut[1]);\r\n}\r\n\r\n/**\r\n * Transform between a \"viewport coord\" and a \"local coord\".\r\n * \"viewport coord\": the coord based on the left-top corner of the viewport\r\n * of the browser.\r\n * \"local coord\": the coord based on the input `el`. The origin point is at\r\n * the position of \"left: 0; top: 0;\" in the `el`.\r\n *\r\n * Support the case when CSS transform is used on el.\r\n *\r\n * @param out [inX: number, inY: number] The output. If `inverse: false`,\r\n * it represents \"local coord\", otherwise \"vireport coord\".\r\n * If can not transform, `out` will not be modified but return `false`.\r\n * @param el The \"local coord\" is based on the `el`, see comment above.\r\n * @param inX If `inverse: false`,\r\n * it represents \"vireport coord\", otherwise \"local coord\".\r\n * @param inY If `inverse: false`,\r\n * it represents \"vireport coord\", otherwise \"local coord\".\r\n * @param inverse\r\n * `true`: from \"viewport coord\" to \"local coord\".\r\n * `false`: from \"local coord\" to \"viewport coord\".\r\n * @return {boolean} Whether transform successfully.\r\n */\r\nexport function transformCoordWithViewport(\r\n out: number[],\r\n el: HTMLElement,\r\n inX: number,\r\n inY: number,\r\n inverse?: boolean\r\n) {\r\n if (el.getBoundingClientRect && env.domSupported && !isCanvasEl(el)) {\r\n const saved = (el as any)[EVENT_SAVED_PROP] || ((el as any)[EVENT_SAVED_PROP] = {});\r\n const markers = prepareCoordMarkers(el, saved);\r\n const transformer = preparePointerTransformer(markers, saved, inverse);\r\n if (transformer) {\r\n transformer(out, inX, inY);\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction prepareCoordMarkers(el: HTMLElement, saved: SavedInfo) {\r\n let markers = saved.markers;\r\n if (markers) {\r\n return markers;\r\n }\r\n\r\n markers = saved.markers = [];\r\n const propLR = ['left', 'right'];\r\n const propTB = ['top', 'bottom'];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const marker = document.createElement('div');\r\n const stl = marker.style;\r\n const idxLR = i % 2;\r\n const idxTB = (i >> 1) % 2;\r\n stl.cssText = [\r\n 'position: absolute',\r\n 'visibility: hidden',\r\n 'padding: 0',\r\n 'margin: 0',\r\n 'border-width: 0',\r\n 'user-select: none',\r\n 'width:0',\r\n 'height:0',\r\n // 'width: 5px',\r\n // 'height: 5px',\r\n propLR[idxLR] + ':0',\r\n propTB[idxTB] + ':0',\r\n propLR[1 - idxLR] + ':auto',\r\n propTB[1 - idxTB] + ':auto',\r\n ''\r\n ].join('!important;');\r\n el.appendChild(marker);\r\n markers.push(marker);\r\n }\r\n\r\n return markers;\r\n}\r\n\r\nfunction preparePointerTransformer(markers: HTMLDivElement[], saved: SavedInfo, inverse?: boolean) {\r\n const transformerName: 'invTrans' | 'trans' = inverse ? 'invTrans' : 'trans';\r\n const transformer = saved[transformerName];\r\n const oldSrcCoords = saved.srcCoords;\r\n const srcCoords = [];\r\n const destCoords = [];\r\n let oldCoordTheSame = true;\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const rect = markers[i].getBoundingClientRect();\r\n const ii = 2 * i;\r\n const x = rect.left;\r\n const y = rect.top;\r\n srcCoords.push(x, y);\r\n oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];\r\n destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);\r\n }\r\n // Cache to avoid time consuming of `buildTransformer`.\r\n return (oldCoordTheSame && transformer)\r\n ? transformer\r\n : (\r\n saved.srcCoords = srcCoords,\r\n saved[transformerName] = inverse\r\n ? buildTransformer(destCoords, srcCoords)\r\n : buildTransformer(srcCoords, destCoords)\r\n );\r\n}\r\n\r\nexport function isCanvasEl(el: HTMLElement): el is HTMLCanvasElement {\r\n return el.nodeName.toUpperCase() === 'CANVAS';\r\n}\r\n\r\nconst replaceReg = /([&<>\"'])/g;\r\nconst replaceMap: Dictionary = {\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n '\\'': '''\r\n};\r\n\r\nexport function encodeHTML(source: string): string {\r\n return source == null\r\n ? ''\r\n : (source + '').replace(replaceReg, function (str, c) {\r\n return replaceMap[c];\r\n });\r\n}\r\n","/**\n * Utilities for mouse or touch events.\n */\n\nimport Eventful from './Eventful';\nimport env from './env';\nimport { ZRRawEvent } from './types';\nimport {isCanvasEl, transformCoordWithViewport} from './dom';\n\nconst MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;\nconst _calcOut: number[] = [];\nconst firefoxNotSupportOffsetXY = env.browser.firefox\n // use offsetX/offsetY for Firefox >= 39\n // PENDING: consider Firefox for Android and Firefox OS? >= 43\n && +(env.browser.version as string).split('.')[0] < 39;\n\ntype FirefoxMouseEvent = {\n layerX: number\n layerY: number\n}\n\n\n/**\n * Get the `zrX` and `zrY`, which are relative to the top-left of\n * the input `el`.\n * CSS transform (2D & 3D) is supported.\n *\n * The strategy to fetch the coords:\n * + If `calculate` is not set as `true`, users of this method should\n * ensure that `el` is the same or the same size & location as `e.target`.\n * Otherwise the result coords are probably not expected. Because we\n * firstly try to get coords from e.offsetX/e.offsetY.\n * + If `calculate` is set as `true`, the input `el` can be any element\n * and we force to calculate the coords based on `el`.\n * + The input `el` should be positionable (not position:static).\n *\n * The force `calculate` can be used in case like:\n * When mousemove event triggered on ec tooltip, `e.target` is not `el`(zr painter.dom).\n *\n * @param el DOM element.\n * @param e Mouse event or touch event.\n * @param out Get `out.zrX` and `out.zrY` as the result.\n * @param calculate Whether to force calculate\n * the coordinates but not use ones provided by browser.\n */\nexport function clientToLocal(\n el: HTMLElement,\n e: ZRRawEvent | FirefoxMouseEvent | Touch,\n out: {zrX?: number, zrY?: number},\n calculate?: boolean\n) {\n out = out || {};\n\n // According to the W3C Working Draft, offsetX and offsetY should be relative\n // to the padding edge of the target element. The only browser using this convention\n // is IE. Webkit uses the border edge, Opera uses the content edge, and FireFox does\n // not support the properties.\n // (see http://www.jacklmoore.com/notes/mouse-position/)\n // In zr painter.dom, padding edge equals to border edge.\n if (calculate) {\n calculateZrXY(el, e as ZRRawEvent, out);\n }\n // Caution: In FireFox, layerX/layerY Mouse position relative to the closest positioned\n // ancestor element, so we should make sure el is positioned (e.g., not position:static).\n // BTW1, Webkit don't return the same results as FF in non-simple cases (like add\n // zoom-factor, overflow / opacity layers, transforms ...)\n // BTW2, (ev.offsetY || ev.pageY - $(ev.target).offset().top) is not correct in preserve-3d.\n // \n // BTW3, In ff, offsetX/offsetY is always 0.\n else if (firefoxNotSupportOffsetXY\n && (e as FirefoxMouseEvent).layerX != null\n && (e as FirefoxMouseEvent).layerX !== (e as MouseEvent).offsetX\n ) {\n out.zrX = (e as FirefoxMouseEvent).layerX;\n out.zrY = (e as FirefoxMouseEvent).layerY;\n }\n // For IE6+, chrome, safari, opera, firefox >= 39\n else if ((e as MouseEvent).offsetX != null) {\n out.zrX = (e as MouseEvent).offsetX;\n out.zrY = (e as MouseEvent).offsetY;\n }\n // For some other device, e.g., IOS safari.\n else {\n calculateZrXY(el, e as ZRRawEvent, out);\n }\n\n return out;\n}\n\nfunction calculateZrXY(\n el: HTMLElement,\n e: ZRRawEvent,\n out: {zrX?: number, zrY?: number}\n) {\n // BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect.\n if (env.domSupported && el.getBoundingClientRect) {\n const ex = (e as MouseEvent).clientX;\n const ey = (e as MouseEvent).clientY;\n\n if (isCanvasEl(el)) {\n // Original approach, which do not support CSS transform.\n // marker can not be locationed in a canvas container\n // (getBoundingClientRect is always 0). We do not support\n // that input a pre-created canvas to zr while using css\n // transform in iOS.\n const box = el.getBoundingClientRect();\n out.zrX = ex - box.left;\n out.zrY = ey - box.top;\n return;\n }\n else {\n if (transformCoordWithViewport(_calcOut, el, ex, ey)) {\n out.zrX = _calcOut[0];\n out.zrY = _calcOut[1];\n return;\n }\n }\n }\n out.zrX = out.zrY = 0;\n}\n\n/**\n * Find native event compat for legency IE.\n * Should be called at the begining of a native event listener.\n *\n * @param e Mouse event or touch event or pointer event.\n * For lagency IE, we use `window.event` is used.\n * @return The native event.\n */\nexport function getNativeEvent(e: ZRRawEvent): ZRRawEvent {\n return e\n || (window.event as any); // For IE\n}\n\n/**\n * Normalize the coordinates of the input event.\n *\n * Get the `e.zrX` and `e.zrY`, which are relative to the top-left of\n * the input `el`.\n * Get `e.zrDelta` if using mouse wheel.\n * Get `e.which`, see the comment inside this function.\n *\n * Do not calculate repeatly if `zrX` and `zrY` already exist.\n *\n * Notice: see comments in `clientToLocal`. check the relationship\n * between the result coords and the parameters `el` and `calculate`.\n *\n * @param el DOM element.\n * @param e See `getNativeEvent`.\n * @param calculate Whether to force calculate\n * the coordinates but not use ones provided by browser.\n * @return The normalized native UIEvent.\n */\nexport function normalizeEvent(\n el: HTMLElement,\n e: ZRRawEvent,\n calculate?: boolean\n) {\n\n e = getNativeEvent(e);\n\n if (e.zrX != null) {\n return e;\n }\n\n const eventType = e.type;\n const isTouch = eventType && eventType.indexOf('touch') >= 0;\n\n if (!isTouch) {\n clientToLocal(el, e, e, calculate);\n const wheelDelta = getWheelDeltaMayPolyfill(e);\n // FIXME: IE8- has \"wheelDeta\" in event \"mousewheel\" but hat different value (120 times)\n // with Chrome and Safari. It's not correct for zrender event but we left it as it was.\n e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;\n }\n else {\n const touch = eventType !== 'touchend'\n ? (e).targetTouches[0]\n : (e).changedTouches[0];\n touch && clientToLocal(el, touch, e, calculate);\n }\n\n // Add which for click: 1 === left; 2 === middle; 3 === right; otherwise: 0;\n // See jQuery: https://github.com/jquery/jquery/blob/master/src/event.js\n // If e.which has been defined, it may be readonly,\n // see: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which\n const button = (e).button;\n if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {\n (e as any).which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));\n }\n // [Caution]: `e.which` from browser is not always reliable. For example,\n // when press left button and `mousemove (pointermove)` in Edge, the `e.which`\n // is 65536 and the `e.button` is -1. But the `mouseup (pointerup)` and\n // `mousedown (pointerdown)` is the same as Chrome does.\n\n return e;\n}\n\n// TODO: also provide prop \"deltaX\" \"deltaY\" in zrender \"mousewheel\" event.\nfunction getWheelDeltaMayPolyfill(e: ZRRawEvent): number {\n // Although event \"wheel\" do not has the prop \"wheelDelta\" in spec,\n // agent like Chrome and Safari still provide \"wheelDelta\" like\n // event \"mousewheel\" did (perhaps for backward compat).\n // Since zrender has been using \"wheelDeta\" in zrender event \"mousewheel\".\n // we currently do not break it.\n // But event \"wheel\" in firefox do not has \"wheelDelta\", so we calculate\n // \"wheelDeta\" from \"deltaX\", \"deltaY\" (which is the props in spec).\n const rawWheelDelta = (e as any).wheelDelta;\n // Theroetically `e.wheelDelta` won't be 0 unless some day it has been deprecated\n // by agent like Chrome or Safari. So we also calculate it if rawWheelDelta is 0.\n if (rawWheelDelta) {\n return rawWheelDelta;\n }\n\n const deltaX = (e as any).deltaX;\n const deltaY = (e as any).deltaY;\n if (deltaX == null || deltaY == null) {\n return rawWheelDelta;\n }\n\n // Test in Chrome and Safari (MacOS):\n // The sign is corrent.\n // The abs value is 99% corrent (inconsist case only like 62~63, 125~126 ...)\n const delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);\n const sign = deltaY > 0 ? -1\n : deltaY < 0 ? 1\n : deltaX > 0 ? -1\n : 1;\n return 3 * delta * sign;\n}\n\n\ntype AddEventListenerParams = Parameters\ntype RemoveEventListenerParams = Parameters\n/**\n * @param el\n * @param name\n * @param handler\n * @param opt If boolean, means `opt.capture`\n * @param opt.capture\n * @param opt.passive\n */\nexport function addEventListener(\n el: HTMLElement | HTMLDocument,\n name: AddEventListenerParams[0],\n handler: AddEventListenerParams[1],\n opt?: AddEventListenerParams[2]\n) {\n // Reproduct the console warning:\n // [Violation] Added non-passive event listener to a scroll-blocking event.\n // Consider marking event handler as 'passive' to make the page more responsive.\n // Just set console log level: verbose in chrome dev tool.\n // then the warning log will be printed when addEventListener called.\n // See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n // We have not yet found a neat way to using passive. Because in zrender the dom event\n // listener delegate all of the upper events of element. Some of those events need\n // to prevent default. For example, the feature `preventDefaultMouseMove` of echarts.\n // Before passive can be adopted, these issues should be considered:\n // (1) Whether and how a zrender user specifies an event listener passive. And by default,\n // passive or not.\n // (2) How to tread that some zrender event listener is passive, and some is not. If\n // we use other way but not preventDefault of mousewheel and touchmove, browser\n // compatibility should be handled.\n\n // const opts = (env.passiveSupported && name === 'mousewheel')\n // ? {passive: true}\n // // By default, the third param of el.addEventListener is `capture: false`.\n // : void 0;\n // el.addEventListener(name, handler /* , opts */);\n el.addEventListener(name, handler, opt);\n}\n\n/**\n * Parameter are the same as `addEventListener`.\n *\n * Notice that if a listener is registered twice, one with capture and one without,\n * remove each one separately. Removal of a capturing listener does not affect a\n * non-capturing version of the same listener, and vice versa.\n */\nexport function removeEventListener(\n el: HTMLElement | HTMLDocument,\n name: RemoveEventListenerParams[0],\n handler: RemoveEventListenerParams[1],\n opt: RemoveEventListenerParams[2]\n) {\n el.removeEventListener(name, handler, opt);\n}\n\n/**\n * preventDefault and stopPropagation.\n * Notice: do not use this method in zrender. It can only be\n * used by upper applications if necessary.\n *\n * @param {Event} e A mouse or touch event.\n */\nexport const stop = function (e: MouseEvent | TouchEvent | PointerEvent) {\n e.preventDefault();\n e.stopPropagation();\n e.cancelBubble = true;\n};\n\n/**\n * This method only works for mouseup and mousedown. The functionality is restricted\n * for fault tolerance, See the `e.which` compatibility above.\n *\n * params can be MouseEvent or ElementEvent\n */\nexport function isMiddleOrRightButtonOnMouseUpDown(e: { which: number }) {\n return e.which === 2 || e.which === 3;\n}\n\n// For backward compatibility\nexport {Eventful as Dispatcher};\n","/**\n * Only implements needed gestures for mobile.\n */\n\nimport * as eventUtil from './event';\nimport { ZRRawTouchEvent, ZRPinchEvent, Dictionary } from './types';\nimport Displayable from '../graphic/Displayable';\n\ninterface TrackItem {\n points: number[][]\n touches: Touch[]\n target: Displayable,\n event: ZRRawTouchEvent\n}\n\nexport class GestureMgr {\n\n private _track: TrackItem[] = []\n\n constructor() {}\n\n recognize(event: ZRRawTouchEvent, target: Displayable, root: HTMLElement) {\n this._doTrack(event, target, root);\n return this._recognize(event);\n }\n\n clear() {\n this._track.length = 0;\n return this;\n }\n\n _doTrack(event: ZRRawTouchEvent, target: Displayable, root: HTMLElement) {\n const touches = event.touches;\n\n if (!touches) {\n return;\n }\n\n const trackItem: TrackItem = {\n points: [],\n touches: [],\n target: target,\n event: event\n };\n\n for (let i = 0, len = touches.length; i < len; i++) {\n const touch = touches[i];\n const pos = eventUtil.clientToLocal(root, touch, {});\n trackItem.points.push([pos.zrX, pos.zrY]);\n trackItem.touches.push(touch);\n }\n\n this._track.push(trackItem);\n }\n\n _recognize(event: ZRRawTouchEvent) {\n for (let eventName in recognizers) {\n if (recognizers.hasOwnProperty(eventName)) {\n const gestureInfo = recognizers[eventName](this._track, event);\n if (gestureInfo) {\n return gestureInfo;\n }\n }\n }\n }\n}\n\nfunction dist(pointPair: number[][]): number {\n const dx = pointPair[1][0] - pointPair[0][0];\n const dy = pointPair[1][1] - pointPair[0][1];\n\n return Math.sqrt(dx * dx + dy * dy);\n}\n\nfunction center(pointPair: number[][]): number[] {\n return [\n (pointPair[0][0] + pointPair[1][0]) / 2,\n (pointPair[0][1] + pointPair[1][1]) / 2\n ];\n}\n\ntype Recognizer = (tracks: TrackItem[], event: ZRRawTouchEvent) => {\n type: string\n target: Displayable\n event: ZRRawTouchEvent\n}\n\nconst recognizers: Dictionary = {\n\n pinch: function (tracks: TrackItem[], event: ZRRawTouchEvent) {\n const trackLen = tracks.length;\n\n if (!trackLen) {\n return;\n }\n\n const pinchEnd = (tracks[trackLen - 1] || {}).points;\n const pinchPre = (tracks[trackLen - 2] || {}).points || pinchEnd;\n\n if (pinchPre\n && pinchPre.length > 1\n && pinchEnd\n && pinchEnd.length > 1\n ) {\n let pinchScale = dist(pinchEnd) / dist(pinchPre);\n !isFinite(pinchScale) && (pinchScale = 1);\n\n (event as ZRPinchEvent).pinchScale = pinchScale;\n\n const pinchCenter = center(pinchEnd);\n (event as ZRPinchEvent).pinchX = pinchCenter[0];\n (event as ZRPinchEvent).pinchY = pinchCenter[1];\n\n return {\n type: 'pinch',\n target: tracks[0].target,\n event: event\n };\n }\n }\n\n // Only pinch currently.\n};","/**\n * 3x2矩阵操作类\n * @exports zrender/tool/matrix\n */\n\n/* global Float32Array */\n\nimport {VectorArray} from './vector';\n\nexport type MatrixArray = number[]\n/**\n * Create a identity matrix.\n */\nexport function create(): MatrixArray {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * 设置矩阵为单位矩阵\n */\nexport function identity(out: MatrixArray): MatrixArray {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * 复制矩阵\n */\nexport function copy(out: MatrixArray, m: MatrixArray): MatrixArray {\n out[0] = m[0];\n out[1] = m[1];\n out[2] = m[2];\n out[3] = m[3];\n out[4] = m[4];\n out[5] = m[5];\n return out;\n}\n\n/**\n * 矩阵相乘\n */\nexport function mul(out: MatrixArray, m1: MatrixArray, m2: MatrixArray): MatrixArray {\n // Consider matrix.mul(m, m2, m);\n // where out is the same as m2.\n // So use temp constiable to escape error.\n const out0 = m1[0] * m2[0] + m1[2] * m2[1];\n const out1 = m1[1] * m2[0] + m1[3] * m2[1];\n const out2 = m1[0] * m2[2] + m1[2] * m2[3];\n const out3 = m1[1] * m2[2] + m1[3] * m2[3];\n const out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];\n const out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = out3;\n out[4] = out4;\n out[5] = out5;\n return out;\n}\n\n/**\n * 平移变换\n */\nexport function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4] + v[0];\n out[5] = a[5] + v[1];\n return out;\n}\n\n/**\n * 旋转变换\n */\nexport function rotate(\n out: MatrixArray,\n a: MatrixArray,\n rad: number,\n pivot: VectorArray = [0, 0]\n): MatrixArray {\n const aa = a[0];\n const ac = a[2];\n const atx = a[4];\n const ab = a[1];\n const ad = a[3];\n const aty = a[5];\n const st = Math.sin(rad);\n const ct = Math.cos(rad);\n\n out[0] = aa * ct + ab * st;\n out[1] = -aa * st + ab * ct;\n out[2] = ac * ct + ad * st;\n out[3] = -ac * st + ct * ad;\n out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];\n out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];\n return out;\n}\n\n/**\n * 缩放变换\n */\nexport function scale(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray {\n const vx = v[0];\n const vy = v[1];\n out[0] = a[0] * vx;\n out[1] = a[1] * vy;\n out[2] = a[2] * vx;\n out[3] = a[3] * vy;\n out[4] = a[4] * vx;\n out[5] = a[5] * vy;\n return out;\n}\n\n/**\n * 求逆矩阵\n */\nexport function invert(out: MatrixArray, a: MatrixArray): MatrixArray | null {\n\n const aa = a[0];\n const ac = a[2];\n const atx = a[4];\n const ab = a[1];\n const ad = a[3];\n const aty = a[5];\n\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\n\n/**\n * Clone a new matrix.\n */\nexport function clone(a: MatrixArray): MatrixArray {\n const b = create();\n copy(b, a);\n return b;\n}\n","import { MatrixArray } from './matrix';\r\n\r\nexport interface PointLike {\r\n x: number\r\n y: number\r\n}\r\nexport default class Point {\r\n\r\n x: number\r\n\r\n y: number\r\n\r\n constructor(x?: number, y?: number) {\r\n this.x = x || 0;\r\n this.y = y || 0;\r\n }\r\n\r\n /**\r\n * Copy from another point\r\n */\r\n copy(other: PointLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Clone a point\r\n */\r\n clone() {\r\n return new Point(this.x, this.y);\r\n }\r\n\r\n /**\r\n * Set x and y\r\n */\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n /**\r\n * If equal to another point\r\n */\r\n equal(other: PointLike) {\r\n return other.x === this.x && other.y === this.y;\r\n }\r\n\r\n /**\r\n * Add another point\r\n */\r\n add(other: PointLike) {\r\n this.x += other.x;\r\n this.y += other.y;\r\n return this;\r\n }\r\n\r\n scale(scalar: number) {\r\n this.x *= scalar;\r\n this.y *= scalar;\r\n }\r\n\r\n scaleAndAdd(other: PointLike, scalar: number) {\r\n this.x += other.x * scalar;\r\n this.y += other.y * scalar;\r\n }\r\n\r\n /**\r\n * Sub another point\r\n */\r\n sub(other: PointLike) {\r\n this.x -= other.x;\r\n this.y -= other.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Dot product with other point\r\n */\r\n dot(other: PointLike) {\r\n return this.x * other.x + this.y * other.y;\r\n }\r\n\r\n /**\r\n * Get length of point\r\n */\r\n len() {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n }\r\n\r\n /**\r\n * Get squared length\r\n */\r\n lenSquare() {\r\n return this.x * this.x + this.y * this.y;\r\n }\r\n\r\n /**\r\n * Normalize\r\n */\r\n normalize() {\r\n const len = this.len();\r\n this.x /= len;\r\n this.y /= len;\r\n return this;\r\n }\r\n\r\n /**\r\n * Distance to another point\r\n */\r\n distance(other: PointLike) {\r\n const dx = this.x - other.x;\r\n const dy = this.y - other.y;\r\n return Math.sqrt(dx * dx + dy * dy);\r\n }\r\n\r\n /**\r\n * Square distance to another point\r\n */\r\n distanceSquare(other: Point) {\r\n const dx = this.x - other.x;\r\n const dy = this.y - other.y;\r\n return dx * dx + dy * dy;\r\n }\r\n\r\n /**\r\n * Negate\r\n */\r\n negate() {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Apply a transform matrix array.\r\n */\r\n transform(m: MatrixArray) {\r\n if (!m) {\r\n return;\r\n }\r\n const x = this.x;\r\n const y = this.y;\r\n this.x = m[0] * x + m[2] * y + m[4];\r\n this.y = m[1] * x + m[3] * y + m[5];\r\n return this;\r\n }\r\n\r\n toArray(out: number[]) {\r\n out[0] = this.x;\r\n out[1] = this.y;\r\n return out;\r\n }\r\n\r\n fromArray(input: number[]) {\r\n this.x = input[0];\r\n this.y = input[1];\r\n }\r\n\r\n static set(p: PointLike, x: number, y: number) {\r\n p.x = x;\r\n p.y = y;\r\n }\r\n\r\n static copy(p: PointLike, p2: PointLike) {\r\n p.x = p2.x;\r\n p.y = p2.y;\r\n }\r\n\r\n static len(p: PointLike) {\r\n return Math.sqrt(p.x * p.x + p.y * p.y);\r\n }\r\n\r\n static lenSquare(p: PointLike) {\r\n return p.x * p.x + p.y * p.y;\r\n }\r\n\r\n static dot(p0: PointLike, p1: PointLike) {\r\n return p0.x * p1.x + p0.y * p1.y;\r\n }\r\n\r\n static add(out: PointLike, p0: PointLike, p1: PointLike) {\r\n out.x = p0.x + p1.x;\r\n out.y = p0.y + p1.y;\r\n }\r\n\r\n static sub(out: PointLike, p0: PointLike, p1: PointLike) {\r\n out.x = p0.x - p1.x;\r\n out.y = p0.y - p1.y;\r\n }\r\n\r\n static scale(out: PointLike, p0: PointLike, scalar: number) {\r\n out.x = p0.x * scalar;\r\n out.y = p0.y * scalar;\r\n }\r\n\r\n static scaleAndAdd(out: PointLike, p0: PointLike, p1: PointLike, scalar: number) {\r\n out.x = p0.x + p1.x * scalar;\r\n out.y = p0.y + p1.y * scalar;\r\n }\r\n\r\n static lerp(out: PointLike, p0: PointLike, p1: PointLike, t: number) {\r\n const onet = 1 - t;\r\n out.x = onet * p0.x + t * p1.x;\r\n out.y = onet * p0.y + t * p1.y;\r\n }\r\n}","/**\r\n * @module echarts/core/BoundingRect\r\n */\r\n\r\nimport * as matrix from './matrix';\r\nimport Point, { PointLike } from './Point';\r\n\r\nconst mathMin = Math.min;\r\nconst mathMax = Math.max;\r\n\r\nconst lt = new Point();\r\nconst rb = new Point();\r\nconst lb = new Point();\r\nconst rt = new Point();\r\n\r\nconst minTv = new Point();\r\nconst maxTv = new Point();\r\n\r\nclass BoundingRect {\r\n\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n\r\n constructor(x: number, y: number, width: number, height: number) {\r\n if (width < 0) {\r\n x = x + width;\r\n width = -width;\r\n }\r\n if (height < 0) {\r\n y = y + height;\r\n height = -height;\r\n }\r\n\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n union(other: BoundingRect) {\r\n const x = mathMin(other.x, this.x);\r\n const y = mathMin(other.y, this.y);\r\n\r\n // If x is -Infinity and width is Infinity (like in the case of\r\n // IncrementalDisplayble), x + width would be NaN\r\n if (isFinite(this.x) && isFinite(this.width)) {\r\n this.width = mathMax(\r\n other.x + other.width,\r\n this.x + this.width\r\n ) - x;\r\n }\r\n else {\r\n this.width = other.width;\r\n }\r\n\r\n if (isFinite(this.y) && isFinite(this.height)) {\r\n this.height = mathMax(\r\n other.y + other.height,\r\n this.y + this.height\r\n ) - y;\r\n }\r\n else {\r\n this.height = other.height;\r\n }\r\n\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n applyTransform(m: matrix.MatrixArray) {\r\n BoundingRect.applyTransform(this, this, m);\r\n }\r\n\r\n calculateTransform(b: RectLike): matrix.MatrixArray {\r\n const a = this;\r\n const sx = b.width / a.width;\r\n const sy = b.height / a.height;\r\n\r\n const m = matrix.create();\r\n\r\n // 矩阵右乘\r\n matrix.translate(m, m, [-a.x, -a.y]);\r\n matrix.scale(m, m, [sx, sy]);\r\n matrix.translate(m, m, [b.x, b.y]);\r\n\r\n return m;\r\n }\r\n\r\n intersect(b: RectLike, mtv?: PointLike): boolean {\r\n if (!b) {\r\n return false;\r\n }\r\n\r\n if (!(b instanceof BoundingRect)) {\r\n // Normalize negative width/height.\r\n b = BoundingRect.create(b);\r\n }\r\n\r\n const a = this;\r\n const ax0 = a.x;\r\n const ax1 = a.x + a.width;\r\n const ay0 = a.y;\r\n const ay1 = a.y + a.height;\r\n\r\n const bx0 = b.x;\r\n const bx1 = b.x + b.width;\r\n const by0 = b.y;\r\n const by1 = b.y + b.height;\r\n\r\n let overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);\r\n if (mtv) {\r\n let dMin = Infinity;\r\n let dMax = 0;\r\n const d0 = Math.abs(ax1 - bx0);\r\n const d1 = Math.abs(bx1 - ax0);\r\n const d2 = Math.abs(ay1 - by0);\r\n const d3 = Math.abs(by1 - ay0);\r\n const dx = Math.min(d0, d1);\r\n const dy = Math.min(d2, d3);\r\n // On x axis\r\n if (ax1 < bx0 || bx1 < ax0) {\r\n if (dx > dMax) {\r\n dMax = dx;\r\n if (d0 < d1) {\r\n Point.set(maxTv, -d0, 0); // b is on the right\r\n }\r\n else {\r\n Point.set(maxTv, d1, 0); // b is on the left\r\n }\r\n }\r\n }\r\n else {\r\n if (dx < dMin) {\r\n dMin = dx;\r\n if (d0 < d1) {\r\n Point.set(minTv, d0, 0); // b is on the right\r\n }\r\n else {\r\n Point.set(minTv, -d1, 0); // b is on the left\r\n }\r\n }\r\n }\r\n\r\n // On y axis\r\n if (ay1 < by0 || by1 < ay0) {\r\n if (dy > dMax) {\r\n dMax = dy;\r\n if (d2 < d3) {\r\n Point.set(maxTv, 0, -d2); // b is on the bottom(larger y)\r\n }\r\n else {\r\n Point.set(maxTv, 0, d3); // b is on the top(smaller y)\r\n }\r\n }\r\n }\r\n else {\r\n if (dx < dMin) {\r\n dMin = dx;\r\n if (d2 < d3) {\r\n Point.set(minTv, 0, d2); // b is on the bottom\r\n }\r\n else {\r\n Point.set(minTv, 0, -d3); // b is on the top\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (mtv) {\r\n Point.copy(mtv, overlap ? minTv : maxTv);\r\n }\r\n return overlap;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const rect = this;\r\n return x >= rect.x\r\n && x <= (rect.x + rect.width)\r\n && y >= rect.y\r\n && y <= (rect.y + rect.height);\r\n }\r\n\r\n clone() {\r\n return new BoundingRect(this.x, this.y, this.width, this.height);\r\n }\r\n\r\n /**\r\n * Copy from another rect\r\n */\r\n copy(other: RectLike) {\r\n BoundingRect.copy(this, other);\r\n }\r\n\r\n plain(): RectLike {\r\n return {\r\n x: this.x,\r\n y: this.y,\r\n width: this.width,\r\n height: this.height\r\n };\r\n }\r\n\r\n /**\r\n * If not having NaN or Infinity with attributes\r\n */\r\n isFinite(): boolean {\r\n return isFinite(this.x)\r\n && isFinite(this.y)\r\n && isFinite(this.width)\r\n && isFinite(this.height);\r\n }\r\n\r\n isZero(): boolean {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n static create(rect: RectLike): BoundingRect {\r\n return new BoundingRect(rect.x, rect.y, rect.width, rect.height);\r\n }\r\n\r\n static copy(target: RectLike, source: RectLike) {\r\n target.x = source.x;\r\n target.y = source.y;\r\n target.width = source.width;\r\n target.height = source.height;\r\n }\r\n\r\n static applyTransform(target: RectLike, source: RectLike, m: matrix.MatrixArray) {\r\n // In case usage like this\r\n // el.getBoundingRect().applyTransform(el.transform)\r\n // And element has no transform\r\n if (!m) {\r\n if (target !== source) {\r\n BoundingRect.copy(target, source);\r\n }\r\n return;\r\n }\r\n // Fast path when there is no rotation in matrix.\r\n if (m[1] < 1e-5 && m[1] > -1e-5 && m[2] < 1e-5 && m[2] > -1e-5) {\r\n const sx = m[0];\r\n const sy = m[3];\r\n const tx = m[4];\r\n const ty = m[5];\r\n target.x = source.x * sx + tx;\r\n target.y = source.y * sy + ty;\r\n target.width = source.width * sx;\r\n target.height = source.height * sy;\r\n if (target.width < 0) {\r\n target.x += target.width;\r\n target.width = -target.width;\r\n }\r\n if (target.height < 0) {\r\n target.y += target.height;\r\n target.height = -target.height;\r\n }\r\n return;\r\n }\r\n\r\n // source and target can be same instance.\r\n lt.x = lb.x = source.x;\r\n lt.y = rt.y = source.y;\r\n rb.x = rt.x = source.x + source.width;\r\n rb.y = lb.y = source.y + source.height;\r\n\r\n lt.transform(m);\r\n rt.transform(m);\r\n rb.transform(m);\r\n lb.transform(m);\r\n\r\n target.x = mathMin(lt.x, rb.x, lb.x, rt.x);\r\n target.y = mathMin(lt.y, rb.y, lb.y, rt.y);\r\n const maxX = mathMax(lt.x, rb.x, lb.x, rt.x);\r\n const maxY = mathMax(lt.y, rb.y, lb.y, rt.y);\r\n target.width = maxX - target.x;\r\n target.height = maxY - target.y;\r\n }\r\n}\r\n\r\n\r\nexport type RectLike = {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n}\r\n\r\nexport default BoundingRect;","import * as util from './core/util';\nimport * as vec2 from './core/vector';\nimport Draggable from './mixin/Draggable';\nimport Eventful from './core/Eventful';\nimport * as eventTool from './core/event';\nimport {GestureMgr} from './core/GestureMgr';\nimport Displayable from './graphic/Displayable';\nimport {PainterBase} from './PainterBase';\nimport HandlerDomProxy, { HandlerProxyInterface } from './dom/HandlerProxy';\nimport { ZRRawEvent, ZRPinchEvent, ElementEventName, ElementEventNameWithOn, ZRRawTouchEvent } from './core/types';\nimport Storage from './Storage';\nimport Element, {ElementEvent} from './Element';\nimport CanvasPainter from './canvas/Painter';\nimport BoundingRect from './core/BoundingRect';\n\n/**\n * [The interface between `Handler` and `HandlerProxy`]:\n *\n * The default `HandlerProxy` only support the common standard web environment\n * (e.g., standalone browser, headless browser, embed browser in mobild APP, ...).\n * But `HandlerProxy` can be replaced to support more non-standard environment\n * (e.g., mini app), or to support more feature that the default `HandlerProxy`\n * not provided (like echarts-gl did).\n * So the interface between `Handler` and `HandlerProxy` should be stable. Do not\n * make break changes util inevitable. The interface include the public methods\n * of `Handler` and the events listed in `handlerNames` below, by which `HandlerProxy`\n * drives `Handler`.\n */\n\n/**\n * [DRAG_OUTSIDE]:\n *\n * That is, triggering `mousemove` and `mouseup` event when the pointer is out of the\n * zrender area when dragging. That is important for the improvement of the user experience\n * when dragging something near the boundary without being terminated unexpectedly.\n *\n * We originally consider to introduce new events like `pagemovemove` and `pagemouseup`\n * to resolve this issue. But some drawbacks of it is described in\n * https://github.com/ecomfe/zrender/pull/536#issuecomment-560286899\n *\n * Instead, we referenced the specifications:\n * https://www.w3.org/TR/touch-events/#the-touchmove-event\n * https://www.w3.org/TR/2014/WD-DOM-Level-3-Events-20140925/#event-type-mousemove\n * where the the mousemove/touchmove can be continue to fire if the user began a drag\n * operation and the pointer has left the boundary. (for the mouse event, browsers\n * only do it on `document` and when the pointer has left the boundary of the browser.)\n *\n * So the default `HandlerProxy` supports this feature similarly: if it is in the dragging\n * state (see `pointerCapture` in `HandlerProxy`), the `mousemove` and `mouseup` continue\n * to fire until release the pointer. That is implemented by listen to those event on\n * `document`.\n * If we implement some other `HandlerProxy` only for touch device, that would be easier.\n * The touch event support this feature by default.\n * The term \"pointer capture\" is from the spec:\n * https://www.w3.org/TR/pointerevents2/#idl-def-element-setpointercapture-pointerid\n *\n * Note:\n * There might be some cases that the mouse event can not be received on `document`.\n * For example,\n * (A) When `useCapture` is not supported and some user defined event listeners on the ancestor\n * of zr dom throw Error.\n * (B) When `useCapture` is not supported and some user defined event listeners on the ancestor of\n * zr dom call `stopPropagation`.\n * In these cases, the `mousemove` event might be keep triggering event when the mouse is released.\n * We try to reduce the side-effect in those cases, that is, use `isOutsideBoundary` to prevent\n * it from do anything (especially, `findHover`).\n * (`useCapture` mean, `addEvnetListener(listener, {capture: true})`, althought it may not be\n * suppported in some environments.)\n *\n * Note:\n * If `HandlerProxy` listens to `document` with `useCapture`, `HandlerProxy` needs to\n * prevent user-registered-handler from calling `stopPropagation` and `preventDefault`\n * when the `event.target` is not a zrender dom element. Otherwise the user-registered-handler\n * may be able to prevent other elements (that not relevant to zrender) in the web page from receiving\n * dom events.\n */\n\nconst SILENT = 'silent';\n\nfunction makeEventPacket(eveType: ElementEventName, targetInfo: {\n target?: Element\n topTarget?: Element\n}, event: ZRRawEvent): ElementEvent {\n return {\n type: eveType,\n event: event,\n // target can only be an element that is not silent.\n target: targetInfo.target,\n // topTarget can be a silent element.\n topTarget: targetInfo.topTarget,\n cancelBubble: false,\n offsetX: event.zrX,\n offsetY: event.zrY,\n gestureEvent: (event as ZRPinchEvent).gestureEvent,\n pinchX: (event as ZRPinchEvent).pinchX,\n pinchY: (event as ZRPinchEvent).pinchY,\n pinchScale: (event as ZRPinchEvent).pinchScale,\n wheelDelta: event.zrDelta,\n zrByTouch: event.zrByTouch,\n which: event.which,\n stop: stopEvent\n };\n}\n\nfunction stopEvent(this: ElementEvent) {\n eventTool.stop(this.event);\n}\n\nclass EmptyProxy extends Eventful {\n handler: Handler = null\n dispose() {}\n setCursor() {}\n}\n\nclass HoveredResult {\n x: number\n y: number\n target: Displayable\n topTarget: Displayable\n constructor(x?: number, y?: number) {\n this.x = x;\n this.y = y;\n }\n}\n\nconst handlerNames = [\n 'click', 'dblclick', 'mousewheel', 'mouseout',\n 'mouseup', 'mousedown', 'mousemove', 'contextmenu'\n];\n\ntype HandlerName = 'click' |'dblclick' |'mousewheel' |'mouseout' |\n 'mouseup' |'mousedown' |'mousemove' |'contextmenu';\n\nconst tmpRect = new BoundingRect(0, 0, 0, 0);\n\n// TODO draggable\nclass Handler extends Eventful {\n\n storage: Storage\n painter: PainterBase\n painterRoot: HTMLElement\n\n proxy: HandlerProxyInterface\n\n private _hovered = new HoveredResult(0, 0)\n\n private _gestureMgr: GestureMgr\n\n private _draggingMgr: Draggable\n\n private _pointerSize: number\n\n _downEl: Element\n _upEl: Element\n _downPoint: [number, number]\n\n constructor(\n storage: Storage,\n painter: PainterBase,\n proxy: HandlerProxyInterface,\n painterRoot: HTMLElement,\n pointerSize: number\n ) {\n super();\n\n this.storage = storage;\n\n this.painter = painter;\n\n this.painterRoot = painterRoot;\n\n this._pointerSize = pointerSize;\n\n proxy = proxy || new EmptyProxy();\n\n /**\n * Proxy of event. can be Dom, WebGLSurface, etc.\n */\n this.proxy = null;\n\n this.setHandlerProxy(proxy);\n\n this._draggingMgr = new Draggable(this);\n }\n\n setHandlerProxy(proxy: HandlerProxyInterface) {\n if (this.proxy) {\n this.proxy.dispose();\n }\n\n if (proxy) {\n util.each(handlerNames, function (name) {\n proxy.on && proxy.on(name, this[name as HandlerName], this);\n }, this);\n // Attach handler\n proxy.handler = this;\n }\n this.proxy = proxy;\n }\n\n mousemove(event: ZRRawEvent) {\n const x = event.zrX;\n const y = event.zrY;\n\n const isOutside = isOutsideBoundary(this, x, y);\n\n let lastHovered = this._hovered;\n let lastHoveredTarget = lastHovered.target;\n\n // If lastHoveredTarget is removed from zr (detected by '__zr') by some API call\n // (like 'setOption' or 'dispatchAction') in event handlers, we should find\n // lastHovered again here. Otherwise 'mouseout' can not be triggered normally.\n // See #6198.\n if (lastHoveredTarget && !lastHoveredTarget.__zr) {\n lastHovered = this.findHover(lastHovered.x, lastHovered.y);\n lastHoveredTarget = lastHovered.target;\n }\n\n const hovered = this._hovered = isOutside ? new HoveredResult(x, y) : this.findHover(x, y);\n const hoveredTarget = hovered.target;\n\n const proxy = this.proxy;\n proxy.setCursor && proxy.setCursor(hoveredTarget ? hoveredTarget.cursor : 'default');\n\n // Mouse out on previous hovered element\n if (lastHoveredTarget && hoveredTarget !== lastHoveredTarget) {\n this.dispatchToElement(lastHovered, 'mouseout', event);\n }\n\n // Mouse moving on one element\n this.dispatchToElement(hovered, 'mousemove', event);\n\n // Mouse over on a new element\n if (hoveredTarget && hoveredTarget !== lastHoveredTarget) {\n this.dispatchToElement(hovered, 'mouseover', event);\n }\n }\n\n mouseout(event: ZRRawEvent) {\n const eventControl = event.zrEventControl;\n\n if (eventControl !== 'only_globalout') {\n this.dispatchToElement(this._hovered, 'mouseout', event);\n }\n\n if (eventControl !== 'no_globalout') {\n // FIXME: if the pointer moving from the extra doms to realy \"outside\",\n // the `globalout` should have been triggered. But currently not.\n this.trigger('globalout', {type: 'globalout', event: event});\n }\n }\n\n /**\n * Resize\n */\n resize() {\n this._hovered = new HoveredResult(0, 0);\n }\n\n /**\n * Dispatch event\n */\n dispatch(eventName: HandlerName, eventArgs?: any) {\n const handler = this[eventName];\n handler && handler.call(this, eventArgs);\n }\n\n /**\n * Dispose\n */\n dispose() {\n\n this.proxy.dispose();\n\n this.storage = null;\n this.proxy = null;\n this.painter = null;\n }\n\n /**\n * 设置默认的cursor style\n * @param cursorStyle 例如 crosshair,默认为 'default'\n */\n setCursorStyle(cursorStyle: string) {\n const proxy = this.proxy;\n proxy.setCursor && proxy.setCursor(cursorStyle);\n }\n\n /**\n * 事件分发代理\n *\n * @private\n * @param {Object} targetInfo {target, topTarget} 目标图形元素\n * @param {string} eventName 事件名称\n * @param {Object} event 事件对象\n */\n dispatchToElement(targetInfo: {\n target?: Element\n topTarget?: Element\n }, eventName: ElementEventName, event: ZRRawEvent) {\n\n targetInfo = targetInfo || {};\n\n let el = targetInfo.target as Element;\n if (el && el.silent) {\n return;\n }\n const eventKey = ('on' + eventName) as ElementEventNameWithOn;\n const eventPacket = makeEventPacket(eventName, targetInfo, event);\n\n while (el) {\n el[eventKey]\n && (eventPacket.cancelBubble = !!el[eventKey].call(el, eventPacket));\n\n el.trigger(eventName, eventPacket);\n\n // Bubble to the host if on the textContent.\n // PENDING\n el = el.__hostTarget ? el.__hostTarget : el.parent;\n\n if (eventPacket.cancelBubble) {\n break;\n }\n }\n\n if (!eventPacket.cancelBubble) {\n // 冒泡到顶级 zrender 对象\n this.trigger(eventName, eventPacket);\n // 分发事件到用户自定义层\n // 用户有可能在全局 click 事件中 dispose,所以需要判断下 painter 是否存在\n if (this.painter && (this.painter as CanvasPainter).eachOtherLayer) {\n (this.painter as CanvasPainter).eachOtherLayer(function (layer) {\n if (typeof (layer[eventKey]) === 'function') {\n layer[eventKey].call(layer, eventPacket);\n }\n if (layer.trigger) {\n layer.trigger(eventName, eventPacket);\n }\n });\n }\n }\n }\n\n findHover(x: number, y: number, exclude?: Displayable): HoveredResult {\n const list = this.storage.getDisplayList();\n const out = new HoveredResult(x, y);\n setHoverTarget(list, out, x, y, exclude);\n\n if (this._pointerSize && !out.target) {\n /**\n * If no element at pointer position, check intersection with\n * elements with pointer enlarged by target size.\n */\n const candidates: Displayable[] = [];\n const pointerSize = this._pointerSize;\n const targetSizeHalf = pointerSize / 2;\n const pointerRect = new BoundingRect(x - targetSizeHalf, y - targetSizeHalf, pointerSize, pointerSize);\n\n for (let i = list.length - 1; i >= 0; i--) {\n const el = list[i];\n if (el !== exclude\n && !el.ignore\n && !el.ignoreCoarsePointer\n // If an element ignores, its textContent should also ignore.\n // TSpan's parent is not a Group but a ZRText.\n // See Text.js _getOrCreateChild\n && (!el.parent || !(el.parent as any).ignoreCoarsePointer)\n ) {\n tmpRect.copy(el.getBoundingRect());\n if (el.transform) {\n tmpRect.applyTransform(el.transform);\n }\n if (tmpRect.intersect(pointerRect)) {\n candidates.push(el);\n }\n }\n }\n\n /**\n * If there are elements whose bounding boxes are near the pointer,\n * use the most top one that intersects with the enlarged pointer.\n */\n if (candidates.length) {\n const rStep = 4;\n const thetaStep = Math.PI / 12;\n const PI2 = Math.PI * 2;\n for (let r = 0; r < targetSizeHalf; r += rStep) {\n for (let theta = 0; theta < PI2; theta += thetaStep) {\n const x1 = x + r * Math.cos(theta);\n const y1 = y + r * Math.sin(theta);\n setHoverTarget(candidates, out, x1, y1, exclude);\n if (out.target) {\n return out;\n }\n }\n }\n }\n }\n\n return out;\n }\n\n processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change') {\n if (!this._gestureMgr) {\n this._gestureMgr = new GestureMgr();\n }\n const gestureMgr = this._gestureMgr;\n\n stage === 'start' && gestureMgr.clear();\n\n const gestureInfo = gestureMgr.recognize(\n event as ZRRawTouchEvent,\n this.findHover(event.zrX, event.zrY, null).target,\n (this.proxy as HandlerDomProxy).dom\n );\n\n stage === 'end' && gestureMgr.clear();\n\n // Do not do any preventDefault here. Upper application do that if necessary.\n if (gestureInfo) {\n const type = gestureInfo.type;\n (event as ZRPinchEvent).gestureEvent = type;\n\n let res = new HoveredResult();\n res.target = gestureInfo.target;\n this.dispatchToElement(res, type as ElementEventName, gestureInfo.event as ZRRawEvent);\n }\n }\n\n click: (event: ZRRawEvent) => void\n mousedown: (event: ZRRawEvent) => void\n mouseup: (event: ZRRawEvent) => void\n mousewheel: (event: ZRRawEvent) => void\n dblclick: (event: ZRRawEvent) => void\n contextmenu: (event: ZRRawEvent) => void\n}\n\n// Common handlers\nutil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name: HandlerName) {\n Handler.prototype[name] = function (event) {\n const x = event.zrX;\n const y = event.zrY;\n const isOutside = isOutsideBoundary(this, x, y);\n\n let hovered;\n let hoveredTarget;\n\n if (name !== 'mouseup' || !isOutside) {\n // Find hover again to avoid click event is dispatched manually. Or click is triggered without mouseover\n hovered = this.findHover(x, y);\n hoveredTarget = hovered.target;\n }\n\n if (name === 'mousedown') {\n this._downEl = hoveredTarget;\n this._downPoint = [event.zrX, event.zrY];\n // In case click triggered before mouseup\n this._upEl = hoveredTarget;\n }\n else if (name === 'mouseup') {\n this._upEl = hoveredTarget;\n }\n else if (name === 'click') {\n if (this._downEl !== this._upEl\n // Original click event is triggered on the whole canvas element,\n // including the case that `mousedown` - `mousemove` - `mouseup`,\n // which should be filtered, otherwise it will bring trouble to\n // pan and zoom.\n || !this._downPoint\n // Arbitrary value\n || vec2.dist(this._downPoint, [event.zrX, event.zrY]) > 4\n ) {\n return;\n }\n this._downPoint = null;\n }\n\n this.dispatchToElement(hovered, name, event);\n };\n});\n\nfunction isHover(displayable: Displayable, x: number, y: number) {\n if (displayable[displayable.rectHover ? 'rectContain' : 'contain'](x, y)) {\n let el: Element = displayable;\n let isSilent;\n let ignoreClip = false;\n while (el) {\n // Ignore clip on any ancestors.\n if (el.ignoreClip) {\n ignoreClip = true;\n }\n if (!ignoreClip) {\n let clipPath = el.getClipPath();\n // If clipped by ancestor.\n // FIXME: If clipPath has neither stroke nor fill,\n // el.clipPath.contain(x, y) will always return false.\n if (clipPath && !clipPath.contain(x, y)) {\n return false;\n }\n }\n if (el.silent) {\n isSilent = true;\n }\n // Consider when el is textContent, also need to be silent\n // if any of its host el and its ancestors is silent.\n const hostEl = el.__hostTarget;\n el = hostEl ? hostEl : el.parent;\n }\n return isSilent ? SILENT : true;\n }\n\n return false;\n}\n\nfunction setHoverTarget(\n list: Displayable[],\n out: HoveredResult,\n x: number,\n y: number,\n exclude: Displayable\n) {\n for (let i = list.length - 1; i >= 0; i--) {\n const el = list[i];\n let hoverCheckResult;\n if (el !== exclude\n // getDisplayList may include ignored item in VML mode\n && !el.ignore\n && (hoverCheckResult = isHover(el, x, y))\n ) {\n !out.topTarget && (out.topTarget = el);\n if (hoverCheckResult !== SILENT) {\n out.target = el;\n break;\n }\n }\n }\n}\n\n/**\n * See [DRAG_OUTSIDE].\n */\nfunction isOutsideBoundary(handlerInstance: Handler, x: number, y: number) {\n const painter = handlerInstance.painter;\n return x < 0 || x > painter.getWidth() || y < 0 || y > painter.getHeight();\n}\n\nexport default Handler;\n","// https://github.com/mziccard/node-timsort\nconst DEFAULT_MIN_MERGE = 32;\n\nconst DEFAULT_MIN_GALLOPING = 7;\n\ntype CompareFunc =(a: T, b: T) => number\n\nfunction minRunLength(n: number): number {\n var r = 0;\n\n while (n >= DEFAULT_MIN_MERGE) {\n r |= n & 1;\n n >>= 1;\n }\n\n return n + r;\n}\n\nfunction makeAscendingRun(array: T[], lo: number, hi: number, compare: CompareFunc) {\n var runHi = lo + 1;\n\n if (runHi === hi) {\n return 1;\n }\n\n if (compare(array[runHi++], array[lo]) < 0) {\n while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {\n runHi++;\n }\n\n reverseRun(array, lo, runHi);\n }\n else {\n while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {\n runHi++;\n }\n }\n\n return runHi - lo;\n}\n\nfunction reverseRun(array: T[], lo: number, hi: number) {\n hi--;\n\n while (lo < hi) {\n var t = array[lo];\n array[lo++] = array[hi];\n array[hi--] = t;\n }\n}\n\nfunction binaryInsertionSort(array: T[], lo: number, hi: number, start: number, compare: CompareFunc) {\n if (start === lo) {\n start++;\n }\n\n for (; start < hi; start++) {\n var pivot = array[start];\n\n var left = lo;\n var right = start;\n var mid;\n\n while (left < right) {\n mid = left + right >>> 1;\n\n if (compare(pivot, array[mid]) < 0) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n }\n\n var n = start - left;\n\n switch (n) {\n case 3:\n array[left + 3] = array[left + 2];\n\n case 2:\n array[left + 2] = array[left + 1];\n\n case 1:\n array[left + 1] = array[left];\n break;\n default:\n while (n > 0) {\n array[left + n] = array[left + n - 1];\n n--;\n }\n }\n\n array[left] = pivot;\n }\n}\n\nfunction gallopLeft(value: T, array: T[], start: number, length: number, hint: number, compare: CompareFunc) {\n var lastOffset = 0;\n var maxOffset = 0;\n var offset = 1;\n\n if (compare(value, array[start + hint]) > 0) {\n maxOffset = length - hint;\n\n while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n lastOffset += hint;\n offset += hint;\n }\n else {\n maxOffset = hint + 1;\n while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n var tmp = lastOffset;\n lastOffset = hint - offset;\n offset = hint - tmp;\n }\n\n lastOffset++;\n while (lastOffset < offset) {\n var m = lastOffset + (offset - lastOffset >>> 1);\n\n if (compare(value, array[start + m]) > 0) {\n lastOffset = m + 1;\n }\n else {\n offset = m;\n }\n }\n return offset;\n}\n\nfunction gallopRight(value: T, array: T[], start: number, length: number, hint: number, compare: CompareFunc) {\n var lastOffset = 0;\n var maxOffset = 0;\n var offset = 1;\n\n if (compare(value, array[start + hint]) < 0) {\n maxOffset = hint + 1;\n\n while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n var tmp = lastOffset;\n lastOffset = hint - offset;\n offset = hint - tmp;\n }\n else {\n maxOffset = length - hint;\n\n while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n lastOffset += hint;\n offset += hint;\n }\n\n lastOffset++;\n\n while (lastOffset < offset) {\n var m = lastOffset + (offset - lastOffset >>> 1);\n\n if (compare(value, array[start + m]) < 0) {\n offset = m;\n }\n else {\n lastOffset = m + 1;\n }\n }\n\n return offset;\n}\n\nfunction TimSort(array: T[], compare: CompareFunc) {\n let minGallop = DEFAULT_MIN_GALLOPING;\n let runStart: number[];\n let runLength: number[];\n let stackSize = 0;\n\n var tmp: T[] = [];\n\n runStart = [];\n runLength = [];\n\n function pushRun(_runStart: number, _runLength: number) {\n runStart[stackSize] = _runStart;\n runLength[stackSize] = _runLength;\n stackSize += 1;\n }\n\n function mergeRuns() {\n while (stackSize > 1) {\n var n = stackSize - 2;\n\n if (\n (n >= 1 && runLength[n - 1] <= runLength[n] + runLength[n + 1])\n || (n >= 2 && runLength[n - 2] <= runLength[n] + runLength[n - 1])\n ) {\n if (runLength[n - 1] < runLength[n + 1]) {\n n--;\n }\n }\n else if (runLength[n] > runLength[n + 1]) {\n break;\n }\n mergeAt(n);\n }\n }\n\n function forceMergeRuns() {\n while (stackSize > 1) {\n var n = stackSize - 2;\n\n if (n > 0 && runLength[n - 1] < runLength[n + 1]) {\n n--;\n }\n\n mergeAt(n);\n }\n }\n\n function mergeAt(i: number) {\n var start1 = runStart[i];\n var length1 = runLength[i];\n var start2 = runStart[i + 1];\n var length2 = runLength[i + 1];\n\n runLength[i] = length1 + length2;\n\n if (i === stackSize - 3) {\n runStart[i + 1] = runStart[i + 2];\n runLength[i + 1] = runLength[i + 2];\n }\n\n stackSize--;\n\n var k = gallopRight(array[start2], array, start1, length1, 0, compare);\n start1 += k;\n length1 -= k;\n\n if (length1 === 0) {\n return;\n }\n\n length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);\n\n if (length2 === 0) {\n return;\n }\n\n if (length1 <= length2) {\n mergeLow(start1, length1, start2, length2);\n }\n else {\n mergeHigh(start1, length1, start2, length2);\n }\n }\n\n function mergeLow(start1: number, length1: number, start2: number, length2: number) {\n var i = 0;\n\n for (i = 0; i < length1; i++) {\n tmp[i] = array[start1 + i];\n }\n\n var cursor1 = 0;\n var cursor2 = start2;\n var dest = start1;\n\n array[dest++] = array[cursor2++];\n\n if (--length2 === 0) {\n for (i = 0; i < length1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n return;\n }\n\n if (length1 === 1) {\n for (i = 0; i < length2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n array[dest + length2] = tmp[cursor1];\n return;\n }\n\n var _minGallop = minGallop;\n var count1;\n var count2;\n var exit;\n\n while (1) {\n count1 = 0;\n count2 = 0;\n exit = false;\n\n do {\n if (compare(array[cursor2], tmp[cursor1]) < 0) {\n array[dest++] = array[cursor2++];\n count2++;\n count1 = 0;\n\n if (--length2 === 0) {\n exit = true;\n break;\n }\n }\n else {\n array[dest++] = tmp[cursor1++];\n count1++;\n count2 = 0;\n if (--length1 === 1) {\n exit = true;\n break;\n }\n }\n } while ((count1 | count2) < _minGallop);\n\n if (exit) {\n break;\n }\n\n do {\n count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);\n\n if (count1 !== 0) {\n for (i = 0; i < count1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n\n dest += count1;\n cursor1 += count1;\n length1 -= count1;\n if (length1 <= 1) {\n exit = true;\n break;\n }\n }\n\n array[dest++] = array[cursor2++];\n\n if (--length2 === 0) {\n exit = true;\n break;\n }\n\n count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);\n\n if (count2 !== 0) {\n for (i = 0; i < count2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n\n dest += count2;\n cursor2 += count2;\n length2 -= count2;\n\n if (length2 === 0) {\n exit = true;\n break;\n }\n }\n array[dest++] = tmp[cursor1++];\n\n if (--length1 === 1) {\n exit = true;\n break;\n }\n\n _minGallop--;\n } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);\n\n if (exit) {\n break;\n }\n\n if (_minGallop < 0) {\n _minGallop = 0;\n }\n\n _minGallop += 2;\n }\n\n minGallop = _minGallop;\n\n minGallop < 1 && (minGallop = 1);\n\n if (length1 === 1) {\n for (i = 0; i < length2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n array[dest + length2] = tmp[cursor1];\n }\n else if (length1 === 0) {\n throw new Error();\n }\n else {\n for (i = 0; i < length1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n }\n }\n\n function mergeHigh(start1: number, length1: number, start2: number, length2: number) {\n var i = 0;\n\n for (i = 0; i < length2; i++) {\n tmp[i] = array[start2 + i];\n }\n\n var cursor1 = start1 + length1 - 1;\n var cursor2 = length2 - 1;\n var dest = start2 + length2 - 1;\n var customCursor = 0;\n var customDest = 0;\n\n array[dest--] = array[cursor1--];\n\n if (--length1 === 0) {\n customCursor = dest - (length2 - 1);\n\n for (i = 0; i < length2; i++) {\n array[customCursor + i] = tmp[i];\n }\n\n return;\n }\n\n if (length2 === 1) {\n dest -= length1;\n cursor1 -= length1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = length1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n array[dest] = tmp[cursor2];\n return;\n }\n\n var _minGallop = minGallop;\n\n while (true) {\n var count1 = 0;\n var count2 = 0;\n var exit = false;\n\n do {\n if (compare(tmp[cursor2], array[cursor1]) < 0) {\n array[dest--] = array[cursor1--];\n count1++;\n count2 = 0;\n if (--length1 === 0) {\n exit = true;\n break;\n }\n }\n else {\n array[dest--] = tmp[cursor2--];\n count2++;\n count1 = 0;\n if (--length2 === 1) {\n exit = true;\n break;\n }\n }\n } while ((count1 | count2) < _minGallop);\n\n if (exit) {\n break;\n }\n\n do {\n count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);\n\n if (count1 !== 0) {\n dest -= count1;\n cursor1 -= count1;\n length1 -= count1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = count1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n if (length1 === 0) {\n exit = true;\n break;\n }\n }\n\n array[dest--] = tmp[cursor2--];\n\n if (--length2 === 1) {\n exit = true;\n break;\n }\n\n count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);\n\n if (count2 !== 0) {\n dest -= count2;\n cursor2 -= count2;\n length2 -= count2;\n customDest = dest + 1;\n customCursor = cursor2 + 1;\n\n for (i = 0; i < count2; i++) {\n array[customDest + i] = tmp[customCursor + i];\n }\n\n if (length2 <= 1) {\n exit = true;\n break;\n }\n }\n\n array[dest--] = array[cursor1--];\n\n if (--length1 === 0) {\n exit = true;\n break;\n }\n\n _minGallop--;\n } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);\n\n if (exit) {\n break;\n }\n\n if (_minGallop < 0) {\n _minGallop = 0;\n }\n\n _minGallop += 2;\n }\n\n minGallop = _minGallop;\n\n if (minGallop < 1) {\n minGallop = 1;\n }\n\n if (length2 === 1) {\n dest -= length1;\n cursor1 -= length1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = length1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n array[dest] = tmp[cursor2];\n }\n else if (length2 === 0) {\n throw new Error();\n // throw new Error('mergeHigh preconditions were not respected');\n }\n else {\n customCursor = dest - (length2 - 1);\n for (i = 0; i < length2; i++) {\n array[customCursor + i] = tmp[i];\n }\n }\n }\n\n return {\n mergeRuns,\n forceMergeRuns,\n pushRun\n };\n}\n\nexport default function sort(\n array: T[],\n compare: CompareFunc,\n lo?: number, hi?: number\n) {\n if (!lo) {\n lo = 0;\n }\n if (!hi) {\n hi = array.length;\n }\n\n var remaining = hi - lo;\n\n if (remaining < 2) {\n return;\n }\n\n var runLength = 0;\n\n if (remaining < DEFAULT_MIN_MERGE) {\n runLength = makeAscendingRun(array, lo, hi, compare);\n binaryInsertionSort(array, lo, hi, lo + runLength, compare);\n return;\n }\n\n var ts = TimSort(array, compare);\n\n var minRun = minRunLength(remaining);\n\n do {\n runLength = makeAscendingRun(array, lo, hi, compare);\n if (runLength < minRun) {\n var force = remaining;\n if (force > minRun) {\n force = minRun;\n }\n\n binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);\n runLength = force;\n }\n\n ts.pushRun(lo, runLength);\n ts.mergeRuns();\n\n remaining -= runLength;\n lo += runLength;\n } while (remaining !== 0);\n\n ts.forceMergeRuns();\n}\n","// Bit masks to check which parts of element needs to be updated.\r\nexport const REDRAW_BIT = 1;\r\nexport const STYLE_CHANGED_BIT = 2;\r\nexport const SHAPE_CHANGED_BIT = 4;\r\n","import * as util from './core/util';\r\nimport Group, { GroupLike } from './graphic/Group';\r\nimport Element from './Element';\r\n\r\n// Use timsort because in most case elements are partially sorted\r\n// https://jsfiddle.net/pissang/jr4x7mdm/8/\r\nimport timsort from './core/timsort';\r\nimport Displayable from './graphic/Displayable';\r\nimport Path from './graphic/Path';\r\nimport { REDRAW_BIT } from './graphic/constants';\r\n\r\nlet invalidZErrorLogged = false;\r\nfunction logInvalidZError() {\r\n if (invalidZErrorLogged) {\r\n return;\r\n }\r\n invalidZErrorLogged = true;\r\n console.warn('z / z2 / zlevel of displayable is invalid, which may cause unexpected errors');\r\n}\r\n\r\nfunction shapeCompareFunc(a: Displayable, b: Displayable) {\r\n if (a.zlevel === b.zlevel) {\r\n if (a.z === b.z) {\r\n return a.z2 - b.z2;\r\n }\r\n return a.z - b.z;\r\n }\r\n return a.zlevel - b.zlevel;\r\n}\r\n\r\nexport default class Storage {\r\n\r\n private _roots: Element[] = []\r\n\r\n private _displayList: Displayable[] = []\r\n\r\n private _displayListLen = 0\r\n\r\n traverse(\r\n cb: (this: T, el: Element) => void,\r\n context?: T\r\n ) {\r\n for (let i = 0; i < this._roots.length; i++) {\r\n this._roots[i].traverse(cb, context);\r\n }\r\n }\r\n\r\n /**\r\n * get a list of elements to be rendered\r\n *\r\n * @param {boolean} update whether to update elements before return\r\n * @param {DisplayParams} params options\r\n * @return {Displayable[]} a list of elements\r\n */\r\n getDisplayList(update?: boolean, includeIgnore?: boolean): Displayable[] {\r\n includeIgnore = includeIgnore || false;\r\n const displayList = this._displayList;\r\n // If displaylist is not created yet. Update force\r\n if (update || !displayList.length) {\r\n this.updateDisplayList(includeIgnore);\r\n }\r\n return displayList;\r\n }\r\n\r\n /**\r\n * 更新图形的绘制队列。\r\n * 每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,\r\n * 最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列\r\n */\r\n updateDisplayList(includeIgnore?: boolean) {\r\n this._displayListLen = 0;\r\n\r\n const roots = this._roots;\r\n const displayList = this._displayList;\r\n for (let i = 0, len = roots.length; i < len; i++) {\r\n this._updateAndAddDisplayable(roots[i], null, includeIgnore);\r\n }\r\n\r\n displayList.length = this._displayListLen;\r\n\r\n timsort(displayList, shapeCompareFunc);\r\n }\r\n\r\n private _updateAndAddDisplayable(\r\n el: Element,\r\n clipPaths: Path[],\r\n includeIgnore?: boolean\r\n ) {\r\n if (el.ignore && !includeIgnore) {\r\n return;\r\n }\r\n\r\n el.beforeUpdate();\r\n el.update();\r\n el.afterUpdate();\r\n\r\n const userSetClipPath = el.getClipPath();\r\n\r\n if (el.ignoreClip) {\r\n clipPaths = null;\r\n }\r\n else if (userSetClipPath) {\r\n\r\n // FIXME 效率影响\r\n if (clipPaths) {\r\n clipPaths = clipPaths.slice();\r\n }\r\n else {\r\n clipPaths = [];\r\n }\r\n\r\n let currentClipPath = userSetClipPath;\r\n let parentClipPath = el;\r\n // Recursively add clip path\r\n while (currentClipPath) {\r\n // clipPath 的变换是基于使用这个 clipPath 的元素\r\n // TODO: parent should be group type.\r\n currentClipPath.parent = parentClipPath as Group;\r\n currentClipPath.updateTransform();\r\n\r\n clipPaths.push(currentClipPath);\r\n\r\n parentClipPath = currentClipPath;\r\n currentClipPath = currentClipPath.getClipPath();\r\n }\r\n }\r\n\r\n // ZRText and Group and combining morphing Path may use children\r\n if ((el as GroupLike).childrenRef) {\r\n const children = (el as GroupLike).childrenRef();\r\n\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n\r\n // Force to mark as dirty if group is dirty\r\n if (el.__dirty) {\r\n child.__dirty |= REDRAW_BIT;\r\n }\r\n\r\n this._updateAndAddDisplayable(child, clipPaths, includeIgnore);\r\n }\r\n\r\n // Mark group clean here\r\n el.__dirty = 0;\r\n\r\n }\r\n else {\r\n const disp = el as Displayable;\r\n // Element is displayable\r\n if (clipPaths && clipPaths.length) {\r\n disp.__clipPaths = clipPaths;\r\n }\r\n else if (disp.__clipPaths && disp.__clipPaths.length > 0) {\r\n disp.__clipPaths = [];\r\n }\r\n\r\n // Avoid invalid z, z2, zlevel cause sorting error.\r\n if (isNaN(disp.z)) {\r\n logInvalidZError();\r\n disp.z = 0;\r\n }\r\n if (isNaN(disp.z2)) {\r\n logInvalidZError();\r\n disp.z2 = 0;\r\n }\r\n if (isNaN(disp.zlevel)) {\r\n logInvalidZError();\r\n disp.zlevel = 0;\r\n }\r\n\r\n this._displayList[this._displayListLen++] = disp;\r\n }\r\n\r\n // Add decal\r\n const decalEl = (el as Path).getDecalElement && (el as Path).getDecalElement();\r\n if (decalEl) {\r\n this._updateAndAddDisplayable(decalEl, clipPaths, includeIgnore);\r\n }\r\n\r\n // Add attached text element and guide line.\r\n const textGuide = el.getTextGuideLine();\r\n if (textGuide) {\r\n this._updateAndAddDisplayable(textGuide, clipPaths, includeIgnore);\r\n }\r\n\r\n const textEl = el.getTextContent();\r\n if (textEl) {\r\n this._updateAndAddDisplayable(textEl, clipPaths, includeIgnore);\r\n }\r\n }\r\n\r\n /**\r\n * 添加图形(Displayable)或者组(Group)到根节点\r\n */\r\n addRoot(el: Element) {\r\n if (el.__zr && el.__zr.storage === this) {\r\n return;\r\n }\r\n\r\n this._roots.push(el);\r\n }\r\n\r\n /**\r\n * 删除指定的图形(Displayable)或者组(Group)\r\n * @param el\r\n */\r\n delRoot(el: Element | Element[]) {\r\n\r\n if (el instanceof Array) {\r\n for (let i = 0, l = el.length; i < l; i++) {\r\n this.delRoot(el[i]);\r\n }\r\n return;\r\n }\r\n\r\n const idx = util.indexOf(this._roots, el);\r\n if (idx >= 0) {\r\n this._roots.splice(idx, 1);\r\n }\r\n }\r\n\r\n delAllRoots() {\r\n this._roots = [];\r\n this._displayList = [];\r\n this._displayListLen = 0;\r\n\r\n return;\r\n }\r\n\r\n getRoots() {\r\n return this._roots;\r\n }\r\n\r\n /**\r\n * 清空并且释放Storage\r\n */\r\n dispose() {\r\n this._displayList = null;\r\n this._roots = null;\r\n }\r\n\r\n displayableSortFunc = shapeCompareFunc\r\n}","import env from '../core/env';\r\n\r\ntype RequestAnimationFrameType = typeof window.requestAnimationFrame\r\n\r\nlet requestAnimationFrame: RequestAnimationFrameType;\r\n\r\nrequestAnimationFrame = (\r\n\tenv.hasGlobalWindow\r\n\t\t&& (\r\n\t\t\t(window.requestAnimationFrame && window.requestAnimationFrame.bind(window))\r\n\t\t\t// https://github.com/ecomfe/zrender/issues/189#issuecomment-224919809\r\n\t\t\t|| ((window as any).msRequestAnimationFrame && (window as any).msRequestAnimationFrame.bind(window))\r\n\t\t\t|| (window as any).mozRequestAnimationFrame\r\n\t\t\t// @ts-ignore\r\n\t\t\t|| window.webkitRequestAnimationFrame\r\n\t\t)\r\n) || function (func: Parameters[0]): number {\r\n\treturn setTimeout(func, 16) as any;\r\n};\r\n\r\nexport default requestAnimationFrame;\r\n","/**\r\n * 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js\r\n * @see http://sole.github.io/tween.js/examples/03_graphs.html\r\n * @exports zrender/animation/easing\r\n */\r\n\r\ntype easingFunc = (percent: number) => number;\r\n\r\nexport type AnimationEasing = keyof typeof easingFuncs | easingFunc;\r\n\r\nconst easingFuncs = {\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n linear(k: number) {\r\n return k;\r\n },\r\n\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticIn(k: number) {\r\n return k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticOut(k: number) {\r\n return k * (2 - k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k;\r\n }\r\n return -0.5 * (--k * (k - 2) - 1);\r\n },\r\n\r\n // 三次方的缓动(t^3)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicIn(k: number) {\r\n return k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicOut(k: number) {\r\n return --k * k * k + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k;\r\n }\r\n return 0.5 * ((k -= 2) * k * k + 2);\r\n },\r\n\r\n // 四次方的缓动(t^4)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticIn(k: number) {\r\n return k * k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticOut(k: number) {\r\n return 1 - (--k * k * k * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k * k;\r\n }\r\n return -0.5 * ((k -= 2) * k * k * k - 2);\r\n },\r\n\r\n // 五次方的缓动(t^5)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticIn(k: number) {\r\n return k * k * k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticOut(k: number) {\r\n return --k * k * k * k * k + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k * k * k;\r\n }\r\n return 0.5 * ((k -= 2) * k * k * k * k + 2);\r\n },\r\n\r\n // 正弦曲线的缓动(sin(t))\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalIn(k: number) {\r\n return 1 - Math.cos(k * Math.PI / 2);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalOut(k: number) {\r\n return Math.sin(k * Math.PI / 2);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalInOut(k: number) {\r\n return 0.5 * (1 - Math.cos(Math.PI * k));\r\n },\r\n\r\n // 指数曲线的缓动(2^t)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialIn(k: number) {\r\n return k === 0 ? 0 : Math.pow(1024, k - 1);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialOut(k: number) {\r\n return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialInOut(k: number) {\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if ((k *= 2) < 1) {\r\n return 0.5 * Math.pow(1024, k - 1);\r\n }\r\n return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);\r\n },\r\n\r\n // 圆形曲线的缓动(sqrt(1-t^2))\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularIn(k: number) {\r\n return 1 - Math.sqrt(1 - k * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularOut(k: number) {\r\n return Math.sqrt(1 - (--k * k));\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return -0.5 * (Math.sqrt(1 - k * k) - 1);\r\n }\r\n return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);\r\n },\r\n\r\n // 创建类似于弹簧在停止前来回振荡的动画\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticIn(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n return -(a * Math.pow(2, 10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p));\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticOut(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n return (a * Math.pow(2, -10 * k)\r\n * Math.sin((k - s) * (2 * Math.PI) / p) + 1);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticInOut(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n if ((k *= 2) < 1) {\r\n return -0.5 * (a * Math.pow(2, 10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p));\r\n }\r\n return a * Math.pow(2, -10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;\r\n\r\n },\r\n\r\n // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backIn(k: number) {\r\n let s = 1.70158;\r\n return k * k * ((s + 1) * k - s);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backOut(k: number) {\r\n let s = 1.70158;\r\n return --k * k * ((s + 1) * k + s) + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backInOut(k: number) {\r\n let s = 1.70158 * 1.525;\r\n if ((k *= 2) < 1) {\r\n return 0.5 * (k * k * ((s + 1) * k - s));\r\n }\r\n return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);\r\n },\r\n\r\n // 创建弹跳效果\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceIn(k: number) {\r\n return 1 - easingFuncs.bounceOut(1 - k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceOut(k: number) {\r\n if (k < (1 / 2.75)) {\r\n return 7.5625 * k * k;\r\n }\r\n else if (k < (2 / 2.75)) {\r\n return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;\r\n }\r\n else if (k < (2.5 / 2.75)) {\r\n return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;\r\n }\r\n else {\r\n return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;\r\n }\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceInOut(k: number) {\r\n if (k < 0.5) {\r\n return easingFuncs.bounceIn(k * 2) * 0.5;\r\n }\r\n return easingFuncs.bounceOut(k * 2 - 1) * 0.5 + 0.5;\r\n }\r\n};\r\n\r\n\r\nexport default easingFuncs;","/**\r\n * 曲线辅助模块\r\n */\r\n\r\nimport {\r\n create as v2Create,\r\n distSquare as v2DistSquare,\r\n VectorArray\r\n} from './vector';\r\n\r\nconst mathPow = Math.pow;\r\nconst mathSqrt = Math.sqrt;\r\n\r\nconst EPSILON = 1e-8;\r\nconst EPSILON_NUMERIC = 1e-4;\r\n\r\nconst THREE_SQRT = mathSqrt(3);\r\nconst ONE_THIRD = 1 / 3;\r\n\r\n// 临时变量\r\nconst _v0 = v2Create();\r\nconst _v1 = v2Create();\r\nconst _v2 = v2Create();\r\n\r\nfunction isAroundZero(val: number) {\r\n return val > -EPSILON && val < EPSILON;\r\n}\r\nfunction isNotAroundZero(val: number) {\r\n return val > EPSILON || val < -EPSILON;\r\n}\r\n/**\r\n * 计算三次贝塞尔值\r\n */\r\nexport function cubicAt(p0: number, p1: number, p2: number, p3: number, t: number): number {\r\n const onet = 1 - t;\r\n return onet * onet * (onet * p0 + 3 * t * p1)\r\n + t * t * (t * p3 + 3 * onet * p2);\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔导数值\r\n */\r\nexport function cubicDerivativeAt(p0: number, p1: number, p2: number, p3: number, t: number): number {\r\n const onet = 1 - t;\r\n return 3 * (\r\n ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet\r\n + (p3 - p2) * t * t\r\n );\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔方程根,使用盛金公式\r\n */\r\nexport function cubicRootAt(p0: number, p1: number, p2: number, p3: number, val: number, roots: number[]): number {\r\n // Evaluate roots of cubic functions\r\n const a = p3 + 3 * (p1 - p2) - p0;\r\n const b = 3 * (p2 - p1 * 2 + p0);\r\n const c = 3 * (p1 - p0);\r\n const d = p0 - val;\r\n\r\n const A = b * b - 3 * a * c;\r\n const B = b * c - 9 * a * d;\r\n const C = c * c - 3 * b * d;\r\n\r\n let n = 0;\r\n\r\n if (isAroundZero(A) && isAroundZero(B)) {\r\n if (isAroundZero(b)) {\r\n roots[0] = 0;\r\n }\r\n else {\r\n const t1 = -c / b; //t1, t2, t3, b is not zero\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = B * B - 4 * A * C;\r\n\r\n if (isAroundZero(disc)) {\r\n const K = B / A;\r\n const t1 = -b / a + K; // t1, a is not zero\r\n const t2 = -K / 2; // t2, t3\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n let Y1 = A * b + 1.5 * a * (-B + discSqrt);\r\n let Y2 = A * b + 1.5 * a * (-B - discSqrt);\r\n if (Y1 < 0) {\r\n Y1 = -mathPow(-Y1, ONE_THIRD);\r\n }\r\n else {\r\n Y1 = mathPow(Y1, ONE_THIRD);\r\n }\r\n if (Y2 < 0) {\r\n Y2 = -mathPow(-Y2, ONE_THIRD);\r\n }\r\n else {\r\n Y2 = mathPow(Y2, ONE_THIRD);\r\n }\r\n const t1 = (-b - (Y1 + Y2)) / (3 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n else {\r\n const T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));\r\n const theta = Math.acos(T) / 3;\r\n const ASqrt = mathSqrt(A);\r\n const tmp = Math.cos(theta);\r\n\r\n const t1 = (-b - 2 * ASqrt * tmp) / (3 * a);\r\n const t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);\r\n const t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n if (t3 >= 0 && t3 <= 1) {\r\n roots[n++] = t3;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔方程极限值的位置\r\n * @return 有效数目\r\n */\r\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number, extrema: number[]): number {\r\n const b = 6 * p2 - 12 * p1 + 6 * p0;\r\n const a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;\r\n const c = 3 * p1 - 3 * p0;\r\n\r\n let n = 0;\r\n if (isAroundZero(a)) {\r\n if (isNotAroundZero(b)) {\r\n const t1 = -c / b;\r\n if (t1 >= 0 && t1 <= 1) {\r\n extrema[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = b * b - 4 * a * c;\r\n if (isAroundZero(disc)) {\r\n extrema[0] = -b / (2 * a);\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n const t1 = (-b + discSqrt) / (2 * a);\r\n const t2 = (-b - discSqrt) / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n extrema[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n extrema[n++] = t2;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 细分三次贝塞尔曲线\r\n */\r\nexport function cubicSubdivide(p0: number, p1: number, p2: number, p3: number, t: number, out: number[]) {\r\n const p01 = (p1 - p0) * t + p0;\r\n const p12 = (p2 - p1) * t + p1;\r\n const p23 = (p3 - p2) * t + p2;\r\n\r\n const p012 = (p12 - p01) * t + p01;\r\n const p123 = (p23 - p12) * t + p12;\r\n\r\n const p0123 = (p123 - p012) * t + p012;\r\n // Seg0\r\n out[0] = p0;\r\n out[1] = p01;\r\n out[2] = p012;\r\n out[3] = p0123;\r\n // Seg1\r\n out[4] = p0123;\r\n out[5] = p123;\r\n out[6] = p23;\r\n out[7] = p3;\r\n}\r\n\r\n/**\r\n * 投射点到三次贝塞尔曲线上,返回投射距离。\r\n * 投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。\r\n */\r\nexport function cubicProjectPoint(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n x: number, y: number, out: VectorArray\r\n): number {\r\n // http://pomax.github.io/bezierinfo/#projections\r\n let t;\r\n let interval = 0.005;\r\n let d = Infinity;\r\n let prev;\r\n let next;\r\n let d1;\r\n let d2;\r\n\r\n _v0[0] = x;\r\n _v0[1] = y;\r\n\r\n // 先粗略估计一下可能的最小距离的 t 值\r\n // PENDING\r\n for (let _t = 0; _t < 1; _t += 0.05) {\r\n _v1[0] = cubicAt(x0, x1, x2, x3, _t);\r\n _v1[1] = cubicAt(y0, y1, y2, y3, _t);\r\n d1 = v2DistSquare(_v0, _v1);\r\n if (d1 < d) {\r\n t = _t;\r\n d = d1;\r\n }\r\n }\r\n d = Infinity;\r\n\r\n // At most 32 iteration\r\n for (let i = 0; i < 32; i++) {\r\n if (interval < EPSILON_NUMERIC) {\r\n break;\r\n }\r\n prev = t - interval;\r\n next = t + interval;\r\n // t - interval\r\n _v1[0] = cubicAt(x0, x1, x2, x3, prev);\r\n _v1[1] = cubicAt(y0, y1, y2, y3, prev);\r\n\r\n d1 = v2DistSquare(_v1, _v0);\r\n\r\n if (prev >= 0 && d1 < d) {\r\n t = prev;\r\n d = d1;\r\n }\r\n else {\r\n // t + interval\r\n _v2[0] = cubicAt(x0, x1, x2, x3, next);\r\n _v2[1] = cubicAt(y0, y1, y2, y3, next);\r\n d2 = v2DistSquare(_v2, _v0);\r\n\r\n if (next <= 1 && d2 < d) {\r\n t = next;\r\n d = d2;\r\n }\r\n else {\r\n interval *= 0.5;\r\n }\r\n }\r\n }\r\n // t\r\n if (out) {\r\n out[0] = cubicAt(x0, x1, x2, x3, t);\r\n out[1] = cubicAt(y0, y1, y2, y3, t);\r\n }\r\n // console.log(interval, i);\r\n return mathSqrt(d);\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔曲线长度\r\n */\r\nexport function cubicLength(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n iteration: number\r\n) {\r\n let px = x0;\r\n let py = y0;\r\n\r\n let d = 0;\r\n\r\n const step = 1 / iteration;\r\n\r\n for (let i = 1; i <= iteration; i++) {\r\n let t = i * step;\r\n const x = cubicAt(x0, x1, x2, x3, t);\r\n const y = cubicAt(y0, y1, y2, y3, t);\r\n\r\n const dx = x - px;\r\n const dy = y - py;\r\n\r\n d += Math.sqrt(dx * dx + dy * dy);\r\n\r\n px = x;\r\n py = y;\r\n }\r\n\r\n return d;\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔值\r\n */\r\nexport function quadraticAt(p0: number, p1: number, p2: number, t: number): number {\r\n const onet = 1 - t;\r\n return onet * (onet * p0 + 2 * t * p1) + t * t * p2;\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔导数值\r\n */\r\nexport function quadraticDerivativeAt(p0: number, p1: number, p2: number, t: number): number {\r\n return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔方程根\r\n * @return 有效根数目\r\n */\r\nexport function quadraticRootAt(p0: number, p1: number, p2: number, val: number, roots: number[]): number {\r\n const a = p0 - 2 * p1 + p2;\r\n const b = 2 * (p1 - p0);\r\n const c = p0 - val;\r\n\r\n let n = 0;\r\n if (isAroundZero(a)) {\r\n if (isNotAroundZero(b)) {\r\n const t1 = -c / b;\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = b * b - 4 * a * c;\r\n if (isAroundZero(disc)) {\r\n const t1 = -b / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n const t1 = (-b + discSqrt) / (2 * a);\r\n const t2 = (-b - discSqrt) / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 计算二次贝塞尔方程极限值\r\n */\r\nexport function quadraticExtremum(p0: number, p1: number, p2: number): number {\r\n const divider = p0 + p2 - 2 * p1;\r\n if (divider === 0) {\r\n // p1 is center of p0 and p2\r\n return 0.5;\r\n }\r\n else {\r\n return (p0 - p1) / divider;\r\n }\r\n}\r\n\r\n/**\r\n * 细分二次贝塞尔曲线\r\n */\r\nexport function quadraticSubdivide(p0: number, p1: number, p2: number, t: number, out: number[]) {\r\n const p01 = (p1 - p0) * t + p0;\r\n const p12 = (p2 - p1) * t + p1;\r\n const p012 = (p12 - p01) * t + p01;\r\n\r\n // Seg0\r\n out[0] = p0;\r\n out[1] = p01;\r\n out[2] = p012;\r\n\r\n // Seg1\r\n out[3] = p012;\r\n out[4] = p12;\r\n out[5] = p2;\r\n}\r\n\r\n/**\r\n * 投射点到二次贝塞尔曲线上,返回投射距离。\r\n * 投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。\r\n * @param {number} x0\r\n * @param {number} y0\r\n * @param {number} x1\r\n * @param {number} y1\r\n * @param {number} x2\r\n * @param {number} y2\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {Array.} out 投射点\r\n * @return {number}\r\n */\r\nexport function quadraticProjectPoint(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n x: number, y: number, out: VectorArray\r\n): number {\r\n // http://pomax.github.io/bezierinfo/#projections\r\n let t: number;\r\n let interval = 0.005;\r\n let d = Infinity;\r\n\r\n _v0[0] = x;\r\n _v0[1] = y;\r\n\r\n // 先粗略估计一下可能的最小距离的 t 值\r\n // PENDING\r\n for (let _t = 0; _t < 1; _t += 0.05) {\r\n _v1[0] = quadraticAt(x0, x1, x2, _t);\r\n _v1[1] = quadraticAt(y0, y1, y2, _t);\r\n const d1 = v2DistSquare(_v0, _v1);\r\n if (d1 < d) {\r\n t = _t;\r\n d = d1;\r\n }\r\n }\r\n d = Infinity;\r\n\r\n // At most 32 iteration\r\n for (let i = 0; i < 32; i++) {\r\n if (interval < EPSILON_NUMERIC) {\r\n break;\r\n }\r\n const prev = t - interval;\r\n const next = t + interval;\r\n // t - interval\r\n _v1[0] = quadraticAt(x0, x1, x2, prev);\r\n _v1[1] = quadraticAt(y0, y1, y2, prev);\r\n\r\n const d1 = v2DistSquare(_v1, _v0);\r\n\r\n if (prev >= 0 && d1 < d) {\r\n t = prev;\r\n d = d1;\r\n }\r\n else {\r\n // t + interval\r\n _v2[0] = quadraticAt(x0, x1, x2, next);\r\n _v2[1] = quadraticAt(y0, y1, y2, next);\r\n const d2 = v2DistSquare(_v2, _v0);\r\n if (next <= 1 && d2 < d) {\r\n t = next;\r\n d = d2;\r\n }\r\n else {\r\n interval *= 0.5;\r\n }\r\n }\r\n }\r\n // t\r\n if (out) {\r\n out[0] = quadraticAt(x0, x1, x2, t);\r\n out[1] = quadraticAt(y0, y1, y2, t);\r\n }\r\n // console.log(interval, i);\r\n return mathSqrt(d);\r\n}\r\n\r\n/**\r\n * 计算二次贝塞尔曲线长度\r\n */\r\nexport function quadraticLength(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n iteration: number\r\n) {\r\n let px = x0;\r\n let py = y0;\r\n\r\n let d = 0;\r\n\r\n const step = 1 / iteration;\r\n\r\n for (let i = 1; i <= iteration; i++) {\r\n let t = i * step;\r\n const x = quadraticAt(x0, x1, x2, t);\r\n const y = quadraticAt(y0, y1, y2, t);\r\n\r\n const dx = x - px;\r\n const dy = y - py;\r\n\r\n d += Math.sqrt(dx * dx + dy * dy);\r\n\r\n px = x;\r\n py = y;\r\n }\r\n\r\n return d;\r\n}\r\n","import { cubicAt, cubicRootAt } from '../core/curve';\r\nimport { trim } from '../core/util';\r\n\r\nconst regexp = /cubic-bezier\\(([0-9,\\.e ]+)\\)/;\r\n\r\nexport function createCubicEasingFunc(cubicEasingStr: string) {\r\n const cubic = cubicEasingStr && regexp.exec(cubicEasingStr);\r\n if (cubic) {\r\n const points = cubic[1].split(',');\r\n const a = +trim(points[0]);\r\n const b = +trim(points[1]);\r\n const c = +trim(points[2]);\r\n const d = +trim(points[3]);\r\n\r\n if (isNaN(a + b + c + d)) {\r\n return;\r\n }\r\n\r\n const roots: number[] = [];\r\n return (p: number) => {\r\n return p <= 0\r\n ? 0 : p >= 1\r\n ? 1\r\n : cubicRootAt(0, a, c, 1, p, roots) && cubicAt(0, b, d, 1, roots[0]);\r\n };\r\n }\r\n}","/**\r\n * 动画主控制器\r\n * @config target 动画对象,可以是数组,如果是数组的话会批量分发onframe等事件\r\n * @config life(1000) 动画时长\r\n * @config delay(0) 动画延迟时间\r\n * @config loop(true)\r\n * @config onframe\r\n * @config easing(optional)\r\n * @config ondestroy(optional)\r\n * @config onrestart(optional)\r\n *\r\n * TODO pause\r\n */\r\n\r\nimport easingFuncs, {AnimationEasing} from './easing';\r\nimport type Animation from './Animation';\r\nimport { isFunction, noop } from '../core/util';\r\nimport { createCubicEasingFunc } from './cubicEasing';\r\n\r\ntype OnframeCallback = (percent: number) => void;\r\ntype ondestroyCallback = () => void\r\ntype onrestartCallback = () => void\r\n\r\nexport type DeferredEventTypes = 'destroy' | 'restart'\r\n// type DeferredEventKeys = 'ondestroy' | 'onrestart'\r\n\r\nexport interface ClipProps {\r\n life?: number\r\n delay?: number\r\n loop?: boolean\r\n easing?: AnimationEasing\r\n\r\n onframe?: OnframeCallback\r\n ondestroy?: ondestroyCallback\r\n onrestart?: onrestartCallback\r\n}\r\n\r\nexport default class Clip {\r\n\r\n private _life: number\r\n private _delay: number\r\n\r\n private _inited: boolean = false\r\n private _startTime = 0 // 开始时间单位毫秒\r\n\r\n private _pausedTime = 0\r\n private _paused = false\r\n\r\n animation: Animation\r\n\r\n loop: boolean\r\n\r\n easing: AnimationEasing\r\n easingFunc: (p: number) => number\r\n\r\n // For linked list. Readonly\r\n next: Clip\r\n prev: Clip\r\n\r\n onframe: OnframeCallback\r\n ondestroy: ondestroyCallback\r\n onrestart: onrestartCallback\r\n\r\n constructor(opts: ClipProps) {\r\n\r\n this._life = opts.life || 1000;\r\n this._delay = opts.delay || 0;\r\n\r\n this.loop = opts.loop || false;\r\n\r\n this.onframe = opts.onframe || noop;\r\n this.ondestroy = opts.ondestroy || noop;\r\n this.onrestart = opts.onrestart || noop;\r\n\r\n opts.easing && this.setEasing(opts.easing);\r\n }\r\n\r\n step(globalTime: number, deltaTime: number): boolean {\r\n // Set startTime on first step, or _startTime may has milleseconds different between clips\r\n // PENDING\r\n if (!this._inited) {\r\n this._startTime = globalTime + this._delay;\r\n this._inited = true;\r\n }\r\n\r\n if (this._paused) {\r\n this._pausedTime += deltaTime;\r\n return;\r\n }\r\n\r\n const life = this._life;\r\n let elapsedTime = globalTime - this._startTime - this._pausedTime;\r\n let percent = elapsedTime / life;\r\n\r\n // PENDING: Not begin yet. Still run the loop.\r\n // In the case callback needs to be invoked.\r\n // Or want to update to the begin state at next frame when `setToFinal` and `delay` are both used.\r\n // To avoid the unexpected blink.\r\n if (percent < 0) {\r\n percent = 0;\r\n }\r\n\r\n percent = Math.min(percent, 1);\r\n\r\n const easingFunc = this.easingFunc;\r\n const schedule = easingFunc ? easingFunc(percent) : percent;\r\n\r\n this.onframe(schedule);\r\n\r\n // 结束\r\n if (percent === 1) {\r\n if (this.loop) {\r\n // Restart\r\n const remainder = elapsedTime % life;\r\n this._startTime = globalTime - remainder;\r\n this._pausedTime = 0;\r\n\r\n this.onrestart();\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n pause() {\r\n this._paused = true;\r\n }\r\n\r\n resume() {\r\n this._paused = false;\r\n }\r\n\r\n setEasing(easing: AnimationEasing) {\r\n this.easing = easing;\r\n this.easingFunc = isFunction(easing)\r\n ? easing\r\n : easingFuncs[easing] || createCubicEasingFunc(easing);\r\n }\r\n}","import { Dictionary } from './types';\r\n\r\n// Simple LRU cache use doubly linked list\r\n// @module zrender/core/LRU\r\n\r\nexport class Entry {\r\n\r\n value: T\r\n\r\n key: string | number\r\n\r\n next: Entry\r\n\r\n prev: Entry\r\n\r\n constructor(val: T) {\r\n this.value = val;\r\n }\r\n}\r\n/**\r\n * Simple double linked list. Compared with array, it has O(1) remove operation.\r\n * @constructor\r\n */\r\nexport class LinkedList {\r\n\r\n head: Entry\r\n tail: Entry\r\n\r\n private _len = 0\r\n\r\n /**\r\n * Insert a new value at the tail\r\n */\r\n insert(val: T): Entry {\r\n const entry = new Entry(val);\r\n this.insertEntry(entry);\r\n return entry;\r\n }\r\n\r\n /**\r\n * Insert an entry at the tail\r\n */\r\n insertEntry(entry: Entry) {\r\n if (!this.head) {\r\n this.head = this.tail = entry;\r\n }\r\n else {\r\n this.tail.next = entry;\r\n entry.prev = this.tail;\r\n entry.next = null;\r\n this.tail = entry;\r\n }\r\n this._len++;\r\n }\r\n\r\n /**\r\n * Remove entry.\r\n */\r\n remove(entry: Entry) {\r\n const prev = entry.prev;\r\n const next = entry.next;\r\n if (prev) {\r\n prev.next = next;\r\n }\r\n else {\r\n // Is head\r\n this.head = next;\r\n }\r\n if (next) {\r\n next.prev = prev;\r\n }\r\n else {\r\n // Is tail\r\n this.tail = prev;\r\n }\r\n entry.next = entry.prev = null;\r\n this._len--;\r\n }\r\n\r\n /**\r\n * Get length\r\n */\r\n len(): number {\r\n return this._len;\r\n }\r\n\r\n /**\r\n * Clear list\r\n */\r\n clear() {\r\n this.head = this.tail = null;\r\n this._len = 0;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * LRU Cache\r\n */\r\nexport default class LRU {\r\n\r\n private _list = new LinkedList()\r\n\r\n private _maxSize = 10\r\n\r\n private _lastRemovedEntry: Entry\r\n\r\n private _map: Dictionary> = {}\r\n\r\n constructor(maxSize: number) {\r\n this._maxSize = maxSize;\r\n }\r\n\r\n /**\r\n * @return Removed value\r\n */\r\n put(key: string | number, value: T): T {\r\n const list = this._list;\r\n const map = this._map;\r\n let removed = null;\r\n if (map[key] == null) {\r\n const len = list.len();\r\n // Reuse last removed entry\r\n let entry = this._lastRemovedEntry;\r\n\r\n if (len >= this._maxSize && len > 0) {\r\n // Remove the least recently used\r\n const leastUsedEntry = list.head;\r\n list.remove(leastUsedEntry);\r\n delete map[leastUsedEntry.key];\r\n\r\n removed = leastUsedEntry.value;\r\n this._lastRemovedEntry = leastUsedEntry;\r\n }\r\n\r\n if (entry) {\r\n entry.value = value;\r\n }\r\n else {\r\n entry = new Entry(value);\r\n }\r\n entry.key = key;\r\n list.insertEntry(entry);\r\n map[key] = entry;\r\n }\r\n\r\n return removed;\r\n }\r\n\r\n get(key: string | number): T {\r\n const entry = this._map[key];\r\n const list = this._list;\r\n if (entry != null) {\r\n // Put the latest used entry in the tail\r\n if (entry !== list.tail) {\r\n list.remove(entry);\r\n list.insertEntry(entry);\r\n }\r\n\r\n return entry.value;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the cache\r\n */\r\n clear() {\r\n this._list.clear();\r\n this._map = {};\r\n }\r\n\r\n len() {\r\n return this._list.len();\r\n }\r\n}","import LRU from '../core/LRU';\nimport { extend, isGradientObject, isString, map } from '../core/util';\nimport { GradientObject } from '../graphic/Gradient';\n\nconst kCSSColorTable = {\n 'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],\n 'antiquewhite': [250, 235, 215, 1], 'aqua': [0, 255, 255, 1],\n 'aquamarine': [127, 255, 212, 1], 'azure': [240, 255, 255, 1],\n 'beige': [245, 245, 220, 1], 'bisque': [255, 228, 196, 1],\n 'black': [0, 0, 0, 1], 'blanchedalmond': [255, 235, 205, 1],\n 'blue': [0, 0, 255, 1], 'blueviolet': [138, 43, 226, 1],\n 'brown': [165, 42, 42, 1], 'burlywood': [222, 184, 135, 1],\n 'cadetblue': [95, 158, 160, 1], 'chartreuse': [127, 255, 0, 1],\n 'chocolate': [210, 105, 30, 1], 'coral': [255, 127, 80, 1],\n 'cornflowerblue': [100, 149, 237, 1], 'cornsilk': [255, 248, 220, 1],\n 'crimson': [220, 20, 60, 1], 'cyan': [0, 255, 255, 1],\n 'darkblue': [0, 0, 139, 1], 'darkcyan': [0, 139, 139, 1],\n 'darkgoldenrod': [184, 134, 11, 1], 'darkgray': [169, 169, 169, 1],\n 'darkgreen': [0, 100, 0, 1], 'darkgrey': [169, 169, 169, 1],\n 'darkkhaki': [189, 183, 107, 1], 'darkmagenta': [139, 0, 139, 1],\n 'darkolivegreen': [85, 107, 47, 1], 'darkorange': [255, 140, 0, 1],\n 'darkorchid': [153, 50, 204, 1], 'darkred': [139, 0, 0, 1],\n 'darksalmon': [233, 150, 122, 1], 'darkseagreen': [143, 188, 143, 1],\n 'darkslateblue': [72, 61, 139, 1], 'darkslategray': [47, 79, 79, 1],\n 'darkslategrey': [47, 79, 79, 1], 'darkturquoise': [0, 206, 209, 1],\n 'darkviolet': [148, 0, 211, 1], 'deeppink': [255, 20, 147, 1],\n 'deepskyblue': [0, 191, 255, 1], 'dimgray': [105, 105, 105, 1],\n 'dimgrey': [105, 105, 105, 1], 'dodgerblue': [30, 144, 255, 1],\n 'firebrick': [178, 34, 34, 1], 'floralwhite': [255, 250, 240, 1],\n 'forestgreen': [34, 139, 34, 1], 'fuchsia': [255, 0, 255, 1],\n 'gainsboro': [220, 220, 220, 1], 'ghostwhite': [248, 248, 255, 1],\n 'gold': [255, 215, 0, 1], 'goldenrod': [218, 165, 32, 1],\n 'gray': [128, 128, 128, 1], 'green': [0, 128, 0, 1],\n 'greenyellow': [173, 255, 47, 1], 'grey': [128, 128, 128, 1],\n 'honeydew': [240, 255, 240, 1], 'hotpink': [255, 105, 180, 1],\n 'indianred': [205, 92, 92, 1], 'indigo': [75, 0, 130, 1],\n 'ivory': [255, 255, 240, 1], 'khaki': [240, 230, 140, 1],\n 'lavender': [230, 230, 250, 1], 'lavenderblush': [255, 240, 245, 1],\n 'lawngreen': [124, 252, 0, 1], 'lemonchiffon': [255, 250, 205, 1],\n 'lightblue': [173, 216, 230, 1], 'lightcoral': [240, 128, 128, 1],\n 'lightcyan': [224, 255, 255, 1], 'lightgoldenrodyellow': [250, 250, 210, 1],\n 'lightgray': [211, 211, 211, 1], 'lightgreen': [144, 238, 144, 1],\n 'lightgrey': [211, 211, 211, 1], 'lightpink': [255, 182, 193, 1],\n 'lightsalmon': [255, 160, 122, 1], 'lightseagreen': [32, 178, 170, 1],\n 'lightskyblue': [135, 206, 250, 1], 'lightslategray': [119, 136, 153, 1],\n 'lightslategrey': [119, 136, 153, 1], 'lightsteelblue': [176, 196, 222, 1],\n 'lightyellow': [255, 255, 224, 1], 'lime': [0, 255, 0, 1],\n 'limegreen': [50, 205, 50, 1], 'linen': [250, 240, 230, 1],\n 'magenta': [255, 0, 255, 1], 'maroon': [128, 0, 0, 1],\n 'mediumaquamarine': [102, 205, 170, 1], 'mediumblue': [0, 0, 205, 1],\n 'mediumorchid': [186, 85, 211, 1], 'mediumpurple': [147, 112, 219, 1],\n 'mediumseagreen': [60, 179, 113, 1], 'mediumslateblue': [123, 104, 238, 1],\n 'mediumspringgreen': [0, 250, 154, 1], 'mediumturquoise': [72, 209, 204, 1],\n 'mediumvioletred': [199, 21, 133, 1], 'midnightblue': [25, 25, 112, 1],\n 'mintcream': [245, 255, 250, 1], 'mistyrose': [255, 228, 225, 1],\n 'moccasin': [255, 228, 181, 1], 'navajowhite': [255, 222, 173, 1],\n 'navy': [0, 0, 128, 1], 'oldlace': [253, 245, 230, 1],\n 'olive': [128, 128, 0, 1], 'olivedrab': [107, 142, 35, 1],\n 'orange': [255, 165, 0, 1], 'orangered': [255, 69, 0, 1],\n 'orchid': [218, 112, 214, 1], 'palegoldenrod': [238, 232, 170, 1],\n 'palegreen': [152, 251, 152, 1], 'paleturquoise': [175, 238, 238, 1],\n 'palevioletred': [219, 112, 147, 1], 'papayawhip': [255, 239, 213, 1],\n 'peachpuff': [255, 218, 185, 1], 'peru': [205, 133, 63, 1],\n 'pink': [255, 192, 203, 1], 'plum': [221, 160, 221, 1],\n 'powderblue': [176, 224, 230, 1], 'purple': [128, 0, 128, 1],\n 'red': [255, 0, 0, 1], 'rosybrown': [188, 143, 143, 1],\n 'royalblue': [65, 105, 225, 1], 'saddlebrown': [139, 69, 19, 1],\n 'salmon': [250, 128, 114, 1], 'sandybrown': [244, 164, 96, 1],\n 'seagreen': [46, 139, 87, 1], 'seashell': [255, 245, 238, 1],\n 'sienna': [160, 82, 45, 1], 'silver': [192, 192, 192, 1],\n 'skyblue': [135, 206, 235, 1], 'slateblue': [106, 90, 205, 1],\n 'slategray': [112, 128, 144, 1], 'slategrey': [112, 128, 144, 1],\n 'snow': [255, 250, 250, 1], 'springgreen': [0, 255, 127, 1],\n 'steelblue': [70, 130, 180, 1], 'tan': [210, 180, 140, 1],\n 'teal': [0, 128, 128, 1], 'thistle': [216, 191, 216, 1],\n 'tomato': [255, 99, 71, 1], 'turquoise': [64, 224, 208, 1],\n 'violet': [238, 130, 238, 1], 'wheat': [245, 222, 179, 1],\n 'white': [255, 255, 255, 1], 'whitesmoke': [245, 245, 245, 1],\n 'yellow': [255, 255, 0, 1], 'yellowgreen': [154, 205, 50, 1]\n};\n\nfunction clampCssByte(i: number): number { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clampCssAngle(i: number): number { // Clamp to integer 0 .. 360.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\n\nfunction clampCssFloat(f: number): number { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parseCssInt(val: string | number): number { // int or percentage.\n let str = val as string;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\n\nfunction parseCssFloat(val: string | number): number { // float or percentage.\n let str = val as string;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\n\nfunction cssHueToRgb(m1: number, m2: number, h: number): number {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n return m1;\n}\n\nfunction lerpNumber(a: number, b: number, p: number): number {\n return a + (b - a) * p;\n}\n\nfunction setRgba(out: number[], r: number, g: number, b: number, a: number): number[] {\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n return out;\n}\nfunction copyRgba(out: number[], a: number[]) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n\nconst colorCache = new LRU(20);\nlet lastRemovedArr: number[] = null;\n\nfunction putToCache(colorStr: string, rgbaArr: number[]) {\n // Reuse removed array\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\n\nexport function parse(colorStr: string, rgbaArr?: number[]): number[] {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n\n let cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n\n // colorStr may be not string\n colorStr = colorStr + '';\n // Remove all whitespace, not compliant, but should just be more accepting.\n let str = colorStr.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str as keyof typeof kCSSColorTable]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n // supports the forms #rgb, #rrggbb, #rgba, #rrggbbaa\n // #rrggbbaa(use the last pair of digits as alpha)\n // see https://drafts.csswg.org/css-color/#hex-notation\n const strLen = str.length;\n if (str.charAt(0) === '#') {\n if (strLen === 4 || strLen === 5) {\n const iv = parseInt(str.slice(1, 4), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n // interpret values of the form #rgb as #rrggbb and #rgba as #rrggbbaa\n setRgba(rgbaArr,\n ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n strLen === 5 ? parseInt(str.slice(4), 16) / 0xf : 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (strLen === 7 || strLen === 9) {\n const iv = parseInt(str.slice(1, 7), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n (iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n strLen === 9 ? parseInt(str.slice(7), 16) / 0xff : 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n return;\n }\n let op = str.indexOf('(');\n let ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === strLen) {\n let fname = str.substr(0, op);\n let params: (number | string)[] = str.substr(op + 1, ep - (op + 1)).split(',');\n let alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n return params.length === 3\n // to be compatible with rgb\n ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1)\n : setRgba(rgbaArr, 0, 0, 0, 1);\n }\n alpha = parseCssFloat(params.pop()); // jshint ignore:line\n // Fall through.\n case 'rgb':\n if (params.length >= 3) {\n setRgba(rgbaArr,\n parseCssInt(params[0]),\n parseCssInt(params[1]),\n parseCssInt(params[2]),\n params.length === 3 ? alpha : parseCssFloat(params[3])\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n}\n\nfunction hsla2rgba(hsla: (number | string) [], rgba?: number[]): number[] {\n const h = (((parseFloat(hsla[0] as string) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n const s = parseCssFloat(hsla[1]);\n const l = parseCssFloat(hsla[2]);\n const m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n const m1 = l * 2 - m2;\n\n rgba = rgba || [];\n setRgba(rgba,\n clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255),\n 1\n );\n\n if (hsla.length === 4) {\n rgba[3] = hsla[3] as number;\n }\n\n return rgba;\n}\n\nfunction rgba2hsla(rgba: number[]): number[] {\n if (!rgba) {\n return;\n }\n\n // RGB from 0 to 255\n const R = rgba[0] / 255;\n const G = rgba[1] / 255;\n const B = rgba[2] / 255;\n\n const vMin = Math.min(R, G, B); // Min. value of RGB\n const vMax = Math.max(R, G, B); // Max. value of RGB\n const delta = vMax - vMin; // Delta RGB value\n\n const L = (vMax + vMin) / 2;\n let H;\n let S;\n // HSL results from 0 to 1\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n\n const deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n const deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n const deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n\n if (H < 0) {\n H += 1;\n }\n\n if (H > 1) {\n H -= 1;\n }\n }\n\n const hsla = [H * 360, S, L];\n\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n\n return hsla;\n}\n\nexport function lift(color: string, level: number) {\n const colorArr = parse(color);\n if (colorArr) {\n for (let i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n if (colorArr[i] > 255) {\n colorArr[i] = 255;\n }\n else if (colorArr[i] < 0) {\n colorArr[i] = 0;\n }\n }\n return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\n\nexport function toHex(color: string): string {\n const colorArr = parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n}\n\n/**\n * Map value to color. Faster than lerp methods because color is represented by rgba array.\n * @param normalizedValue A float between 0 and 1.\n * @param colors List of rgba color array\n * @param out Mapped gba color array\n * @return will be null/undefined if input illegal.\n */\nexport function fastLerp(\n normalizedValue: number,\n colors: number[][],\n out?: number[]\n): number[] {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n out = out || [];\n\n const value = normalizedValue * (colors.length - 1);\n const leftIndex = Math.floor(value);\n const rightIndex = Math.ceil(value);\n const leftColor = colors[leftIndex];\n const rightColor = colors[rightIndex];\n const dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n\n return out;\n}\n\n/**\n * @deprecated\n */\nexport const fastMapToColor = fastLerp;\n\ntype LerpFullOutput = {\n color: string\n leftIndex: number\n rightIndex: number\n value: number\n}\n/**\n * @param normalizedValue A float between 0 and 1.\n * @param colors Color list.\n * @param fullOutput Default false.\n * @return Result color. If fullOutput,\n return {color: ..., leftIndex: ..., rightIndex: ..., value: ...},\n */\nexport function lerp(\n normalizedValue: number,\n colors: string[],\n fullOutput: boolean\n): LerpFullOutput\nexport function lerp(\n normalizedValue: number,\n colors: string[]\n): string\nexport function lerp(\n normalizedValue: number,\n colors: string[],\n fullOutput?: boolean\n): string | LerpFullOutput {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n const value = normalizedValue * (colors.length - 1);\n const leftIndex = Math.floor(value);\n const rightIndex = Math.ceil(value);\n const leftColor = parse(colors[leftIndex]);\n const rightColor = parse(colors[rightIndex]);\n const dv = value - leftIndex;\n\n const color = stringify(\n [\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ],\n 'rgba'\n );\n\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\n\n/**\n * @deprecated\n */\nexport const mapToColor = lerp;\n\n/**\n * @param color\n * @param h 0 ~ 360, ignore when null.\n * @param s 0 ~ 1, ignore when null.\n * @param l 0 ~ 1, ignore when null.\n * @return Color string in rgba format.\n * @memberOf module:zrender/util/color\n */\nexport function modifyHSL(color: string, h?: number, s?: number, l?: number): string {\n let colorArr = parse(color);\n\n if (color) {\n colorArr = rgba2hsla(colorArr);\n h != null && (colorArr[0] = clampCssAngle(h));\n s != null && (colorArr[1] = parseCssFloat(s));\n l != null && (colorArr[2] = parseCssFloat(l));\n\n return stringify(hsla2rgba(colorArr), 'rgba');\n }\n}\n\n/**\n * @param color\n * @param alpha 0 ~ 1\n * @return Color string in rgba format.\n * @memberOf module:zrender/util/color\n */\nexport function modifyAlpha(color: string, alpha?: number): string {\n const colorArr = parse(color);\n\n if (colorArr && alpha != null) {\n colorArr[3] = clampCssFloat(alpha);\n return stringify(colorArr, 'rgba');\n }\n}\n\n/**\n * @param arrColor like [12,33,44,0.4]\n * @param type 'rgba', 'hsva', ...\n * @return Result color. (If input illegal, return undefined).\n */\nexport function stringify(arrColor: number[], type: string): string {\n if (!arrColor || !arrColor.length) {\n return;\n }\n let colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n}\n\n/**\n * Calculate luminance. It will include alpha.\n */\nexport function lum(color: string, backgroundLum: number) {\n const arr = parse(color);\n return arr\n ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255\n + (1 - arr[3]) * backgroundLum // Blending with assumed white background.\n : 0;\n}\n\n/**\n * Generate a random color\n */\nexport function random(): string {\n return stringify([\n Math.round(Math.random() * 255),\n Math.round(Math.random() * 255),\n Math.round(Math.random() * 255)\n ], 'rgb');\n}\n\nconst liftedColorCache = new LRU(100);\nexport function liftColor(color: GradientObject): GradientObject;\nexport function liftColor(color: string): string;\nexport function liftColor(color: string | GradientObject): string | GradientObject {\n if (isString(color)) {\n let liftedColor = liftedColorCache.get(color);\n if (!liftedColor) {\n liftedColor = lift(color, -0.1);\n liftedColorCache.put(color, liftedColor);\n }\n return liftedColor;\n }\n else if (isGradientObject(color)) {\n const ret = extend({}, color) as GradientObject;\n ret.colorStops = map(color.colorStops, stop => ({\n offset: stop.offset,\n color: lift(stop.color, -0.1)\n }));\n return ret;\n }\n // Change nothing.\n return color;\n}\n","// Shared methods of svg and svg-ssr\r\n\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Transformable, { TransformProp } from '../core/Transformable';\r\nimport { RADIAN_TO_DEGREE, retrieve2, logError, isFunction } from '../core/util';\r\nimport Displayable from '../graphic/Displayable';\r\nimport { GradientObject } from '../graphic/Gradient';\r\nimport { LinearGradientObject } from '../graphic/LinearGradient';\r\nimport Path from '../graphic/Path';\r\nimport { ImagePatternObject, PatternObject, SVGPatternObject } from '../graphic/Pattern';\r\nimport { RadialGradientObject } from '../graphic/RadialGradient';\r\nimport { parse } from '../tool/color';\r\nimport env from '../core/env';\r\n\r\nconst mathRound = Math.round;\r\n\r\nexport function normalizeColor(color: string): { color: string; opacity: number; } {\r\n let opacity;\r\n if (!color || color === 'transparent') {\r\n color = 'none';\r\n }\r\n else if (typeof color === 'string' && color.indexOf('rgba') > -1) {\r\n const arr = parse(color);\r\n if (arr) {\r\n // TODO use hex?\r\n color = 'rgb(' + arr[0] + ',' + arr[1] + ',' + arr[2] + ')';\r\n opacity = arr[3];\r\n }\r\n }\r\n return {\r\n color,\r\n opacity: opacity == null ? 1 : opacity\r\n };\r\n}\r\nconst EPSILON = 1e-4;\r\nexport function isAroundZero(transform: number) {\r\n return transform < EPSILON && transform > -EPSILON;\r\n}\r\n\r\nexport function round3(transform: number) {\r\n return mathRound(transform * 1e3) / 1e3;\r\n}\r\nexport function round4(transform: number) {\r\n return mathRound(transform * 1e4) / 1e4;\r\n}\r\nexport function round1(transform: number) {\r\n return mathRound(transform * 10) / 10;\r\n}\r\n\r\nexport function getMatrixStr(m: MatrixArray) {\r\n return 'matrix('\r\n // Avoid large string of matrix\r\n // PENDING If have precision issue when scaled\r\n + round3(m[0]) + ','\r\n + round3(m[1]) + ','\r\n + round3(m[2]) + ','\r\n + round3(m[3]) + ','\r\n + round4(m[4]) + ','\r\n + round4(m[5])\r\n + ')';\r\n}\r\n\r\nexport const TEXT_ALIGN_TO_ANCHOR = {\r\n left: 'start',\r\n right: 'end',\r\n center: 'middle',\r\n middle: 'middle'\r\n};\r\n\r\nexport function adjustTextY(y: number, lineHeight: number, textBaseline: CanvasTextBaseline): number {\r\n // TODO Other baselines.\r\n if (textBaseline === 'top') {\r\n y += lineHeight / 2;\r\n }\r\n else if (textBaseline === 'bottom') {\r\n y -= lineHeight / 2;\r\n }\r\n return y;\r\n}\r\n\r\n\r\nexport function hasShadow(style: Displayable['style']) {\r\n // TODO: textBoxShadowBlur is not supported yet\r\n return style\r\n && (style.shadowBlur || style.shadowOffsetX || style.shadowOffsetY);\r\n}\r\n\r\nexport function getShadowKey(displayable: Displayable) {\r\n const style = displayable.style;\r\n const globalScale = displayable.getGlobalScale();\r\n return [\r\n style.shadowColor,\r\n (style.shadowBlur || 0).toFixed(2), // Reduce the precision\r\n (style.shadowOffsetX || 0).toFixed(2),\r\n (style.shadowOffsetY || 0).toFixed(2),\r\n globalScale[0],\r\n globalScale[1]\r\n ].join(',');\r\n}\r\n\r\nexport function getClipPathsKey(clipPaths: Path[]) {\r\n let key: number[] = [];\r\n if (clipPaths) {\r\n for (let i = 0; i < clipPaths.length; i++) {\r\n const clipPath = clipPaths[i];\r\n key.push(clipPath.id);\r\n }\r\n }\r\n return key.join(',');\r\n}\r\n\r\nexport function isImagePattern(val: any): val is ImagePatternObject {\r\n return val && (!!(val as ImagePatternObject).image);\r\n}\r\nexport function isSVGPattern(val: any): val is SVGPatternObject {\r\n return val && (!!(val as SVGPatternObject).svgElement);\r\n}\r\nexport function isPattern(val: any): val is PatternObject {\r\n return isImagePattern(val) || isSVGPattern(val);\r\n}\r\n\r\nexport function isLinearGradient(val: GradientObject): val is LinearGradientObject {\r\n return val.type === 'linear';\r\n}\r\n\r\nexport function isRadialGradient(val: GradientObject): val is RadialGradientObject {\r\n return val.type === 'radial';\r\n}\r\n\r\nexport function isGradient(val: any): val is GradientObject {\r\n return val && (\r\n (val as GradientObject).type === 'linear'\r\n || (val as GradientObject).type === 'radial'\r\n );\r\n}\r\n\r\nexport function getIdURL(id: string) {\r\n return `url(#${id})`;\r\n}\r\n\r\nexport function getPathPrecision(el: Path) {\r\n const scale = el.getGlobalScale();\r\n const size = Math.max(scale[0], scale[1]);\r\n return Math.max(Math.ceil(Math.log(size) / Math.log(10)), 1);\r\n}\r\n\r\nexport function getSRTTransformString(\r\n transform: Partial>\r\n) {\r\n const x = transform.x || 0;\r\n const y = transform.y || 0;\r\n const rotation = (transform.rotation || 0) * RADIAN_TO_DEGREE;\r\n const scaleX = retrieve2(transform.scaleX, 1);\r\n const scaleY = retrieve2(transform.scaleY, 1);\r\n const skewX = transform.skewX || 0;\r\n const skewY = transform.skewY || 0;\r\n const res = [];\r\n if (x || y) {\r\n // TODO not using px unit?\r\n res.push(`translate(${x}px,${y}px)`);\r\n }\r\n if (rotation) {\r\n res.push(`rotate(${rotation})`);\r\n }\r\n if (scaleX !== 1 || scaleY !== 1) {\r\n res.push(`scale(${scaleX},${scaleY})`);\r\n }\r\n if (skewX || skewY) {\r\n res.push(`skew(${mathRound(skewX * RADIAN_TO_DEGREE)}deg, ${mathRound(skewY * RADIAN_TO_DEGREE)}deg)`);\r\n }\r\n\r\n return res.join(' ');\r\n}\r\n\r\nexport const encodeBase64 = (function () {\r\n if (env.hasGlobalWindow && isFunction(window.btoa)) {\r\n return function (str: string) {\r\n return window.btoa(unescape(encodeURIComponent(str)));\r\n };\r\n }\r\n if (typeof Buffer !== 'undefined') {\r\n return function (str: string) {\r\n return Buffer.from(str).toString('base64');\r\n };\r\n }\r\n return function (str: string): string {\r\n if (process.env.NODE_ENV !== 'production') {\r\n logError('Base64 isn\\'t natively supported in the current environment.');\r\n }\r\n return null;\r\n };\r\n})();","/**\r\n * @module echarts/animation/Animator\r\n */\r\n\r\nimport Clip from './Clip';\r\nimport * as color from '../tool/color';\r\nimport {\r\n eqNaN,\r\n extend,\r\n isArrayLike,\r\n isFunction,\r\n isGradientObject,\r\n isNumber,\r\n isString,\r\n keys,\r\n logError,\r\n map\r\n} from '../core/util';\r\nimport {ArrayLike, Dictionary} from '../core/types';\r\nimport easingFuncs, { AnimationEasing } from './easing';\r\nimport Animation from './Animation';\r\nimport { createCubicEasingFunc } from './cubicEasing';\r\nimport { isLinearGradient, isRadialGradient } from '../svg/helper';\r\n\r\ntype NumberArray = ArrayLike\r\ntype InterpolatableType = string | number | NumberArray | NumberArray[];\r\n\r\ninterface ParsedColorStop {\r\n color: number[],\r\n offset: number\r\n};\r\n\r\ninterface ParsedGradientObject {\r\n colorStops: ParsedColorStop[]\r\n x: number\r\n y: number\r\n global: boolean\r\n}\r\ninterface ParsedLinearGradientObject extends ParsedGradientObject {\r\n x2: number\r\n y2: number\r\n}\r\ninterface ParsedRadialGradientObject extends ParsedGradientObject {\r\n r: number\r\n}\r\n\r\nconst arraySlice = Array.prototype.slice;\r\n\r\nfunction interpolateNumber(p0: number, p1: number, percent: number): number {\r\n return (p1 - p0) * percent + p0;\r\n}\r\nfunction interpolate1DArray(\r\n out: NumberArray,\r\n p0: NumberArray,\r\n p1: NumberArray,\r\n percent: number\r\n) {\r\n // TODO Handling different length TypedArray\r\n const len = p0.length;\r\n for (let i = 0; i < len; i++) {\r\n out[i] = interpolateNumber(p0[i], p1[i], percent);\r\n }\r\n return out;\r\n}\r\n\r\nfunction interpolate2DArray(\r\n out: NumberArray[],\r\n p0: NumberArray[],\r\n p1: NumberArray[],\r\n percent: number\r\n) {\r\n const len = p0.length;\r\n // TODO differnt length on each item?\r\n const len2 = len && p0[0].length;\r\n for (let i = 0; i < len; i++) {\r\n if (!out[i]) {\r\n out[i] = [];\r\n }\r\n for (let j = 0; j < len2; j++) {\r\n out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction add1DArray(\r\n out: NumberArray,\r\n p0: NumberArray,\r\n p1: NumberArray,\r\n sign: 1 | -1\r\n) {\r\n const len = p0.length;\r\n for (let i = 0; i < len; i++) {\r\n out[i] = p0[i] + p1[i] * sign;\r\n }\r\n return out;\r\n}\r\n\r\nfunction add2DArray(\r\n out: NumberArray[],\r\n p0: NumberArray[],\r\n p1: NumberArray[],\r\n sign: 1 | -1\r\n) {\r\n const len = p0.length;\r\n const len2 = len && p0[0].length;\r\n for (let i = 0; i < len; i++) {\r\n if (!out[i]) {\r\n out[i] = [];\r\n }\r\n for (let j = 0; j < len2; j++) {\r\n out[i][j] = p0[i][j] + p1[i][j] * sign;\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction fillColorStops(val0: ParsedColorStop[], val1: ParsedColorStop[]) {\r\n const len0 = val0.length;\r\n const len1 = val1.length;\r\n\r\n const shorterArr = len0 > len1 ? val1 : val0;\r\n const shorterLen = Math.min(len0, len1);\r\n const last = shorterArr[shorterLen - 1] || { color: [0, 0, 0, 0], offset: 0 };\r\n for (let i = shorterLen; i < Math.max(len0, len1); i++) {\r\n // Use last color stop to fill the shorter array\r\n shorterArr.push({\r\n offset: last.offset,\r\n color: last.color.slice()\r\n });\r\n }\r\n}\r\n// arr0 is source array, arr1 is target array.\r\n// Do some preprocess to avoid error happened when interpolating from arr0 to arr1\r\nfunction fillArray(\r\n val0: NumberArray | NumberArray[],\r\n val1: NumberArray | NumberArray[],\r\n arrDim: 1 | 2\r\n) {\r\n // TODO Handling different length TypedArray\r\n let arr0 = val0 as (number | number[])[];\r\n let arr1 = val1 as (number | number[])[];\r\n if (!arr0.push || !arr1.push) {\r\n return;\r\n }\r\n const arr0Len = arr0.length;\r\n const arr1Len = arr1.length;\r\n if (arr0Len !== arr1Len) {\r\n // FIXME Not work for TypedArray\r\n const isPreviousLarger = arr0Len > arr1Len;\r\n if (isPreviousLarger) {\r\n // Cut the previous\r\n arr0.length = arr1Len;\r\n }\r\n else {\r\n // Fill the previous\r\n for (let i = arr0Len; i < arr1Len; i++) {\r\n arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));\r\n }\r\n }\r\n }\r\n // Handling NaN value\r\n const len2 = arr0[0] && (arr0[0] as number[]).length;\r\n for (let i = 0; i < arr0.length; i++) {\r\n if (arrDim === 1) {\r\n if (isNaN(arr0[i] as number)) {\r\n arr0[i] = arr1[i];\r\n }\r\n }\r\n else {\r\n for (let j = 0; j < len2; j++) {\r\n if (isNaN((arr0 as number[][])[i][j])) {\r\n (arr0 as number[][])[i][j] = (arr1 as number[][])[i][j];\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function cloneValue(value: InterpolatableType) {\r\n if (isArrayLike(value)) {\r\n const len = value.length;\r\n if (isArrayLike(value[0])) {\r\n const ret = [];\r\n for (let i = 0; i < len; i++) {\r\n ret.push(arraySlice.call(value[i]));\r\n }\r\n return ret;\r\n }\r\n\r\n return arraySlice.call(value);\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction rgba2String(rgba: number[]): string {\r\n rgba[0] = Math.floor(rgba[0]) || 0;\r\n rgba[1] = Math.floor(rgba[1]) || 0;\r\n rgba[2] = Math.floor(rgba[2]) || 0;\r\n rgba[3] = rgba[3] == null ? 1 : rgba[3];\r\n\r\n return 'rgba(' + rgba.join(',') + ')';\r\n}\r\n\r\nfunction guessArrayDim(value: ArrayLike): 1 | 2 {\r\n return isArrayLike(value && (value as ArrayLike)[0]) ? 2 : 1;\r\n}\r\n\r\nconst VALUE_TYPE_NUMBER = 0;\r\nconst VALUE_TYPE_1D_ARRAY = 1;\r\nconst VALUE_TYPE_2D_ARRAY = 2;\r\nconst VALUE_TYPE_COLOR = 3;\r\nconst VALUE_TYPE_LINEAR_GRADIENT = 4;\r\nconst VALUE_TYPE_RADIAL_GRADIENT = 5;\r\n// Other value type that can only use discrete animation.\r\nconst VALUE_TYPE_UNKOWN = 6;\r\n\r\ntype ValueType = 0 | 1 | 2 | 3 | 4 | 5 | 6;\r\n\r\ntype Keyframe = {\r\n time: number\r\n value: unknown\r\n percent: number\r\n // Raw value for discrete animation.\r\n rawValue: unknown\r\n\r\n easing?: AnimationEasing // Raw easing\r\n easingFunc?: (percent: number) => number\r\n additiveValue?: unknown\r\n}\r\n\r\n\r\nfunction isGradientValueType(valType: ValueType): valType is 4 | 5 {\r\n return valType === VALUE_TYPE_LINEAR_GRADIENT || valType === VALUE_TYPE_RADIAL_GRADIENT;\r\n}\r\nfunction isArrayValueType(valType: ValueType): valType is 1 | 2 {\r\n return valType === VALUE_TYPE_1D_ARRAY || valType === VALUE_TYPE_2D_ARRAY;\r\n}\r\n\r\n\r\nlet tmpRgba: number[] = [0, 0, 0, 0];\r\n\r\nclass Track {\r\n\r\n keyframes: Keyframe[] = []\r\n\r\n propName: string\r\n\r\n valType: ValueType\r\n\r\n discrete: boolean = false\r\n\r\n _invalid: boolean = false;\r\n\r\n private _finished: boolean\r\n\r\n private _needsSort: boolean = false\r\n\r\n private _additiveTrack: Track\r\n // Temporal storage for interpolated additive value.\r\n private _additiveValue: unknown\r\n\r\n // Info for run\r\n /**\r\n * Last frame\r\n */\r\n private _lastFr = 0\r\n /**\r\n * Percent of last frame.\r\n */\r\n private _lastFrP = 0\r\n\r\n constructor(propName: string) {\r\n this.propName = propName;\r\n }\r\n\r\n isFinished() {\r\n return this._finished;\r\n }\r\n\r\n setFinished() {\r\n this._finished = true;\r\n // Also set additive track to finished.\r\n // Make sure the final value stopped on the latest track\r\n if (this._additiveTrack) {\r\n this._additiveTrack.setFinished();\r\n }\r\n }\r\n\r\n needsAnimate() {\r\n return this.keyframes.length >= 1;\r\n }\r\n\r\n getAdditiveTrack() {\r\n return this._additiveTrack;\r\n }\r\n\r\n addKeyframe(time: number, rawValue: unknown, easing?: AnimationEasing) {\r\n this._needsSort = true;\r\n\r\n let keyframes = this.keyframes;\r\n let len = keyframes.length;\r\n\r\n let discrete = false;\r\n let valType: ValueType = VALUE_TYPE_UNKOWN;\r\n let value = rawValue;\r\n\r\n // Handling values only if it's possible to be interpolated.\r\n if (isArrayLike(rawValue)) {\r\n let arrayDim = guessArrayDim(rawValue);\r\n valType = arrayDim;\r\n // Not a number array.\r\n if (arrayDim === 1 && !isNumber(rawValue[0])\r\n || arrayDim === 2 && !isNumber(rawValue[0][0])) {\r\n discrete = true;\r\n }\r\n }\r\n else {\r\n if (isNumber(rawValue) && !eqNaN(rawValue)) {\r\n valType = VALUE_TYPE_NUMBER;\r\n }\r\n else if (isString(rawValue)) {\r\n if (!isNaN(+rawValue)) { // Can be string number like '2'\r\n valType = VALUE_TYPE_NUMBER;\r\n }\r\n else {\r\n const colorArray = color.parse(rawValue);\r\n if (colorArray) {\r\n value = colorArray;\r\n valType = VALUE_TYPE_COLOR;\r\n }\r\n }\r\n }\r\n else if (isGradientObject(rawValue)) {\r\n // TODO Color to gradient or gradient to color.\r\n const parsedGradient = extend({}, value) as unknown as ParsedGradientObject;\r\n parsedGradient.colorStops = map(rawValue.colorStops, colorStop => ({\r\n offset: colorStop.offset,\r\n color: color.parse(colorStop.color)\r\n }));\r\n if (isLinearGradient(rawValue)) {\r\n valType = VALUE_TYPE_LINEAR_GRADIENT;\r\n }\r\n else if (isRadialGradient(rawValue)) {\r\n valType = VALUE_TYPE_RADIAL_GRADIENT;\r\n }\r\n value = parsedGradient;\r\n }\r\n }\r\n\r\n if (len === 0) {\r\n // Inference type from the first keyframe.\r\n this.valType = valType;\r\n }\r\n // Not same value type or can't be interpolated.\r\n else if (valType !== this.valType || valType === VALUE_TYPE_UNKOWN) {\r\n discrete = true;\r\n }\r\n\r\n this.discrete = this.discrete || discrete;\r\n\r\n const kf: Keyframe = {\r\n time,\r\n value,\r\n rawValue,\r\n percent: 0\r\n };\r\n if (easing) {\r\n // Save the raw easing name to be used in css animation output\r\n kf.easing = easing;\r\n kf.easingFunc = isFunction(easing)\r\n ? easing\r\n : easingFuncs[easing] || createCubicEasingFunc(easing);\r\n }\r\n // Not check if value equal here.\r\n keyframes.push(kf);\r\n return kf;\r\n }\r\n\r\n prepare(maxTime: number, additiveTrack?: Track) {\r\n let kfs = this.keyframes;\r\n if (this._needsSort) {\r\n // Sort keyframe as ascending\r\n kfs.sort(function (a: Keyframe, b: Keyframe) {\r\n return a.time - b.time;\r\n });\r\n }\r\n\r\n const valType = this.valType;\r\n const kfsLen = kfs.length;\r\n const lastKf = kfs[kfsLen - 1];\r\n const isDiscrete = this.discrete;\r\n const isArr = isArrayValueType(valType);\r\n const isGradient = isGradientValueType(valType);\r\n\r\n for (let i = 0; i < kfsLen; i++) {\r\n const kf = kfs[i];\r\n const value = kf.value;\r\n const lastValue = lastKf.value;\r\n kf.percent = kf.time / maxTime;\r\n if (!isDiscrete) {\r\n if (isArr && i !== kfsLen - 1) {\r\n // Align array with target frame.\r\n fillArray(value as NumberArray, lastValue as NumberArray, valType);\r\n }\r\n else if (isGradient) {\r\n fillColorStops(\r\n (value as ParsedLinearGradientObject).colorStops,\r\n (lastValue as ParsedLinearGradientObject).colorStops\r\n );\r\n }\r\n }\r\n }\r\n\r\n // Only apply additive animaiton on INTERPOLABLE SAME TYPE values.\r\n if (\r\n !isDiscrete\r\n // TODO support gradient\r\n && valType !== VALUE_TYPE_RADIAL_GRADIENT\r\n && additiveTrack\r\n // If two track both will be animated and have same value format.\r\n && this.needsAnimate()\r\n && additiveTrack.needsAnimate()\r\n && valType === additiveTrack.valType\r\n && !additiveTrack._finished\r\n ) {\r\n this._additiveTrack = additiveTrack;\r\n\r\n const startValue = kfs[0].value;\r\n // Calculate difference\r\n for (let i = 0; i < kfsLen; i++) {\r\n if (valType === VALUE_TYPE_NUMBER) {\r\n kfs[i].additiveValue = kfs[i].value as number - (startValue as number);\r\n }\r\n else if (valType === VALUE_TYPE_COLOR) {\r\n kfs[i].additiveValue =\r\n add1DArray([], kfs[i].value as NumberArray, startValue as NumberArray, -1);\r\n }\r\n else if (isArrayValueType(valType)) {\r\n kfs[i].additiveValue = valType === VALUE_TYPE_1D_ARRAY\r\n ? add1DArray([], kfs[i].value as NumberArray, startValue as NumberArray, -1)\r\n : add2DArray([], kfs[i].value as NumberArray[], startValue as NumberArray[], -1);\r\n }\r\n }\r\n }\r\n }\r\n\r\n step(target: any, percent: number) {\r\n if (this._finished) { // Track may be set to finished.\r\n return;\r\n }\r\n\r\n if (this._additiveTrack && this._additiveTrack._finished) {\r\n // Remove additive track if it's finished.\r\n this._additiveTrack = null;\r\n }\r\n const isAdditive = this._additiveTrack != null;\r\n const valueKey = isAdditive ? 'additiveValue' : 'value';\r\n\r\n const valType = this.valType;\r\n const keyframes = this.keyframes;\r\n const kfsNum = keyframes.length;\r\n const propName = this.propName;\r\n const isValueColor = valType === VALUE_TYPE_COLOR;\r\n // Find the range keyframes\r\n // kf1-----kf2---------current--------kf3\r\n // find kf2 and kf3 and do interpolation\r\n let frameIdx;\r\n const lastFrame = this._lastFr;\r\n const mathMin = Math.min;\r\n let frame;\r\n let nextFrame;\r\n if (kfsNum === 1) {\r\n frame = nextFrame = keyframes[0];\r\n }\r\n else {\r\n // In the easing function like elasticOut, percent may less than 0\r\n if (percent < 0) {\r\n frameIdx = 0;\r\n }\r\n else if (percent < this._lastFrP) {\r\n // Start from next key\r\n // PENDING start from lastFrame ?\r\n const start = mathMin(lastFrame + 1, kfsNum - 1);\r\n for (frameIdx = start; frameIdx >= 0; frameIdx--) {\r\n if (keyframes[frameIdx].percent <= percent) {\r\n break;\r\n }\r\n }\r\n frameIdx = mathMin(frameIdx, kfsNum - 2);\r\n }\r\n else {\r\n for (frameIdx = lastFrame; frameIdx < kfsNum; frameIdx++) {\r\n if (keyframes[frameIdx].percent > percent) {\r\n break;\r\n }\r\n }\r\n frameIdx = mathMin(frameIdx - 1, kfsNum - 2);\r\n }\r\n\r\n nextFrame = keyframes[frameIdx + 1];\r\n frame = keyframes[frameIdx];\r\n }\r\n\r\n // Defensive coding.\r\n if (!(frame && nextFrame)) {\r\n return;\r\n }\r\n\r\n this._lastFr = frameIdx;\r\n this._lastFrP = percent;\r\n\r\n const interval = (nextFrame.percent - frame.percent);\r\n let w = interval === 0 ? 1 : mathMin((percent - frame.percent) / interval, 1);\r\n\r\n // Apply different easing of each keyframe.\r\n // Use easing specified in target frame.\r\n if (nextFrame.easingFunc) {\r\n w = nextFrame.easingFunc(w);\r\n }\r\n\r\n // If value is arr\r\n let targetArr = isAdditive ? this._additiveValue\r\n : (isValueColor ? tmpRgba : target[propName]);\r\n\r\n if ((isArrayValueType(valType) || isValueColor) && !targetArr) {\r\n targetArr = this._additiveValue = [];\r\n }\r\n\r\n if (this.discrete) {\r\n // use raw value without parse in discrete animation.\r\n target[propName] = w < 1 ? frame.rawValue : nextFrame.rawValue;\r\n }\r\n else if (isArrayValueType(valType)) {\r\n valType === VALUE_TYPE_1D_ARRAY\r\n ? interpolate1DArray(\r\n targetArr as NumberArray,\r\n frame[valueKey] as NumberArray,\r\n nextFrame[valueKey] as NumberArray,\r\n w\r\n )\r\n : interpolate2DArray(\r\n targetArr as NumberArray[],\r\n frame[valueKey] as NumberArray[],\r\n nextFrame[valueKey] as NumberArray[],\r\n w\r\n );\r\n }\r\n else if (isGradientValueType(valType)) {\r\n const val = frame[valueKey] as ParsedGradientObject;\r\n const nextVal = nextFrame[valueKey] as ParsedGradientObject;\r\n const isLinearGradient = valType === VALUE_TYPE_LINEAR_GRADIENT;\r\n target[propName] = {\r\n type: isLinearGradient ? 'linear' : 'radial',\r\n x: interpolateNumber(val.x, nextVal.x, w),\r\n y: interpolateNumber(val.y, nextVal.y, w),\r\n // TODO performance\r\n colorStops: map(val.colorStops, (colorStop, idx) => {\r\n const nextColorStop = nextVal.colorStops[idx];\r\n return {\r\n offset: interpolateNumber(colorStop.offset, nextColorStop.offset, w),\r\n color: rgba2String(interpolate1DArray(\r\n [] as number[], colorStop.color, nextColorStop.color, w\r\n ) as number[])\r\n };\r\n }),\r\n global: nextVal.global\r\n };\r\n if (isLinearGradient) {\r\n // Linear\r\n target[propName].x2 = interpolateNumber(\r\n (val as ParsedLinearGradientObject).x2, (nextVal as ParsedLinearGradientObject).x2, w\r\n );\r\n target[propName].y2 = interpolateNumber(\r\n (val as ParsedLinearGradientObject).y2, (nextVal as ParsedLinearGradientObject).y2, w\r\n );\r\n }\r\n else {\r\n // Radial\r\n target[propName].r = interpolateNumber(\r\n (val as ParsedRadialGradientObject).r, (nextVal as ParsedRadialGradientObject).r, w\r\n );\r\n }\r\n }\r\n else if (isValueColor) {\r\n interpolate1DArray(\r\n targetArr,\r\n frame[valueKey] as NumberArray,\r\n nextFrame[valueKey] as NumberArray,\r\n w\r\n );\r\n if (!isAdditive) { // Convert to string later:)\r\n target[propName] = rgba2String(targetArr);\r\n }\r\n }\r\n else {\r\n const value = interpolateNumber(frame[valueKey] as number, nextFrame[valueKey] as number, w);\r\n if (isAdditive) {\r\n this._additiveValue = value;\r\n }\r\n else {\r\n target[propName] = value;\r\n }\r\n }\r\n\r\n // Add additive to target\r\n if (isAdditive) {\r\n this._addToTarget(target);\r\n }\r\n }\r\n\r\n private _addToTarget(target: any) {\r\n const valType = this.valType;\r\n const propName = this.propName;\r\n const additiveValue = this._additiveValue;\r\n\r\n if (valType === VALUE_TYPE_NUMBER) {\r\n // Add a difference value based on the change of previous frame.\r\n target[propName] = target[propName] + additiveValue;\r\n }\r\n else if (valType === VALUE_TYPE_COLOR) {\r\n // TODO reduce unnecessary parse\r\n color.parse(target[propName], tmpRgba);\r\n add1DArray(tmpRgba, tmpRgba, additiveValue as NumberArray, 1);\r\n target[propName] = rgba2String(tmpRgba);\r\n }\r\n else if (valType === VALUE_TYPE_1D_ARRAY) {\r\n add1DArray(target[propName], target[propName], additiveValue as NumberArray, 1);\r\n }\r\n else if (valType === VALUE_TYPE_2D_ARRAY) {\r\n add2DArray(target[propName], target[propName], additiveValue as NumberArray[], 1);\r\n }\r\n }\r\n}\r\n\r\n\r\ntype DoneCallback = () => void;\r\ntype AbortCallback = () => void;\r\nexport type OnframeCallback = (target: T, percent: number) => void;\r\n\r\nexport type AnimationPropGetter = (target: T, key: string) => InterpolatableType;\r\nexport type AnimationPropSetter = (target: T, key: string, value: InterpolatableType) => void;\r\n\r\nexport default class Animator {\r\n\r\n animation?: Animation\r\n\r\n targetName?: string\r\n\r\n scope?: string\r\n\r\n __fromStateTransition?: string\r\n\r\n private _tracks: Dictionary = {}\r\n private _trackKeys: string[] = []\r\n\r\n private _target: T\r\n\r\n private _loop: boolean\r\n private _delay: number\r\n private _maxTime = 0\r\n\r\n /**\r\n * If force run regardless of empty tracks when duration is set.\r\n */\r\n private _force: boolean;\r\n\r\n /**\r\n * If animator is paused\r\n * @default false\r\n */\r\n private _paused: boolean\r\n // 0: Not started\r\n // 1: Invoked started\r\n // 2: Has been run for at least one frame.\r\n private _started = 0\r\n\r\n /**\r\n * If allow discrete animation\r\n * @default false\r\n */\r\n private _allowDiscrete: boolean\r\n\r\n private _additiveAnimators: Animator[]\r\n\r\n private _doneCbs: DoneCallback[]\r\n private _onframeCbs: OnframeCallback[]\r\n\r\n private _abortedCbs: AbortCallback[]\r\n\r\n private _clip: Clip = null\r\n\r\n constructor(\r\n target: T,\r\n loop: boolean,\r\n allowDiscreteAnimation?: boolean, // If doing discrete animation on the values can't be interpolated\r\n additiveTo?: Animator[]\r\n ) {\r\n this._target = target;\r\n this._loop = loop;\r\n if (loop && additiveTo) {\r\n logError('Can\\' use additive animation on looped animation.');\r\n return;\r\n }\r\n this._additiveAnimators = additiveTo;\r\n\r\n this._allowDiscrete = allowDiscreteAnimation;\r\n }\r\n\r\n getMaxTime() {\r\n return this._maxTime;\r\n }\r\n\r\n getDelay() {\r\n return this._delay;\r\n }\r\n\r\n getLoop() {\r\n return this._loop;\r\n }\r\n\r\n getTarget() {\r\n return this._target;\r\n }\r\n\r\n /**\r\n * Target can be changed during animation\r\n * For example if style is changed during state change.\r\n * We need to change target to the new style object.\r\n */\r\n changeTarget(target: T) {\r\n this._target = target;\r\n }\r\n\r\n /**\r\n * Set Animation keyframe\r\n * @param time time of keyframe in ms\r\n * @param props key-value props of keyframe.\r\n * @param easing\r\n */\r\n when(time: number, props: Dictionary, easing?: AnimationEasing) {\r\n return this.whenWithKeys(time, props, keys(props) as string[], easing);\r\n }\r\n\r\n\r\n // Fast path for add keyframes of aniamteTo\r\n whenWithKeys(time: number, props: Dictionary, propNames: string[], easing?: AnimationEasing) {\r\n const tracks = this._tracks;\r\n for (let i = 0; i < propNames.length; i++) {\r\n const propName = propNames[i];\r\n\r\n let track = tracks[propName];\r\n if (!track) {\r\n track = tracks[propName] = new Track(propName);\r\n\r\n let initialValue;\r\n const additiveTrack = this._getAdditiveTrack(propName);\r\n if (additiveTrack) {\r\n const addtiveTrackKfs = additiveTrack.keyframes;\r\n const lastFinalKf = addtiveTrackKfs[addtiveTrackKfs.length - 1];\r\n // Use the last state of additived animator.\r\n initialValue = lastFinalKf && lastFinalKf.value;\r\n if (additiveTrack.valType === VALUE_TYPE_COLOR && initialValue) {\r\n // Convert to rgba string\r\n initialValue = rgba2String(initialValue as number[]);\r\n }\r\n }\r\n else {\r\n initialValue = (this._target as any)[propName];\r\n }\r\n // Invalid value\r\n if (initialValue == null) {\r\n // zrLog('Invalid property ' + propName);\r\n continue;\r\n }\r\n // If time is <= 0\r\n // Then props is given initialize value\r\n // Note: initial percent can be negative, which means the initial value is before the animation start.\r\n // Else\r\n // Initialize value from current prop value\r\n if (time > 0) {\r\n track.addKeyframe(0, cloneValue(initialValue), easing);\r\n }\r\n\r\n this._trackKeys.push(propName);\r\n }\r\n track.addKeyframe(time, cloneValue(props[propName]), easing);\r\n }\r\n this._maxTime = Math.max(this._maxTime, time);\r\n return this;\r\n }\r\n\r\n pause() {\r\n this._clip.pause();\r\n this._paused = true;\r\n }\r\n\r\n resume() {\r\n this._clip.resume();\r\n this._paused = false;\r\n }\r\n\r\n isPaused(): boolean {\r\n return !!this._paused;\r\n }\r\n\r\n /**\r\n * Set duration of animator.\r\n * Will run this duration regardless the track max time or if trackes exits.\r\n * @param duration\r\n * @returns\r\n */\r\n duration(duration: number) {\r\n this._maxTime = duration;\r\n this._force = true;\r\n return this;\r\n }\r\n\r\n private _doneCallback() {\r\n this._setTracksFinished();\r\n // Clear clip\r\n this._clip = null;\r\n\r\n const doneList = this._doneCbs;\r\n if (doneList) {\r\n const len = doneList.length;\r\n for (let i = 0; i < len; i++) {\r\n doneList[i].call(this);\r\n }\r\n }\r\n }\r\n private _abortedCallback() {\r\n this._setTracksFinished();\r\n\r\n const animation = this.animation;\r\n const abortedList = this._abortedCbs;\r\n\r\n if (animation) {\r\n animation.removeClip(this._clip);\r\n }\r\n this._clip = null;\r\n\r\n if (abortedList) {\r\n for (let i = 0; i < abortedList.length; i++) {\r\n abortedList[i].call(this);\r\n }\r\n }\r\n }\r\n private _setTracksFinished() {\r\n const tracks = this._tracks;\r\n const tracksKeys = this._trackKeys;\r\n for (let i = 0; i < tracksKeys.length; i++) {\r\n tracks[tracksKeys[i]].setFinished();\r\n }\r\n }\r\n\r\n private _getAdditiveTrack(trackName: string): Track {\r\n let additiveTrack;\r\n const additiveAnimators = this._additiveAnimators;\r\n if (additiveAnimators) {\r\n for (let i = 0; i < additiveAnimators.length; i++) {\r\n const track = additiveAnimators[i].getTrack(trackName);\r\n if (track) {\r\n // Use the track of latest animator.\r\n additiveTrack = track;\r\n }\r\n }\r\n }\r\n return additiveTrack;\r\n }\r\n\r\n /**\r\n * Start the animation\r\n * @param easing\r\n * @return\r\n */\r\n start(easing?: AnimationEasing) {\r\n if (this._started > 0) {\r\n return;\r\n }\r\n this._started = 1;\r\n\r\n const self = this;\r\n\r\n const tracks: Track[] = [];\r\n const maxTime = this._maxTime || 0;\r\n for (let i = 0; i < this._trackKeys.length; i++) {\r\n const propName = this._trackKeys[i];\r\n const track = this._tracks[propName];\r\n const additiveTrack = this._getAdditiveTrack(propName);\r\n const kfs = track.keyframes;\r\n const kfsNum = kfs.length;\r\n track.prepare(maxTime, additiveTrack);\r\n if (track.needsAnimate()) {\r\n // Set value directly if discrete animation is not allowed.\r\n if (!this._allowDiscrete && track.discrete) {\r\n const lastKf = kfs[kfsNum - 1];\r\n // Set final value.\r\n if (lastKf) {\r\n // use raw value without parse.\r\n (self._target as any)[track.propName] = lastKf.rawValue;\r\n }\r\n track.setFinished();\r\n }\r\n else {\r\n tracks.push(track);\r\n }\r\n }\r\n }\r\n // Add during callback on the last clip\r\n if (tracks.length || this._force) {\r\n const clip = new Clip({\r\n life: maxTime,\r\n loop: this._loop,\r\n delay: this._delay || 0,\r\n onframe(percent: number) {\r\n self._started = 2;\r\n // Remove additived animator if it's finished.\r\n // For the purpose of memory effeciency.\r\n const additiveAnimators = self._additiveAnimators;\r\n if (additiveAnimators) {\r\n let stillHasAdditiveAnimator = false;\r\n for (let i = 0; i < additiveAnimators.length; i++) {\r\n if (additiveAnimators[i]._clip) {\r\n stillHasAdditiveAnimator = true;\r\n break;\r\n }\r\n }\r\n if (!stillHasAdditiveAnimator) {\r\n self._additiveAnimators = null;\r\n }\r\n }\r\n\r\n for (let i = 0; i < tracks.length; i++) {\r\n // NOTE: don't cache target outside.\r\n // Because target may be changed.\r\n tracks[i].step(self._target, percent);\r\n }\r\n\r\n const onframeList = self._onframeCbs;\r\n if (onframeList) {\r\n for (let i = 0; i < onframeList.length; i++) {\r\n onframeList[i](self._target, percent);\r\n }\r\n }\r\n },\r\n ondestroy() {\r\n self._doneCallback();\r\n }\r\n });\r\n this._clip = clip;\r\n\r\n if (this.animation) {\r\n this.animation.addClip(clip);\r\n }\r\n\r\n if (easing) {\r\n clip.setEasing(easing);\r\n }\r\n }\r\n else {\r\n // This optimization will help the case that in the upper application\r\n // the view may be refreshed frequently, where animation will be\r\n // called repeatly but nothing changed.\r\n this._doneCallback();\r\n }\r\n\r\n return this;\r\n }\r\n /**\r\n * Stop animation\r\n * @param {boolean} forwardToLast If move to last frame before stop\r\n */\r\n stop(forwardToLast?: boolean) {\r\n if (!this._clip) {\r\n return;\r\n }\r\n const clip = this._clip;\r\n if (forwardToLast) {\r\n // Move to last frame before stop\r\n clip.onframe(1);\r\n }\r\n\r\n this._abortedCallback();\r\n }\r\n /**\r\n * Set when animation delay starts\r\n * @param time 单位ms\r\n */\r\n delay(time: number) {\r\n this._delay = time;\r\n return this;\r\n }\r\n /**\r\n * 添加动画每一帧的回调函数\r\n * @param callback\r\n */\r\n during(cb: OnframeCallback) {\r\n if (cb) {\r\n if (!this._onframeCbs) {\r\n this._onframeCbs = [];\r\n }\r\n this._onframeCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n /**\r\n * Add callback for animation end\r\n * @param cb\r\n */\r\n done(cb: DoneCallback) {\r\n if (cb) {\r\n if (!this._doneCbs) {\r\n this._doneCbs = [];\r\n }\r\n this._doneCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n\r\n aborted(cb: AbortCallback) {\r\n if (cb) {\r\n if (!this._abortedCbs) {\r\n this._abortedCbs = [];\r\n }\r\n this._abortedCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n\r\n getClip() {\r\n return this._clip;\r\n }\r\n\r\n getTrack(propName: string) {\r\n return this._tracks[propName];\r\n }\r\n\r\n getTracks() {\r\n return map(this._trackKeys, key => this._tracks[key]);\r\n }\r\n\r\n /**\r\n * Return true if animator is not available anymore.\r\n */\r\n stopTracks(propNames: string[], forwardToLast?: boolean): boolean {\r\n if (!propNames.length || !this._clip) {\r\n return true;\r\n }\r\n const tracks = this._tracks;\r\n const tracksKeys = this._trackKeys;\r\n\r\n for (let i = 0; i < propNames.length; i++) {\r\n const track = tracks[propNames[i]];\r\n if (track && !track.isFinished()) {\r\n if (forwardToLast) {\r\n track.step(this._target, 1);\r\n }\r\n // If the track has not been run for at least one frame.\r\n // The property may be stayed at the final state. when setToFinal is set true.\r\n // For example:\r\n // Animate x from 0 to 100, then animate to 150 immediately.\r\n // We want the x is translated from 0 to 150, not 100 to 150.\r\n else if (this._started === 1) {\r\n track.step(this._target, 0);\r\n }\r\n // Set track to finished\r\n track.setFinished();\r\n }\r\n }\r\n let allAborted = true;\r\n for (let i = 0; i < tracksKeys.length; i++) {\r\n if (!tracks[tracksKeys[i]].isFinished()) {\r\n allAborted = false;\r\n break;\r\n }\r\n }\r\n // Remove clip if all tracks has been aborted.\r\n if (allAborted) {\r\n this._abortedCallback();\r\n }\r\n\r\n return allAborted;\r\n }\r\n\r\n /**\r\n * Save values of final state to target.\r\n * It is mainly used in state mangement. When state is switching during animation.\r\n * We need to save final state of animation to the normal state. Not interpolated value.\r\n *\r\n * @param target\r\n * @param trackKeys\r\n * @param firstOrLast If save first frame or last frame\r\n */\r\n saveTo(\r\n target: T,\r\n trackKeys?: readonly string[],\r\n firstOrLast?: boolean\r\n ) {\r\n if (!target) { // DO nothing if target is not given.\r\n return;\r\n }\r\n\r\n trackKeys = trackKeys || this._trackKeys;\r\n\r\n for (let i = 0; i < trackKeys.length; i++) {\r\n const propName = trackKeys[i];\r\n const track = this._tracks[propName];\r\n if (!track || track.isFinished()) { // Ignore finished track.\r\n continue;\r\n }\r\n const kfs = track.keyframes;\r\n const kf = kfs[firstOrLast ? 0 : kfs.length - 1];\r\n if (kf) {\r\n // TODO CLONE?\r\n // Use raw value without parse.\r\n (target as any)[propName] = cloneValue(kf.rawValue as any);\r\n }\r\n }\r\n }\r\n\r\n // Change final value after animator has been started.\r\n // NOTE: Be careful to use it.\r\n __changeFinalValue(finalProps: Dictionary, trackKeys?: readonly string[]) {\r\n trackKeys = trackKeys || keys(finalProps);\r\n\r\n for (let i = 0; i < trackKeys.length; i++) {\r\n const propName = trackKeys[i];\r\n\r\n const track = this._tracks[propName];\r\n if (!track) {\r\n continue;\r\n }\r\n\r\n const kfs = track.keyframes;\r\n if (kfs.length > 1) {\r\n // Remove the original last kf and add again.\r\n const lastKf = kfs.pop();\r\n\r\n track.addKeyframe(lastKf.time, finalProps[propName]);\r\n // Prepare again.\r\n track.prepare(this._maxTime, track.getAdditiveTrack());\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport type AnimatorTrack = Track;","/**\r\n * Animation main class, dispatch and manage all animation controllers\r\n *\r\n */\r\n// TODO Additive animation\r\n// http://iosoteric.com/additive-animations-animatewithduration-in-ios-8/\r\n// https://developer.apple.com/videos/wwdc2014/#236\r\n\r\nimport Eventful from '../core/Eventful';\r\nimport requestAnimationFrame from './requestAnimationFrame';\r\nimport Animator from './Animator';\r\nimport Clip from './Clip';\r\n\r\nexport function getTime() {\r\n return new Date().getTime();\r\n}\r\n\r\ninterface Stage {\r\n update?: () => void\r\n}\r\n\r\ninterface AnimationOption {\r\n stage?: Stage\r\n}\r\n/**\r\n * @example\r\n * const animation = new Animation();\r\n * const obj = {\r\n * x: 100,\r\n * y: 100\r\n * };\r\n * animation.animate(node.position)\r\n * .when(1000, {\r\n * x: 500,\r\n * y: 500\r\n * })\r\n * .when(2000, {\r\n * x: 100,\r\n * y: 100\r\n * })\r\n * .start();\r\n */\r\n\r\nexport default class Animation extends Eventful {\r\n\r\n stage: Stage\r\n\r\n // Use linked list to store clip\r\n private _head: Clip\r\n private _tail: Clip\r\n\r\n private _running = false\r\n\r\n private _time = 0\r\n private _pausedTime = 0\r\n private _pauseStart = 0\r\n\r\n private _paused = false;\r\n\r\n constructor(opts?: AnimationOption) {\r\n super();\r\n\r\n opts = opts || {};\r\n\r\n this.stage = opts.stage || {};\r\n }\r\n\r\n /**\r\n * Add clip\r\n */\r\n addClip(clip: Clip) {\r\n if (clip.animation) {\r\n // Clip has been added\r\n this.removeClip(clip);\r\n }\r\n\r\n if (!this._head) {\r\n this._head = this._tail = clip;\r\n }\r\n else {\r\n this._tail.next = clip;\r\n clip.prev = this._tail;\r\n clip.next = null;\r\n this._tail = clip;\r\n }\r\n clip.animation = this;\r\n }\r\n /**\r\n * Add animator\r\n */\r\n addAnimator(animator: Animator) {\r\n animator.animation = this;\r\n const clip = animator.getClip();\r\n if (clip) {\r\n this.addClip(clip);\r\n }\r\n }\r\n /**\r\n * Delete animation clip\r\n */\r\n removeClip(clip: Clip) {\r\n if (!clip.animation) {\r\n return;\r\n }\r\n const prev = clip.prev;\r\n const next = clip.next;\r\n if (prev) {\r\n prev.next = next;\r\n }\r\n else {\r\n // Is head\r\n this._head = next;\r\n }\r\n if (next) {\r\n next.prev = prev;\r\n }\r\n else {\r\n // Is tail\r\n this._tail = prev;\r\n }\r\n clip.next = clip.prev = clip.animation = null;\r\n }\r\n\r\n /**\r\n * Delete animation clip\r\n */\r\n removeAnimator(animator: Animator) {\r\n const clip = animator.getClip();\r\n if (clip) {\r\n this.removeClip(clip);\r\n }\r\n animator.animation = null;\r\n }\r\n\r\n update(notTriggerFrameAndStageUpdate?: boolean) {\r\n const time = getTime() - this._pausedTime;\r\n const delta = time - this._time;\r\n let clip = this._head;\r\n\r\n while (clip) {\r\n // Save the nextClip before step.\r\n // So the loop will not been affected if the clip is removed in the callback\r\n const nextClip = clip.next;\r\n let finished = clip.step(time, delta);\r\n if (finished) {\r\n clip.ondestroy();\r\n this.removeClip(clip);\r\n clip = nextClip;\r\n }\r\n else {\r\n clip = nextClip;\r\n }\r\n }\r\n\r\n this._time = time;\r\n\r\n if (!notTriggerFrameAndStageUpdate) {\r\n\r\n // 'frame' should be triggered before stage, because upper application\r\n // depends on the sequence (e.g., echarts-stream and finish\r\n // event judge)\r\n this.trigger('frame', delta);\r\n\r\n this.stage.update && this.stage.update();\r\n }\r\n }\r\n\r\n _startLoop() {\r\n const self = this;\r\n\r\n this._running = true;\r\n\r\n function step() {\r\n if (self._running) {\r\n requestAnimationFrame(step);\r\n !self._paused && self.update();\r\n }\r\n }\r\n\r\n requestAnimationFrame(step);\r\n }\r\n\r\n /**\r\n * Start animation.\r\n */\r\n start() {\r\n if (this._running) {\r\n return;\r\n }\r\n\r\n this._time = getTime();\r\n this._pausedTime = 0;\r\n\r\n this._startLoop();\r\n }\r\n\r\n /**\r\n * Stop animation.\r\n */\r\n stop() {\r\n this._running = false;\r\n }\r\n\r\n /**\r\n * Pause animation.\r\n */\r\n pause() {\r\n if (!this._paused) {\r\n this._pauseStart = getTime();\r\n this._paused = true;\r\n }\r\n }\r\n\r\n /**\r\n * Resume animation.\r\n */\r\n resume() {\r\n if (this._paused) {\r\n this._pausedTime += getTime() - this._pauseStart;\r\n this._paused = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clear animation.\r\n */\r\n clear() {\r\n let clip = this._head;\r\n\r\n while (clip) {\r\n let nextClip = clip.next;\r\n clip.prev = clip.next = clip.animation = null;\r\n clip = nextClip;\r\n }\r\n\r\n this._head = this._tail = null;\r\n }\r\n\r\n /**\r\n * Whether animation finished.\r\n */\r\n isFinished() {\r\n return this._head == null;\r\n }\r\n\r\n /**\r\n * Creat animator for a target, whose props can be animated.\r\n */\r\n // TODO Gap\r\n animate(target: T, options: {\r\n loop?: boolean // Whether loop animation\r\n }) {\r\n options = options || {};\r\n\r\n // Start animation loop\r\n this.start();\r\n\r\n const animator = new Animator(\r\n target,\r\n options.loop\r\n );\r\n\r\n this.addAnimator(animator);\r\n\r\n return animator;\r\n }\r\n}","\n/* global document */\n\nimport {\n addEventListener,\n removeEventListener,\n normalizeEvent,\n getNativeEvent\n} from '../core/event';\nimport * as zrUtil from '../core/util';\nimport Eventful from '../core/Eventful';\nimport env from '../core/env';\nimport { Dictionary, ZRRawEvent, ZRRawMouseEvent } from '../core/types';\nimport { VectorArray } from '../core/vector';\nimport Handler from '../Handler';\n\ntype DomHandlersMap = Dictionary<(this: HandlerDomProxy, event: ZRRawEvent) => void>\n\ntype DomExtended = Node & {\n domBelongToZr: boolean\n}\n\nconst TOUCH_CLICK_DELAY = 300;\n\nconst globalEventSupported = env.domSupported;\n\n\nconst localNativeListenerNames = (function () {\n const mouseHandlerNames = [\n 'click', 'dblclick', 'mousewheel', 'wheel', 'mouseout',\n 'mouseup', 'mousedown', 'mousemove', 'contextmenu'\n ];\n const touchHandlerNames = [\n 'touchstart', 'touchend', 'touchmove'\n ];\n const pointerEventNameMap = {\n pointerdown: 1, pointerup: 1, pointermove: 1, pointerout: 1\n };\n const pointerHandlerNames = zrUtil.map(mouseHandlerNames, function (name) {\n const nm = name.replace('mouse', 'pointer');\n return pointerEventNameMap.hasOwnProperty(nm) ? nm : name;\n });\n\n return {\n mouse: mouseHandlerNames,\n touch: touchHandlerNames,\n pointer: pointerHandlerNames\n };\n})();\n\nconst globalNativeListenerNames = {\n mouse: ['mousemove', 'mouseup'],\n pointer: ['pointermove', 'pointerup']\n};\n\nlet wheelEventSupported = false;\n\n\n// Although firfox has 'DOMMouseScroll' event and do not has 'mousewheel' event,\n// the 'DOMMouseScroll' event do not performe the same behavior on touch pad device\n// (like on Mac) ('DOMMouseScroll' will be triggered only if a big wheel delta).\n// So we should not use it.\n// function eventNameFix(name: string) {\n// return (name === 'mousewheel' && env.browser.firefox) ? 'DOMMouseScroll' : name;\n// }\n\nfunction isPointerFromTouch(event: ZRRawEvent) {\n const pointerType = (event as any).pointerType;\n return pointerType === 'pen' || pointerType === 'touch';\n}\n\n// function useMSGuesture(handlerProxy, event) {\n// return isPointerFromTouch(event) && !!handlerProxy._msGesture;\n// }\n\n// function onMSGestureChange(proxy, event) {\n// if (event.translationX || event.translationY) {\n// // mousemove is carried by MSGesture to reduce the sensitivity.\n// proxy.handler.dispatchToElement(event.target, 'mousemove', event);\n// }\n// if (event.scale !== 1) {\n// event.pinchX = event.offsetX;\n// event.pinchY = event.offsetY;\n// event.pinchScale = event.scale;\n// proxy.handler.dispatchToElement(event.target, 'pinch', event);\n// }\n// }\n\n/**\n * Prevent mouse event from being dispatched after Touch Events action\n * @see \n * 1. Mobile browsers dispatch mouse events 300ms after touchend.\n * 2. Chrome for Android dispatch mousedown for long-touch about 650ms\n * Result: Blocking Mouse Events for 700ms.\n *\n * @param {DOMHandlerScope} scope\n */\nfunction setTouchTimer(scope: DOMHandlerScope) {\n scope.touching = true;\n if (scope.touchTimer != null) {\n clearTimeout(scope.touchTimer);\n scope.touchTimer = null;\n }\n scope.touchTimer = setTimeout(function () {\n scope.touching = false;\n scope.touchTimer = null;\n }, 700);\n}\n\n// Mark touch, which is useful in distinguish touch and\n// mouse event in upper applicatoin.\nfunction markTouch(event: ZRRawEvent) {\n event && (event.zrByTouch = true);\n}\n\n\n// function markTriggeredFromLocal(event) {\n// event && (event.__zrIsFromLocal = true);\n// }\n\n// function isTriggeredFromLocal(instance, event) {\n// return !!(event && event.__zrIsFromLocal);\n// }\n\nfunction normalizeGlobalEvent(instance: HandlerDomProxy, event: ZRRawEvent) {\n // offsetX, offsetY still need to be calculated. They are necessary in the event\n // handlers of the upper applications. Set `true` to force calculate them.\n return normalizeEvent(\n instance.dom,\n // TODO ANY TYPE\n new FakeGlobalEvent(instance, event) as any as ZRRawEvent,\n true\n );\n}\n\n/**\n * Detect whether the given el is in `painterRoot`.\n */\nfunction isLocalEl(instance: HandlerDomProxy, el: Node) {\n let elTmp = el;\n let isLocal = false;\n while (elTmp && elTmp.nodeType !== 9\n && !(\n isLocal = (elTmp as DomExtended).domBelongToZr\n || (elTmp !== el && elTmp === instance.painterRoot)\n )\n ) {\n elTmp = elTmp.parentNode;\n }\n return isLocal;\n}\n\n/**\n * Make a fake event but not change the original event,\n * because the global event probably be used by other\n * listeners not belonging to zrender.\n * @class\n */\nclass FakeGlobalEvent {\n type: string\n target: HTMLElement\n currentTarget: HTMLElement\n\n pointerType: string\n clientX: number\n clientY: number\n\n constructor(instance: HandlerDomProxy, event: ZRRawEvent) {\n this.type = event.type;\n this.target = this.currentTarget = instance.dom;\n this.pointerType = (event as any).pointerType;\n // Necessray for the force calculation of zrX, zrY\n this.clientX = (event as ZRRawMouseEvent).clientX;\n this.clientY = (event as ZRRawMouseEvent).clientY;\n // Because we do not mount global listeners to touch events,\n // we do not copy `targetTouches` and `changedTouches` here.\n }\n\n // we make the default methods on the event do nothing,\n // otherwise it is dangerous. See more details in\n // [DRAG_OUTSIDE] in `Handler.js`.\n stopPropagation = zrUtil.noop\n stopImmediatePropagation = zrUtil.noop\n preventDefault = zrUtil.noop\n}\n\n\n/**\n * Local DOM Handlers\n * @this {HandlerProxy}\n */\nconst localDOMHandlers: DomHandlersMap = {\n\n mousedown(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n this.__mayPointerCapture = [event.zrX, event.zrY];\n\n this.trigger('mousedown', event);\n },\n\n mousemove(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n const downPoint = this.__mayPointerCapture;\n if (downPoint && (event.zrX !== downPoint[0] || event.zrY !== downPoint[1])) {\n this.__togglePointerCapture(true);\n }\n\n this.trigger('mousemove', event);\n },\n\n mouseup(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n this.__togglePointerCapture(false);\n\n this.trigger('mouseup', event);\n },\n\n mouseout(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n // There might be some doms created by upper layer application\n // at the same level of painter.getViewportRoot() (e.g., tooltip\n // dom created by echarts), where 'globalout' event should not\n // be triggered when mouse enters these doms. (But 'mouseout'\n // should be triggered at the original hovered element as usual).\n const element = (event as any).toElement || (event as ZRRawMouseEvent).relatedTarget;\n\n // For SVG rendering, there are SVG elements inside `this.dom`.\n // (especially in decal case). Should not to handle those \"mouseout\"..\n if (!isLocalEl(this, element)) {\n // Similarly to the browser did on `document` and touch event,\n // `globalout` will be delayed to final pointer cature release.\n if (this.__pointerCapturing) {\n event.zrEventControl = 'no_globalout';\n }\n\n this.trigger('mouseout', event);\n }\n },\n\n wheel(event: ZRRawEvent) {\n // Morden agent has supported event `wheel` instead of `mousewheel`.\n // About the polyfill of the props \"delta\", see \"arc/core/event.ts\".\n\n // Firefox only support `wheel` rather than `mousewheel`. Although firfox has been supporting\n // event `DOMMouseScroll`, it do not act the same behavior as `wheel` on touch pad device\n // like on Mac, where `DOMMouseScroll` will be triggered only if a big wheel delta occurs,\n // and it results in no chance to \"preventDefault\". So we should not use `DOMMouseScroll`.\n\n wheelEventSupported = true;\n event = normalizeEvent(this.dom, event);\n // Follow the definition of the previous version, the zrender event name is still 'mousewheel'.\n this.trigger('mousewheel', event);\n },\n\n mousewheel(event: ZRRawEvent) {\n // IE8- and some other lagacy agent do not support event `wheel`, so we still listen\n // to the legacy event `mouseevent`.\n // Typically if event `wheel` is supported and the handler has been mounted on a\n // DOM element, the legacy `mousewheel` event will not be triggered (Chrome and Safari).\n // But we still do this guard to avoid to duplicated handle.\n if (wheelEventSupported) {\n return;\n }\n event = normalizeEvent(this.dom, event);\n this.trigger('mousewheel', event);\n },\n\n touchstart(event: ZRRawEvent) {\n // Default mouse behaviour should not be disabled here.\n // For example, page may needs to be slided.\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.__lastTouchMoment = new Date();\n\n this.handler.processGesture(event, 'start');\n\n // For consistent event listener for both touch device and mouse device,\n // we simulate \"mouseover-->mousedown\" in touch device. So we trigger\n // `mousemove` here (to trigger `mouseover` inside), and then trigger\n // `mousedown`.\n localDOMHandlers.mousemove.call(this, event);\n localDOMHandlers.mousedown.call(this, event);\n },\n\n touchmove(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.handler.processGesture(event, 'change');\n\n // Mouse move should always be triggered no matter whether\n // there is gestrue event, because mouse move and pinch may\n // be used at the same time.\n localDOMHandlers.mousemove.call(this, event);\n },\n\n touchend(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.handler.processGesture(event, 'end');\n\n localDOMHandlers.mouseup.call(this, event);\n\n // Do not trigger `mouseout` here, in spite of `mousemove`(`mouseover`) is\n // triggered in `touchstart`. This seems to be illogical, but by this mechanism,\n // we can conveniently implement \"hover style\" in both PC and touch device just\n // by listening to `mouseover` to add \"hover style\" and listening to `mouseout`\n // to remove \"hover style\" on an element, without any additional code for\n // compatibility. (`mouseout` will not be triggered in `touchend`, so \"hover\n // style\" will remain for user view)\n\n // click event should always be triggered no matter whether\n // there is gestrue event. System click can not be prevented.\n if (+new Date() - (+this.__lastTouchMoment) < TOUCH_CLICK_DELAY) {\n localDOMHandlers.click.call(this, event);\n }\n },\n\n pointerdown(event: ZRRawEvent) {\n localDOMHandlers.mousedown.call(this, event);\n\n // if (useMSGuesture(this, event)) {\n // this._msGesture.addPointer(event.pointerId);\n // }\n },\n\n pointermove(event: ZRRawEvent) {\n // FIXME\n // pointermove is so sensitive that it always triggered when\n // tap(click) on touch screen, which affect some judgement in\n // upper application. So, we don't support mousemove on MS touch\n // device yet.\n if (!isPointerFromTouch(event)) {\n localDOMHandlers.mousemove.call(this, event);\n }\n },\n\n pointerup(event: ZRRawEvent) {\n localDOMHandlers.mouseup.call(this, event);\n },\n\n pointerout(event: ZRRawEvent) {\n // pointerout will be triggered when tap on touch screen\n // (IE11+/Edge on MS Surface) after click event triggered,\n // which is inconsistent with the mousout behavior we defined\n // in touchend. So we unify them.\n // (check localDOMHandlers.touchend for detailed explanation)\n if (!isPointerFromTouch(event)) {\n localDOMHandlers.mouseout.call(this, event);\n }\n }\n\n};\n\n/**\n * Othere DOM UI Event handlers for zr dom.\n * @this {HandlerProxy}\n */\nzrUtil.each(['click', 'dblclick', 'contextmenu'], function (name) {\n localDOMHandlers[name] = function (event) {\n event = normalizeEvent(this.dom, event);\n this.trigger(name, event);\n };\n});\n\n\n/**\n * DOM UI Event handlers for global page.\n *\n * [Caution]:\n * those handlers should both support in capture phase and bubble phase!\n */\nconst globalDOMHandlers: DomHandlersMap = {\n\n pointermove: function (event: ZRRawEvent) {\n // FIXME\n // pointermove is so sensitive that it always triggered when\n // tap(click) on touch screen, which affect some judgement in\n // upper application. So, we don't support mousemove on MS touch\n // device yet.\n if (!isPointerFromTouch(event)) {\n globalDOMHandlers.mousemove.call(this, event);\n }\n },\n\n pointerup: function (event: ZRRawEvent) {\n globalDOMHandlers.mouseup.call(this, event);\n },\n\n mousemove: function (event: ZRRawEvent) {\n this.trigger('mousemove', event);\n },\n\n mouseup: function (event: ZRRawEvent) {\n const pointerCaptureReleasing = this.__pointerCapturing;\n\n this.__togglePointerCapture(false);\n\n this.trigger('mouseup', event);\n\n if (pointerCaptureReleasing) {\n event.zrEventControl = 'only_globalout';\n this.trigger('mouseout', event);\n }\n }\n\n};\n\n\nfunction mountLocalDOMEventListeners(instance: HandlerDomProxy, scope: DOMHandlerScope) {\n const domHandlers = scope.domHandlers;\n\n if (env.pointerEventsSupported) { // Only IE11+/Edge\n // 1. On devices that both enable touch and mouse (e.g., MS Surface and lenovo X240),\n // IE11+/Edge do not trigger touch event, but trigger pointer event and mouse event\n // at the same time.\n // 2. On MS Surface, it probablely only trigger mousedown but no mouseup when tap on\n // screen, which do not occurs in pointer event.\n // So we use pointer event to both detect touch gesture and mouse behavior.\n zrUtil.each(localNativeListenerNames.pointer, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n });\n });\n\n // FIXME\n // Note: MS Gesture require CSS touch-action set. But touch-action is not reliable,\n // which does not prevent defuault behavior occasionally (which may cause view port\n // zoomed in but use can not zoom it back). And event.preventDefault() does not work.\n // So we have to not to use MSGesture and not to support touchmove and pinch on MS\n // touch screen. And we only support click behavior on MS touch screen now.\n\n // MS Gesture Event is only supported on IE11+/Edge and on Windows 8+.\n // We don't support touch on IE on win7.\n // See \n // if (typeof MSGesture === 'function') {\n // (this._msGesture = new MSGesture()).target = dom; // jshint ignore:line\n // dom.addEventListener('MSGestureChange', onMSGestureChange);\n // }\n }\n else {\n if (env.touchEventsSupported) {\n zrUtil.each(localNativeListenerNames.touch, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n setTouchTimer(scope);\n });\n });\n // Handler of 'mouseout' event is needed in touch mode, which will be mounted below.\n // addEventListener(root, 'mouseout', this._mouseoutHandler);\n }\n\n // 1. Considering some devices that both enable touch and mouse event (like on MS Surface\n // and lenovo X240, @see #2350), we make mouse event be always listened, otherwise\n // mouse event can not be handle in those devices.\n // 2. On MS Surface, Chrome will trigger both touch event and mouse event. How to prevent\n // mouseevent after touch event triggered, see `setTouchTimer`.\n zrUtil.each(localNativeListenerNames.mouse, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event: ZRRawEvent) {\n event = getNativeEvent(event);\n if (!scope.touching) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n }\n });\n });\n }\n}\n\nfunction mountGlobalDOMEventListeners(instance: HandlerDomProxy, scope: DOMHandlerScope) {\n // Only IE11+/Edge. See the comment in `mountLocalDOMEventListeners`.\n if (env.pointerEventsSupported) {\n zrUtil.each(globalNativeListenerNames.pointer, mount);\n }\n // Touch event has implemented \"drag outside\" so we do not mount global listener for touch event.\n // (see https://www.w3.org/TR/touch-events/#the-touchmove-event) (see also `DRAG_OUTSIDE`).\n // We do not consider \"both-support-touch-and-mouse device\" for this feature (see the comment of\n // `mountLocalDOMEventListeners`) to avoid bugs util some requirements come.\n else if (!env.touchEventsSupported) {\n zrUtil.each(globalNativeListenerNames.mouse, mount);\n }\n\n function mount(nativeEventName: string) {\n function nativeEventListener(event: ZRRawEvent) {\n event = getNativeEvent(event);\n // See the reason in [DRAG_OUTSIDE] in `Handler.js`\n // This checking supports both `useCapture` or not.\n // PENDING: if there is performance issue in some devices,\n // we probably can not use `useCapture` and change a easier\n // to judes whether local (mark).\n if (!isLocalEl(instance, event.target as Node)) {\n event = normalizeGlobalEvent(instance, event);\n scope.domHandlers[nativeEventName].call(instance, event);\n }\n }\n mountSingleDOMEventListener(\n scope, nativeEventName, nativeEventListener,\n {capture: true} // See [DRAG_OUTSIDE] in `Handler.js`\n );\n }\n}\n\nfunction mountSingleDOMEventListener(\n scope: DOMHandlerScope,\n nativeEventName: string,\n listener: EventListener,\n opt?: boolean | AddEventListenerOptions\n) {\n scope.mounted[nativeEventName] = listener;\n scope.listenerOpts[nativeEventName] = opt;\n addEventListener(scope.domTarget, nativeEventName, listener, opt);\n}\n\nfunction unmountDOMEventListeners(scope: DOMHandlerScope) {\n const mounted = scope.mounted;\n for (let nativeEventName in mounted) {\n if (mounted.hasOwnProperty(nativeEventName)) {\n removeEventListener(\n scope.domTarget, nativeEventName, mounted[nativeEventName],\n scope.listenerOpts[nativeEventName]\n );\n }\n }\n scope.mounted = {};\n}\n\n\nclass DOMHandlerScope {\n domTarget: HTMLElement | HTMLDocument\n domHandlers: DomHandlersMap\n\n // Key: eventName, value: mounted handler functions.\n // Used for unmount.\n mounted: Dictionary = {};\n\n listenerOpts: Dictionary = {};\n\n touchTimer: ReturnType;\n touching = false;\n\n constructor(\n domTarget: HTMLElement | HTMLDocument,\n domHandlers: DomHandlersMap\n ) {\n this.domTarget = domTarget;\n this.domHandlers = domHandlers;\n\n }\n}\n\n\nexport default class HandlerDomProxy extends Eventful {\n\n dom: HTMLElement\n painterRoot: HTMLElement\n\n handler: Handler\n\n private _localHandlerScope: DOMHandlerScope\n private _globalHandlerScope: DOMHandlerScope\n\n __lastTouchMoment: Date\n\n // See [DRAG_OUTSIDE] in `Handler.ts`.\n __pointerCapturing = false\n // [x, y]\n __mayPointerCapture: VectorArray\n\n\n constructor(dom: HTMLElement, painterRoot: HTMLElement) {\n super();\n\n this.dom = dom;\n this.painterRoot = painterRoot;\n\n this._localHandlerScope = new DOMHandlerScope(dom, localDOMHandlers);\n\n if (globalEventSupported) {\n this._globalHandlerScope = new DOMHandlerScope(document, globalDOMHandlers);\n }\n\n mountLocalDOMEventListeners(this, this._localHandlerScope);\n }\n\n dispose() {\n unmountDOMEventListeners(this._localHandlerScope);\n if (globalEventSupported) {\n unmountDOMEventListeners(this._globalHandlerScope);\n }\n }\n\n setCursor(cursorStyle: string) {\n this.dom.style && (this.dom.style.cursor = cursorStyle || 'default');\n }\n\n /**\n * See [DRAG_OUTSIDE] in `Handler.js`.\n * @implement\n * @param isPointerCapturing Should never be `null`/`undefined`.\n * `true`: start to capture pointer if it is not capturing.\n * `false`: end the capture if it is capturing.\n */\n __togglePointerCapture(isPointerCapturing?: boolean) {\n this.__mayPointerCapture = null;\n\n if (globalEventSupported\n && ((+this.__pointerCapturing) ^ (+isPointerCapturing))\n ) {\n this.__pointerCapturing = isPointerCapturing;\n\n const globalHandlerScope = this._globalHandlerScope;\n isPointerCapturing\n ? mountGlobalDOMEventListeners(this, globalHandlerScope)\n : unmountDOMEventListeners(globalHandlerScope);\n }\n }\n}\n\nexport interface HandlerProxyInterface extends Eventful {\n handler: Handler\n dispose: () => void\n setCursor: (cursorStyle?: string) => void\n}","import env from './core/env';\n\nlet dpr = 1;\n\n// If in browser environment\nif (env.hasGlobalWindow) {\n dpr = Math.max(\n window.devicePixelRatio\n || (window.screen && (window.screen as any).deviceXDPI / (window.screen as any).logicalXDPI)\n || 1, 1\n );\n}\n\n/**\n * Debug log mode:\n * 0: Do nothing, for release.\n * 1: console.error, for debug.\n */\nexport const debugMode = 0;\n\n// retina 屏幕优化\nexport const devicePixelRatio = dpr;\n\n\n/**\n * Determine when to turn on dark mode based on the luminance of backgroundColor\n */\nexport const DARK_MODE_THRESHOLD = 0.4;\n\n/**\n * Color of default dark label.\n */\nexport const DARK_LABEL_COLOR = '#333';\n\n/**\n * Color of default light label.\n */\nexport const LIGHT_LABEL_COLOR = '#ccc';\n\n/**\n * Color of default light label.\n */\nexport const LIGHTER_LABEL_COLOR = '#eee';\n","import * as matrix from './matrix';\nimport * as vector from './vector';\n\nconst mIdentity = matrix.identity;\n\nconst EPSILON = 5e-5;\n\nfunction isNotAroundZero(val: number) {\n return val > EPSILON || val < -EPSILON;\n}\n\nconst scaleTmp: vector.VectorArray = [];\nconst tmpTransform: matrix.MatrixArray = [];\nconst originTransform = matrix.create();\nconst abs = Math.abs;\n\nclass Transformable {\n\n parent: Transformable\n\n x: number\n y: number\n\n scaleX: number\n scaleY: number\n\n skewX: number\n skewY: number\n\n rotation: number\n\n /**\n * Will translated the element to the anchor position before applying other transforms.\n */\n anchorX: number\n anchorY: number\n /**\n * Origin of scale, rotation, skew\n */\n originX: number\n originY: number\n\n /**\n * Scale ratio\n */\n globalScaleRatio: number\n\n transform: matrix.MatrixArray\n invTransform: matrix.MatrixArray\n\n /**\n * Get computed local transform\n */\n getLocalTransform(m?: matrix.MatrixArray) {\n return Transformable.getLocalTransform(this, m);\n }\n\n /**\n * Set position from array\n */\n setPosition(arr: number[]) {\n this.x = arr[0];\n this.y = arr[1];\n }\n /**\n * Set scale from array\n */\n setScale(arr: number[]) {\n this.scaleX = arr[0];\n this.scaleY = arr[1];\n }\n\n /**\n * Set skew from array\n */\n setSkew(arr: number[]) {\n this.skewX = arr[0];\n this.skewY = arr[1];\n }\n\n /**\n * Set origin from array\n */\n setOrigin(arr: number[]) {\n this.originX = arr[0];\n this.originY = arr[1];\n }\n\n /**\n * If needs to compute transform\n */\n needLocalTransform(): boolean {\n return isNotAroundZero(this.rotation)\n || isNotAroundZero(this.x)\n || isNotAroundZero(this.y)\n || isNotAroundZero(this.scaleX - 1)\n || isNotAroundZero(this.scaleY - 1)\n || isNotAroundZero(this.skewX)\n || isNotAroundZero(this.skewY);\n }\n\n /**\n * Update global transform\n */\n updateTransform() {\n const parentTransform = this.parent && this.parent.transform;\n const needLocalTransform = this.needLocalTransform();\n\n let m = this.transform;\n if (!(needLocalTransform || parentTransform)) {\n if (m) {\n mIdentity(m);\n // reset invTransform\n this.invTransform = null;\n }\n return;\n }\n\n m = m || matrix.create();\n\n if (needLocalTransform) {\n this.getLocalTransform(m);\n }\n else {\n mIdentity(m);\n }\n\n // 应用父节点变换\n if (parentTransform) {\n if (needLocalTransform) {\n matrix.mul(m, parentTransform, m);\n }\n else {\n matrix.copy(m, parentTransform);\n }\n }\n // 保存这个变换矩阵\n this.transform = m;\n\n this._resolveGlobalScaleRatio(m);\n }\n\n private _resolveGlobalScaleRatio(m: matrix.MatrixArray) {\n const globalScaleRatio = this.globalScaleRatio;\n if (globalScaleRatio != null && globalScaleRatio !== 1) {\n this.getGlobalScale(scaleTmp);\n const relX = scaleTmp[0] < 0 ? -1 : 1;\n const relY = scaleTmp[1] < 0 ? -1 : 1;\n const sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;\n const sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;\n\n m[0] *= sx;\n m[1] *= sx;\n m[2] *= sy;\n m[3] *= sy;\n }\n\n this.invTransform = this.invTransform || matrix.create();\n matrix.invert(this.invTransform, m);\n }\n\n /**\n * Get computed global transform\n * NOTE: this method will force update transform on all ancestors.\n * Please be aware of the potential performance cost.\n */\n getComputedTransform() {\n let transformNode: Transformable = this;\n const ancestors: Transformable[] = [];\n while (transformNode) {\n ancestors.push(transformNode);\n transformNode = transformNode.parent;\n }\n\n // Update from topdown.\n while (transformNode = ancestors.pop()) {\n transformNode.updateTransform();\n }\n\n return this.transform;\n }\n\n setLocalTransform(m: vector.VectorArray) {\n if (!m) {\n // TODO return or set identity?\n return;\n }\n let sx = m[0] * m[0] + m[1] * m[1];\n let sy = m[2] * m[2] + m[3] * m[3];\n\n const rotation = Math.atan2(m[1], m[0]);\n\n const shearX = Math.PI / 2 + rotation - Math.atan2(m[3], m[2]);\n sy = Math.sqrt(sy) * Math.cos(shearX);\n sx = Math.sqrt(sx);\n\n this.skewX = shearX;\n this.skewY = 0;\n this.rotation = -rotation;\n\n this.x = +m[4];\n this.y = +m[5];\n this.scaleX = sx;\n this.scaleY = sy;\n\n this.originX = 0;\n this.originY = 0;\n }\n /**\n * 分解`transform`矩阵到`position`, `rotation`, `scale`\n */\n decomposeTransform() {\n if (!this.transform) {\n return;\n }\n const parent = this.parent;\n let m = this.transform;\n if (parent && parent.transform) {\n // Get local transform and decompose them to position, scale, rotation\n parent.invTransform = parent.invTransform || matrix.create();\n matrix.mul(tmpTransform, parent.invTransform, m);\n m = tmpTransform;\n }\n const ox = this.originX;\n const oy = this.originY;\n if (ox || oy) {\n originTransform[4] = ox;\n originTransform[5] = oy;\n matrix.mul(tmpTransform, m, originTransform);\n tmpTransform[4] -= ox;\n tmpTransform[5] -= oy;\n m = tmpTransform;\n }\n\n this.setLocalTransform(m);\n }\n\n /**\n * Get global scale\n */\n getGlobalScale(out?: vector.VectorArray): vector.VectorArray {\n const m = this.transform;\n out = out || [];\n if (!m) {\n out[0] = 1;\n out[1] = 1;\n return out;\n }\n out[0] = Math.sqrt(m[0] * m[0] + m[1] * m[1]);\n out[1] = Math.sqrt(m[2] * m[2] + m[3] * m[3]);\n if (m[0] < 0) {\n out[0] = -out[0];\n }\n if (m[3] < 0) {\n out[1] = -out[1];\n }\n return out;\n }\n /**\n * 变换坐标位置到 shape 的局部坐标空间\n */\n transformCoordToLocal(x: number, y: number): number[] {\n const v2 = [x, y];\n const invTransform = this.invTransform;\n if (invTransform) {\n vector.applyTransform(v2, v2, invTransform);\n }\n return v2;\n }\n\n /**\n * 变换局部坐标位置到全局坐标空间\n */\n transformCoordToGlobal(x: number, y: number): number[] {\n const v2 = [x, y];\n const transform = this.transform;\n if (transform) {\n vector.applyTransform(v2, v2, transform);\n }\n return v2;\n }\n\n\n getLineScale() {\n const m = this.transform;\n // Get the line scale.\n // Determinant of `m` means how much the area is enlarged by the\n // transformation. So its square root can be used as a scale factor\n // for width.\n return m && abs(m[0] - 1) > 1e-10 && abs(m[3] - 1) > 1e-10\n ? Math.sqrt(abs(m[0] * m[3] - m[2] * m[1]))\n : 1;\n }\n\n copyTransform(source: Transformable) {\n copyTransform(this, source);\n }\n\n\n static getLocalTransform(target: Transformable, m?: matrix.MatrixArray): matrix.MatrixArray {\n m = m || [];\n\n const ox = target.originX || 0;\n const oy = target.originY || 0;\n const sx = target.scaleX;\n const sy = target.scaleY;\n const ax = target.anchorX;\n const ay = target.anchorY;\n const rotation = target.rotation || 0;\n const x = target.x;\n const y = target.y;\n const skewX = target.skewX ? Math.tan(target.skewX) : 0;\n // TODO: zrender use different hand in coordinate system and y axis is inversed.\n const skewY = target.skewY ? Math.tan(-target.skewY) : 0;\n\n // The order of transform (-anchor * -origin * scale * skew * rotate * origin * translate).\n // We merge (-origin * scale * skew) into one. Also did identity in these operations.\n // origin\n if (ox || oy || ax || ay) {\n const dx = ox + ax;\n const dy = oy + ay;\n m[4] = -dx * sx - skewX * dy * sy;\n m[5] = -dy * sy - skewY * dx * sx;\n }\n else {\n m[4] = m[5] = 0;\n }\n // scale\n m[0] = sx;\n m[3] = sy;\n // skew\n m[1] = skewY * sx;\n m[2] = skewX * sy;\n\n // Apply rotation\n rotation && matrix.rotate(m, m, rotation);\n\n // Translate back from origin and apply translation\n m[4] += ox + x;\n m[5] += oy + y;\n\n return m;\n }\n\n private static initDefaultProps = (function () {\n const proto = Transformable.prototype;\n proto.scaleX =\n proto.scaleY =\n proto.globalScaleRatio = 1;\n proto.x =\n proto.y =\n proto.originX =\n proto.originY =\n proto.skewX =\n proto.skewY =\n proto.rotation =\n proto.anchorX =\n proto.anchorY = 0;\n })()\n};\n\nexport const TRANSFORMABLE_PROPS = [\n 'x', 'y', 'originX', 'originY', 'anchorX', 'anchorY', 'rotation', 'scaleX', 'scaleY', 'skewX', 'skewY'\n] as const;\n\nexport type TransformProp = (typeof TRANSFORMABLE_PROPS)[number]\n\nexport function copyTransform(\n target: Partial>,\n source: Pick\n) {\n for (let i = 0; i < TRANSFORMABLE_PROPS.length; i++) {\n const propName = TRANSFORMABLE_PROPS[i];\n target[propName] = source[propName];\n }\n}\n\nexport default Transformable;","import BoundingRect, { RectLike } from '../core/BoundingRect';\r\nimport { Dictionary, TextAlign, TextVerticalAlign, BuiltinTextPosition } from '../core/types';\r\nimport LRU from '../core/LRU';\r\nimport { DEFAULT_FONT, platformApi } from '../core/platform';\r\n\r\nlet textWidthCache: Dictionary> = {};\r\n\r\nexport function getWidth(text: string, font: string): number {\r\n font = font || DEFAULT_FONT;\r\n let cacheOfFont = textWidthCache[font];\r\n if (!cacheOfFont) {\r\n cacheOfFont = textWidthCache[font] = new LRU(500);\r\n }\r\n let width = cacheOfFont.get(text);\r\n if (width == null) {\r\n width = platformApi.measureText(text, font).width;\r\n cacheOfFont.put(text, width);\r\n }\r\n\r\n return width;\r\n}\r\n\r\n/**\r\n *\r\n * Get bounding rect for inner usage(TSpan)\r\n * Which not include text newline.\r\n */\r\nexport function innerGetBoundingRect(\r\n text: string,\r\n font: string,\r\n textAlign?: TextAlign,\r\n textBaseline?: TextVerticalAlign\r\n): BoundingRect {\r\n const width = getWidth(text, font);\r\n const height = getLineHeight(font);\r\n\r\n const x = adjustTextX(0, width, textAlign);\r\n const y = adjustTextY(0, height, textBaseline);\r\n\r\n const rect = new BoundingRect(x, y, width, height);\r\n\r\n return rect;\r\n}\r\n\r\n/**\r\n *\r\n * Get bounding rect for outer usage. Compatitable with old implementation\r\n * Which includes text newline.\r\n */\r\nexport function getBoundingRect(\r\n text: string,\r\n font: string,\r\n textAlign?: TextAlign,\r\n textBaseline?: TextVerticalAlign\r\n) {\r\n const textLines = ((text || '') + '').split('\\n');\r\n const len = textLines.length;\r\n if (len === 1) {\r\n return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);\r\n }\r\n else {\r\n const uniondRect = new BoundingRect(0, 0, 0, 0);\r\n for (let i = 0; i < textLines.length; i++) {\r\n const rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);\r\n i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);\r\n }\r\n return uniondRect;\r\n }\r\n}\r\n\r\nexport function adjustTextX(x: number, width: number, textAlign: TextAlign): number {\r\n // TODO Right to left language\r\n if (textAlign === 'right') {\r\n x -= width;\r\n }\r\n else if (textAlign === 'center') {\r\n x -= width / 2;\r\n }\r\n return x;\r\n}\r\n\r\nexport function adjustTextY(y: number, height: number, verticalAlign: TextVerticalAlign): number {\r\n if (verticalAlign === 'middle') {\r\n y -= height / 2;\r\n }\r\n else if (verticalAlign === 'bottom') {\r\n y -= height;\r\n }\r\n return y;\r\n}\r\n\r\n\r\nexport function getLineHeight(font?: string): number {\r\n // FIXME A rough approach.\r\n return getWidth('国', font);\r\n}\r\n\r\nexport function measureText(text: string, font?: string): {\r\n width: number\r\n} {\r\n return platformApi.measureText(text, font);\r\n}\r\n\r\n\r\nexport function parsePercent(value: number | string, maxValue: number): number {\r\n if (typeof value === 'string') {\r\n if (value.lastIndexOf('%') >= 0) {\r\n return parseFloat(value) / 100 * maxValue;\r\n }\r\n return parseFloat(value);\r\n }\r\n return value;\r\n}\r\n\r\nexport interface TextPositionCalculationResult {\r\n x: number\r\n y: number\r\n align: TextAlign\r\n verticalAlign: TextVerticalAlign\r\n}\r\n/**\r\n * Follow same interface to `Displayable.prototype.calculateTextPosition`.\r\n * @public\r\n * @param out Prepared out object. If not input, auto created in the method.\r\n * @param style where `textPosition` and `textDistance` are visited.\r\n * @param rect {x, y, width, height} Rect of the host elment, according to which the text positioned.\r\n * @return The input `out`. Set: {x, y, textAlign, textVerticalAlign}\r\n */\r\nexport function calculateTextPosition(\r\n out: TextPositionCalculationResult,\r\n opts: {\r\n position?: BuiltinTextPosition | (number | string)[]\r\n distance?: number // Default 5\r\n global?: boolean\r\n },\r\n rect: RectLike\r\n): TextPositionCalculationResult {\r\n const textPosition = opts.position || 'inside';\r\n const distance = opts.distance != null ? opts.distance : 5;\r\n\r\n const height = rect.height;\r\n const width = rect.width;\r\n const halfHeight = height / 2;\r\n\r\n let x = rect.x;\r\n let y = rect.y;\r\n\r\n let textAlign: TextAlign = 'left';\r\n let textVerticalAlign: TextVerticalAlign = 'top';\r\n\r\n if (textPosition instanceof Array) {\r\n x += parsePercent(textPosition[0], rect.width);\r\n y += parsePercent(textPosition[1], rect.height);\r\n // Not use textAlign / textVerticalAlign\r\n textAlign = null;\r\n textVerticalAlign = null;\r\n }\r\n else {\r\n switch (textPosition) {\r\n case 'left':\r\n x -= distance;\r\n y += halfHeight;\r\n textAlign = 'right';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'right':\r\n x += distance + width;\r\n y += halfHeight;\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'top':\r\n x += width / 2;\r\n y -= distance;\r\n textAlign = 'center';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'bottom':\r\n x += width / 2;\r\n y += height + distance;\r\n textAlign = 'center';\r\n break;\r\n case 'inside':\r\n x += width / 2;\r\n y += halfHeight;\r\n textAlign = 'center';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideLeft':\r\n x += distance;\r\n y += halfHeight;\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideRight':\r\n x += width - distance;\r\n y += halfHeight;\r\n textAlign = 'right';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideTop':\r\n x += width / 2;\r\n y += distance;\r\n textAlign = 'center';\r\n break;\r\n case 'insideBottom':\r\n x += width / 2;\r\n y += height - distance;\r\n textAlign = 'center';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'insideTopLeft':\r\n x += distance;\r\n y += distance;\r\n break;\r\n case 'insideTopRight':\r\n x += width - distance;\r\n y += distance;\r\n textAlign = 'right';\r\n break;\r\n case 'insideBottomLeft':\r\n x += distance;\r\n y += height - distance;\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'insideBottomRight':\r\n x += width - distance;\r\n y += height - distance;\r\n textAlign = 'right';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n }\r\n }\r\n\r\n out = out || {} as TextPositionCalculationResult;\r\n out.x = x;\r\n out.y = y;\r\n out.align = textAlign;\r\n out.verticalAlign = textVerticalAlign;\r\n\r\n return out;\r\n}\r\n","import Transformable, {TRANSFORMABLE_PROPS, TransformProp} from './core/Transformable';\nimport { AnimationEasing } from './animation/easing';\nimport Animator, {cloneValue} from './animation/Animator';\nimport { ZRenderType } from './zrender';\nimport {\n Dictionary, ElementEventName, ZRRawEvent, BuiltinTextPosition, AllPropTypes,\n TextVerticalAlign, TextAlign, MapToType\n} from './core/types';\nimport Path from './graphic/Path';\nimport BoundingRect, { RectLike } from './core/BoundingRect';\nimport Eventful from './core/Eventful';\nimport ZRText, { DefaultTextStyle } from './graphic/Text';\nimport { calculateTextPosition, TextPositionCalculationResult, parsePercent } from './contain/text';\nimport {\n guid,\n isObject,\n keys,\n extend,\n indexOf,\n logError,\n mixin,\n isArrayLike,\n isTypedArray,\n isGradientObject,\n filter,\n reduce\n} from './core/util';\nimport Polyline from './graphic/shape/Polyline';\nimport Group from './graphic/Group';\nimport Point from './core/Point';\nimport { LIGHT_LABEL_COLOR, DARK_LABEL_COLOR } from './config';\nimport { parse, stringify } from './tool/color';\nimport { REDRAW_BIT } from './graphic/constants';\n\nexport interface ElementAnimateConfig {\n duration?: number\n delay?: number\n easing?: AnimationEasing\n during?: (percent: number) => void\n\n // `done` will be called when all of the animations of the target props are\n // \"done\" or \"aborted\", and at least one \"done\" happened.\n // Common cases: animations declared, but some of them are aborted (e.g., by state change).\n // The calling of `animationTo` done rather than aborted if at least one done happened.\n done?: Function\n // `aborted` will be called when all of the animations of the target props are \"aborted\".\n aborted?: Function\n\n scope?: string\n /**\n * If force animate\n * Prevent stop animation and callback\n * immediently when target values are the same as current values.\n */\n force?: boolean\n /**\n * If use additive animation.\n */\n additive?: boolean\n /**\n * If set to final state before animation started.\n * It can be useful if something you want to calcuate depends on the final state of element.\n * Like bounding rect for text layouting.\n *\n * Only available in animateTo\n */\n setToFinal?: boolean\n}\n\nexport interface ElementTextConfig {\n /**\n * Position relative to the element bounding rect\n * @default 'inside'\n */\n position?: BuiltinTextPosition | (number | string)[]\n\n /**\n * Rotation of the label.\n */\n rotation?: number\n\n /**\n * Rect that text will be positioned.\n * Default to be the rect of element.\n */\n layoutRect?: RectLike\n\n /**\n * Offset of the label.\n * The difference of offset and position is that it will be applied\n * in the rotation\n */\n offset?: number[]\n\n /**\n * Origin or rotation. Which is relative to the bounding box of the attached element.\n * Can be percent value. Relative to the bounding box.\n * If specified center. It will be center of the bounding box.\n *\n * Only available when position and rotation are both set.\n */\n origin?: (number | string)[] | 'center'\n\n /**\n * Distance to the rect\n * @default 5\n */\n distance?: number\n\n /**\n * If use local user space. Which will apply host's transform\n * @default false\n */\n local?: boolean\n\n /**\n * `insideFill` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `fill` will be picked by this priority:\n * `textContent.style.fill` > `textConfig.insideFill` > \"auto-calculated-fill\"\n * In most cases, \"auto-calculated-fill\" is white.\n */\n insideFill?: string\n\n /**\n * `insideStroke` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `stroke` will be picked by this priority:\n * `textContent.style.stroke` > `textConfig.insideStroke` > \"auto-calculated-stroke\"\n *\n * The rule of getting \"auto-calculated-stroke\":\n * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`)\n * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`)\n * \"auto-calculated-stroke\" will be null.\n * Otherwise, \"auto-calculated-stroke\" will be the same as `fill` of this element if possible, or null.\n *\n * The reason of (A) is not decisive:\n * 1. If users specify `fill` in style and still use \"auto-calculated-stroke\", the effect\n * is not good and unexpected in some cases. It not easy and seams uncessary to auto calculate\n * a proper `stroke` for the given `fill`, since they can specify `stroke` themselve.\n * 2. Backward compat.\n */\n insideStroke?: string\n\n /**\n * `outsideFill` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `fill` will be picked by this priority:\n * `textContent.style.fill` > `textConfig.outsideFill` > #000\n */\n outsideFill?: string\n\n /**\n * `outsideStroke` is a color string or left empth.\n * If a `textContent` is not \"inside\", its final `stroke` will be picked by this priority:\n * `textContent.style.stroke` > `textConfig.outsideStroke` > \"auto-calculated-stroke\"\n *\n * The rule of getting \"auto-calculated-stroke\":\n * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`)\n * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`)\n * \"auto-calculated-stroke\" will be null.\n * Otherwise, \"auto-calculated-stroke\" will be a neer white color to distinguish \"front end\"\n * label with messy background (like other text label, line or other graphic).\n */\n outsideStroke?: string\n\n /**\n * Tell zrender I can sure this text is inside or not.\n * In case position is not using builtin `inside` hints.\n */\n inside?: boolean\n}\nexport interface ElementTextGuideLineConfig {\n /**\n * Anchor for text guide line.\n * Notice: Won't work\n */\n anchor?: Point\n\n /**\n * If above the target element.\n */\n showAbove?: boolean\n\n /**\n * Candidates of connectors. Used when autoCalculate is true and anchor is not specified.\n */\n candidates?: ('left' | 'top' | 'right' | 'bottom')[]\n}\n\nexport interface ElementEvent {\n type: ElementEventName,\n event: ZRRawEvent,\n // target can only be an element that is not silent.\n target: Element,\n // topTarget can be a silent element.\n topTarget: Element,\n cancelBubble: boolean,\n offsetX: number,\n offsetY: number,\n gestureEvent: string,\n pinchX: number,\n pinchY: number,\n pinchScale: number,\n wheelDelta: number,\n zrByTouch: boolean,\n which: number,\n stop: (this: ElementEvent) => void\n}\n\nexport type ElementEventCallback = (\n this: CbThis, e: ElementEvent\n) => boolean | void\ntype CbThis = unknown extends Ctx ? Impl : Ctx;\n\ninterface ElementEventHandlerProps {\n // Events\n onclick: ElementEventCallback\n ondblclick: ElementEventCallback\n onmouseover: ElementEventCallback\n onmouseout: ElementEventCallback\n onmousemove: ElementEventCallback\n onmousewheel: ElementEventCallback\n onmousedown: ElementEventCallback\n onmouseup: ElementEventCallback\n oncontextmenu: ElementEventCallback\n\n ondrag: ElementEventCallback\n ondragstart: ElementEventCallback\n ondragend: ElementEventCallback\n ondragenter: ElementEventCallback\n ondragleave: ElementEventCallback\n ondragover: ElementEventCallback\n ondrop: ElementEventCallback\n}\n\nexport interface ElementProps extends Partial, Partial> {\n name?: string\n ignore?: boolean\n isGroup?: boolean\n draggable?: boolean | 'horizontal' | 'vertical'\n\n silent?: boolean\n\n ignoreClip?: boolean\n globalScaleRatio?: number\n\n textConfig?: ElementTextConfig\n textContent?: ZRText\n\n clipPath?: Path\n drift?: Element['drift']\n\n extra?: Dictionary\n\n // For echarts animation.\n anid?: string\n}\n\n// Properties can be used in state.\nexport const PRESERVED_NORMAL_STATE = '__zr_normal__';\n// export const PRESERVED_MERGED_STATE = '__zr_merged__';\n\nconst PRIMARY_STATES_KEYS = (TRANSFORMABLE_PROPS as any).concat(['ignore']) as [TransformProp, 'ignore'];\nconst DEFAULT_ANIMATABLE_MAP = reduce(TRANSFORMABLE_PROPS, (obj, key) => {\n obj[key] = true;\n return obj;\n}, {ignore: false} as Partial>);\n\nexport type ElementStatePropNames = (typeof PRIMARY_STATES_KEYS)[number] | 'textConfig';\nexport type ElementState = Pick & ElementCommonState\n\nexport type ElementCommonState = {\n hoverLayer?: boolean\n}\n\nexport type ElementCalculateTextPosition = (\n out: TextPositionCalculationResult,\n style: ElementTextConfig,\n rect: RectLike\n) => TextPositionCalculationResult;\n\nlet tmpTextPosCalcRes = {} as TextPositionCalculationResult;\nlet tmpBoundingRect = new BoundingRect(0, 0, 0, 0);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ninterface Element extends Transformable,\n Eventful<{\n [key in ElementEventName]: (e: ElementEvent) => void | boolean\n } & {\n [key in string]: (...args: any) => void | boolean\n }>,\n ElementEventHandlerProps {\n}\n\nclass Element {\n\n id: number = guid()\n /**\n * Element type\n */\n type: string\n\n /**\n * Element name\n */\n name: string\n\n /**\n * If ignore drawing and events of the element object\n */\n ignore: boolean\n\n /**\n * Whether to respond to mouse events.\n */\n silent: boolean\n\n /**\n * 是否是 Group\n */\n isGroup: boolean\n\n /**\n * Whether it can be dragged.\n */\n draggable: boolean | 'horizontal' | 'vertical'\n\n /**\n * Whether is it dragging.\n */\n dragging: boolean\n\n parent: Group\n\n animators: Animator[] = []\n\n /**\n * If ignore clip from it's parent or hosts.\n * Applied on itself and all it's children.\n *\n * NOTE: It won't affect the clipPath set on the children.\n */\n ignoreClip: boolean\n\n /**\n * If element is used as a component of other element.\n */\n __hostTarget: Element\n\n /**\n * ZRender instance will be assigned when element is associated with zrender\n */\n __zr: ZRenderType\n\n /**\n * Dirty bits.\n * From which painter will determine if this displayable object needs brush.\n */\n __dirty: number\n\n /**\n * If element was painted on the screen\n */\n __isRendered: boolean;\n\n /**\n * If element has been moved to the hover layer.\n *\n * If so, dirty will only trigger the zrender refresh hover layer\n */\n __inHover: boolean\n\n /**\n * path to clip the elements and its children, if it is a group.\n * @see http://www.w3.org/TR/2dcontext/#clipping-region\n */\n private _clipPath?: Path\n\n /**\n * Attached text element.\n * `position`, `style.textAlign`, `style.textVerticalAlign`\n * of element will be ignored if textContent.position is set\n */\n private _textContent?: ZRText\n\n /**\n * Text guide line.\n */\n private _textGuide?: Polyline\n\n /**\n * Config of textContent. Inlcuding layout, color, ...etc.\n */\n textConfig?: ElementTextConfig\n\n /**\n * Config for guide line calculating.\n *\n * NOTE: This is just a property signature. READ and WRITE are all done in echarts.\n */\n textGuideLineConfig?: ElementTextGuideLineConfig\n\n // FOR ECHARTS\n /**\n * Id for mapping animation\n */\n anid: string\n\n extra: Dictionary\n\n currentStates?: string[] = []\n // prevStates is for storager in echarts.\n prevStates?: string[]\n /**\n * Store of element state.\n * '__normal__' key is preserved for default properties.\n */\n states: Dictionary = {}\n\n /**\n * Animation config applied on state switching.\n */\n stateTransition: ElementAnimateConfig\n\n /**\n * Proxy function for getting state with given stateName.\n * ZRender will first try to get with stateProxy. Then find from states if stateProxy returns nothing\n *\n * targetStates will be given in useStates\n */\n stateProxy?: (stateName: string, targetStates?: string[]) => ElementState\n\n protected _normalState: ElementState\n\n // Temporary storage for inside text color configuration.\n private _innerTextDefaultStyle: DefaultTextStyle\n\n constructor(props?: Props) {\n this._init(props);\n }\n\n protected _init(props?: Props) {\n // Init default properties\n this.attr(props);\n }\n\n /**\n * Drift element\n * @param {number} dx dx on the global space\n * @param {number} dy dy on the global space\n */\n drift(dx: number, dy: number, e?: ElementEvent) {\n switch (this.draggable) {\n case 'horizontal':\n dy = 0;\n break;\n case 'vertical':\n dx = 0;\n break;\n }\n\n let m = this.transform;\n if (!m) {\n m = this.transform = [1, 0, 0, 1, 0, 0];\n }\n m[4] += dx;\n m[5] += dy;\n\n this.decomposeTransform();\n this.markRedraw();\n }\n\n /**\n * Hook before update\n */\n beforeUpdate() {}\n /**\n * Hook after update\n */\n afterUpdate() {}\n /**\n * Update each frame\n */\n update() {\n this.updateTransform();\n\n if (this.__dirty) {\n this.updateInnerText();\n }\n }\n\n updateInnerText(forceUpdate?: boolean) {\n // Update textContent\n const textEl = this._textContent;\n if (textEl && (!textEl.ignore || forceUpdate)) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n const textConfig = this.textConfig;\n const isLocal = textConfig.local;\n const innerTransformable = textEl.innerTransformable;\n\n let textAlign: TextAlign;\n let textVerticalAlign: TextVerticalAlign;\n\n let textStyleChanged = false;\n\n // Apply host's transform.\n innerTransformable.parent = isLocal ? this as unknown as Group : null;\n\n let innerOrigin = false;\n\n // Reset x/y/rotation\n innerTransformable.copyTransform(textEl);\n\n // Force set attached text's position if `position` is in config.\n if (textConfig.position != null) {\n let layoutRect = tmpBoundingRect;\n if (textConfig.layoutRect) {\n layoutRect.copy(textConfig.layoutRect);\n }\n else {\n layoutRect.copy(this.getBoundingRect());\n }\n if (!isLocal) {\n layoutRect.applyTransform(this.transform);\n }\n\n if (this.calculateTextPosition) {\n this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n else {\n calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n\n // TODO Should modify back if textConfig.position is set to null again.\n // Or textContent is detached.\n innerTransformable.x = tmpTextPosCalcRes.x;\n innerTransformable.y = tmpTextPosCalcRes.y;\n\n // User specified align/verticalAlign has higher priority, which is\n // useful in the case that attached text is rotated 90 degree.\n textAlign = tmpTextPosCalcRes.align;\n textVerticalAlign = tmpTextPosCalcRes.verticalAlign;\n\n const textOrigin = textConfig.origin;\n if (textOrigin && textConfig.rotation != null) {\n let relOriginX;\n let relOriginY;\n if (textOrigin === 'center') {\n relOriginX = layoutRect.width * 0.5;\n relOriginY = layoutRect.height * 0.5;\n }\n else {\n relOriginX = parsePercent(textOrigin[0], layoutRect.width);\n relOriginY = parsePercent(textOrigin[1], layoutRect.height);\n }\n\n innerOrigin = true;\n innerTransformable.originX = -innerTransformable.x + relOriginX + (isLocal ? 0 : layoutRect.x);\n innerTransformable.originY = -innerTransformable.y + relOriginY + (isLocal ? 0 : layoutRect.y);\n }\n }\n\n\n if (textConfig.rotation != null) {\n innerTransformable.rotation = textConfig.rotation;\n }\n\n // TODO\n const textOffset = textConfig.offset;\n if (textOffset) {\n innerTransformable.x += textOffset[0];\n innerTransformable.y += textOffset[1];\n\n // Not change the user set origin.\n if (!innerOrigin) {\n innerTransformable.originX = -textOffset[0];\n innerTransformable.originY = -textOffset[1];\n }\n }\n\n // Calculate text color\n const isInside = textConfig.inside == null // Force to be inside or not.\n ? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)\n : textConfig.inside;\n const innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});\n\n let textFill;\n let textStroke;\n let autoStroke;\n if (isInside && this.canBeInsideText()) {\n // In most cases `textContent` need this \"auto\" strategy.\n // So by default be 'auto'. Otherwise users need to literally\n // set `insideFill: 'auto', insideStroke: 'auto'` each time.\n textFill = textConfig.insideFill;\n textStroke = textConfig.insideStroke;\n\n if (textFill == null || textFill === 'auto') {\n textFill = this.getInsideTextFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getInsideTextStroke(textFill);\n autoStroke = true;\n }\n }\n else {\n textFill = textConfig.outsideFill;\n textStroke = textConfig.outsideStroke;\n\n if (textFill == null || textFill === 'auto') {\n textFill = this.getOutsideFill();\n }\n // By default give a stroke to distinguish \"front end\" label with\n // messy background (like other text label, line or other graphic).\n // If textContent.style.fill specified, this auto stroke will not be used.\n if (textStroke == null || textStroke === 'auto') {\n // If some time need to customize the default stroke getter,\n // add some kind of override method.\n textStroke = this.getOutsideStroke(textFill);\n autoStroke = true;\n }\n }\n // Default `textFill` should must have a value to ensure text can be displayed.\n textFill = textFill || '#000';\n\n if (textFill !== innerTextDefaultStyle.fill\n || textStroke !== innerTextDefaultStyle.stroke\n || autoStroke !== innerTextDefaultStyle.autoStroke\n || textAlign !== innerTextDefaultStyle.align\n || textVerticalAlign !== innerTextDefaultStyle.verticalAlign\n ) {\n\n textStyleChanged = true;\n\n innerTextDefaultStyle.fill = textFill;\n innerTextDefaultStyle.stroke = textStroke;\n innerTextDefaultStyle.autoStroke = autoStroke;\n innerTextDefaultStyle.align = textAlign;\n innerTextDefaultStyle.verticalAlign = textVerticalAlign;\n\n textEl.setDefaultTextStyle(innerTextDefaultStyle);\n }\n\n // Mark textEl to update transform.\n // DON'T use markRedraw. It will cause Element itself to dirty again.\n textEl.__dirty |= REDRAW_BIT;\n\n if (textStyleChanged) {\n // Only mark style dirty if necessary. Update ZRText is costly.\n textEl.dirtyStyle(true);\n }\n }\n }\n\n protected canBeInsideText() {\n return true;\n }\n\n protected getInsideTextFill(): string | undefined {\n return '#fff';\n }\n\n protected getInsideTextStroke(textFill: string): string | undefined {\n return '#000';\n }\n\n protected getOutsideFill(): string | undefined {\n return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;\n }\n\n protected getOutsideStroke(textFill: string): string {\n const backgroundColor = this.__zr && this.__zr.getBackgroundColor();\n let colorArr = typeof backgroundColor === 'string' && parse(backgroundColor as string);\n if (!colorArr) {\n colorArr = [255, 255, 255, 1];\n }\n // Assume blending on a white / black(dark) background.\n const alpha = colorArr[3];\n const isDark = this.__zr.isDarkMode();\n for (let i = 0; i < 3; i++) {\n colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);\n }\n colorArr[3] = 1;\n return stringify(colorArr, 'rgba');\n }\n\n traverse(\n cb: (this: Context, el: Element) => void,\n context?: Context\n ) {}\n\n protected attrKV(key: string, value: unknown) {\n if (key === 'textConfig') {\n this.setTextConfig(value as ElementTextConfig);\n }\n else if (key === 'textContent') {\n this.setTextContent(value as ZRText);\n }\n else if (key === 'clipPath') {\n this.setClipPath(value as Path);\n }\n else if (key === 'extra') {\n this.extra = this.extra || {};\n extend(this.extra, value);\n }\n else {\n (this as any)[key] = value;\n }\n }\n\n /**\n * Hide the element\n */\n hide() {\n this.ignore = true;\n this.markRedraw();\n }\n\n /**\n * Show the element\n */\n show() {\n this.ignore = false;\n this.markRedraw();\n }\n\n attr(keyOrObj: Props): this\n attr(keyOrObj: T, value: Props[T]): this\n attr(keyOrObj: keyof Props | Props, value?: unknown): this {\n if (typeof keyOrObj === 'string') {\n this.attrKV(keyOrObj as keyof ElementProps, value as AllPropTypes);\n }\n else if (isObject(keyOrObj)) {\n let obj = keyOrObj as object;\n let keysArr = keys(obj);\n for (let i = 0; i < keysArr.length; i++) {\n let key = keysArr[i];\n this.attrKV(key as keyof ElementProps, keyOrObj[key]);\n }\n }\n this.markRedraw();\n return this;\n }\n\n // Save current state to normal\n saveCurrentToNormalState(toState: ElementState) {\n this._innerSaveToNormal(toState);\n\n // If we are switching from normal to other state during animation.\n // We need to save final value of animation to the normal state. Not interpolated value.\n const normalState = this._normalState;\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n const fromStateTransition = animator.__fromStateTransition;\n // Ignore animation from state transition(except normal).\n // Ignore loop animation.\n if (animator.getLoop() || fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {\n continue;\n }\n\n const targetName = animator.targetName;\n // Respecting the order of animation if multiple animator is\n // animating on the same property(If additive animation is used)\n const target = targetName\n ? (normalState as any)[targetName] : normalState;\n // Only save keys that are changed by the states.\n animator.saveTo(target);\n }\n }\n\n protected _innerSaveToNormal(toState: ElementState) {\n let normalState = this._normalState;\n if (!normalState) {\n // Clear previous stored normal states when switching from normalState to otherState.\n normalState = this._normalState = {};\n }\n if (toState.textConfig && !normalState.textConfig) {\n normalState.textConfig = this.textConfig;\n }\n\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n }\n\n protected _savePrimaryToNormal(\n toState: Dictionary, normalState: Dictionary, primaryKeys: readonly string[]\n ) {\n for (let i = 0; i < primaryKeys.length; i++) {\n let key = primaryKeys[i];\n // Only save property that will be changed by toState\n // and has not been saved to normalState yet.\n if (toState[key] != null && !(key in normalState)) {\n (normalState as any)[key] = (this as any)[key];\n }\n }\n }\n\n /**\n * If has any state.\n */\n hasState() {\n return this.currentStates.length > 0;\n }\n\n /**\n * Get state object\n */\n getState(name: string) {\n return this.states[name];\n }\n\n\n /**\n * Ensure state exists. If not, will create one and return.\n */\n ensureState(name: string) {\n const states = this.states;\n if (!states[name]) {\n states[name] = {};\n }\n return states[name];\n }\n\n /**\n * Clear all states.\n */\n clearStates(noAnimation?: boolean) {\n this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);\n // TODO set _normalState to null?\n }\n /**\n * Use state. State is a collection of properties.\n * Will return current state object if state exists and stateName has been changed.\n *\n * @param stateName State name to be switched to\n * @param keepCurrentState If keep current states.\n * If not, it will inherit from the normal state.\n */\n useState(stateName: string, keepCurrentStates?: boolean, noAnimation?: boolean, forceUseHoverLayer?: boolean) {\n // Use preserved word __normal__\n // TODO: Only restore changed properties when restore to normal???\n const toNormalState = stateName === PRESERVED_NORMAL_STATE;\n const hasStates = this.hasState();\n\n if (!hasStates && toNormalState) {\n // If switched from normal to normal.\n return;\n }\n\n const currentStates = this.currentStates;\n const animationCfg = this.stateTransition;\n\n // No need to change in following cases:\n // 1. Keep current states. and already being applied before.\n // 2. Don't keep current states. And new state is same with the only one exists state.\n if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {\n return;\n }\n\n let state;\n if (this.stateProxy && !toNormalState) {\n state = this.stateProxy(stateName);\n }\n\n if (!state) {\n state = (this.states && this.states[stateName]);\n }\n\n if (!state && !toNormalState) {\n logError(`State ${stateName} not exists.`);\n return;\n }\n\n if (!toNormalState) {\n this.saveCurrentToNormalState(state);\n }\n\n const useHoverLayer = !!((state && state.hoverLayer) || forceUseHoverLayer);\n\n if (useHoverLayer) {\n // Enter hover layer before states update.\n this._toggleHoverLayerFlag(true);\n }\n\n this._applyStateObj(\n stateName,\n state,\n this._normalState,\n keepCurrentStates,\n !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0,\n animationCfg\n );\n\n // Also set text content.\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n // Force textContent use hover layer if self is using it.\n textContent.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n\n if (toNormalState) {\n // Clear state\n this.currentStates = [];\n // Reset normal state.\n this._normalState = {};\n }\n else {\n if (!keepCurrentStates) {\n this.currentStates = [stateName];\n }\n else {\n this.currentStates.push(stateName);\n }\n }\n\n // Update animating target to the new object after state changed.\n this._updateAnimationTargets();\n\n this.markRedraw();\n\n if (!useHoverLayer && this.__inHover) {\n // Leave hover layer after states update and markRedraw.\n this._toggleHoverLayerFlag(false);\n // NOTE: avoid unexpected refresh when moving out from hover layer!!\n // Only clear from hover layer.\n this.__dirty &= ~REDRAW_BIT;\n }\n\n // Return used state.\n return state;\n }\n\n /**\n * Apply multiple states.\n * @param states States list.\n */\n useStates(states: string[], noAnimation?: boolean, forceUseHoverLayer?: boolean) {\n if (!states.length) {\n this.clearStates();\n }\n else {\n const stateObjects: ElementState[] = [];\n const currentStates = this.currentStates;\n const len = states.length;\n let notChange = len === currentStates.length;\n if (notChange) {\n for (let i = 0; i < len; i++) {\n if (states[i] !== currentStates[i]) {\n notChange = false;\n break;\n }\n }\n }\n if (notChange) {\n return;\n }\n\n for (let i = 0; i < len; i++) {\n const stateName = states[i];\n let stateObj: ElementState;\n if (this.stateProxy) {\n stateObj = this.stateProxy(stateName, states);\n }\n if (!stateObj) {\n stateObj = this.states[stateName];\n }\n if (stateObj) {\n stateObjects.push(stateObj);\n }\n }\n\n const lastStateObj = stateObjects[len - 1];\n const useHoverLayer = !!((lastStateObj && lastStateObj.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n // Enter hover layer before states update.\n this._toggleHoverLayerFlag(true);\n }\n\n const mergedState = this._mergeStates(stateObjects);\n const animationCfg = this.stateTransition;\n\n this.saveCurrentToNormalState(mergedState);\n\n this._applyStateObj(\n states.join(','),\n mergedState,\n this._normalState,\n false,\n !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0,\n animationCfg\n );\n\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n textContent.useStates(states, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useStates(states, noAnimation, useHoverLayer);\n }\n\n this._updateAnimationTargets();\n\n // Create a copy\n this.currentStates = states.slice();\n this.markRedraw();\n\n if (!useHoverLayer && this.__inHover) {\n // Leave hover layer after states update and markRedraw.\n this._toggleHoverLayerFlag(false);\n // NOTE: avoid unexpected refresh when moving out from hover layer!!\n // Only clear from hover layer.\n this.__dirty &= ~REDRAW_BIT;\n }\n }\n }\n\n /**\n * Return if el.silent or any ancestor element has silent true.\n */\n isSilent() {\n let isSilent = this.silent;\n let ancestor = this.parent;\n while (!isSilent && ancestor) {\n if (ancestor.silent) {\n isSilent = true;\n break;\n }\n ancestor = ancestor.parent;\n }\n return isSilent;\n }\n\n /**\n * Update animation targets when reference is changed.\n */\n private _updateAnimationTargets() {\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n if (animator.targetName) {\n animator.changeTarget((this as any)[animator.targetName]);\n }\n }\n }\n\n /**\n * Remove state\n * @param state State to remove\n */\n removeState(state: string) {\n const idx = indexOf(this.currentStates, state);\n if (idx >= 0) {\n const currentStates = this.currentStates.slice();\n currentStates.splice(idx, 1);\n this.useStates(currentStates);\n }\n }\n\n /**\n * Replace exists state.\n * @param oldState\n * @param newState\n * @param forceAdd If still add when even if replaced target not exists.\n */\n replaceState(oldState: string, newState: string, forceAdd: boolean) {\n const currentStates = this.currentStates.slice();\n const idx = indexOf(currentStates, oldState);\n const newStateExists = indexOf(currentStates, newState) >= 0;\n if (idx >= 0) {\n if (!newStateExists) {\n // Replace the old with the new one.\n currentStates[idx] = newState;\n }\n else {\n // Only remove the old one.\n currentStates.splice(idx, 1);\n }\n }\n else if (forceAdd && !newStateExists) {\n currentStates.push(newState);\n }\n this.useStates(currentStates);\n }\n\n /**\n * Toogle state.\n */\n toggleState(state: string, enable: boolean) {\n if (enable) {\n this.useState(state, true);\n }\n else {\n this.removeState(state);\n }\n }\n\n protected _mergeStates(states: ElementState[]) {\n const mergedState: ElementState = {};\n let mergedTextConfig: ElementTextConfig;\n for (let i = 0; i < states.length; i++) {\n const state = states[i];\n extend(mergedState, state);\n\n if (state.textConfig) {\n mergedTextConfig = mergedTextConfig || {};\n extend(mergedTextConfig, state.textConfig);\n }\n }\n if (mergedTextConfig) {\n mergedState.textConfig = mergedTextConfig;\n }\n\n return mergedState;\n }\n\n protected _applyStateObj(\n stateName: string,\n state: ElementState,\n normalState: ElementState,\n keepCurrentStates: boolean,\n transition: boolean,\n animationCfg: ElementAnimateConfig\n ) {\n const needsRestoreToNormal = !(state && keepCurrentStates);\n\n // TODO: Save current state to normal?\n // TODO: Animation\n if (state && state.textConfig) {\n // Inherit from current state or normal state.\n this.textConfig = extend(\n {},\n keepCurrentStates ? this.textConfig : normalState.textConfig\n );\n extend(this.textConfig, state.textConfig);\n }\n else if (needsRestoreToNormal) {\n if (normalState.textConfig) { // Only restore if changed and saved.\n this.textConfig = normalState.textConfig;\n }\n }\n\n const transitionTarget: Dictionary = {};\n let hasTransition = false;\n\n for (let i = 0; i < PRIMARY_STATES_KEYS.length; i++) {\n const key = PRIMARY_STATES_KEYS[i];\n const propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];\n\n if (state && state[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = state[key];\n }\n else {\n // Replace if it exist in target state\n (this as any)[key] = state[key];\n }\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = normalState[key];\n }\n else {\n // Restore to normal state\n (this as any)[key] = normalState[key];\n }\n }\n }\n }\n\n if (!transition) {\n // Keep the running animation to the new values after states changed.\n // Not simply stop animation. Or it may have jump effect.\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n const targetName = animator.targetName;\n // Ignore loop animation\n if (!animator.getLoop()) {\n animator.__changeFinalValue(targetName\n ? ((state || normalState) as any)[targetName]\n : (state || normalState)\n );\n }\n }\n }\n\n if (hasTransition) {\n this._transitionState(\n stateName,\n transitionTarget as Props,\n animationCfg\n );\n }\n }\n\n /**\n * Component is some elements attached on this element for specific purpose.\n * Like clipPath, textContent\n */\n private _attachComponent(componentEl: Element) {\n if (componentEl.__zr && !componentEl.__hostTarget) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Text element has been added to zrender.');\n }\n return;\n }\n\n if (componentEl === this) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Recursive component attachment.');\n }\n return;\n }\n\n const zr = this.__zr;\n if (zr) {\n // Needs to add self to zrender. For rerender triggering, or animation.\n componentEl.addSelfToZr(zr);\n }\n\n componentEl.__zr = zr;\n componentEl.__hostTarget = this as unknown as Element;\n }\n\n private _detachComponent(componentEl: Element) {\n if (componentEl.__zr) {\n componentEl.removeSelfFromZr(componentEl.__zr);\n }\n\n componentEl.__zr = null;\n componentEl.__hostTarget = null;\n }\n\n /**\n * Get clip path\n */\n getClipPath() {\n return this._clipPath;\n }\n\n /**\n * Set clip path\n *\n * clipPath can't be shared between two elements.\n */\n setClipPath(clipPath: Path) {\n // Remove previous clip path\n if (this._clipPath && this._clipPath !== clipPath) {\n this.removeClipPath();\n }\n\n this._attachComponent(clipPath);\n\n this._clipPath = clipPath;\n this.markRedraw();\n }\n\n /**\n * Remove clip path\n */\n removeClipPath() {\n const clipPath = this._clipPath;\n if (clipPath) {\n this._detachComponent(clipPath);\n this._clipPath = null;\n this.markRedraw();\n }\n }\n\n /**\n * Get attached text content.\n */\n getTextContent(): ZRText {\n return this._textContent;\n }\n\n /**\n * Attach text on element\n */\n setTextContent(textEl: ZRText) {\n const previousTextContent = this._textContent;\n if (previousTextContent === textEl) {\n return;\n }\n // Remove previous textContent\n if (previousTextContent && previousTextContent !== textEl) {\n this.removeTextContent();\n }\n if (process.env.NODE_ENV !== 'production') {\n if (textEl.__zr && !textEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n }\n\n textEl.innerTransformable = new Transformable();\n\n this._attachComponent(textEl);\n\n this._textContent = textEl;\n\n this.markRedraw();\n }\n\n /**\n * Set layout of attached text. Will merge with the previous.\n */\n setTextConfig(cfg: ElementTextConfig) {\n // TODO hide cfg property?\n if (!this.textConfig) {\n this.textConfig = {};\n }\n extend(this.textConfig, cfg);\n this.markRedraw();\n }\n\n /**\n * Remove text config\n */\n removeTextConfig() {\n this.textConfig = null;\n this.markRedraw();\n }\n\n /**\n * Remove attached text element.\n */\n removeTextContent() {\n const textEl = this._textContent;\n if (textEl) {\n textEl.innerTransformable = null;\n this._detachComponent(textEl);\n this._textContent = null;\n this._innerTextDefaultStyle = null;\n this.markRedraw();\n }\n }\n\n getTextGuideLine(): Polyline {\n return this._textGuide;\n }\n\n setTextGuideLine(guideLine: Polyline) {\n // Remove previous clip path\n if (this._textGuide && this._textGuide !== guideLine) {\n this.removeTextGuideLine();\n }\n\n this._attachComponent(guideLine);\n\n this._textGuide = guideLine;\n\n this.markRedraw();\n }\n\n removeTextGuideLine() {\n const textGuide = this._textGuide;\n if (textGuide) {\n this._detachComponent(textGuide);\n this._textGuide = null;\n this.markRedraw();\n }\n }\n /**\n * Mark element needs to be repainted\n */\n markRedraw() {\n this.__dirty |= REDRAW_BIT;\n const zr = this.__zr;\n if (zr) {\n if (this.__inHover) {\n zr.refreshHover();\n }\n else {\n zr.refresh();\n }\n }\n\n // Used as a clipPath or textContent\n if (this.__hostTarget) {\n this.__hostTarget.markRedraw();\n }\n }\n\n /**\n * Besides marking elements to be refreshed.\n * It will also invalid all cache and doing recalculate next frame.\n */\n dirty() {\n this.markRedraw();\n }\n\n private _toggleHoverLayerFlag(inHover: boolean) {\n this.__inHover = inHover;\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n textContent.__inHover = inHover;\n }\n if (textGuide) {\n textGuide.__inHover = inHover;\n }\n }\n\n /**\n * Add self from zrender instance.\n * Not recursively because it will be invoked when element added to storage.\n */\n addSelfToZr(zr: ZRenderType) {\n if (this.__zr === zr) {\n return;\n }\n\n this.__zr = zr;\n // 添加动画\n const animators = this.animators;\n if (animators) {\n for (let i = 0; i < animators.length; i++) {\n zr.animation.addAnimator(animators[i]);\n }\n }\n\n if (this._clipPath) {\n this._clipPath.addSelfToZr(zr);\n }\n if (this._textContent) {\n this._textContent.addSelfToZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.addSelfToZr(zr);\n }\n }\n\n /**\n * Remove self from zrender instance.\n * Not recursively because it will be invoked when element added to storage.\n */\n removeSelfFromZr(zr: ZRenderType) {\n if (!this.__zr) {\n return;\n }\n\n this.__zr = null;\n // Remove animation\n const animators = this.animators;\n if (animators) {\n for (let i = 0; i < animators.length; i++) {\n zr.animation.removeAnimator(animators[i]);\n }\n }\n\n if (this._clipPath) {\n this._clipPath.removeSelfFromZr(zr);\n }\n if (this._textContent) {\n this._textContent.removeSelfFromZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.removeSelfFromZr(zr);\n }\n }\n\n /**\n * 动画\n *\n * @param path The key to fetch value from object. Mostly style or shape.\n * @param loop Whether to loop animation.\n * @param allowDiscreteAnimation Whether to allow discrete animation\n * @example:\n * el.animate('style', false)\n * .when(1000, {x: 10} )\n * .done(function(){ // Animation done })\n * .start()\n */\n animate(key?: string, loop?: boolean, allowDiscreteAnimation?: boolean) {\n let target = key ? (this as any)[key] : this;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!target) {\n logError(\n 'Property \"'\n + key\n + '\" is not existed in element '\n + this.id\n );\n return;\n }\n }\n\n const animator = new Animator(target, loop, allowDiscreteAnimation);\n key && (animator.targetName = key);\n this.addAnimator(animator, key);\n return animator;\n }\n\n addAnimator(animator: Animator, key: string): void {\n const zr = this.__zr;\n\n const el = this;\n\n animator.during(function () {\n el.updateDuringAnimation(key as string);\n }).done(function () {\n const animators = el.animators;\n // FIXME Animator will not be removed if use `Animator#stop` to stop animation\n const idx = indexOf(animators, animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n\n this.animators.push(animator);\n\n // If animate after added to the zrender\n if (zr) {\n zr.animation.addAnimator(animator);\n }\n\n // Wake up zrender to start the animation loop.\n zr && zr.wakeUp();\n }\n\n updateDuringAnimation(key: string) {\n this.markRedraw();\n }\n\n /**\n * 停止动画\n * @param {boolean} forwardToLast If move to last frame before stop\n */\n stopAnimation(scope?: string, forwardToLast?: boolean) {\n const animators = this.animators;\n const len = animators.length;\n const leftAnimators: Animator[] = [];\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n if (!scope || scope === animator.scope) {\n animator.stop(forwardToLast);\n }\n else {\n leftAnimators.push(animator);\n }\n }\n this.animators = leftAnimators;\n\n return this;\n }\n\n /**\n * @param animationProps A map to specify which property to animate. If not specified, will animate all.\n * @example\n * // Animate position\n * el.animateTo({\n * position: [10, 10]\n * }, { done: () => { // done } })\n *\n * // Animate shape, style and position in 100ms, delayed 100ms, with cubicOut easing\n * el.animateTo({\n * shape: {\n * width: 500\n * },\n * style: {\n * fill: 'red'\n * }\n * position: [10, 10]\n * }, {\n * duration: 100,\n * delay: 100,\n * easing: 'cubicOut',\n * done: () => { // done }\n * })\n */\n animateTo(target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType) {\n animateTo(this, target, cfg, animationProps);\n }\n\n /**\n * Animate from the target state to current state.\n * The params and the value are the same as `this.animateTo`.\n */\n\n // Overload definitions\n animateFrom(\n target: Props, cfg: ElementAnimateConfig, animationProps?: MapToType\n ) {\n animateTo(this, target, cfg, animationProps, true);\n }\n\n protected _transitionState(\n stateName: string, target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType\n ) {\n const animators = animateTo(this, target, cfg, animationProps);\n for (let i = 0; i < animators.length; i++) {\n animators[i].__fromStateTransition = stateName;\n }\n }\n\n /**\n * Interface of getting the minimum bounding box.\n */\n getBoundingRect(): BoundingRect {\n return null;\n }\n\n getPaintRect(): BoundingRect {\n return null;\n }\n\n /**\n * The string value of `textPosition` needs to be calculated to a real postion.\n * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]`\n * by default. See `contain/text.js#calculateTextPosition` for more details.\n * But some coutom shapes like \"pin\", \"flag\" have center that is not exactly\n * `[width/2, height/2]`. So we provide this hook to customize the calculation\n * for those shapes. It will be called if the `style.textPosition` is a string.\n * @param {Obejct} [out] Prepared out object. If not provided, this method should\n * be responsible for creating one.\n * @param {module:zrender/graphic/Style} style\n * @param {Object} rect {x, y, width, height}\n * @return {Obejct} out The same as the input out.\n * {\n * x: number. mandatory.\n * y: number. mandatory.\n * align: string. optional. use style.textAlign by default.\n * verticalAlign: string. optional. use style.textVerticalAlign by default.\n * }\n */\n calculateTextPosition: ElementCalculateTextPosition;\n\n protected static initDefaultProps = (function () {\n const elProto = Element.prototype;\n elProto.type = 'element';\n elProto.name = '';\n\n elProto.ignore =\n elProto.silent =\n elProto.isGroup =\n elProto.draggable =\n elProto.dragging =\n elProto.ignoreClip =\n elProto.__inHover = false;\n\n elProto.__dirty = REDRAW_BIT;\n\n\n const logs: Dictionary = {};\n function logDeprecatedError(key: string, xKey: string, yKey: string) {\n if (!logs[key + xKey + yKey]) {\n console.warn(`DEPRECATED: '${key}' has been deprecated. use '${xKey}', '${yKey}' instead`);\n logs[key + xKey + yKey] = true;\n }\n }\n // Legacy transform properties. position and scale\n function createLegacyProperty(\n key: string,\n privateKey: string,\n xKey: string,\n yKey: string\n ) {\n Object.defineProperty(elProto, key, {\n get() {\n if (process.env.NODE_ENV !== 'production') {\n logDeprecatedError(key, xKey, yKey);\n }\n if (!this[privateKey]) {\n const pos: number[] = this[privateKey] = [];\n enhanceArray(this, pos);\n }\n return this[privateKey];\n },\n set(pos: number[]) {\n if (process.env.NODE_ENV !== 'production') {\n logDeprecatedError(key, xKey, yKey);\n }\n this[xKey] = pos[0];\n this[yKey] = pos[1];\n this[privateKey] = pos;\n enhanceArray(this, pos);\n }\n });\n function enhanceArray(self: any, pos: number[]) {\n Object.defineProperty(pos, 0, {\n get() {\n return self[xKey];\n },\n set(val: number) {\n self[xKey] = val;\n }\n });\n Object.defineProperty(pos, 1, {\n get() {\n return self[yKey];\n },\n set(val: number) {\n self[yKey] = val;\n }\n });\n }\n }\n if (Object.defineProperty\n // Just don't support ie8\n // && (!(env as any).browser.ie || (env as any).browser.version > 8)\n ) {\n createLegacyProperty('position', '_legacyPos', 'x', 'y');\n createLegacyProperty('scale', '_legacyScale', 'scaleX', 'scaleY');\n createLegacyProperty('origin', '_legacyOrigin', 'originX', 'originY');\n }\n })()\n}\n\nmixin(Element, Eventful);\nmixin(Element, Transformable);\n\nfunction animateTo(\n animatable: Element,\n target: Dictionary,\n cfg: ElementAnimateConfig,\n animationProps: Dictionary,\n reverse?: boolean\n) {\n cfg = cfg || {};\n const animators: Animator[] = [];\n animateToShallow(\n animatable,\n '',\n animatable,\n target,\n cfg,\n animationProps,\n animators,\n reverse\n );\n\n let finishCount = animators.length;\n let doneHappened = false;\n const cfgDone = cfg.done;\n const cfgAborted = cfg.aborted;\n\n const doneCb = () => {\n doneHappened = true;\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n\n const abortedCb = () => {\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n\n // No animators. This should be checked before animators[i].start(),\n // because 'done' may be executed immediately if no need to animate.\n if (!finishCount) {\n cfgDone && cfgDone();\n }\n\n // Adding during callback to the first animator\n if (animators.length > 0 && cfg.during) {\n // TODO If there are two animators in animateTo, and the first one is stopped by other animator.\n animators[0].during((target, percent) => {\n cfg.during(percent);\n });\n }\n\n // Start after all animators created\n // Incase any animator is done immediately when all animation properties are not changed\n for (let i = 0; i < animators.length; i++) {\n const animator = animators[i];\n if (doneCb) {\n animator.done(doneCb);\n }\n if (abortedCb) {\n animator.aborted(abortedCb);\n }\n if (cfg.force) {\n animator.duration(cfg.duration);\n }\n animator.start(cfg.easing);\n }\n\n return animators;\n}\n\nfunction copyArrShallow(source: number[], target: number[], len: number) {\n for (let i = 0; i < len; i++) {\n source[i] = target[i];\n }\n}\n\nfunction is2DArray(value: any[]): value is number[][] {\n return isArrayLike(value[0]);\n}\n\nfunction copyValue(target: Dictionary, source: Dictionary, key: string) {\n if (isArrayLike(source[key])) {\n if (!isArrayLike(target[key])) {\n target[key] = [];\n }\n\n if (isTypedArray(source[key])) {\n const len = source[key].length;\n if (target[key].length !== len) {\n target[key] = new (source[key].constructor)(len);\n copyArrShallow(target[key], source[key], len);\n }\n }\n else {\n const sourceArr = source[key] as any[];\n const targetArr = target[key] as any[];\n\n const len0 = sourceArr.length;\n if (is2DArray(sourceArr)) {\n // NOTE: each item should have same length\n const len1 = sourceArr[0].length;\n\n for (let i = 0; i < len0; i++) {\n if (!targetArr[i]) {\n targetArr[i] = Array.prototype.slice.call(sourceArr[i]);\n }\n else {\n copyArrShallow(targetArr[i], sourceArr[i], len1);\n }\n }\n }\n else {\n copyArrShallow(targetArr, sourceArr, len0);\n }\n\n targetArr.length = sourceArr.length;\n }\n }\n else {\n target[key] = source[key];\n }\n}\n\nfunction isValueSame(val1: any, val2: any) {\n return val1 === val2\n // Only check 1 dimension array\n || isArrayLike(val1) && isArrayLike(val2) && is1DArraySame(val1, val2);\n}\n\nfunction is1DArraySame(arr0: ArrayLike, arr1: ArrayLike) {\n const len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n for (let i = 0; i < len; i++) {\n if (arr0[i] !== arr1[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction animateToShallow(\n animatable: Element,\n topKey: string,\n animateObj: Dictionary,\n target: Dictionary,\n cfg: ElementAnimateConfig,\n animationProps: Dictionary | true,\n animators: Animator[],\n reverse: boolean // If `true`, animate from the `target` to current state.\n) {\n const targetKeys = keys(target);\n const duration = cfg.duration;\n const delay = cfg.delay;\n const additive = cfg.additive;\n const setToFinal = cfg.setToFinal;\n const animateAll = !isObject(animationProps);\n // Find last animator animating same prop.\n const existsAnimators = animatable.animators;\n\n let animationKeys: string[] = [];\n for (let k = 0; k < targetKeys.length; k++) {\n const innerKey = targetKeys[k] as string;\n const targetVal = target[innerKey];\n\n if (\n targetVal != null && animateObj[innerKey] != null\n && (animateAll || (animationProps as Dictionary)[innerKey])\n ) {\n if (isObject(targetVal)\n && !isArrayLike(targetVal)\n && !isGradientObject(targetVal)\n ) {\n if (topKey) {\n // logError('Only support 1 depth nest object animation.');\n // Assign directly.\n // TODO richText?\n if (!reverse) {\n animateObj[innerKey] = targetVal;\n animatable.updateDuringAnimation(topKey);\n }\n continue;\n }\n animateToShallow(\n animatable,\n innerKey,\n animateObj[innerKey],\n targetVal,\n cfg,\n animationProps && (animationProps as Dictionary)[innerKey],\n animators,\n reverse\n );\n }\n else {\n animationKeys.push(innerKey);\n }\n }\n else if (!reverse) {\n // Assign target value directly.\n animateObj[innerKey] = targetVal;\n animatable.updateDuringAnimation(topKey);\n // Previous animation will be stopped on the changed keys.\n // So direct assign is also included.\n animationKeys.push(innerKey);\n }\n }\n\n let keyLen = animationKeys.length;\n // Stop previous animations on the same property.\n if (!additive && keyLen) {\n // Stop exists animation on specific tracks. Only one animator available for each property.\n // TODO Should invoke previous animation callback?\n for (let i = 0; i < existsAnimators.length; i++) {\n const animator = existsAnimators[i];\n if (animator.targetName === topKey) {\n const allAborted = animator.stopTracks(animationKeys);\n if (allAborted) { // This animator can't be used.\n const idx = indexOf(existsAnimators, animator);\n existsAnimators.splice(idx, 1);\n }\n }\n }\n }\n\n // Ignore values not changed.\n // NOTE: Must filter it after previous animation stopped\n // and make sure the value to compare is using initial frame if animation is not started yet when setToFinal is used.\n if (!cfg.force) {\n animationKeys = filter(animationKeys, key => !isValueSame(target[key], animateObj[key]));\n keyLen = animationKeys.length;\n }\n\n if (keyLen > 0\n // cfg.force is mainly for keep invoking onframe and ondone callback even if animation is not necessary.\n // So if there is already has animators. There is no need to create another animator if not necessary.\n // Or it will always add one more with empty target.\n || (cfg.force && !animators.length)\n ) {\n let revertedSource: Dictionary;\n let reversedTarget: Dictionary;\n let sourceClone: Dictionary;\n if (reverse) {\n reversedTarget = {};\n if (setToFinal) {\n revertedSource = {};\n }\n for (let i = 0; i < keyLen; i++) {\n const innerKey = animationKeys[i];\n reversedTarget[innerKey] = animateObj[innerKey];\n if (setToFinal) {\n revertedSource[innerKey] = target[innerKey];\n }\n else {\n // The usage of \"animateFrom\" expects that the element props has been updated dirctly to\n // \"final\" values outside, and input the \"from\" values here (i.e., in variable `target` here).\n // So here we assign the \"from\" values directly to element here (rather that in the next frame)\n // to prevent the \"final\" values from being read in any other places (like other running\n // animator during callbacks).\n // But if `setToFinal: true` this feature can not be satisfied.\n animateObj[innerKey] = target[innerKey];\n }\n }\n }\n else if (setToFinal) {\n sourceClone = {};\n for (let i = 0; i < keyLen; i++) {\n const innerKey = animationKeys[i];\n // NOTE: Must clone source after the stopTracks. The property may be modified in stopTracks.\n sourceClone[innerKey] = cloneValue(animateObj[innerKey]);\n // Use copy, not change the original reference\n // Copy from target to source.\n copyValue(animateObj, target, innerKey);\n }\n }\n\n const animator = new Animator(animateObj, false, false, additive ? filter(\n // Use key string instead object reference because ref may be changed.\n existsAnimators, animator => animator.targetName === topKey\n ) : null);\n\n animator.targetName = topKey;\n if (cfg.scope) {\n animator.scope = cfg.scope;\n }\n\n if (setToFinal && revertedSource) {\n animator.whenWithKeys(0, revertedSource, animationKeys);\n }\n if (sourceClone) {\n animator.whenWithKeys(0, sourceClone, animationKeys);\n }\n\n animator.whenWithKeys(\n duration == null ? 500 : duration,\n reverse ? reversedTarget : target,\n animationKeys\n ).delay(delay || 0);\n\n animatable.addAnimator(animator, topKey);\n animators.push(animator);\n }\n}\n\n\nexport default Element;\n","/**\r\n * Group是一个容器,可以插入子节点,Group的变换也会被应用到子节点上\r\n * @module zrender/graphic/Group\r\n * @example\r\n * const Group = require('zrender/graphic/Group');\r\n * const Circle = require('zrender/graphic/shape/Circle');\r\n * const g = new Group();\r\n * g.position[0] = 100;\r\n * g.position[1] = 100;\r\n * g.add(new Circle({\r\n * style: {\r\n * x: 100,\r\n * y: 100,\r\n * r: 20,\r\n * }\r\n * }));\r\n * zr.add(g);\r\n */\r\n\r\nimport * as zrUtil from '../core/util';\r\nimport Element, { ElementProps } from '../Element';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Displayable from './Displayable';\r\nimport { ZRenderType } from '../zrender';\r\n\r\nexport interface GroupProps extends ElementProps {\r\n}\r\n\r\nclass Group extends Element {\r\n\r\n readonly isGroup = true\r\n\r\n private _children: Element[] = []\r\n\r\n\r\n constructor(opts?: GroupProps) {\r\n super();\r\n\r\n this.attr(opts);\r\n }\r\n\r\n /**\r\n * Get children reference.\r\n */\r\n childrenRef() {\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Get children copy.\r\n */\r\n children() {\r\n return this._children.slice();\r\n }\r\n\r\n /**\r\n * 获取指定 index 的儿子节点\r\n */\r\n childAt(idx: number): Element {\r\n return this._children[idx];\r\n }\r\n\r\n /**\r\n * 获取指定名字的儿子节点\r\n */\r\n childOfName(name: string): Element {\r\n const children = this._children;\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].name === name) {\r\n return children[i];\r\n }\r\n }\r\n }\r\n\r\n childCount(): number {\r\n return this._children.length;\r\n }\r\n\r\n /**\r\n * 添加子节点到最后\r\n */\r\n add(child: Element): Group {\r\n if (child) {\r\n if (child !== this && child.parent !== this) {\r\n this._children.push(child);\r\n this._doAdd(child);\r\n }\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (child.__hostTarget) {\r\n throw 'This elemenet has been used as an attachment';\r\n }\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * 添加子节点在 nextSibling 之前\r\n */\r\n addBefore(child: Element, nextSibling: Element) {\r\n if (child && child !== this && child.parent !== this\r\n && nextSibling && nextSibling.parent === this) {\r\n\r\n const children = this._children;\r\n const idx = children.indexOf(nextSibling);\r\n\r\n if (idx >= 0) {\r\n children.splice(idx, 0, child);\r\n this._doAdd(child);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n replace(oldChild: Element, newChild: Element) {\r\n const idx = zrUtil.indexOf(this._children, oldChild);\r\n if (idx >= 0) {\r\n this.replaceAt(newChild, idx);\r\n }\r\n return this;\r\n }\r\n\r\n replaceAt(child: Element, index: number) {\r\n const children = this._children;\r\n const old = children[index];\r\n\r\n if (child && child !== this && child.parent !== this && child !== old) {\r\n children[index] = child;\r\n\r\n old.parent = null;\r\n const zr = this.__zr;\r\n if (zr) {\r\n old.removeSelfFromZr(zr);\r\n }\r\n\r\n this._doAdd(child);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n _doAdd(child: Element) {\r\n if (child.parent) {\r\n // Parent must be a group\r\n (child.parent as Group).remove(child);\r\n }\r\n\r\n child.parent = this;\r\n\r\n const zr = this.__zr;\r\n if (zr && zr !== (child as Group).__zr) { // Only group has __storage\r\n\r\n child.addSelfToZr(zr);\r\n }\r\n\r\n zr && zr.refresh();\r\n }\r\n\r\n /**\r\n * Remove child\r\n * @param child\r\n */\r\n remove(child: Element) {\r\n const zr = this.__zr;\r\n const children = this._children;\r\n\r\n const idx = zrUtil.indexOf(children, child);\r\n if (idx < 0) {\r\n return this;\r\n }\r\n children.splice(idx, 1);\r\n\r\n child.parent = null;\r\n\r\n if (zr) {\r\n\r\n child.removeSelfFromZr(zr);\r\n }\r\n\r\n zr && zr.refresh();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove all children\r\n */\r\n removeAll() {\r\n const children = this._children;\r\n const zr = this.__zr;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (zr) {\r\n child.removeSelfFromZr(zr);\r\n }\r\n child.parent = null;\r\n }\r\n children.length = 0;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * 遍历所有子节点\r\n */\r\n eachChild(\r\n cb: (this: Context, el: Element, index?: number) => void,\r\n context?: Context\r\n ) {\r\n const children = this._children;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n cb.call(context, child, i);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Visit all descendants.\r\n * Return false in callback to stop visit descendants of current node\r\n */\r\n // TODO Group itself should also invoke the callback.\r\n traverse(\r\n cb: (this: T, el: Element) => boolean | void,\r\n context?: T\r\n ) {\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n const stopped = cb.call(context, child);\r\n\r\n if (child.isGroup && !stopped) {\r\n child.traverse(cb, context);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n addSelfToZr(zr: ZRenderType) {\r\n super.addSelfToZr(zr);\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n child.addSelfToZr(zr);\r\n }\r\n }\r\n\r\n removeSelfFromZr(zr: ZRenderType) {\r\n super.removeSelfFromZr(zr);\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n child.removeSelfFromZr(zr);\r\n }\r\n }\r\n\r\n getBoundingRect(includeChildren?: Element[]): BoundingRect {\r\n // TODO Caching\r\n const tmpRect = new BoundingRect(0, 0, 0, 0);\r\n const children = includeChildren || this._children;\r\n const tmpMat: MatrixArray = [];\r\n let rect = null;\r\n\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n // TODO invisible?\r\n if (child.ignore || (child as Displayable).invisible) {\r\n continue;\r\n }\r\n\r\n const childRect = child.getBoundingRect();\r\n const transform = child.getLocalTransform(tmpMat);\r\n // TODO\r\n // The boundingRect cacluated by transforming original\r\n // rect may be bigger than the actual bundingRect when rotation\r\n // is used. (Consider a circle rotated aginst its center, where\r\n // the actual boundingRect should be the same as that not be\r\n // rotated.) But we can not find better approach to calculate\r\n // actual boundingRect yet, considering performance.\r\n if (transform) {\r\n BoundingRect.applyTransform(tmpRect, childRect, transform);\r\n rect = rect || tmpRect.clone();\r\n rect.union(tmpRect);\r\n }\r\n else {\r\n rect = rect || childRect.clone();\r\n rect.union(childRect);\r\n }\r\n }\r\n return rect || tmpRect;\r\n }\r\n}\r\n\r\nGroup.prototype.type = 'group';\r\n// Storage will use childrenRef to get children to render.\r\nexport interface GroupLike extends Element {\r\n childrenRef(): Element[]\r\n}\r\n\r\nexport default Group;","/*!\n* ZRender, a high performance 2d drawing library.\n*\n* Copyright (c) 2013, Baidu Inc.\n* All rights reserved.\n*\n* LICENSE\n* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt\n*/\n\nimport env from './core/env';\nimport * as zrUtil from './core/util';\nimport Handler from './Handler';\nimport Storage from './Storage';\nimport {PainterBase} from './PainterBase';\nimport Animation, {getTime} from './animation/Animation';\nimport HandlerProxy from './dom/HandlerProxy';\nimport Element, { ElementEventCallback } from './Element';\nimport { Dictionary, ElementEventName, RenderedEvent, WithThisType } from './core/types';\nimport { LayerConfig } from './canvas/Layer';\nimport { GradientObject } from './graphic/Gradient';\nimport { PatternObject } from './graphic/Pattern';\nimport { EventCallback } from './core/Eventful';\nimport Displayable from './graphic/Displayable';\nimport { lum } from './tool/color';\nimport { DARK_MODE_THRESHOLD } from './config';\nimport Group from './graphic/Group';\n\n\ntype PainterBaseCtor = {\n new(dom: HTMLElement, storage: Storage, ...args: any[]): PainterBase\n}\n\nconst painterCtors: Dictionary = {};\n\nlet instances: { [key: number]: ZRender } = {};\n\nfunction delInstance(id: number) {\n delete instances[id];\n}\n\nfunction isDarkMode(backgroundColor: string | GradientObject | PatternObject): boolean {\n if (!backgroundColor) {\n return false;\n }\n if (typeof backgroundColor === 'string') {\n return lum(backgroundColor, 1) < DARK_MODE_THRESHOLD;\n }\n else if ((backgroundColor as GradientObject).colorStops) {\n const colorStops = (backgroundColor as GradientObject).colorStops;\n let totalLum = 0;\n const len = colorStops.length;\n // Simply do the math of average the color. Not consider the offset\n for (let i = 0; i < len; i++) {\n totalLum += lum(colorStops[i].color, 1);\n }\n totalLum /= len;\n\n return totalLum < DARK_MODE_THRESHOLD;\n }\n // Can't determine\n return false;\n}\n\nclass ZRender {\n /**\n * Not necessary if using SSR painter like svg-ssr\n */\n dom?: HTMLElement\n\n id: number\n\n storage: Storage\n painter: PainterBase\n handler: Handler\n animation: Animation\n\n private _sleepAfterStill = 10;\n\n private _stillFrameAccum = 0;\n\n private _needsRefresh = true\n private _needsRefreshHover = true\n private _disposed: boolean;\n /**\n * If theme is dark mode. It will determine the color strategy for labels.\n */\n private _darkMode = false;\n\n private _backgroundColor: string | GradientObject | PatternObject;\n\n constructor(id: number, dom?: HTMLElement, opts?: ZRenderInitOpt) {\n opts = opts || {};\n\n /**\n * @type {HTMLDomElement}\n */\n this.dom = dom;\n\n this.id = id;\n\n const storage = new Storage();\n\n let rendererType = opts.renderer || 'canvas';\n\n if (!painterCtors[rendererType]) {\n // Use the first registered renderer.\n rendererType = zrUtil.keys(painterCtors)[0];\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!painterCtors[rendererType]) {\n throw new Error(`Renderer '${rendererType}' is not imported. Please import it first.`);\n }\n }\n\n opts.useDirtyRect = opts.useDirtyRect == null\n ? false\n : opts.useDirtyRect;\n\n const painter = new painterCtors[rendererType](dom, storage, opts, id);\n const ssrMode = opts.ssr || painter.ssrOnly;\n\n this.storage = storage;\n this.painter = painter;\n\n const handlerProxy = (!env.node && !env.worker && !ssrMode)\n ? new HandlerProxy(painter.getViewportRoot(), painter.root)\n : null;\n\n const useCoarsePointer = opts.useCoarsePointer;\n const usePointerSize = (useCoarsePointer == null || useCoarsePointer === 'auto')\n ? env.touchEventsSupported\n : !!useCoarsePointer;\n const defaultPointerSize = 44;\n let pointerSize;\n if (usePointerSize) {\n pointerSize = zrUtil.retrieve2(opts.pointerSize, defaultPointerSize);\n }\n\n this.handler = new Handler(storage, painter, handlerProxy, painter.root, pointerSize);\n\n this.animation = new Animation({\n stage: {\n update: ssrMode ? null : () => this._flush(true)\n }\n });\n\n if (!ssrMode) {\n this.animation.start();\n }\n }\n\n /**\n * 添加元素\n */\n add(el: Element) {\n if (this._disposed || !el) {\n return;\n }\n this.storage.addRoot(el);\n el.addSelfToZr(this);\n this.refresh();\n }\n\n /**\n * 删除元素\n */\n remove(el: Element) {\n if (this._disposed || !el) {\n return;\n }\n this.storage.delRoot(el);\n el.removeSelfFromZr(this);\n this.refresh();\n }\n\n /**\n * Change configuration of layer\n */\n configLayer(zLevel: number, config: LayerConfig) {\n if (this._disposed) {\n return;\n }\n if (this.painter.configLayer) {\n this.painter.configLayer(zLevel, config);\n }\n this.refresh();\n }\n\n /**\n * Set background color\n */\n setBackgroundColor(backgroundColor: string | GradientObject | PatternObject) {\n if (this._disposed) {\n return;\n }\n if (this.painter.setBackgroundColor) {\n this.painter.setBackgroundColor(backgroundColor);\n }\n this.refresh();\n this._backgroundColor = backgroundColor;\n this._darkMode = isDarkMode(backgroundColor);\n }\n\n getBackgroundColor() {\n return this._backgroundColor;\n }\n\n /**\n * Force to set dark mode\n */\n setDarkMode(darkMode: boolean) {\n this._darkMode = darkMode;\n }\n\n isDarkMode() {\n return this._darkMode;\n }\n\n /**\n * Repaint the canvas immediately\n */\n refreshImmediately(fromInside?: boolean) {\n if (this._disposed) {\n return;\n }\n // const start = new Date();\n if (!fromInside) {\n // Update animation if refreshImmediately is invoked from outside.\n // Not trigger stage update to call flush again. Which may refresh twice\n this.animation.update(true);\n }\n\n // Clear needsRefresh ahead to avoid something wrong happens in refresh\n // Or it will cause zrender refreshes again and again.\n this._needsRefresh = false;\n this.painter.refresh();\n // Avoid trigger zr.refresh in Element#beforeUpdate hook\n this._needsRefresh = false;\n }\n\n /**\n * Mark and repaint the canvas in the next frame of browser\n */\n refresh() {\n if (this._disposed) {\n return;\n }\n this._needsRefresh = true;\n // Active the animation again.\n this.animation.start();\n }\n\n /**\n * Perform all refresh\n */\n flush() {\n if (this._disposed) {\n return;\n }\n this._flush(false);\n }\n\n private _flush(fromInside?: boolean) {\n let triggerRendered;\n\n const start = getTime();\n if (this._needsRefresh) {\n triggerRendered = true;\n this.refreshImmediately(fromInside);\n }\n\n if (this._needsRefreshHover) {\n triggerRendered = true;\n this.refreshHoverImmediately();\n }\n const end = getTime();\n\n if (triggerRendered) {\n this._stillFrameAccum = 0;\n this.trigger('rendered', {\n elapsedTime: end - start\n } as RenderedEvent);\n }\n else if (this._sleepAfterStill > 0) {\n this._stillFrameAccum++;\n // Stop the animation after still for 10 frames.\n if (this._stillFrameAccum > this._sleepAfterStill) {\n this.animation.stop();\n }\n }\n }\n\n /**\n * Set sleep after still for frames.\n * Disable auto sleep when it's 0.\n */\n setSleepAfterStill(stillFramesCount: number) {\n this._sleepAfterStill = stillFramesCount;\n }\n\n /**\n * Wake up animation loop. But not render.\n */\n wakeUp() {\n if (this._disposed) {\n return;\n }\n this.animation.start();\n // Reset the frame count.\n this._stillFrameAccum = 0;\n }\n\n /**\n * Refresh hover in next frame\n */\n refreshHover() {\n this._needsRefreshHover = true;\n }\n\n /**\n * Refresh hover immediately\n */\n refreshHoverImmediately() {\n if (this._disposed) {\n return;\n }\n this._needsRefreshHover = false;\n if (this.painter.refreshHover && this.painter.getType() === 'canvas') {\n this.painter.refreshHover();\n }\n }\n\n /**\n * Resize the canvas.\n * Should be invoked when container size is changed\n */\n resize(opts?: {\n width?: number| string\n height?: number | string\n }) {\n if (this._disposed) {\n return;\n }\n opts = opts || {};\n this.painter.resize(opts.width, opts.height);\n this.handler.resize();\n }\n\n /**\n * Stop and clear all animation immediately\n */\n clearAnimation() {\n if (this._disposed) {\n return;\n }\n this.animation.clear();\n }\n\n /**\n * Get container width\n */\n getWidth(): number | undefined {\n if (this._disposed) {\n return;\n }\n return this.painter.getWidth();\n }\n\n /**\n * Get container height\n */\n getHeight(): number | undefined {\n if (this._disposed) {\n return;\n }\n return this.painter.getHeight();\n }\n\n /**\n * Set default cursor\n * @param cursorStyle='default' 例如 crosshair\n */\n setCursorStyle(cursorStyle: string) {\n if (this._disposed) {\n return;\n }\n this.handler.setCursorStyle(cursorStyle);\n }\n\n /**\n * Find hovered element\n * @param x\n * @param y\n * @return {target, topTarget}\n */\n findHover(x: number, y: number): {\n target: Displayable\n topTarget: Displayable\n } | undefined {\n if (this._disposed) {\n return;\n }\n return this.handler.findHover(x, y);\n }\n\n on(eventName: ElementEventName, eventHandler: ElementEventCallback, context?: Ctx): this\n // eslint-disable-next-line max-len\n on(eventName: string, eventHandler: WithThisType, unknown extends Ctx ? ZRenderType : Ctx>, context?: Ctx): this\n // eslint-disable-next-line max-len\n on(eventName: string, eventHandler: (...args: any) => any, context?: Ctx): this {\n if (!this._disposed) {\n this.handler.on(eventName, eventHandler, context);\n }\n return this;\n }\n\n /**\n * Unbind event\n * @param eventName Event name\n * @param eventHandler Handler function\n */\n // eslint-disable-next-line max-len\n off(eventName?: string, eventHandler?: EventCallback) {\n if (this._disposed) {\n return;\n }\n this.handler.off(eventName, eventHandler);\n }\n\n /**\n * Trigger event manually\n *\n * @param eventName Event name\n * @param event Event object\n */\n trigger(eventName: string, event?: unknown) {\n if (this._disposed) {\n return;\n }\n this.handler.trigger(eventName, event);\n }\n\n\n /**\n * Clear all objects and the canvas.\n */\n clear() {\n if (this._disposed) {\n return;\n }\n const roots = this.storage.getRoots();\n for (let i = 0; i < roots.length; i++) {\n if (roots[i] instanceof Group) {\n roots[i].removeSelfFromZr(this);\n }\n }\n this.storage.delAllRoots();\n this.painter.clear();\n }\n\n /**\n * Dispose self.\n */\n dispose() {\n if (this._disposed) {\n return;\n }\n\n this.animation.stop();\n\n this.clear();\n this.storage.dispose();\n this.painter.dispose();\n this.handler.dispose();\n\n this.animation =\n this.storage =\n this.painter =\n this.handler = null;\n\n this._disposed = true;\n\n delInstance(this.id);\n }\n}\n\n\nexport interface ZRenderInitOpt {\n renderer?: string // 'canvas' or 'svg\n devicePixelRatio?: number\n width?: number | string // 10, 10px, 'auto'\n height?: number | string\n useDirtyRect?: boolean\n useCoarsePointer?: 'auto' | boolean\n pointerSize?: number\n ssr?: boolean // If enable ssr mode.\n}\n\n/**\n * Initializing a zrender instance\n *\n * @param dom Not necessary if using SSR painter like svg-ssr\n */\nexport function init(dom?: HTMLElement | null, opts?: ZRenderInitOpt) {\n const zr = new ZRender(zrUtil.guid(), dom, opts);\n instances[zr.id] = zr;\n return zr;\n}\n\n/**\n * Dispose zrender instance\n */\nexport function dispose(zr: ZRender) {\n zr.dispose();\n}\n\n/**\n * Dispose all zrender instances\n */\nexport function disposeAll() {\n for (let key in instances) {\n if (instances.hasOwnProperty(key)) {\n instances[key].dispose();\n }\n }\n instances = {};\n}\n\n/**\n * Get zrender instance by id\n */\nexport function getInstance(id: number): ZRender {\n return instances[id];\n}\n\nexport function registerPainter(name: string, Ctor: PainterBaseCtor) {\n painterCtors[name] = Ctor;\n}\n\nexport type ElementSSRData = zrUtil.HashMap;\nexport type ElementSSRDataGetter = (el: Element) => zrUtil.HashMap;\n\nlet ssrDataGetter: ElementSSRDataGetter;\n\nexport function getElementSSRData(el: Element): ElementSSRData {\n if (typeof ssrDataGetter === 'function') {\n return ssrDataGetter(el);\n }\n}\n\nexport function registerSSRDataGetter(getter: ElementSSRDataGetter) {\n ssrDataGetter = getter;\n}\n\n/**\n * @type {string}\n */\nexport const version = '5.6.1';\n\n\nexport interface ZRenderType extends ZRender {};","/**\r\n * Base class of all displayable graphic objects\r\n */\r\n\r\nimport Element, {ElementProps, ElementStatePropNames, ElementAnimateConfig, ElementCommonState} from '../Element';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { PropType, Dictionary, MapToType } from '../core/types';\r\nimport Path from './Path';\r\nimport { keys, extend, createObject } from '../core/util';\r\nimport Animator from '../animation/Animator';\r\nimport { REDRAW_BIT, STYLE_CHANGED_BIT } from './constants';\r\n\r\n// type CalculateTextPositionResult = ReturnType\r\n\r\nconst STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));\r\n\r\nexport interface CommonStyleProps {\r\n shadowBlur?: number\r\n shadowOffsetX?: number\r\n shadowOffsetY?: number\r\n shadowColor?: string\r\n\r\n opacity?: number\r\n /**\r\n * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation\r\n */\r\n blend?: string\r\n}\r\n\r\nexport const DEFAULT_COMMON_STYLE: CommonStyleProps = {\r\n shadowBlur: 0,\r\n shadowOffsetX: 0,\r\n shadowOffsetY: 0,\r\n shadowColor: '#000',\r\n opacity: 1,\r\n blend: 'source-over'\r\n};\r\n\r\nexport const DEFAULT_COMMON_ANIMATION_PROPS: MapToType = {\r\n style: {\r\n shadowBlur: true,\r\n shadowOffsetX: true,\r\n shadowOffsetY: true,\r\n shadowColor: true,\r\n opacity: true\r\n }\r\n };\r\n\r\n(DEFAULT_COMMON_STYLE as any)[STYLE_MAGIC_KEY] = true;\r\n\r\nexport interface DisplayableProps extends ElementProps {\r\n style?: Dictionary\r\n\r\n zlevel?: number\r\n z?: number\r\n z2?: number\r\n\r\n culling?: boolean\r\n\r\n // TODO list all cursors\r\n cursor?: string\r\n\r\n rectHover?: boolean\r\n\r\n progressive?: boolean\r\n\r\n incremental?: boolean\r\n\r\n ignoreCoarsePointer?: boolean\r\n\r\n batch?: boolean\r\n invisible?: boolean\r\n}\r\n\r\ntype DisplayableKey = keyof DisplayableProps\r\ntype DisplayablePropertyType = PropType\r\n\r\nexport type DisplayableStatePropNames = ElementStatePropNames | 'style' | 'z' | 'z2' | 'invisible';\r\nexport type DisplayableState = Pick & ElementCommonState;\r\n\r\nconst PRIMARY_STATES_KEYS = ['z', 'z2', 'invisible'] as const;\r\nconst PRIMARY_STATES_KEYS_IN_HOVER_LAYER = ['invisible'] as const;\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\ninterface Displayable {\r\n animate(key?: '', loop?: boolean): Animator\r\n animate(key: 'style', loop?: boolean): Animator\r\n\r\n getState(stateName: string): DisplayableState\r\n ensureState(stateName: string): DisplayableState\r\n\r\n states: Dictionary\r\n stateProxy: (stateName: string) => DisplayableState\r\n}\r\n\r\nclass Displayable extends Element {\r\n\r\n /**\r\n * Whether the displayable object is visible. when it is true, the displayable object\r\n * is not drawn, but the mouse event can still trigger the object.\r\n */\r\n invisible: boolean\r\n\r\n z: number\r\n\r\n z2: number\r\n\r\n /**\r\n * The z level determines the displayable object can be drawn in which layer canvas.\r\n */\r\n zlevel: number\r\n\r\n /**\r\n * If enable culling\r\n */\r\n culling: boolean\r\n\r\n /**\r\n * Mouse cursor when hovered\r\n */\r\n cursor: string\r\n\r\n /**\r\n * If hover area is bounding rect\r\n */\r\n rectHover: boolean\r\n /**\r\n * For increamental rendering\r\n */\r\n incremental: boolean\r\n\r\n /**\r\n * Never increase to target size\r\n */\r\n ignoreCoarsePointer?: boolean\r\n\r\n style: Dictionary\r\n\r\n protected _normalState: DisplayableState\r\n\r\n protected _rect: BoundingRect\r\n protected _paintRect: BoundingRect\r\n protected _prevPaintRect: BoundingRect\r\n\r\n dirtyRectTolerance: number\r\n\r\n /************* Properties will be inejected in other modules. *******************/\r\n\r\n // @deprecated.\r\n useHoverLayer?: boolean\r\n\r\n __hoverStyle?: CommonStyleProps\r\n\r\n // TODO use WeakMap?\r\n\r\n // Shapes for cascade clipping.\r\n // Can only be `null`/`undefined` or an non-empty array, MUST NOT be an empty array.\r\n // because it is easy to only using null to check whether clipPaths changed.\r\n __clipPaths?: Path[]\r\n\r\n // FOR CANVAS PAINTER\r\n __canvasFillGradient: CanvasGradient\r\n __canvasStrokeGradient: CanvasGradient\r\n __canvasFillPattern: CanvasPattern\r\n __canvasStrokePattern: CanvasPattern\r\n\r\n // FOR SVG PAINTER\r\n __svgEl: SVGElement\r\n\r\n constructor(props?: Props) {\r\n super(props);\r\n }\r\n\r\n protected _init(props?: Props) {\r\n // Init default properties\r\n const keysArr = keys(props);\r\n for (let i = 0; i < keysArr.length; i++) {\r\n const key = keysArr[i];\r\n if (key === 'style') {\r\n this.useStyle(props[key] as Props['style']);\r\n }\r\n else {\r\n super.attrKV(key as any, props[key]);\r\n }\r\n }\r\n // Give a empty style\r\n if (!this.style) {\r\n this.useStyle({});\r\n }\r\n }\r\n\r\n // Hook provided to developers.\r\n beforeBrush() {}\r\n afterBrush() {}\r\n\r\n // Hook provided to inherited classes.\r\n // Executed between beforeBrush / afterBrush\r\n innerBeforeBrush() {}\r\n innerAfterBrush() {}\r\n\r\n shouldBePainted(\r\n viewWidth: number,\r\n viewHeight: number,\r\n considerClipPath: boolean,\r\n considerAncestors: boolean\r\n ) {\r\n const m = this.transform;\r\n if (\r\n this.ignore\r\n // Ignore invisible element\r\n || this.invisible\r\n // Ignore transparent element\r\n || this.style.opacity === 0\r\n // Ignore culled element\r\n || (this.culling\r\n && isDisplayableCulled(this, viewWidth, viewHeight)\r\n )\r\n // Ignore scale 0 element, in some environment like node-canvas\r\n // Draw a scale 0 element can cause all following draw wrong\r\n // And setTransform with scale 0 will cause set back transform failed.\r\n || (m && !m[0] && !m[3])\r\n ) {\r\n return false;\r\n }\r\n\r\n if (considerClipPath && this.__clipPaths) {\r\n for (let i = 0; i < this.__clipPaths.length; ++i) {\r\n if (this.__clipPaths[i].isZeroArea()) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n if (considerAncestors && this.parent) {\r\n let parent = this.parent;\r\n while (parent) {\r\n if (parent.ignore) {\r\n return false;\r\n }\r\n parent = parent.parent;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * If displayable element contain coord x, y\r\n */\r\n contain(x: number, y: number) {\r\n return this.rectContain(x, y);\r\n }\r\n\r\n traverse(\r\n cb: (this: Context, el: this) => void,\r\n context?: Context\r\n ) {\r\n cb.call(context, this);\r\n }\r\n\r\n /**\r\n * If bounding rect of element contain coord x, y\r\n */\r\n rectContain(x: number, y: number) {\r\n const coord = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n return rect.contain(coord[0], coord[1]);\r\n }\r\n\r\n getPaintRect(): BoundingRect {\r\n let rect = this._paintRect;\r\n if (!this._paintRect || this.__dirty) {\r\n const transform = this.transform;\r\n const elRect = this.getBoundingRect();\r\n\r\n const style = this.style;\r\n const shadowSize = style.shadowBlur || 0;\r\n const shadowOffsetX = style.shadowOffsetX || 0;\r\n const shadowOffsetY = style.shadowOffsetY || 0;\r\n\r\n rect = this._paintRect || (this._paintRect = new BoundingRect(0, 0, 0, 0));\r\n if (transform) {\r\n BoundingRect.applyTransform(rect, elRect, transform);\r\n }\r\n else {\r\n rect.copy(elRect);\r\n }\r\n\r\n if (shadowSize || shadowOffsetX || shadowOffsetY) {\r\n rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);\r\n rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);\r\n rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);\r\n rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);\r\n\r\n }\r\n\r\n // For the accuracy tolerance of text height or line joint point\r\n const tolerance = this.dirtyRectTolerance;\r\n if (!rect.isZero()) {\r\n rect.x = Math.floor(rect.x - tolerance);\r\n rect.y = Math.floor(rect.y - tolerance);\r\n rect.width = Math.ceil(rect.width + 1 + tolerance * 2);\r\n rect.height = Math.ceil(rect.height + 1 + tolerance * 2);\r\n }\r\n }\r\n return rect;\r\n }\r\n\r\n setPrevPaintRect(paintRect: BoundingRect) {\r\n if (paintRect) {\r\n this._prevPaintRect = this._prevPaintRect || new BoundingRect(0, 0, 0, 0);\r\n this._prevPaintRect.copy(paintRect);\r\n }\r\n else {\r\n this._prevPaintRect = null;\r\n }\r\n }\r\n\r\n getPrevPaintRect(): BoundingRect {\r\n return this._prevPaintRect;\r\n }\r\n\r\n /**\r\n * Alias for animate('style')\r\n * @param loop\r\n */\r\n animateStyle(loop: boolean) {\r\n return this.animate('style', loop);\r\n }\r\n\r\n // Override updateDuringAnimation\r\n updateDuringAnimation(targetKey: string) {\r\n if (targetKey === 'style') {\r\n this.dirtyStyle();\r\n }\r\n else {\r\n this.markRedraw();\r\n }\r\n }\r\n\r\n attrKV(key: DisplayableKey, value: DisplayablePropertyType) {\r\n if (key !== 'style') {\r\n super.attrKV(key as keyof DisplayableProps, value);\r\n }\r\n else {\r\n if (!this.style) {\r\n this.useStyle(value as Dictionary);\r\n }\r\n else {\r\n this.setStyle(value as Dictionary);\r\n }\r\n }\r\n }\r\n\r\n setStyle(obj: Props['style']): this\r\n setStyle(obj: T, value: Props['style'][T]): this\r\n setStyle(keyOrObj: keyof Props['style'] | Props['style'], value?: unknown): this {\r\n if (typeof keyOrObj === 'string') {\r\n this.style[keyOrObj] = value;\r\n }\r\n else {\r\n extend(this.style, keyOrObj as Props['style']);\r\n }\r\n this.dirtyStyle();\r\n return this;\r\n }\r\n\r\n // getDefaultStyleValue(key: T): Props['style'][T] {\r\n // // Default value is on the prototype.\r\n // return this.style.prototype[key];\r\n // }\r\n\r\n dirtyStyle(notRedraw?: boolean) {\r\n if (!notRedraw) {\r\n this.markRedraw();\r\n }\r\n this.__dirty |= STYLE_CHANGED_BIT;\r\n // Clear bounding rect.\r\n if (this._rect) {\r\n this._rect = null;\r\n }\r\n }\r\n\r\n dirty() {\r\n this.dirtyStyle();\r\n }\r\n\r\n /**\r\n * Is style changed. Used with dirtyStyle.\r\n */\r\n styleChanged() {\r\n return !!(this.__dirty & STYLE_CHANGED_BIT);\r\n }\r\n\r\n /**\r\n * Mark style updated. Only useful when style is used for caching. Like in the text.\r\n */\r\n styleUpdated() {\r\n this.__dirty &= ~STYLE_CHANGED_BIT;\r\n }\r\n\r\n /**\r\n * Create a style object with default values in it's prototype.\r\n */\r\n createStyle(obj?: Props['style']) {\r\n return createObject(DEFAULT_COMMON_STYLE, obj);\r\n }\r\n\r\n /**\r\n * Replace style property.\r\n * It will create a new style if given obj is not a valid style object.\r\n */\r\n // PENDING should not createStyle if it's an style object.\r\n useStyle(obj: Props['style']) {\r\n if (!obj[STYLE_MAGIC_KEY]) {\r\n obj = this.createStyle(obj);\r\n }\r\n if (this.__inHover) {\r\n this.__hoverStyle = obj; // Not affect exists style.\r\n }\r\n else {\r\n this.style = obj;\r\n }\r\n this.dirtyStyle();\r\n }\r\n\r\n /**\r\n * Determine if an object is a valid style object.\r\n * Which means it is created by `createStyle.`\r\n *\r\n * A valid style object will have all default values in it's prototype.\r\n * To avoid get null/undefined values.\r\n */\r\n isStyleObject(obj: Props['style']) {\r\n return obj[STYLE_MAGIC_KEY];\r\n }\r\n\r\n protected _innerSaveToNormal(toState: DisplayableState) {\r\n super._innerSaveToNormal(toState);\r\n\r\n const normalState = this._normalState;\r\n if (toState.style && !normalState.style) {\r\n // Clone style object.\r\n // TODO: Only save changed style.\r\n normalState.style = this._mergeStyle(this.createStyle(), this.style);\r\n }\r\n\r\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\r\n }\r\n\r\n protected _applyStateObj(\r\n stateName: string,\r\n state: DisplayableState,\r\n normalState: DisplayableState,\r\n keepCurrentStates: boolean,\r\n transition: boolean,\r\n animationCfg: ElementAnimateConfig\r\n ) {\r\n super._applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg);\r\n\r\n const needsRestoreToNormal = !(state && keepCurrentStates);\r\n let targetStyle: Props['style'];\r\n if (state && state.style) {\r\n // Only animate changed properties.\r\n if (transition) {\r\n if (keepCurrentStates) {\r\n targetStyle = state.style;\r\n }\r\n else {\r\n targetStyle = this._mergeStyle(this.createStyle(), normalState.style);\r\n this._mergeStyle(targetStyle, state.style);\r\n }\r\n }\r\n else {\r\n targetStyle = this._mergeStyle(\r\n this.createStyle(),\r\n keepCurrentStates ? this.style : normalState.style\r\n );\r\n this._mergeStyle(targetStyle, state.style);\r\n }\r\n }\r\n else if (needsRestoreToNormal) {\r\n targetStyle = normalState.style;\r\n }\r\n\r\n if (targetStyle) {\r\n if (transition) {\r\n // Clone a new style. Not affect the original one.\r\n const sourceStyle = this.style;\r\n\r\n this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);\r\n // const sourceStyle = this.style = this.createStyle(this.style);\r\n\r\n if (needsRestoreToNormal) {\r\n const changedKeys = keys(sourceStyle);\r\n for (let i = 0; i < changedKeys.length; i++) {\r\n const key = changedKeys[i];\r\n if (key in targetStyle) { // Not use `key == null` because == null may means no stroke/fill.\r\n // Pick out from prototype. Or the property won't be animated.\r\n (targetStyle as any)[key] = targetStyle[key];\r\n // Omit the property has no default value.\r\n (this.style as any)[key] = sourceStyle[key];\r\n }\r\n }\r\n }\r\n\r\n // If states is switched twice in ONE FRAME, for example:\r\n // one property(for example shadowBlur) changed from default value to a specifed value,\r\n // then switched back in immediately. this.style may don't set this property yet when switching back.\r\n // It won't treat it as an changed property when switching back. And it won't be animated.\r\n // So here we make sure the properties will be animated from default value to a specifed value are set.\r\n const targetKeys = keys(targetStyle);\r\n for (let i = 0; i < targetKeys.length; i++) {\r\n const key = targetKeys[i];\r\n this.style[key] = this.style[key];\r\n }\r\n\r\n this._transitionState(stateName, {\r\n style: targetStyle\r\n } as Props, animationCfg, this.getAnimationStyleProps() as MapToType);\r\n }\r\n else {\r\n this.useStyle(targetStyle);\r\n }\r\n }\r\n\r\n // Don't change z, z2 for element moved into hover layer.\r\n // It's not necessary and will cause paint list order changed.\r\n const statesKeys = this.__inHover ? PRIMARY_STATES_KEYS_IN_HOVER_LAYER : PRIMARY_STATES_KEYS;\r\n for (let i = 0; i < statesKeys.length; i++) {\r\n let key = statesKeys[i];\r\n if (state && state[key] != null) {\r\n // Replace if it exist in target state\r\n (this as any)[key] = state[key];\r\n }\r\n else if (needsRestoreToNormal) {\r\n // Restore to normal state\r\n if (normalState[key] != null) {\r\n (this as any)[key] = normalState[key];\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _mergeStates(states: DisplayableState[]) {\r\n const mergedState = super._mergeStates(states) as DisplayableState;\r\n let mergedStyle: Props['style'];\r\n for (let i = 0; i < states.length; i++) {\r\n const state = states[i];\r\n if (state.style) {\r\n mergedStyle = mergedStyle || {};\r\n this._mergeStyle(mergedStyle, state.style);\r\n }\r\n }\r\n if (mergedStyle) {\r\n mergedState.style = mergedStyle;\r\n }\r\n return mergedState;\r\n }\r\n\r\n protected _mergeStyle(\r\n targetStyle: CommonStyleProps,\r\n sourceStyle: CommonStyleProps\r\n ) {\r\n extend(targetStyle, sourceStyle);\r\n return targetStyle;\r\n }\r\n\r\n getAnimationStyleProps() {\r\n return DEFAULT_COMMON_ANIMATION_PROPS;\r\n }\r\n\r\n /**\r\n * The string value of `textPosition` needs to be calculated to a real postion.\r\n * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]`\r\n * by default. See `contain/text.js#calculateTextPosition` for more details.\r\n * But some coutom shapes like \"pin\", \"flag\" have center that is not exactly\r\n * `[width/2, height/2]`. So we provide this hook to customize the calculation\r\n * for those shapes. It will be called if the `style.textPosition` is a string.\r\n * @param out Prepared out object. If not provided, this method should\r\n * be responsible for creating one.\r\n * @param style\r\n * @param rect {x, y, width, height}\r\n * @return out The same as the input out.\r\n * {\r\n * x: number. mandatory.\r\n * y: number. mandatory.\r\n * textAlign: string. optional. use style.textAlign by default.\r\n * textVerticalAlign: string. optional. use style.textVerticalAlign by default.\r\n * }\r\n */\r\n // calculateTextPosition: (out: CalculateTextPositionResult, style: Dictionary, rect: RectLike) => CalculateTextPositionResult\r\n\r\n protected static initDefaultProps = (function () {\r\n const dispProto = Displayable.prototype;\r\n dispProto.type = 'displayable';\r\n dispProto.invisible = false;\r\n dispProto.z = 0;\r\n dispProto.z2 = 0;\r\n dispProto.zlevel = 0;\r\n dispProto.culling = false;\r\n dispProto.cursor = 'pointer';\r\n dispProto.rectHover = false;\r\n dispProto.incremental = false;\r\n dispProto._rect = null;\r\n dispProto.dirtyRectTolerance = 0;\r\n\r\n dispProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT;\r\n })()\r\n}\r\n\r\nconst tmpRect = new BoundingRect(0, 0, 0, 0);\r\nconst viewRect = new BoundingRect(0, 0, 0, 0);\r\nfunction isDisplayableCulled(el: Displayable, width: number, height: number) {\r\n tmpRect.copy(el.getBoundingRect());\r\n if (el.transform) {\r\n tmpRect.applyTransform(el.transform);\r\n }\r\n viewRect.width = width;\r\n viewRect.height = height;\r\n return !tmpRect.intersect(viewRect);\r\n}\r\n\r\nexport default Displayable;","/**\r\n * @author Yi Shen(https://github.com/pissang)\r\n */\r\n\r\nimport * as vec2 from './vector';\r\nimport * as curve from './curve';\r\n\r\nconst mathMin = Math.min;\r\nconst mathMax = Math.max;\r\nconst mathSin = Math.sin;\r\nconst mathCos = Math.cos;\r\nconst PI2 = Math.PI * 2;\r\n\r\nconst start = vec2.create();\r\nconst end = vec2.create();\r\nconst extremity = vec2.create();\r\n\r\n/**\r\n * 从顶点数组中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromPoints(points: ArrayLike[], min: vec2.VectorArray, max: vec2.VectorArray) {\r\n if (points.length === 0) {\r\n return;\r\n }\r\n let p = points[0];\r\n let left = p[0];\r\n let right = p[0];\r\n let top = p[1];\r\n let bottom = p[1];\r\n\r\n for (let i = 1; i < points.length; i++) {\r\n p = points[i];\r\n left = mathMin(left, p[0]);\r\n right = mathMax(right, p[0]);\r\n top = mathMin(top, p[1]);\r\n bottom = mathMax(bottom, p[1]);\r\n }\r\n\r\n min[0] = left;\r\n min[1] = top;\r\n max[0] = right;\r\n max[1] = bottom;\r\n}\r\n\r\nexport function fromLine(\r\n x0: number, y0: number, x1: number, y1: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n min[0] = mathMin(x0, x1);\r\n min[1] = mathMin(y0, y1);\r\n max[0] = mathMax(x0, x1);\r\n max[1] = mathMax(y0, y1);\r\n}\r\n\r\nconst xDim: number[] = [];\r\nconst yDim: number[] = [];\r\n/**\r\n * 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromCubic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const cubicExtrema = curve.cubicExtrema;\r\n const cubicAt = curve.cubicAt;\r\n let n = cubicExtrema(x0, x1, x2, x3, xDim);\r\n min[0] = Infinity;\r\n min[1] = Infinity;\r\n max[0] = -Infinity;\r\n max[1] = -Infinity;\r\n\r\n for (let i = 0; i < n; i++) {\r\n const x = cubicAt(x0, x1, x2, x3, xDim[i]);\r\n min[0] = mathMin(x, min[0]);\r\n max[0] = mathMax(x, max[0]);\r\n }\r\n n = cubicExtrema(y0, y1, y2, y3, yDim);\r\n for (let i = 0; i < n; i++) {\r\n const y = cubicAt(y0, y1, y2, y3, yDim[i]);\r\n min[1] = mathMin(y, min[1]);\r\n max[1] = mathMax(y, max[1]);\r\n }\r\n\r\n min[0] = mathMin(x0, min[0]);\r\n max[0] = mathMax(x0, max[0]);\r\n min[0] = mathMin(x3, min[0]);\r\n max[0] = mathMax(x3, max[0]);\r\n\r\n min[1] = mathMin(y0, min[1]);\r\n max[1] = mathMax(y0, max[1]);\r\n min[1] = mathMin(y3, min[1]);\r\n max[1] = mathMax(y3, max[1]);\r\n}\r\n\r\n/**\r\n * 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromQuadratic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const quadraticExtremum = curve.quadraticExtremum;\r\n const quadraticAt = curve.quadraticAt;\r\n // Find extremities, where derivative in x dim or y dim is zero\r\n const tx =\r\n mathMax(\r\n mathMin(quadraticExtremum(x0, x1, x2), 1), 0\r\n );\r\n const ty =\r\n mathMax(\r\n mathMin(quadraticExtremum(y0, y1, y2), 1), 0\r\n );\r\n\r\n const x = quadraticAt(x0, x1, x2, tx);\r\n const y = quadraticAt(y0, y1, y2, ty);\r\n\r\n min[0] = mathMin(x0, x2, x);\r\n min[1] = mathMin(y0, y2, y);\r\n max[0] = mathMax(x0, x2, x);\r\n max[1] = mathMax(y0, y2, y);\r\n}\r\n\r\n/**\r\n * 从圆弧中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromArc(\r\n x: number, y: number, rx: number, ry: number, startAngle: number, endAngle: number, anticlockwise: boolean,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const vec2Min = vec2.min;\r\n const vec2Max = vec2.max;\r\n\r\n const diff = Math.abs(startAngle - endAngle);\r\n\r\n\r\n if (diff % PI2 < 1e-4 && diff > 1e-4) {\r\n // Is a circle\r\n min[0] = x - rx;\r\n min[1] = y - ry;\r\n max[0] = x + rx;\r\n max[1] = y + ry;\r\n return;\r\n }\r\n\r\n start[0] = mathCos(startAngle) * rx + x;\r\n start[1] = mathSin(startAngle) * ry + y;\r\n\r\n end[0] = mathCos(endAngle) * rx + x;\r\n end[1] = mathSin(endAngle) * ry + y;\r\n\r\n vec2Min(min, start, end);\r\n vec2Max(max, start, end);\r\n\r\n // Thresh to [0, Math.PI * 2]\r\n startAngle = startAngle % (PI2);\r\n if (startAngle < 0) {\r\n startAngle = startAngle + PI2;\r\n }\r\n endAngle = endAngle % (PI2);\r\n if (endAngle < 0) {\r\n endAngle = endAngle + PI2;\r\n }\r\n\r\n if (startAngle > endAngle && !anticlockwise) {\r\n endAngle += PI2;\r\n }\r\n else if (startAngle < endAngle && anticlockwise) {\r\n startAngle += PI2;\r\n }\r\n if (anticlockwise) {\r\n const tmp = endAngle;\r\n endAngle = startAngle;\r\n startAngle = tmp;\r\n }\r\n\r\n // const number = 0;\r\n // const step = (anticlockwise ? -Math.PI : Math.PI) / 2;\r\n for (let angle = 0; angle < endAngle; angle += Math.PI / 2) {\r\n if (angle > startAngle) {\r\n extremity[0] = mathCos(angle) * rx + x;\r\n extremity[1] = mathSin(angle) * ry + y;\r\n\r\n vec2Min(min, extremity, min);\r\n vec2Max(max, extremity, max);\r\n }\r\n }\r\n}\r\n","/**\n * Path 代理,可以在`buildPath`中用于替代`ctx`, 会保存每个path操作的命令到pathCommands属性中\n * 可以用于 isInsidePath 判断以及获取boundingRect\n */\n\n// TODO getTotalLength, getPointAtLength, arcTo\n\n/* global Float32Array */\n\nimport * as vec2 from './vector';\nimport BoundingRect from './BoundingRect';\nimport {devicePixelRatio as dpr} from '../config';\nimport { fromLine, fromCubic, fromQuadratic, fromArc } from './bbox';\nimport { cubicLength, cubicSubdivide, quadraticLength, quadraticSubdivide } from './curve';\n\nconst CMD = {\n M: 1,\n L: 2,\n C: 3,\n Q: 4,\n A: 5,\n Z: 6,\n // Rect\n R: 7\n};\n\n// const CMD_MEM_SIZE = {\n// M: 3,\n// L: 3,\n// C: 7,\n// Q: 5,\n// A: 9,\n// R: 5,\n// Z: 1\n// };\n\ninterface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {\n dpr?: number\n}\n\nconst tmpOutX: number[] = [];\nconst tmpOutY: number[] = [];\n\nconst min: number[] = [];\nconst max: number[] = [];\nconst min2: number[] = [];\nconst max2: number[] = [];\nconst mathMin = Math.min;\nconst mathMax = Math.max;\nconst mathCos = Math.cos;\nconst mathSin = Math.sin;\nconst mathAbs = Math.abs;\n\nconst PI = Math.PI;\nconst PI2 = PI * 2;\n\nconst hasTypedArray = typeof Float32Array !== 'undefined';\n\nconst tmpAngles: number[] = [];\n\nfunction modPI2(radian: number) {\n // It's much more stable to mod N instedof PI\n const n = Math.round(radian / PI * 1e8) / 1e8;\n return (n % 2) * PI;\n}\n/**\n * Normalize start and end angles.\n * startAngle will be normalized to 0 ~ PI*2\n * sweepAngle(endAngle - startAngle) will be normalized to 0 ~ PI*2 if clockwise.\n * -PI*2 ~ 0 if anticlockwise.\n */\nexport function normalizeArcAngles(angles: number[], anticlockwise: boolean): void {\n let newStartAngle = modPI2(angles[0]);\n if (newStartAngle < 0) {\n // Normlize to 0 - PI2\n newStartAngle += PI2;\n }\n\n let delta = newStartAngle - angles[0];\n let newEndAngle = angles[1];\n newEndAngle += delta;\n\n // https://github.com/chromium/chromium/blob/c20d681c9c067c4e15bb1408f17114b9e8cba294/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc#L184\n // Is circle\n if (!anticlockwise && newEndAngle - newStartAngle >= PI2) {\n newEndAngle = newStartAngle + PI2;\n }\n else if (anticlockwise && newStartAngle - newEndAngle >= PI2) {\n newEndAngle = newStartAngle - PI2;\n }\n // Make startAngle < endAngle when clockwise, otherwise endAngle < startAngle.\n // The sweep angle can never been larger than P2.\n else if (!anticlockwise && newStartAngle > newEndAngle) {\n newEndAngle = newStartAngle + (PI2 - modPI2(newStartAngle - newEndAngle));\n }\n else if (anticlockwise && newStartAngle < newEndAngle) {\n newEndAngle = newStartAngle - (PI2 - modPI2(newEndAngle - newStartAngle));\n }\n\n angles[0] = newStartAngle;\n angles[1] = newEndAngle;\n}\n\n\nexport default class PathProxy {\n\n dpr = 1\n\n data: number[] | Float32Array\n\n /**\n * Version is for tracking if the path has been changed.\n */\n private _version: number\n\n /**\n * If save path data.\n */\n private _saveData: boolean\n\n /**\n * If the line segment is too small to draw. It will be added to the pending pt.\n * It will be added if the subpath needs to be finished before stroke, fill, or starting a new subpath.\n */\n private _pendingPtX: number;\n private _pendingPtY: number;\n // Distance of pending pt to previous point.\n // 0 if there is no pending point.\n // Only update the pending pt when distance is larger.\n private _pendingPtDist: number;\n\n private _ctx: ExtendedCanvasRenderingContext2D\n\n private _xi = 0\n private _yi = 0\n\n private _x0 = 0\n private _y0 = 0\n\n private _len = 0\n\n // Calculating path len and seg len.\n private _pathSegLen: number[]\n private _pathLen: number\n // Unit x, Unit y. Provide for avoiding drawing that too short line segment\n private _ux: number\n private _uy: number\n\n static CMD = CMD\n\n constructor(notSaveData?: boolean) {\n if (notSaveData) {\n this._saveData = false;\n }\n\n if (this._saveData) {\n this.data = [];\n }\n }\n\n increaseVersion() {\n this._version++;\n }\n\n /**\n * Version can be used outside for compare if the path is changed.\n * For example to determine if need to update svg d str in svg renderer.\n */\n getVersion() {\n return this._version;\n }\n\n /**\n * @readOnly\n */\n setScale(sx: number, sy: number, segmentIgnoreThreshold?: number) {\n // Compat. Previously there is no segmentIgnoreThreshold.\n segmentIgnoreThreshold = segmentIgnoreThreshold || 0;\n if (segmentIgnoreThreshold > 0) {\n this._ux = mathAbs(segmentIgnoreThreshold / dpr / sx) || 0;\n this._uy = mathAbs(segmentIgnoreThreshold / dpr / sy) || 0;\n }\n }\n\n setDPR(dpr: number) {\n this.dpr = dpr;\n }\n\n setContext(ctx: ExtendedCanvasRenderingContext2D) {\n this._ctx = ctx;\n }\n\n getContext(): ExtendedCanvasRenderingContext2D {\n return this._ctx;\n }\n\n beginPath() {\n this._ctx && this._ctx.beginPath();\n this.reset();\n return this;\n }\n\n /**\n * Reset path data.\n */\n reset() {\n // Reset\n if (this._saveData) {\n this._len = 0;\n }\n\n if (this._pathSegLen) {\n this._pathSegLen = null;\n this._pathLen = 0;\n }\n\n // Update version\n this._version++;\n }\n\n moveTo(x: number, y: number) {\n // Add pending point for previous path.\n this._drawPendingPt();\n\n this.addData(CMD.M, x, y);\n this._ctx && this._ctx.moveTo(x, y);\n\n // x0, y0, xi, yi 是记录在 _dashedXXXXTo 方法中使用\n // xi, yi 记录当前点, x0, y0 在 closePath 的时候回到起始点。\n // 有可能在 beginPath 之后直接调用 lineTo,这时候 x0, y0 需要\n // 在 lineTo 方法中记录,这里先不考虑这种情况,dashed line 也只在 IE10- 中不支持\n this._x0 = x;\n this._y0 = y;\n\n this._xi = x;\n this._yi = y;\n\n return this;\n }\n\n lineTo(x: number, y: number) {\n const dx = mathAbs(x - this._xi);\n const dy = mathAbs(y - this._yi);\n const exceedUnit = dx > this._ux || dy > this._uy;\n\n this.addData(CMD.L, x, y);\n\n if (this._ctx && exceedUnit) {\n this._ctx.lineTo(x, y);\n }\n if (exceedUnit) {\n this._xi = x;\n this._yi = y;\n this._pendingPtDist = 0;\n }\n else {\n const d2 = dx * dx + dy * dy;\n // Only use the farthest pending point.\n if (d2 > this._pendingPtDist) {\n this._pendingPtX = x;\n this._pendingPtY = y;\n this._pendingPtDist = d2;\n }\n }\n\n return this;\n }\n\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number) {\n this._drawPendingPt();\n\n this.addData(CMD.C, x1, y1, x2, y2, x3, y3);\n if (this._ctx) {\n this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n this._xi = x3;\n this._yi = y3;\n return this;\n }\n\n quadraticCurveTo(x1: number, y1: number, x2: number, y2: number) {\n this._drawPendingPt();\n\n this.addData(CMD.Q, x1, y1, x2, y2);\n if (this._ctx) {\n this._ctx.quadraticCurveTo(x1, y1, x2, y2);\n }\n this._xi = x2;\n this._yi = y2;\n return this;\n }\n\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise?: boolean) {\n this._drawPendingPt();\n\n tmpAngles[0] = startAngle;\n tmpAngles[1] = endAngle;\n normalizeArcAngles(tmpAngles, anticlockwise);\n\n startAngle = tmpAngles[0];\n endAngle = tmpAngles[1];\n\n let delta = endAngle - startAngle;\n\n this.addData(\n CMD.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1\n );\n\n this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n\n this._xi = mathCos(endAngle) * r + cx;\n this._yi = mathSin(endAngle) * r + cy;\n return this;\n }\n\n // TODO\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this._drawPendingPt();\n\n if (this._ctx) {\n this._ctx.arcTo(x1, y1, x2, y2, radius);\n }\n return this;\n }\n\n // TODO\n rect(x: number, y: number, w: number, h: number) {\n this._drawPendingPt();\n\n this._ctx && this._ctx.rect(x, y, w, h);\n this.addData(CMD.R, x, y, w, h);\n return this;\n }\n\n closePath() {\n // Add pending point for previous path.\n this._drawPendingPt();\n\n this.addData(CMD.Z);\n\n const ctx = this._ctx;\n const x0 = this._x0;\n const y0 = this._y0;\n if (ctx) {\n ctx.closePath();\n }\n\n this._xi = x0;\n this._yi = y0;\n return this;\n }\n\n fill(ctx: CanvasRenderingContext2D) {\n ctx && ctx.fill();\n this.toStatic();\n }\n\n stroke(ctx: CanvasRenderingContext2D) {\n ctx && ctx.stroke();\n this.toStatic();\n }\n\n len() {\n return this._len;\n }\n\n setData(data: Float32Array | number[]) {\n\n const len = data.length;\n\n if (!(this.data && this.data.length === len) && hasTypedArray) {\n this.data = new Float32Array(len);\n }\n\n for (let i = 0; i < len; i++) {\n this.data[i] = data[i];\n }\n\n this._len = len;\n }\n\n appendPath(path: PathProxy | PathProxy[]) {\n if (!(path instanceof Array)) {\n path = [path];\n }\n const len = path.length;\n let appendSize = 0;\n let offset = this._len;\n for (let i = 0; i < len; i++) {\n appendSize += path[i].len();\n }\n if (hasTypedArray && (this.data instanceof Float32Array)) {\n this.data = new Float32Array(offset + appendSize);\n }\n for (let i = 0; i < len; i++) {\n const appendPathData = path[i].data;\n for (let k = 0; k < appendPathData.length; k++) {\n this.data[offset++] = appendPathData[k];\n }\n }\n this._len = offset;\n }\n\n /**\n * 填充 Path 数据。\n * 尽量复用而不申明新的数组。大部分图形重绘的指令数据长度都是不变的。\n */\n addData(\n cmd: number,\n a?: number,\n b?: number,\n c?: number,\n d?: number,\n e?: number,\n f?: number,\n g?: number,\n h?: number\n ) {\n if (!this._saveData) {\n return;\n }\n\n let data = this.data;\n if (this._len + arguments.length > data.length) {\n // 因为之前的数组已经转换成静态的 Float32Array\n // 所以不够用时需要扩展一个新的动态数组\n this._expandData();\n data = this.data;\n }\n for (let i = 0; i < arguments.length; i++) {\n data[this._len++] = arguments[i];\n }\n }\n\n private _drawPendingPt() {\n if (this._pendingPtDist > 0) {\n this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY);\n this._pendingPtDist = 0;\n }\n }\n\n private _expandData() {\n // Only if data is Float32Array\n if (!(this.data instanceof Array)) {\n const newData = [];\n for (let i = 0; i < this._len; i++) {\n newData[i] = this.data[i];\n }\n this.data = newData;\n }\n }\n\n /**\n * Convert dynamic array to static Float32Array\n *\n * It will still use a normal array if command buffer length is less than 10\n * Because Float32Array itself may take more memory than a normal array.\n *\n * 10 length will make sure at least one M command and one A(arc) command.\n */\n toStatic() {\n if (!this._saveData) {\n return;\n }\n\n this._drawPendingPt();\n\n const data = this.data;\n if (data instanceof Array) {\n data.length = this._len;\n if (hasTypedArray && this._len > 11) {\n this.data = new Float32Array(data);\n }\n }\n }\n\n\n getBoundingRect() {\n min[0] = min[1] = min2[0] = min2[1] = Number.MAX_VALUE;\n max[0] = max[1] = max2[0] = max2[1] = -Number.MAX_VALUE;\n\n const data = this.data;\n let xi = 0;\n let yi = 0;\n let x0 = 0;\n let y0 = 0;\n\n let i;\n for (i = 0; i < this._len;) {\n const cmd = data[i++] as number;\n\n const isFirst = i === 1;\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = data[i];\n yi = data[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n\n switch (cmd) {\n case CMD.M:\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\n // 在 closePath 的时候使用\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n min2[0] = x0;\n min2[1] = y0;\n max2[0] = x0;\n max2[1] = y0;\n break;\n case CMD.L:\n fromLine(xi, yi, data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n fromCubic(\n xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\n min2, max2\n );\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n fromQuadratic(\n xi, yi, data[i++], data[i++], data[i], data[i + 1],\n min2, max2\n );\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n const cx = data[i++];\n const cy = data[i++];\n const rx = data[i++];\n const ry = data[i++];\n const startAngle = data[i++];\n const endAngle = data[i++] + startAngle;\n // TODO Arc 旋转\n i += 1;\n const anticlockwise = !data[i++];\n\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n\n fromArc(\n cx, cy, rx, ry, startAngle, endAngle,\n anticlockwise, min2, max2\n );\n\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n const width = data[i++];\n const height = data[i++];\n // Use fromLine\n fromLine(x0, y0, x0 + width, y0 + height, min2, max2);\n break;\n case CMD.Z:\n xi = x0;\n yi = y0;\n break;\n }\n\n // Union\n vec2.min(min, min, min2);\n vec2.max(max, max, max2);\n }\n\n // No data\n if (i === 0) {\n min[0] = min[1] = max[0] = max[1] = 0;\n }\n\n return new BoundingRect(\n min[0], min[1], max[0] - min[0], max[1] - min[1]\n );\n }\n\n private _calculateLength(): number {\n const data = this.data;\n const len = this._len;\n const ux = this._ux;\n const uy = this._uy;\n let xi = 0;\n let yi = 0;\n let x0 = 0;\n let y0 = 0;\n\n if (!this._pathSegLen) {\n this._pathSegLen = [];\n }\n const pathSegLen = this._pathSegLen;\n let pathTotalLen = 0;\n let segCount = 0;\n\n for (let i = 0; i < len;) {\n const cmd = data[i++] as number;\n const isFirst = i === 1;\n\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = data[i];\n yi = data[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n\n let l = -1;\n\n switch (cmd) {\n case CMD.M:\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\n // 在 closePath 的时候使用\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n break;\n case CMD.L: {\n const x2 = data[i++];\n const y2 = data[i++];\n const dx = x2 - xi;\n const dy = y2 - yi;\n if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x2;\n yi = y2;\n }\n break;\n }\n case CMD.C: {\n const x1 = data[i++];\n const y1 = data[i++];\n const x2 = data[i++];\n const y2 = data[i++];\n const x3 = data[i++];\n const y3 = data[i++];\n // TODO adaptive iteration\n l = cubicLength(xi, yi, x1, y1, x2, y2, x3, y3, 10);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n const x1 = data[i++];\n const y1 = data[i++];\n const x2 = data[i++];\n const y2 = data[i++];\n l = quadraticLength(xi, yi, x1, y1, x2, y2, 10);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n // TODO Arc 判断的开销比较大\n const cx = data[i++];\n const cy = data[i++];\n const rx = data[i++];\n const ry = data[i++];\n const startAngle = data[i++];\n let delta = data[i++];\n const endAngle = delta + startAngle;\n // TODO Arc 旋转\n i += 1;\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n\n // TODO Ellipse\n l = mathMax(rx, ry) * mathMin(PI2, Math.abs(delta));\n\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R: {\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n const width = data[i++];\n const height = data[i++];\n l = width * 2 + height * 2;\n break;\n }\n case CMD.Z: {\n const dx = x0 - xi;\n const dy = y0 - yi;\n l = Math.sqrt(dx * dx + dy * dy);\n\n xi = x0;\n yi = y0;\n break;\n }\n }\n\n if (l >= 0) {\n pathSegLen[segCount++] = l;\n pathTotalLen += l;\n }\n }\n\n // TODO Optimize memory cost.\n this._pathLen = pathTotalLen;\n\n return pathTotalLen;\n }\n /**\n * Rebuild path from current data\n * Rebuild path will not consider javascript implemented line dash.\n * @param {CanvasRenderingContext2D} ctx\n */\n rebuildPath(ctx: PathRebuilder, percent: number) {\n const d = this.data;\n const ux = this._ux;\n const uy = this._uy;\n const len = this._len;\n let x0;\n let y0;\n let xi;\n let yi;\n let x;\n let y;\n\n const drawPart = percent < 1;\n let pathSegLen;\n let pathTotalLen;\n let accumLength = 0;\n let segCount = 0;\n let displayedLength;\n\n let pendingPtDist = 0;\n let pendingPtX: number;\n let pendingPtY: number;\n\n\n if (drawPart) {\n if (!this._pathSegLen) {\n this._calculateLength();\n }\n pathSegLen = this._pathSegLen;\n pathTotalLen = this._pathLen;\n displayedLength = percent * pathTotalLen;\n\n if (!displayedLength) {\n return;\n }\n }\n\n lo: for (let i = 0; i < len;) {\n const cmd = d[i++];\n const isFirst = i === 1;\n\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = d[i];\n yi = d[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n // Only lineTo support ignoring small segments.\n // Otherwise if the pending point should always been flushed.\n if (cmd !== CMD.L && pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n switch (cmd) {\n case CMD.M:\n x0 = xi = d[i++];\n y0 = yi = d[i++];\n ctx.moveTo(xi, yi);\n break;\n case CMD.L: {\n x = d[i++];\n y = d[i++];\n const dx = mathAbs(x - xi);\n const dy = mathAbs(y - yi);\n // Not draw too small seg between\n if (dx > ux || dy > uy) {\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x * t, yi * (1 - t) + y * t);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.lineTo(x, y);\n xi = x;\n yi = y;\n pendingPtDist = 0;\n }\n else {\n const d2 = dx * dx + dy * dy;\n // Only use the farthest pending point.\n if (d2 > pendingPtDist) {\n pendingPtX = x;\n pendingPtY = y;\n pendingPtDist = d2;\n }\n }\n break;\n }\n case CMD.C: {\n const x1 = d[i++];\n const y1 = d[i++];\n const x2 = d[i++];\n const y2 = d[i++];\n const x3 = d[i++];\n const y3 = d[i++];\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n cubicSubdivide(xi, x1, x2, x3, t, tmpOutX);\n cubicSubdivide(yi, y1, y2, y3, t, tmpOutY);\n ctx.bezierCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2], tmpOutX[3], tmpOutY[3]);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n const x1 = d[i++];\n const y1 = d[i++];\n const x2 = d[i++];\n const y2 = d[i++];\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n quadraticSubdivide(xi, x1, x2, t, tmpOutX);\n quadraticSubdivide(yi, y1, y2, t, tmpOutY);\n ctx.quadraticCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2]);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.quadraticCurveTo(x1, y1, x2, y2);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n const cx = d[i++];\n const cy = d[i++];\n const rx = d[i++];\n const ry = d[i++];\n let startAngle = d[i++];\n let delta = d[i++];\n const psi = d[i++];\n const anticlockwise = !d[i++];\n const r = (rx > ry) ? rx : ry;\n // const scaleX = (rx > ry) ? 1 : rx / ry;\n // const scaleY = (rx > ry) ? ry / rx : 1;\n const isEllipse = mathAbs(rx - ry) > 1e-3;\n let endAngle = startAngle + delta;\n let breakBuild = false;\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n endAngle = startAngle + delta * (displayedLength - accumLength) / l;\n breakBuild = true;\n }\n accumLength += l;\n }\n if (isEllipse && ctx.ellipse) {\n ctx.ellipse(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise);\n }\n else {\n ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n }\n\n if (breakBuild) {\n break lo;\n }\n\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = d[i];\n y0 = yi = d[i + 1];\n\n x = d[i++];\n y = d[i++];\n const width = d[i++];\n const height = d[i++];\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n let d = displayedLength - accumLength;\n ctx.moveTo(x, y);\n ctx.lineTo(x + mathMin(d, width), y);\n d -= width;\n if (d > 0) {\n ctx.lineTo(x + width, y + mathMin(d, height));\n }\n d -= height;\n if (d > 0) {\n ctx.lineTo(x + mathMax(width - d, 0), y + height);\n }\n d -= width;\n if (d > 0) {\n ctx.lineTo(x, y + mathMax(height - d, 0));\n }\n break lo;\n }\n accumLength += l;\n }\n ctx.rect(x, y, width, height);\n break;\n case CMD.Z:\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x0 * t, yi * (1 - t) + y0 * t);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.closePath();\n xi = x0;\n yi = y0;\n }\n }\n }\n\n clone() {\n const newProxy = new PathProxy();\n const data = this.data;\n newProxy.data = data.slice ? data.slice()\n : Array.prototype.slice.call(data);\n newProxy._len = this._len;\n return newProxy;\n }\n\n private static initDefaultProps = (function () {\n const proto = PathProxy.prototype;\n proto._saveData = true;\n proto._ux = 0;\n proto._uy = 0;\n proto._pendingPtDist = 0;\n proto._version = 0;\n })()\n}\n\n\nexport interface PathRebuilder {\n moveTo(x: number, y: number): void\n lineTo(x: number, y: number): void\n bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number): void\n quadraticCurveTo(x: number, y: number, x2: number, y2: number): void\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean): void\n // eslint-disable-next-line max-len\n ellipse(cx: number, cy: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise: boolean): void\n rect(x: number, y: number, width: number, height: number): void\n closePath(): void\n}","\r\n/**\r\n * 线段包含判断\r\n * @param {number} x0\r\n * @param {number} y0\r\n * @param {number} x1\r\n * @param {number} y1\r\n * @param {number} lineWidth\r\n * @param {number} x\r\n * @param {number} y\r\n * @return {boolean}\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n let _a = 0;\r\n let _b = x0;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l)\r\n || (y < y0 - _l && y < y1 - _l)\r\n || (x > x0 + _l && x > x1 + _l)\r\n || (x < x0 - _l && x < x1 - _l)\r\n ) {\r\n return false;\r\n }\r\n\r\n if (x0 !== x1) {\r\n _a = (y0 - y1) / (x0 - x1);\r\n _b = (x0 * y1 - x1 * y0) / (x0 - x1);\r\n }\r\n else {\r\n return Math.abs(x - x0) <= _l / 2;\r\n }\r\n const tmp = _a * x - y + _b;\r\n const _s = tmp * tmp / (_a * _a + 1);\r\n return _s <= _l / 2 * _l / 2;\r\n}","\r\nimport * as curve from '../core/curve';\r\n\r\n/**\r\n * 三次贝塞尔曲线描边包含判断\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number,\r\n x2: number, y2: number, x3: number, y3: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)\r\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)\r\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)\r\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)\r\n ) {\r\n return false;\r\n }\r\n const d = curve.cubicProjectPoint(\r\n x0, y0, x1, y1, x2, y2, x3, y3,\r\n x, y, null\r\n );\r\n return d <= _l / 2;\r\n}","import {quadraticProjectPoint} from '../core/curve';\r\n\r\n/**\r\n * 二次贝塞尔曲线描边包含判断\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l && y > y2 + _l)\r\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l)\r\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l)\r\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l)\r\n ) {\r\n return false;\r\n }\r\n const d = quadraticProjectPoint(\r\n x0, y0, x1, y1, x2, y2,\r\n x, y, null\r\n );\r\n return d <= _l / 2;\r\n}\r\n","\r\nconst PI2 = Math.PI * 2;\r\n\r\nexport function normalizeRadian(angle: number): number {\r\n angle %= PI2;\r\n if (angle < 0) {\r\n angle += PI2;\r\n }\r\n return angle;\r\n}","\r\nimport {normalizeRadian} from './util';\r\n\r\nconst PI2 = Math.PI * 2;\r\n\r\n/**\r\n * 圆弧描边包含判断\r\n */\r\nexport function containStroke(\r\n cx: number, cy: number, r: number, startAngle: number, endAngle: number,\r\n anticlockwise: boolean,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n\r\n x -= cx;\r\n y -= cy;\r\n const d = Math.sqrt(x * x + y * y);\r\n\r\n if ((d - _l > r) || (d + _l < r)) {\r\n return false;\r\n }\r\n // TODO\r\n if (Math.abs(startAngle - endAngle) % PI2 < 1e-4) {\r\n // Is a circle\r\n return true;\r\n }\r\n if (anticlockwise) {\r\n const tmp = startAngle;\r\n startAngle = normalizeRadian(endAngle);\r\n endAngle = normalizeRadian(tmp);\r\n }\r\n else {\r\n startAngle = normalizeRadian(startAngle);\r\n endAngle = normalizeRadian(endAngle);\r\n }\r\n if (startAngle > endAngle) {\r\n endAngle += PI2;\r\n }\r\n\r\n let angle = Math.atan2(y, x);\r\n if (angle < 0) {\r\n angle += PI2;\r\n }\r\n return (angle >= startAngle && angle <= endAngle)\r\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);\r\n}","\r\nexport default function windingLine(\r\n x0: number, y0: number, x1: number, y1: number, x: number, y: number\r\n): number {\r\n if ((y > y0 && y > y1) || (y < y0 && y < y1)) {\r\n return 0;\r\n }\r\n // Ignore horizontal line\r\n if (y1 === y0) {\r\n return 0;\r\n }\r\n const t = (y - y0) / (y1 - y0);\r\n\r\n let dir = y1 < y0 ? 1 : -1;\r\n // Avoid winding error when intersection point is the connect point of two line of polygon\r\n if (t === 1 || t === 0) {\r\n dir = y1 < y0 ? 0.5 : -0.5;\r\n }\r\n\r\n const x_ = t * (x1 - x0) + x0;\r\n\r\n // If (x, y) on the line, considered as \"contain\".\r\n return x_ === x ? Infinity : x_ > x ? dir : 0;\r\n}","import PathProxy from '../core/PathProxy';\r\nimport * as line from './line';\r\nimport * as cubic from './cubic';\r\nimport * as quadratic from './quadratic';\r\nimport * as arc from './arc';\r\nimport * as curve from '../core/curve';\r\nimport windingLine from './windingLine';\r\n\r\nconst CMD = PathProxy.CMD;\r\nconst PI2 = Math.PI * 2;\r\n\r\nconst EPSILON = 1e-4;\r\n\r\nfunction isAroundEqual(a: number, b: number) {\r\n return Math.abs(a - b) < EPSILON;\r\n}\r\n\r\n// 临时数组\r\nconst roots = [-1, -1, -1];\r\nconst extrema = [-1, -1];\r\n\r\nfunction swapExtrema() {\r\n const tmp = extrema[0];\r\n extrema[0] = extrema[1];\r\n extrema[1] = tmp;\r\n}\r\n\r\nfunction windingCubic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n x: number, y: number\r\n): number {\r\n // Quick reject\r\n if (\r\n (y > y0 && y > y1 && y > y2 && y > y3)\r\n || (y < y0 && y < y1 && y < y2 && y < y3)\r\n ) {\r\n return 0;\r\n }\r\n const nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);\r\n if (nRoots === 0) {\r\n return 0;\r\n }\r\n else {\r\n let w = 0;\r\n let nExtrema = -1;\r\n let y0_;\r\n let y1_;\r\n for (let i = 0; i < nRoots; i++) {\r\n let t = roots[i];\r\n\r\n // Avoid winding error when intersection point is the connect point of two line of polygon\r\n let unit = (t === 0 || t === 1) ? 0.5 : 1;\r\n\r\n let x_ = curve.cubicAt(x0, x1, x2, x3, t);\r\n if (x_ < x) { // Quick reject\r\n continue;\r\n }\r\n if (nExtrema < 0) {\r\n nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);\r\n if (extrema[1] < extrema[0] && nExtrema > 1) {\r\n swapExtrema();\r\n }\r\n y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);\r\n if (nExtrema > 1) {\r\n y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);\r\n }\r\n }\r\n if (nExtrema === 2) {\r\n // 分成三段单调函数\r\n if (t < extrema[0]) {\r\n w += y0_ < y0 ? unit : -unit;\r\n }\r\n else if (t < extrema[1]) {\r\n w += y1_ < y0_ ? unit : -unit;\r\n }\r\n else {\r\n w += y3 < y1_ ? unit : -unit;\r\n }\r\n }\r\n else {\r\n // 分成两段单调函数\r\n if (t < extrema[0]) {\r\n w += y0_ < y0 ? unit : -unit;\r\n }\r\n else {\r\n w += y3 < y0_ ? unit : -unit;\r\n }\r\n }\r\n }\r\n return w;\r\n }\r\n}\r\n\r\nfunction windingQuadratic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n x: number, y: number\r\n): number {\r\n // Quick reject\r\n if (\r\n (y > y0 && y > y1 && y > y2)\r\n || (y < y0 && y < y1 && y < y2)\r\n ) {\r\n return 0;\r\n }\r\n const nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);\r\n if (nRoots === 0) {\r\n return 0;\r\n }\r\n else {\r\n const t = curve.quadraticExtremum(y0, y1, y2);\r\n if (t >= 0 && t <= 1) {\r\n let w = 0;\r\n let y_ = curve.quadraticAt(y0, y1, y2, t);\r\n for (let i = 0; i < nRoots; i++) {\r\n // Remove one endpoint.\r\n let unit = (roots[i] === 0 || roots[i] === 1) ? 0.5 : 1;\r\n\r\n let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);\r\n if (x_ < x) { // Quick reject\r\n continue;\r\n }\r\n if (roots[i] < t) {\r\n w += y_ < y0 ? unit : -unit;\r\n }\r\n else {\r\n w += y2 < y_ ? unit : -unit;\r\n }\r\n }\r\n return w;\r\n }\r\n else {\r\n // Remove one endpoint.\r\n const unit = (roots[0] === 0 || roots[0] === 1) ? 0.5 : 1;\r\n\r\n const x_ = curve.quadraticAt(x0, x1, x2, roots[0]);\r\n if (x_ < x) { // Quick reject\r\n return 0;\r\n }\r\n return y2 < y0 ? unit : -unit;\r\n }\r\n }\r\n}\r\n// TODO\r\n// Arc 旋转\r\n// startAngle, endAngle has been normalized by normalizeArcAngles\r\nfunction windingArc(\r\n cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean,\r\n x: number, y: number\r\n) {\r\n y -= cy;\r\n if (y > r || y < -r) {\r\n return 0;\r\n }\r\n const tmp = Math.sqrt(r * r - y * y);\r\n roots[0] = -tmp;\r\n roots[1] = tmp;\r\n\r\n const dTheta = Math.abs(startAngle - endAngle);\r\n if (dTheta < 1e-4) {\r\n return 0;\r\n }\r\n if (dTheta >= PI2 - 1e-4) {\r\n // Is a circle\r\n startAngle = 0;\r\n endAngle = PI2;\r\n const dir = anticlockwise ? 1 : -1;\r\n if (x >= roots[0] + cx && x <= roots[1] + cx) {\r\n return dir;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n\r\n if (startAngle > endAngle) {\r\n // Swap, make sure startAngle is smaller than endAngle.\r\n const tmp = startAngle;\r\n startAngle = endAngle;\r\n endAngle = tmp;\r\n }\r\n // endAngle - startAngle is normalized to 0 - 2*PI.\r\n // So following will normalize them to 0 - 4*PI\r\n if (startAngle < 0) {\r\n startAngle += PI2;\r\n endAngle += PI2;\r\n }\r\n\r\n let w = 0;\r\n for (let i = 0; i < 2; i++) {\r\n const x_ = roots[i];\r\n if (x_ + cx > x) {\r\n let angle = Math.atan2(y, x_);\r\n let dir = anticlockwise ? 1 : -1;\r\n if (angle < 0) {\r\n angle = PI2 + angle;\r\n }\r\n if (\r\n (angle >= startAngle && angle <= endAngle)\r\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)\r\n ) {\r\n if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {\r\n dir = -dir;\r\n }\r\n w += dir;\r\n }\r\n }\r\n }\r\n return w;\r\n}\r\n\r\n\r\nfunction containPath(\r\n path: PathProxy, lineWidth: number, isStroke: boolean, x: number, y: number\r\n): boolean {\r\n const data = path.data;\r\n const len = path.len();\r\n let w = 0;\r\n let xi = 0;\r\n let yi = 0;\r\n let x0 = 0;\r\n let y0 = 0;\r\n let x1;\r\n let y1;\r\n\r\n for (let i = 0; i < len;) {\r\n const cmd = data[i++];\r\n const isFirst = i === 1;\r\n // Begin a new subpath\r\n if (cmd === CMD.M && i > 1) {\r\n // Close previous subpath\r\n if (!isStroke) {\r\n w += windingLine(xi, yi, x0, y0, x, y);\r\n }\r\n // 如果被任何一个 subpath 包含\r\n // if (w !== 0) {\r\n // return true;\r\n // }\r\n }\r\n\r\n if (isFirst) {\r\n // 如果第一个命令是 L, C, Q\r\n // 则 previous point 同绘制命令的第一个 point\r\n //\r\n // 第一个命令为 Arc 的情况下会在后面特殊处理\r\n xi = data[i];\r\n yi = data[i + 1];\r\n\r\n x0 = xi;\r\n y0 = yi;\r\n }\r\n\r\n switch (cmd) {\r\n case CMD.M:\r\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\r\n // 在 closePath 的时候使用\r\n x0 = data[i++];\r\n y0 = data[i++];\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n case CMD.L:\r\n if (isStroke) {\r\n if (line.containStroke(xi, yi, data[i], data[i + 1], lineWidth, x, y)) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // NOTE 在第一个命令为 L, C, Q 的时候会计算出 NaN\r\n w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.C:\r\n if (isStroke) {\r\n if (cubic.containStroke(xi, yi,\r\n data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\r\n lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingCubic(\r\n xi, yi,\r\n data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\r\n x, y\r\n ) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.Q:\r\n if (isStroke) {\r\n if (quadratic.containStroke(xi, yi,\r\n data[i++], data[i++], data[i], data[i + 1],\r\n lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingQuadratic(\r\n xi, yi,\r\n data[i++], data[i++], data[i], data[i + 1],\r\n x, y\r\n ) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.A:\r\n // TODO Arc 判断的开销比较大\r\n const cx = data[i++];\r\n const cy = data[i++];\r\n const rx = data[i++];\r\n const ry = data[i++];\r\n const theta = data[i++];\r\n const dTheta = data[i++];\r\n // TODO Arc 旋转\r\n i += 1;\r\n const anticlockwise = !!(1 - data[i++]);\r\n x1 = Math.cos(theta) * rx + cx;\r\n y1 = Math.sin(theta) * ry + cy;\r\n // 不是直接使用 arc 命令\r\n if (!isFirst) {\r\n w += windingLine(xi, yi, x1, y1, x, y);\r\n }\r\n else {\r\n // 第一个命令起点还未定义\r\n x0 = x1;\r\n y0 = y1;\r\n }\r\n // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放\r\n const _x = (x - cx) * ry / rx + cx;\r\n if (isStroke) {\r\n if (arc.containStroke(\r\n cx, cy, ry, theta, theta + dTheta, anticlockwise,\r\n lineWidth, _x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingArc(\r\n cx, cy, ry, theta, theta + dTheta, anticlockwise,\r\n _x, y\r\n );\r\n }\r\n xi = Math.cos(theta + dTheta) * rx + cx;\r\n yi = Math.sin(theta + dTheta) * ry + cy;\r\n break;\r\n case CMD.R:\r\n x0 = xi = data[i++];\r\n y0 = yi = data[i++];\r\n const width = data[i++];\r\n const height = data[i++];\r\n x1 = x0 + width;\r\n y1 = y0 + height;\r\n if (isStroke) {\r\n if (line.containStroke(x0, y0, x1, y0, lineWidth, x, y)\r\n || line.containStroke(x1, y0, x1, y1, lineWidth, x, y)\r\n || line.containStroke(x1, y1, x0, y1, lineWidth, x, y)\r\n || line.containStroke(x0, y1, x0, y0, lineWidth, x, y)\r\n ) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // FIXME Clockwise ?\r\n w += windingLine(x1, y0, x1, y1, x, y);\r\n w += windingLine(x0, y1, x0, y0, x, y);\r\n }\r\n break;\r\n case CMD.Z:\r\n if (isStroke) {\r\n if (line.containStroke(\r\n xi, yi, x0, y0, lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // Close a subpath\r\n w += windingLine(xi, yi, x0, y0, x, y);\r\n // 如果被任何一个 subpath 包含\r\n // FIXME subpaths may overlap\r\n // if (w !== 0) {\r\n // return true;\r\n // }\r\n }\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n }\r\n }\r\n if (!isStroke && !isAroundEqual(yi, y0)) {\r\n w += windingLine(xi, yi, x0, y0, x, y) || 0;\r\n }\r\n return w !== 0;\r\n}\r\n\r\nexport function contain(pathProxy: PathProxy, x: number, y: number): boolean {\r\n return containPath(pathProxy, 0, false, x, y);\r\n}\r\n\r\nexport function containStroke(pathProxy: PathProxy, lineWidth: number, x: number, y: number): boolean {\r\n return containPath(pathProxy, lineWidth, true, x, y);\r\n}","import Displayable, { DisplayableProps,\r\n CommonStyleProps,\r\n DEFAULT_COMMON_STYLE,\r\n DisplayableStatePropNames,\r\n DEFAULT_COMMON_ANIMATION_PROPS\r\n} from './Displayable';\r\nimport Element, { ElementAnimateConfig } from '../Element';\r\nimport PathProxy from '../core/PathProxy';\r\nimport * as pathContain from '../contain/path';\r\nimport { PatternObject } from './Pattern';\r\nimport { Dictionary, PropType, MapToType } from '../core/types';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { LinearGradientObject } from './LinearGradient';\r\nimport { RadialGradientObject } from './RadialGradient';\r\nimport { defaults, keys, extend, clone, isString, createObject } from '../core/util';\r\nimport Animator from '../animation/Animator';\r\nimport { lum } from '../tool/color';\r\nimport { DARK_LABEL_COLOR, LIGHT_LABEL_COLOR, DARK_MODE_THRESHOLD, LIGHTER_LABEL_COLOR } from '../config';\r\nimport { REDRAW_BIT, SHAPE_CHANGED_BIT, STYLE_CHANGED_BIT } from './constants';\r\nimport { TRANSFORMABLE_PROPS } from '../core/Transformable';\r\n\r\n\r\nexport interface PathStyleProps extends CommonStyleProps {\r\n fill?: string | PatternObject | LinearGradientObject | RadialGradientObject\r\n stroke?: string | PatternObject | LinearGradientObject | RadialGradientObject\r\n decal?: PatternObject\r\n\r\n /**\r\n * Still experimental, not works weel on arc with edge cases(large angle).\r\n */\r\n strokePercent?: number\r\n strokeNoScale?: boolean\r\n fillOpacity?: number\r\n strokeOpacity?: number\r\n\r\n /**\r\n * `true` is not supported.\r\n * `false`/`null`/`undefined` are the same.\r\n * `false` is used to remove lineDash in some\r\n * case that `null`/`undefined` can not be set.\r\n * (e.g., emphasis.lineStyle in echarts)\r\n */\r\n lineDash?: false | number[] | 'solid' | 'dashed' | 'dotted'\r\n lineDashOffset?: number\r\n\r\n lineWidth?: number\r\n lineCap?: CanvasLineCap\r\n lineJoin?: CanvasLineJoin\r\n\r\n miterLimit?: number\r\n /**\r\n * Paint order, if do stroke first. Similar to SVG paint-order\r\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/paint-order\r\n */\r\n strokeFirst?: boolean\r\n}\r\n\r\nexport const DEFAULT_PATH_STYLE: PathStyleProps = defaults({\r\n fill: '#000',\r\n stroke: null,\r\n strokePercent: 1,\r\n fillOpacity: 1,\r\n strokeOpacity: 1,\r\n\r\n lineDashOffset: 0,\r\n lineWidth: 1,\r\n lineCap: 'butt',\r\n miterLimit: 10,\r\n\r\n strokeNoScale: false,\r\n strokeFirst: false\r\n} as PathStyleProps, DEFAULT_COMMON_STYLE);\r\n\r\n\r\nexport const DEFAULT_PATH_ANIMATION_PROPS: MapToType = {\r\n style: defaults, MapToType>({\r\n fill: true,\r\n stroke: true,\r\n strokePercent: true,\r\n fillOpacity: true,\r\n strokeOpacity: true,\r\n lineDashOffset: true,\r\n lineWidth: true,\r\n miterLimit: true\r\n } as MapToType, DEFAULT_COMMON_ANIMATION_PROPS.style)\r\n };\r\n\r\nexport interface PathProps extends DisplayableProps {\r\n strokeContainThreshold?: number\r\n segmentIgnoreThreshold?: number\r\n subPixelOptimize?: boolean\r\n\r\n style?: PathStyleProps\r\n shape?: Dictionary\r\n\r\n autoBatch?: boolean\r\n\r\n __value?: (string | number)[] | (string | number)\r\n\r\n buildPath?: (\r\n ctx: PathProxy | CanvasRenderingContext2D,\r\n shapeCfg: Dictionary,\r\n inBatch?: boolean\r\n ) => void\r\n}\r\n\r\n\r\ntype PathKey = keyof PathProps\r\ntype PathPropertyType = PropType\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\ninterface Path {\r\n animate(key?: '', loop?: boolean): Animator\r\n animate(key: 'style', loop?: boolean): Animator\r\n animate(key: 'shape', loop?: boolean): Animator\r\n\r\n getState(stateName: string): PathState\r\n ensureState(stateName: string): PathState\r\n\r\n states: Dictionary\r\n stateProxy: (stateName: string) => PathState\r\n}\r\n\r\nexport type PathStatePropNames = DisplayableStatePropNames | 'shape';\r\nexport type PathState = Pick & {\r\n hoverLayer?: boolean\r\n}\r\n\r\nconst pathCopyParams = (TRANSFORMABLE_PROPS as readonly string[]).concat(['invisible',\r\n 'culling', 'z', 'z2', 'zlevel', 'parent'\r\n]) as (keyof Path)[];\r\n\r\nclass Path extends Displayable {\r\n\r\n path: PathProxy\r\n\r\n strokeContainThreshold: number\r\n\r\n // This item default to be false. But in map series in echarts,\r\n // in order to improve performance, it should be set to true,\r\n // so the shorty segment won't draw.\r\n segmentIgnoreThreshold: number\r\n\r\n subPixelOptimize: boolean\r\n\r\n style: PathStyleProps\r\n /**\r\n * If element can be batched automatically\r\n */\r\n autoBatch: boolean\r\n\r\n private _rectStroke: BoundingRect\r\n\r\n protected _normalState: PathState\r\n\r\n protected _decalEl: Path\r\n\r\n // Must have an initial value on shape.\r\n // It will be assigned by default value.\r\n shape: Dictionary\r\n\r\n constructor(opts?: Props) {\r\n super(opts);\r\n }\r\n\r\n update() {\r\n super.update();\r\n\r\n const style = this.style;\r\n if (style.decal) {\r\n const decalEl: Path = this._decalEl = this._decalEl || new Path();\r\n if (decalEl.buildPath === Path.prototype.buildPath) {\r\n decalEl.buildPath = ctx => {\r\n this.buildPath(ctx, this.shape);\r\n };\r\n }\r\n\r\n decalEl.silent = true;\r\n\r\n const decalElStyle = decalEl.style;\r\n\r\n for (let key in style) {\r\n if ((decalElStyle as any)[key] !== (style as any)[key]) {\r\n (decalElStyle as any)[key] = (style as any)[key];\r\n }\r\n }\r\n decalElStyle.fill = style.fill ? style.decal : null;\r\n decalElStyle.decal = null;\r\n decalElStyle.shadowColor = null;\r\n style.strokeFirst && (decalElStyle.stroke = null);\r\n\r\n for (let i = 0; i < pathCopyParams.length; ++i) {\r\n (decalEl as any)[pathCopyParams[i]] = this[pathCopyParams[i]];\r\n }\r\n\r\n decalEl.__dirty |= REDRAW_BIT;\r\n }\r\n else if (this._decalEl) {\r\n this._decalEl = null;\r\n }\r\n }\r\n\r\n getDecalElement() {\r\n return this._decalEl;\r\n }\r\n\r\n protected _init(props?: Props) {\r\n // Init default properties\r\n const keysArr = keys(props);\r\n\r\n this.shape = this.getDefaultShape();\r\n const defaultStyle = this.getDefaultStyle();\r\n if (defaultStyle) {\r\n this.useStyle(defaultStyle);\r\n }\r\n\r\n for (let i = 0; i < keysArr.length; i++) {\r\n const key = keysArr[i];\r\n const value = props[key];\r\n if (key === 'style') {\r\n if (!this.style) {\r\n // PENDING Reuse style object if possible?\r\n this.useStyle(value as Props['style']);\r\n }\r\n else {\r\n extend(this.style, value as Props['style']);\r\n }\r\n }\r\n else if (key === 'shape') {\r\n // this.shape = value;\r\n extend(this.shape, value as Props['shape']);\r\n }\r\n else {\r\n super.attrKV(key as any, value);\r\n }\r\n }\r\n\r\n // Create an empty one if no style object exists.\r\n if (!this.style) {\r\n this.useStyle({});\r\n }\r\n // const defaultShape = this.getDefaultShape();\r\n // if (!this.shape) {\r\n // this.shape = defaultShape;\r\n // }\r\n // else {\r\n // defaults(this.shape, defaultShape);\r\n // }\r\n }\r\n\r\n protected getDefaultStyle(): Props['style'] {\r\n return null;\r\n }\r\n\r\n // Needs to override\r\n protected getDefaultShape() {\r\n return {};\r\n }\r\n\r\n protected canBeInsideText() {\r\n return this.hasFill();\r\n }\r\n\r\n protected getInsideTextFill() {\r\n const pathFill = this.style.fill;\r\n if (pathFill !== 'none') {\r\n if (isString(pathFill)) {\r\n const fillLum = lum(pathFill, 0);\r\n // Determin text color based on the lum of path fill.\r\n // TODO use (1 - DARK_MODE_THRESHOLD)?\r\n if (fillLum > 0.5) { // TODO Consider background lum?\r\n return DARK_LABEL_COLOR;\r\n }\r\n else if (fillLum > 0.2) {\r\n return LIGHTER_LABEL_COLOR;\r\n }\r\n return LIGHT_LABEL_COLOR;\r\n }\r\n else if (pathFill) {\r\n return LIGHT_LABEL_COLOR;\r\n }\r\n\r\n }\r\n return DARK_LABEL_COLOR;\r\n }\r\n\r\n protected getInsideTextStroke(textFill?: string) {\r\n const pathFill = this.style.fill;\r\n // Not stroke on none fill object or gradient object\r\n if (isString(pathFill)) {\r\n const zr = this.__zr;\r\n const isDarkMode = !!(zr && zr.isDarkMode());\r\n const isDarkLabel = lum(textFill, 0) < DARK_MODE_THRESHOLD;\r\n // All dark or all light.\r\n if (isDarkMode === isDarkLabel) {\r\n return pathFill;\r\n }\r\n }\r\n }\r\n\r\n // When bundling path, some shape may decide if use moveTo to begin a new subpath or closePath\r\n // Like in circle\r\n buildPath(\r\n ctx: PathProxy | CanvasRenderingContext2D,\r\n shapeCfg: Dictionary,\r\n inBatch?: boolean\r\n ) {}\r\n\r\n pathUpdated() {\r\n this.__dirty &= ~SHAPE_CHANGED_BIT;\r\n }\r\n\r\n getUpdatedPathProxy(inBatch?: boolean) {\r\n // Update path proxy data to latest.\r\n !this.path && this.createPathProxy();\r\n this.path.beginPath();\r\n this.buildPath(this.path, this.shape, inBatch);\r\n return this.path;\r\n }\r\n\r\n createPathProxy() {\r\n this.path = new PathProxy(false);\r\n }\r\n\r\n hasStroke() {\r\n const style = this.style;\r\n const stroke = style.stroke;\r\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\r\n }\r\n\r\n hasFill() {\r\n const style = this.style;\r\n const fill = style.fill;\r\n return fill != null && fill !== 'none';\r\n }\r\n\r\n getBoundingRect(): BoundingRect {\r\n let rect = this._rect;\r\n const style = this.style;\r\n const needsUpdateRect = !rect;\r\n if (needsUpdateRect) {\r\n let firstInvoke = false;\r\n if (!this.path) {\r\n firstInvoke = true;\r\n // Create path on demand.\r\n this.createPathProxy();\r\n }\r\n let path = this.path;\r\n if (firstInvoke || (this.__dirty & SHAPE_CHANGED_BIT)) {\r\n path.beginPath();\r\n this.buildPath(path, this.shape, false);\r\n this.pathUpdated();\r\n }\r\n rect = path.getBoundingRect();\r\n }\r\n this._rect = rect;\r\n\r\n if (this.hasStroke() && this.path && this.path.len() > 0) {\r\n // Needs update rect with stroke lineWidth when\r\n // 1. Element changes scale or lineWidth\r\n // 2. Shape is changed\r\n const rectStroke = this._rectStroke || (this._rectStroke = rect.clone());\r\n if (this.__dirty || needsUpdateRect) {\r\n rectStroke.copy(rect);\r\n // PENDING, Min line width is needed when line is horizontal or vertical\r\n const lineScale = style.strokeNoScale ? this.getLineScale() : 1;\r\n // FIXME Must after updateTransform\r\n let w = style.lineWidth;\r\n\r\n // Only add extra hover lineWidth when there are no fill\r\n if (!this.hasFill()) {\r\n const strokeContainThreshold = this.strokeContainThreshold;\r\n w = Math.max(w, strokeContainThreshold == null ? 4 : strokeContainThreshold);\r\n }\r\n // Consider line width\r\n // Line scale can't be 0;\r\n if (lineScale > 1e-10) {\r\n rectStroke.width += w / lineScale;\r\n rectStroke.height += w / lineScale;\r\n rectStroke.x -= w / lineScale / 2;\r\n rectStroke.y -= w / lineScale / 2;\r\n }\r\n }\r\n\r\n // Return rect with stroke\r\n return rectStroke;\r\n }\r\n\r\n return rect;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const localPos = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n const style = this.style;\r\n x = localPos[0];\r\n y = localPos[1];\r\n\r\n if (rect.contain(x, y)) {\r\n const pathProxy = this.path;\r\n if (this.hasStroke()) {\r\n let lineWidth = style.lineWidth;\r\n let lineScale = style.strokeNoScale ? this.getLineScale() : 1;\r\n // Line scale can't be 0;\r\n if (lineScale > 1e-10) {\r\n // Only add extra hover lineWidth when there are no fill\r\n if (!this.hasFill()) {\r\n lineWidth = Math.max(lineWidth, this.strokeContainThreshold);\r\n }\r\n if (pathContain.containStroke(\r\n pathProxy, lineWidth / lineScale, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n }\r\n if (this.hasFill()) {\r\n return pathContain.contain(pathProxy, x, y);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Shape changed\r\n */\r\n dirtyShape() {\r\n this.__dirty |= SHAPE_CHANGED_BIT;\r\n if (this._rect) {\r\n this._rect = null;\r\n }\r\n if (this._decalEl) {\r\n this._decalEl.dirtyShape();\r\n }\r\n this.markRedraw();\r\n }\r\n\r\n dirty() {\r\n this.dirtyStyle();\r\n this.dirtyShape();\r\n }\r\n\r\n /**\r\n * Alias for animate('shape')\r\n * @param {boolean} loop\r\n */\r\n animateShape(loop: boolean) {\r\n return this.animate('shape', loop);\r\n }\r\n\r\n // Override updateDuringAnimation\r\n updateDuringAnimation(targetKey: string) {\r\n if (targetKey === 'style') {\r\n this.dirtyStyle();\r\n }\r\n else if (targetKey === 'shape') {\r\n this.dirtyShape();\r\n }\r\n else {\r\n this.markRedraw();\r\n }\r\n }\r\n\r\n // Overwrite attrKV\r\n attrKV(key: PathKey, value: PathPropertyType) {\r\n // FIXME\r\n if (key === 'shape') {\r\n this.setShape(value as Props['shape']);\r\n }\r\n else {\r\n super.attrKV(key as keyof DisplayableProps, value);\r\n }\r\n }\r\n\r\n setShape(obj: Props['shape']): this\r\n setShape(obj: T, value: Props['shape'][T]): this\r\n setShape(keyOrObj: keyof Props['shape'] | Props['shape'], value?: unknown): this {\r\n let shape = this.shape;\r\n if (!shape) {\r\n shape = this.shape = {};\r\n }\r\n // Path from string may not have shape\r\n if (typeof keyOrObj === 'string') {\r\n shape[keyOrObj] = value;\r\n }\r\n else {\r\n extend(shape, keyOrObj as Props['shape']);\r\n }\r\n this.dirtyShape();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * If shape changed. used with dirtyShape\r\n */\r\n shapeChanged() {\r\n return !!(this.__dirty & SHAPE_CHANGED_BIT);\r\n }\r\n\r\n /**\r\n * Create a path style object with default values in it's prototype.\r\n * @override\r\n */\r\n createStyle(obj?: Props['style']) {\r\n return createObject(DEFAULT_PATH_STYLE, obj);\r\n }\r\n\r\n protected _innerSaveToNormal(toState: PathState) {\r\n super._innerSaveToNormal(toState);\r\n\r\n const normalState = this._normalState;\r\n // Clone a new one. DON'T share object reference between states and current using.\r\n // TODO: Clone array in shape?.\r\n // TODO: Only save changed shape.\r\n if (toState.shape && !normalState.shape) {\r\n normalState.shape = extend({}, this.shape);\r\n }\r\n }\r\n\r\n protected _applyStateObj(\r\n stateName: string,\r\n state: PathState,\r\n normalState: PathState,\r\n keepCurrentStates: boolean,\r\n transition: boolean,\r\n animationCfg: ElementAnimateConfig\r\n ) {\r\n super._applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg);\r\n const needsRestoreToNormal = !(state && keepCurrentStates);\r\n let targetShape: Props['shape'];\r\n if (state && state.shape) {\r\n // Only animate changed properties.\r\n if (transition) {\r\n if (keepCurrentStates) {\r\n targetShape = state.shape;\r\n }\r\n else {\r\n // Inherits from normal state.\r\n targetShape = extend({}, normalState.shape);\r\n extend(targetShape, state.shape);\r\n }\r\n }\r\n else {\r\n // Because the shape will be replaced. So inherits from current shape.\r\n targetShape = extend({}, keepCurrentStates ? this.shape : normalState.shape);\r\n extend(targetShape, state.shape);\r\n }\r\n }\r\n else if (needsRestoreToNormal) {\r\n targetShape = normalState.shape;\r\n }\r\n\r\n if (targetShape) {\r\n if (transition) {\r\n // Clone a new shape.\r\n this.shape = extend({}, this.shape);\r\n // Only supports transition on primary props. Because shape is not deep cloned.\r\n const targetShapePrimaryProps: Props['shape'] = {};\r\n const shapeKeys = keys(targetShape);\r\n for (let i = 0; i < shapeKeys.length; i++) {\r\n const key = shapeKeys[i];\r\n if (typeof targetShape[key] === 'object') {\r\n (this.shape as Props['shape'])[key] = targetShape[key];\r\n }\r\n else {\r\n targetShapePrimaryProps[key] = targetShape[key];\r\n }\r\n }\r\n this._transitionState(stateName, {\r\n shape: targetShapePrimaryProps\r\n } as Props, animationCfg);\r\n }\r\n else {\r\n this.shape = targetShape;\r\n this.dirtyShape();\r\n }\r\n }\r\n }\r\n\r\n protected _mergeStates(states: PathState[]) {\r\n const mergedState = super._mergeStates(states) as PathState;\r\n let mergedShape: Props['shape'];\r\n for (let i = 0; i < states.length; i++) {\r\n const state = states[i];\r\n if (state.shape) {\r\n mergedShape = mergedShape || {};\r\n this._mergeStyle(mergedShape, state.shape);\r\n }\r\n }\r\n if (mergedShape) {\r\n mergedState.shape = mergedShape;\r\n }\r\n return mergedState;\r\n }\r\n\r\n getAnimationStyleProps() {\r\n return DEFAULT_PATH_ANIMATION_PROPS;\r\n }\r\n /**\r\n * If path shape is zero area\r\n */\r\n isZeroArea(): boolean {\r\n return false;\r\n }\r\n /**\r\n * 扩展一个 Path element, 比如星形,圆等。\r\n * Extend a path element\r\n * @DEPRECATED Use class extends\r\n * @param props\r\n * @param props.type Path type\r\n * @param props.init Initialize\r\n * @param props.buildPath Overwrite buildPath method\r\n * @param props.style Extended default style config\r\n * @param props.shape Extended default shape config\r\n */\r\n static extend>(defaultProps: {\r\n type?: string\r\n shape?: Shape\r\n style?: PathStyleProps\r\n beforeBrush?: Displayable['beforeBrush']\r\n afterBrush?: Displayable['afterBrush']\r\n getBoundingRect?: Displayable['getBoundingRect']\r\n\r\n calculateTextPosition?: Element['calculateTextPosition']\r\n buildPath(this: Path, ctx: CanvasRenderingContext2D | PathProxy, shape: Shape, inBatch?: boolean): void\r\n init?(this: Path, opts: PathProps): void // TODO Should be SubPathOption\r\n }): {\r\n new(opts?: PathProps & {shape: Shape}): Path\r\n } {\r\n interface SubPathOption extends PathProps {\r\n shape: Shape\r\n }\r\n\r\n class Sub extends Path {\r\n\r\n shape: Shape\r\n\r\n getDefaultStyle() {\r\n return clone(defaultProps.style);\r\n }\r\n\r\n getDefaultShape() {\r\n return clone(defaultProps.shape);\r\n }\r\n\r\n constructor(opts?: SubPathOption) {\r\n super(opts);\r\n defaultProps.init && defaultProps.init.call(this as any, opts);\r\n }\r\n }\r\n\r\n // TODO Legacy usage. Extend functions\r\n for (let key in defaultProps) {\r\n if (typeof (defaultProps as any)[key] === 'function') {\r\n (Sub.prototype as any)[key] = (defaultProps as any)[key];\r\n }\r\n }\r\n // Sub.prototype.buildPath = defaultProps.buildPath;\r\n // Sub.prototype.beforeBrush = defaultProps.beforeBrush;\r\n // Sub.prototype.afterBrush = defaultProps.afterBrush;\r\n\r\n return Sub as any;\r\n }\r\n\r\n protected static initDefaultProps = (function () {\r\n const pathProto = Path.prototype;\r\n pathProto.type = 'path';\r\n pathProto.strokeContainThreshold = 5;\r\n pathProto.segmentIgnoreThreshold = 0;\r\n pathProto.subPixelOptimize = false;\r\n pathProto.autoBatch = false;\r\n pathProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;\r\n })()\r\n}\r\n\r\nexport default Path;","import PathProxy from '../core/PathProxy';\r\nimport {applyTransform as v2ApplyTransform, VectorArray} from '../core/vector';\r\nimport { MatrixArray } from '../core/matrix';\r\n\r\nconst CMD = PathProxy.CMD;\r\n\r\nconst points: VectorArray[] = [[], [], []];\r\nconst mathSqrt = Math.sqrt;\r\nconst mathAtan2 = Math.atan2;\r\n\r\nexport default function transformPath(path: PathProxy, m: MatrixArray) {\r\n if (!m) {\r\n return;\r\n }\r\n\r\n let data = path.data;\r\n const len = path.len();\r\n let cmd;\r\n let nPoint: number;\r\n let i: number;\r\n let j: number;\r\n let k: number;\r\n let p: VectorArray;\r\n\r\n const M = CMD.M;\r\n const C = CMD.C;\r\n const L = CMD.L;\r\n const R = CMD.R;\r\n const A = CMD.A;\r\n const Q = CMD.Q;\r\n\r\n for (i = 0, j = 0; i < len;) {\r\n cmd = data[i++];\r\n j = i;\r\n nPoint = 0;\r\n\r\n switch (cmd) {\r\n case M:\r\n nPoint = 1;\r\n break;\r\n case L:\r\n nPoint = 1;\r\n break;\r\n case C:\r\n nPoint = 3;\r\n break;\r\n case Q:\r\n nPoint = 2;\r\n break;\r\n case A:\r\n const x = m[4];\r\n const y = m[5];\r\n const sx = mathSqrt(m[0] * m[0] + m[1] * m[1]);\r\n const sy = mathSqrt(m[2] * m[2] + m[3] * m[3]);\r\n const angle = mathAtan2(-m[1] / sy, m[0] / sx);\r\n // cx\r\n data[i] *= sx;\r\n data[i++] += x;\r\n // cy\r\n data[i] *= sy;\r\n data[i++] += y;\r\n // Scale rx and ry\r\n // FIXME Assume psi is 0 here\r\n data[i++] *= sx;\r\n data[i++] *= sy;\r\n\r\n // Start angle\r\n data[i++] += angle;\r\n // end angle\r\n data[i++] += angle;\r\n // FIXME psi\r\n i += 2;\r\n j = i;\r\n break;\r\n case R:\r\n // x0, y0\r\n p[0] = data[i++];\r\n p[1] = data[i++];\r\n v2ApplyTransform(p, p, m);\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n // x1, y1\r\n p[0] += data[i++];\r\n p[1] += data[i++];\r\n v2ApplyTransform(p, p, m);\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n }\r\n\r\n for (k = 0; k < nPoint; k++) {\r\n let p = points[k];\r\n p[0] = data[i++];\r\n p[1] = data[i++];\r\n\r\n v2ApplyTransform(p, p, m);\r\n // Write back\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n }\r\n }\r\n\r\n path.increaseVersion();\r\n}\r\n","import Path, { PathProps } from '../graphic/Path';\nimport PathProxy from '../core/PathProxy';\nimport transformPath from './transformPath';\nimport { VectorArray } from '../core/vector';\nimport { MatrixArray } from '../core/matrix';\nimport { extend } from '../core/util';\n\n// command chars\n// const cc = [\n// 'm', 'M', 'l', 'L', 'v', 'V', 'h', 'H', 'z', 'Z',\n// 'c', 'C', 'q', 'Q', 't', 'T', 's', 'S', 'a', 'A'\n// ];\n\nconst mathSqrt = Math.sqrt;\nconst mathSin = Math.sin;\nconst mathCos = Math.cos;\nconst PI = Math.PI;\n\nfunction vMag(v: VectorArray): number {\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n};\nfunction vRatio(u: VectorArray, v: VectorArray): number {\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\n};\nfunction vAngle(u: VectorArray, v: VectorArray): number {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)\n * Math.acos(vRatio(u, v));\n};\n\nfunction processArc(\n x1: number, y1: number, x2: number, y2: number, fa: number, fs: number,\n rx: number, ry: number, psiDeg: number, cmd: number, path: PathProxy\n) {\n // https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const psi = psiDeg * (PI / 180.0);\n const xp = mathCos(psi) * (x1 - x2) / 2.0\n + mathSin(psi) * (y1 - y2) / 2.0;\n const yp = -1 * mathSin(psi) * (x1 - x2) / 2.0\n + mathCos(psi) * (y1 - y2) / 2.0;\n\n const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n\n if (lambda > 1) {\n rx *= mathSqrt(lambda);\n ry *= mathSqrt(lambda);\n }\n\n const f = (fa === fs ? -1 : 1)\n * mathSqrt((((rx * rx) * (ry * ry))\n - ((rx * rx) * (yp * yp))\n - ((ry * ry) * (xp * xp))) / ((rx * rx) * (yp * yp)\n + (ry * ry) * (xp * xp))\n ) || 0;\n\n const cxp = f * rx * yp / ry;\n const cyp = f * -ry * xp / rx;\n\n const cx = (x1 + x2) / 2.0\n + mathCos(psi) * cxp\n - mathSin(psi) * cyp;\n const cy = (y1 + y2) / 2.0\n + mathSin(psi) * cxp\n + mathCos(psi) * cyp;\n\n const theta = vAngle([ 1, 0 ], [ (xp - cxp) / rx, (yp - cyp) / ry ]);\n const u = [ (xp - cxp) / rx, (yp - cyp) / ry ];\n const v = [ (-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry ];\n let dTheta = vAngle(u, v);\n\n if (vRatio(u, v) <= -1) {\n dTheta = PI;\n }\n if (vRatio(u, v) >= 1) {\n dTheta = 0;\n }\n\n if (dTheta < 0) {\n const n = Math.round(dTheta / PI * 1e6) / 1e6;\n // Convert to positive\n dTheta = PI * 2 + (n % 2) * PI;\n }\n\n path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);\n}\n\n\nconst commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;\n// Consider case:\n// (1) delimiter can be comma or space, where continuous commas\n// or spaces should be seen as one comma.\n// (2) value can be like:\n// '2e-4', 'l.5.9' (ignore 0), 'M-10-10', 'l-2.43e-1,34.9983',\n// 'l-.5E1,54', '121-23-44-11' (no delimiter)\nconst numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\n// const valueSplitReg = /[\\s,]+/;\n\nfunction createPathProxyFromString(data: string) {\n const path = new PathProxy();\n\n if (!data) {\n return path;\n }\n\n // const data = data.replace(/-/g, ' -')\n // .replace(/ /g, ' ')\n // .replace(/ /g, ',')\n // .replace(/,,/g, ',');\n\n // const n;\n // create pipes so that we can split the data\n // for (n = 0; n < cc.length; n++) {\n // cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]);\n // }\n\n // data = data.replace(/-/g, ',-');\n\n // create array\n // const arr = cs.split('|');\n // init context point\n let cpx = 0;\n let cpy = 0;\n let subpathX = cpx;\n let subpathY = cpy;\n let prevCmd;\n\n const CMD = PathProxy.CMD;\n\n // commandReg.lastIndex = 0;\n // const cmdResult;\n // while ((cmdResult = commandReg.exec(data)) != null) {\n // const cmdStr = cmdResult[1];\n // const cmdContent = cmdResult[2];\n\n const cmdList = data.match(commandReg);\n if (!cmdList) {\n // Invalid svg path.\n return path;\n }\n\n for (let l = 0; l < cmdList.length; l++) {\n const cmdText = cmdList[l];\n let cmdStr = cmdText.charAt(0);\n\n let cmd;\n\n // String#split is faster a little bit than String#replace or RegExp#exec.\n // const p = cmdContent.split(valueSplitReg);\n // const pLen = 0;\n // for (let i = 0; i < p.length; i++) {\n // // '' and other invalid str => NaN\n // const val = parseFloat(p[i]);\n // !isNaN(val) && (p[pLen++] = val);\n // }\n\n\n // Following code will convert string to number. So convert type to number here\n const p = cmdText.match(numberReg) as any[] as number[] || [];\n const pLen = p.length;\n for (let i = 0; i < pLen; i++) {\n p[i] = parseFloat(p[i] as any as string);\n }\n\n let off = 0;\n while (off < pLen) {\n let ctlPtx;\n let ctlPty;\n\n let rx;\n let ry;\n let psi;\n let fa;\n let fs;\n\n let x1 = cpx;\n let y1 = cpy;\n\n let len: number;\n let pathData: number[] | Float32Array;\n // convert l, H, h, V, and v to L\n switch (cmdStr) {\n case 'l':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'L':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'm':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'l';\n break;\n case 'M':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'L';\n break;\n case 'h':\n cpx += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'H':\n cpx = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'v':\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'V':\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'C':\n cmd = CMD.C;\n path.addData(\n cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]\n );\n cpx = p[off - 2];\n cpy = p[off - 1];\n break;\n case 'c':\n cmd = CMD.C;\n path.addData(\n cmd,\n p[off++] + cpx, p[off++] + cpy,\n p[off++] + cpx, p[off++] + cpy,\n p[off++] + cpx, p[off++] + cpy\n );\n cpx += p[off - 2];\n cpy += p[off - 1];\n break;\n case 'S':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 's':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = cpx + p[off++];\n y1 = cpy + p[off++];\n cpx += p[off++];\n cpy += p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 'Q':\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'q':\n x1 = p[off++] + cpx;\n y1 = p[off++] + cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'T':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 't':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 'A':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n\n x1 = cpx, y1 = cpy;\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.A;\n processArc(\n x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path\n );\n break;\n case 'a':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n\n x1 = cpx, y1 = cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.A;\n processArc(\n x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path\n );\n break;\n }\n }\n\n if (cmdStr === 'z' || cmdStr === 'Z') {\n cmd = CMD.Z;\n path.addData(cmd);\n // z may be in the middle of the path.\n cpx = subpathX;\n cpy = subpathY;\n }\n\n prevCmd = cmd;\n }\n\n path.toStatic();\n\n return path;\n}\n\ntype SVGPathOption = Omit\ninterface InnerSVGPathOption extends PathProps {\n applyTransform?: (m: MatrixArray) => void\n}\nclass SVGPath extends Path {\n applyTransform(m: MatrixArray) {}\n}\n\nfunction isPathProxy(path: PathProxy | CanvasRenderingContext2D): path is PathProxy {\n return (path as PathProxy).setData != null;\n}\n// TODO Optimize double memory cost problem\nfunction createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption {\n const pathProxy = createPathProxyFromString(str);\n const innerOpts: InnerSVGPathOption = extend({}, opts);\n innerOpts.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {\n if (isPathProxy(path)) {\n path.setData(pathProxy.data);\n // Svg and vml renderer don't have context\n const ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n else {\n const ctx = path;\n pathProxy.rebuildPath(ctx, 1);\n }\n };\n\n innerOpts.applyTransform = function (this: SVGPath, m: MatrixArray) {\n transformPath(pathProxy, m);\n this.dirtyShape();\n };\n\n return innerOpts;\n}\n\n/**\n * Create a Path object from path string data\n * http://www.w3.org/TR/SVG/paths.html#PathData\n * @param opts Other options\n */\nexport function createFromString(str: string, opts?: SVGPathOption): SVGPath {\n // PENDING\n return new SVGPath(createPathOptions(str, opts));\n}\n\n/**\n * Create a Path class from path string data\n * @param str\n * @param opts Other options\n */\nexport function extendFromString(str: string, defaultOpts?: SVGPathOption): typeof SVGPath {\n const innerOpts = createPathOptions(str, defaultOpts);\n class Sub extends SVGPath {\n constructor(opts: InnerSVGPathOption) {\n super(opts);\n this.applyTransform = innerOpts.applyTransform;\n this.buildPath = innerOpts.buildPath;\n }\n }\n return Sub;\n}\n\n/**\n * Merge multiple paths\n */\n// TODO Apply transform\n// TODO stroke dash\n// TODO Optimize double memory cost problem\nexport function mergePath(pathEls: Path[], opts: PathProps) {\n const pathList: PathProxy[] = [];\n const len = pathEls.length;\n for (let i = 0; i < len; i++) {\n const pathEl = pathEls[i];\n pathList.push(pathEl.getUpdatedPathProxy(true));\n }\n\n const pathBundle = new Path(opts);\n // Need path proxy.\n pathBundle.createPathProxy();\n pathBundle.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {\n if (isPathProxy(path)) {\n path.appendPath(pathList);\n // Svg and vml renderer don't have context\n const ctx = path.getContext();\n if (ctx) {\n // Path bundle not support percent draw.\n path.rebuildPath(ctx, 1);\n }\n }\n };\n\n return pathBundle;\n}\n\n/**\n * Clone a path.\n */\nexport function clonePath(sourcePath: Path, opts?: {\n /**\n * If bake global transform to path.\n */\n bakeTransform?: boolean\n /**\n * Convert global transform to local.\n */\n toLocal?: boolean\n}) {\n opts = opts || {};\n const path = new Path();\n if (sourcePath.shape) {\n path.setShape(sourcePath.shape);\n }\n path.setStyle(sourcePath.style);\n\n if (opts.bakeTransform) {\n transformPath(path.path, sourcePath.getComputedTransform());\n }\n else {\n // TODO Copy getLocalTransform, updateTransform since they can be changed.\n if (opts.toLocal) {\n path.setLocalTransform(sourcePath.getComputedTransform());\n }\n else {\n path.copyTransform(sourcePath);\n }\n }\n\n // These methods may be overridden\n path.buildPath = sourcePath.buildPath;\n (path as SVGPath).applyTransform = (path as SVGPath).applyTransform;\n\n path.z = sourcePath.z;\n path.z2 = sourcePath.z2;\n path.zlevel = sourcePath.zlevel;\n\n return path;\n}\n","import Displayable, { DisplayableProps,\n CommonStyleProps,\n DEFAULT_COMMON_STYLE,\n DisplayableStatePropNames,\n DEFAULT_COMMON_ANIMATION_PROPS\n} from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { ImageLike, MapToType } from '../core/types';\nimport { defaults, createObject } from '../core/util';\nimport { ElementCommonState } from '../Element';\n\nexport interface ImageStyleProps extends CommonStyleProps {\n image?: string | ImageLike\n x?: number\n y?: number\n width?: number\n height?: number\n sx?: number\n sy?: number\n sWidth?: number\n sHeight?: number\n}\n\nexport const DEFAULT_IMAGE_STYLE: CommonStyleProps = defaults({\n x: 0,\n y: 0\n}, DEFAULT_COMMON_STYLE);\n\nexport const DEFAULT_IMAGE_ANIMATION_PROPS: MapToType = {\n style: defaults, MapToType>({\n x: true,\n y: true,\n width: true,\n height: true,\n sx: true,\n sy: true,\n sWidth: true,\n sHeight: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n };\n\nexport interface ImageProps extends DisplayableProps {\n style?: ImageStyleProps\n\n onload?: (image: ImageLike) => void\n}\n\nexport type ImageState = Pick & ElementCommonState\n\nfunction isImageLike(source: unknown): source is HTMLImageElement {\n return !!(source\n && typeof source !== 'string'\n // Image source is an image, canvas, video.\n && (source as HTMLImageElement).width && (source as HTMLImageElement).height);\n}\n\nclass ZRImage extends Displayable {\n\n style: ImageStyleProps\n\n // FOR CANVAS RENDERER\n __image: ImageLike\n // FOR SVG RENDERER\n __imageSrc: string\n\n onload: (image: ImageLike) => void\n\n /**\n * Create an image style object with default values in it's prototype.\n * @override\n */\n createStyle(obj?: ImageStyleProps) {\n return createObject(DEFAULT_IMAGE_STYLE, obj);\n }\n\n private _getSize(dim: 'width' | 'height') {\n const style = this.style;\n\n let size = style[dim];\n if (size != null) {\n return size;\n }\n\n const imageSource = isImageLike(style.image)\n ? style.image : this.__image;\n\n if (!imageSource) {\n return 0;\n }\n\n const otherDim = dim === 'width' ? 'height' : 'width';\n let otherDimSize = style[otherDim];\n if (otherDimSize == null) {\n return imageSource[dim];\n }\n else {\n return imageSource[dim] / imageSource[otherDim] * otherDimSize;\n }\n }\n\n getWidth(): number {\n return this._getSize('width');\n }\n\n getHeight(): number {\n return this._getSize('height');\n }\n\n getAnimationStyleProps() {\n return DEFAULT_IMAGE_ANIMATION_PROPS;\n }\n\n getBoundingRect(): BoundingRect {\n const style = this.style;\n if (!this._rect) {\n this._rect = new BoundingRect(\n style.x || 0, style.y || 0, this.getWidth(), this.getHeight()\n );\n }\n return this._rect;\n }\n}\n\nZRImage.prototype.type = 'image';\n\nexport default ZRImage;","/**\r\n * 圆形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class CircleShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n}\r\n\r\nexport interface CircleProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Circle extends Path {\r\n\r\n shape: CircleShape\r\n\r\n constructor(opts?: CircleProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new CircleShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: CircleShape) {\r\n // Use moveTo to start a new sub path.\r\n // Or it will be connected to other subpaths when in CompoundPath\r\n ctx.moveTo(shape.cx + shape.r, shape.cy);\r\n ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);\r\n }\r\n};\r\n\r\nCircle.prototype.type = 'circle';\r\n\r\nexport default Circle;","import PathProxy from '../../core/PathProxy';\r\n\r\nexport function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n r?: number | number[]\r\n}) {\r\n let x = shape.x;\r\n let y = shape.y;\r\n let width = shape.width;\r\n let height = shape.height;\r\n let r = shape.r;\r\n let r1;\r\n let r2;\r\n let r3;\r\n let r4;\r\n\r\n // Convert width and height to positive for better borderRadius\r\n if (width < 0) {\r\n x = x + width;\r\n width = -width;\r\n }\r\n if (height < 0) {\r\n y = y + height;\r\n height = -height;\r\n }\r\n\r\n if (typeof r === 'number') {\r\n r1 = r2 = r3 = r4 = r;\r\n }\r\n else if (r instanceof Array) {\r\n if (r.length === 1) {\r\n r1 = r2 = r3 = r4 = r[0];\r\n }\r\n else if (r.length === 2) {\r\n r1 = r3 = r[0];\r\n r2 = r4 = r[1];\r\n }\r\n else if (r.length === 3) {\r\n r1 = r[0];\r\n r2 = r4 = r[1];\r\n r3 = r[2];\r\n }\r\n else {\r\n r1 = r[0];\r\n r2 = r[1];\r\n r3 = r[2];\r\n r4 = r[3];\r\n }\r\n }\r\n else {\r\n r1 = r2 = r3 = r4 = 0;\r\n }\r\n\r\n let total;\r\n if (r1 + r2 > width) {\r\n total = r1 + r2;\r\n r1 *= width / total;\r\n r2 *= width / total;\r\n }\r\n if (r3 + r4 > width) {\r\n total = r3 + r4;\r\n r3 *= width / total;\r\n r4 *= width / total;\r\n }\r\n if (r2 + r3 > height) {\r\n total = r2 + r3;\r\n r2 *= height / total;\r\n r3 *= height / total;\r\n }\r\n if (r1 + r4 > height) {\r\n total = r1 + r4;\r\n r1 *= height / total;\r\n r4 *= height / total;\r\n }\r\n ctx.moveTo(x + r1, y);\r\n ctx.lineTo(x + width - r2, y);\r\n r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);\r\n ctx.lineTo(x + width, y + height - r3);\r\n r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);\r\n ctx.lineTo(x + r4, y + height);\r\n r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);\r\n ctx.lineTo(x, y + r1);\r\n r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);\r\n}\r\n","import { PathStyleProps } from '../Path';\r\n\r\n/**\r\n * Sub-pixel optimize for canvas rendering, prevent from blur\r\n * when rendering a thin vertical/horizontal line.\r\n */\r\n\r\nconst round = Math.round;\r\n\r\ntype LineShape = {\r\n x1: number\r\n y1: number\r\n x2: number\r\n y2: number\r\n}\r\n\r\ntype RectShape = {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n r?: number | number[]\r\n}\r\n/**\r\n * Sub pixel optimize line for canvas\r\n *\r\n * @param outputShape The modification will be performed on `outputShape`.\r\n * `outputShape` and `inputShape` can be the same object.\r\n * `outputShape` object can be used repeatly, because all of\r\n * the `x1`, `x2`, `y1`, `y2` will be assigned in this method.\r\n */\r\nexport function subPixelOptimizeLine(\r\n outputShape: Partial,\r\n inputShape: LineShape,\r\n style: Pick // DO not optimize when lineWidth is 0\r\n): LineShape {\r\n if (!inputShape) {\r\n return;\r\n }\r\n\r\n const x1 = inputShape.x1;\r\n const x2 = inputShape.x2;\r\n const y1 = inputShape.y1;\r\n const y2 = inputShape.y2;\r\n\r\n outputShape.x1 = x1;\r\n outputShape.x2 = x2;\r\n outputShape.y1 = y1;\r\n outputShape.y2 = y2;\r\n\r\n const lineWidth = style && style.lineWidth;\r\n if (!lineWidth) {\r\n return outputShape as LineShape;\r\n }\r\n\r\n if (round(x1 * 2) === round(x2 * 2)) {\r\n outputShape.x1 = outputShape.x2 = subPixelOptimize(x1, lineWidth, true);\r\n }\r\n if (round(y1 * 2) === round(y2 * 2)) {\r\n outputShape.y1 = outputShape.y2 = subPixelOptimize(y1, lineWidth, true);\r\n }\r\n\r\n return outputShape as LineShape;\r\n}\r\n\r\n/**\r\n * Sub pixel optimize rect for canvas\r\n *\r\n * @param outputShape The modification will be performed on `outputShape`.\r\n * `outputShape` and `inputShape` can be the same object.\r\n * `outputShape` object can be used repeatly, because all of\r\n * the `x`, `y`, `width`, `height` will be assigned in this method.\r\n */\r\nexport function subPixelOptimizeRect(\r\n outputShape: Partial,\r\n inputShape: RectShape,\r\n style: Pick // DO not optimize when lineWidth is 0\r\n): RectShape {\r\n if (!inputShape) {\r\n return;\r\n }\r\n\r\n const originX = inputShape.x;\r\n const originY = inputShape.y;\r\n const originWidth = inputShape.width;\r\n const originHeight = inputShape.height;\r\n\r\n outputShape.x = originX;\r\n outputShape.y = originY;\r\n outputShape.width = originWidth;\r\n outputShape.height = originHeight;\r\n\r\n const lineWidth = style && style.lineWidth;\r\n if (!lineWidth) {\r\n return outputShape as RectShape;\r\n }\r\n\r\n outputShape.x = subPixelOptimize(originX, lineWidth, true);\r\n outputShape.y = subPixelOptimize(originY, lineWidth, true);\r\n outputShape.width = Math.max(\r\n subPixelOptimize(originX + originWidth, lineWidth, false) - outputShape.x,\r\n originWidth === 0 ? 0 : 1\r\n );\r\n outputShape.height = Math.max(\r\n subPixelOptimize(originY + originHeight, lineWidth, false) - outputShape.y,\r\n originHeight === 0 ? 0 : 1\r\n );\r\n\r\n return outputShape as RectShape;\r\n}\r\n\r\n/**\r\n * Sub pixel optimize for canvas\r\n *\r\n * @param position Coordinate, such as x, y\r\n * @param lineWidth If `null`/`undefined`/`0`, do not optimize.\r\n * @param positiveOrNegative Default false (negative).\r\n * @return Optimized position.\r\n */\r\nexport function subPixelOptimize(\r\n position: number,\r\n lineWidth?: number,\r\n positiveOrNegative?: boolean\r\n) {\r\n if (!lineWidth) {\r\n return position;\r\n }\r\n // Assure that (position + lineWidth / 2) is near integer edge,\r\n // otherwise line will be fuzzy in canvas.\r\n const doubledPosition = round(position * 2);\r\n return (doubledPosition + round(lineWidth)) % 2 === 0\r\n ? doubledPosition / 2\r\n : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;\r\n}\r\n","/**\r\n * 矩形\r\n * @module zrender/graphic/shape/Rect\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as roundRectHelper from '../helper/roundRect';\r\nimport {subPixelOptimizeRect} from '../helper/subPixelOptimize';\r\n\r\nexport class RectShape {\r\n // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4\r\n // r缩写为1 相当于 [1, 1, 1, 1]\r\n // r缩写为[1] 相当于 [1, 1, 1, 1]\r\n // r缩写为[1, 2] 相当于 [1, 2, 1, 2]\r\n // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]\r\n r?: number | number[]\r\n\r\n x = 0\r\n y = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface RectProps extends PathProps {\r\n shape?: Partial\r\n}\r\n// Avoid create repeatly.\r\nconst subPixelOptimizeOutputShape = {};\r\n\r\nclass Rect extends Path {\r\n\r\n shape: RectShape\r\n\r\n constructor(opts?: RectProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new RectShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RectShape) {\r\n let x: number;\r\n let y: number;\r\n let width: number;\r\n let height: number;\r\n\r\n if (this.subPixelOptimize) {\r\n const optimizedShape = subPixelOptimizeRect(subPixelOptimizeOutputShape, shape, this.style);\r\n x = optimizedShape.x;\r\n y = optimizedShape.y;\r\n width = optimizedShape.width;\r\n height = optimizedShape.height;\r\n optimizedShape.r = shape.r;\r\n shape = optimizedShape;\r\n }\r\n else {\r\n x = shape.x;\r\n y = shape.y;\r\n width = shape.width;\r\n height = shape.height;\r\n }\r\n\r\n if (!shape.r) {\r\n ctx.rect(x, y, width, height);\r\n }\r\n else {\r\n roundRectHelper.buildPath(ctx, shape);\r\n }\r\n }\r\n\r\n isZeroArea() {\r\n return !this.shape.width || !this.shape.height;\r\n }\r\n}\r\n\r\nRect.prototype.type = 'rect';\r\n\r\nexport default Rect;","/**\r\n * 椭圆形状\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class EllipseShape {\r\n cx = 0\r\n cy = 0\r\n rx = 0\r\n ry = 0\r\n}\r\n\r\nexport interface EllipseProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Ellipse extends Path {\r\n\r\n shape: EllipseShape\r\n\r\n constructor(opts?: EllipseProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new EllipseShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: EllipseShape) {\r\n const k = 0.5522848;\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.rx;\r\n const b = shape.ry;\r\n const ox = a * k; // 水平控制点偏移量\r\n const oy = b * k; // 垂直控制点偏移量\r\n // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线\r\n ctx.moveTo(x - a, y);\r\n ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);\r\n ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);\r\n ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);\r\n ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nEllipse.prototype.type = 'ellipse';\r\n\r\nexport default Ellipse;","/**\r\n * 直线\r\n * @module zrender/graphic/shape/Line\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport {subPixelOptimizeLine} from '../helper/subPixelOptimize';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\n// Avoid create repeatly.\r\nconst subPixelOptimizeOutputShape = {};\r\n\r\nexport class LineShape {\r\n // Start point\r\n x1 = 0\r\n y1 = 0\r\n // End point\r\n x2 = 0\r\n y2 = 0\r\n\r\n percent = 1\r\n}\r\n\r\nexport interface LineProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Line extends Path {\r\n\r\n shape: LineShape\r\n\r\n constructor(opts?: LineProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new LineShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: LineShape) {\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n if (this.subPixelOptimize) {\r\n const optimizedShape = subPixelOptimizeLine(\r\n subPixelOptimizeOutputShape, shape, this.style\r\n );\r\n x1 = optimizedShape.x1;\r\n y1 = optimizedShape.y1;\r\n x2 = optimizedShape.x2;\r\n y2 = optimizedShape.y2;\r\n }\r\n else {\r\n x1 = shape.x1;\r\n y1 = shape.y1;\r\n x2 = shape.x2;\r\n y2 = shape.y2;\r\n }\r\n\r\n const percent = shape.percent;\r\n\r\n if (percent === 0) {\r\n return;\r\n }\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n if (percent < 1) {\r\n x2 = x1 * (1 - percent) + x2 * percent;\r\n y2 = y1 * (1 - percent) + y2 * percent;\r\n }\r\n ctx.lineTo(x2, y2);\r\n }\r\n\r\n /**\r\n * Get point at percent\r\n */\r\n pointAt(p: number): VectorArray {\r\n const shape = this.shape;\r\n return [\r\n shape.x1 * (1 - p) + shape.x2 * p,\r\n shape.y1 * (1 - p) + shape.y2 * p\r\n ];\r\n }\r\n}\r\n\r\nLine.prototype.type = 'line';\r\nexport default Line;","/**\r\n * 贝塞尔平滑曲线\r\n */\r\n\r\nimport {\r\n min as v2Min,\r\n max as v2Max,\r\n scale as v2Scale,\r\n distance as v2Distance,\r\n add as v2Add,\r\n clone as v2Clone,\r\n sub as v2Sub,\r\n VectorArray\r\n} from '../../core/vector';\r\n\r\n/**\r\n * 贝塞尔平滑曲线\r\n * @param points 线段顶点数组\r\n * @param smooth 平滑等级, 0-1\r\n * @param isLoop\r\n * @param constraint 将计算出来的控制点约束在一个包围盒内\r\n * 比如 [[0, 0], [100, 100]], 这个包围盒会与\r\n * 整个折线的包围盒做一个并集用来约束控制点。\r\n * @param 计算出来的控制点数组\r\n */\r\nexport default function smoothBezier(\r\n points: VectorArray[],\r\n smooth?: number,\r\n isLoop?: boolean,\r\n constraint?: VectorArray[]\r\n) {\r\n const cps = [];\r\n\r\n const v: VectorArray = [];\r\n const v1: VectorArray = [];\r\n const v2: VectorArray = [];\r\n let prevPoint;\r\n let nextPoint;\r\n\r\n let min;\r\n let max;\r\n if (constraint) {\r\n min = [Infinity, Infinity];\r\n max = [-Infinity, -Infinity];\r\n for (let i = 0, len = points.length; i < len; i++) {\r\n v2Min(min, min, points[i]);\r\n v2Max(max, max, points[i]);\r\n }\r\n // 与指定的包围盒做并集\r\n v2Min(min, min, constraint[0]);\r\n v2Max(max, max, constraint[1]);\r\n }\r\n\r\n for (let i = 0, len = points.length; i < len; i++) {\r\n const point = points[i];\r\n\r\n if (isLoop) {\r\n prevPoint = points[i ? i - 1 : len - 1];\r\n nextPoint = points[(i + 1) % len];\r\n }\r\n else {\r\n if (i === 0 || i === len - 1) {\r\n cps.push(v2Clone(points[i]));\r\n continue;\r\n }\r\n else {\r\n prevPoint = points[i - 1];\r\n nextPoint = points[i + 1];\r\n }\r\n }\r\n\r\n v2Sub(v, nextPoint, prevPoint);\r\n\r\n // use degree to scale the handle length\r\n v2Scale(v, v, smooth);\r\n\r\n let d0 = v2Distance(point, prevPoint);\r\n let d1 = v2Distance(point, nextPoint);\r\n const sum = d0 + d1;\r\n if (sum !== 0) {\r\n d0 /= sum;\r\n d1 /= sum;\r\n }\r\n\r\n v2Scale(v1, v, -d0);\r\n v2Scale(v2, v, d1);\r\n const cp0 = v2Add([], point, v1);\r\n const cp1 = v2Add([], point, v2);\r\n if (constraint) {\r\n v2Max(cp0, cp0, min);\r\n v2Min(cp0, cp0, max);\r\n v2Max(cp1, cp1, min);\r\n v2Min(cp1, cp1, max);\r\n }\r\n cps.push(cp0);\r\n cps.push(cp1);\r\n }\r\n\r\n if (isLoop) {\r\n cps.push(cps.shift());\r\n }\r\n\r\n return cps;\r\n}","\r\nimport smoothBezier from './smoothBezier';\r\nimport { VectorArray } from '../../core/vector';\r\nimport PathProxy from '../../core/PathProxy';\r\n\r\nexport function buildPath(\r\n ctx: CanvasRenderingContext2D | PathProxy,\r\n shape: {\r\n points: VectorArray[],\r\n smooth?: number\r\n smoothConstraint?: VectorArray[]\r\n },\r\n closePath: boolean\r\n) {\r\n const smooth = shape.smooth;\r\n let points = shape.points;\r\n if (points && points.length >= 2) {\r\n if (smooth) {\r\n const controlPoints = smoothBezier(\r\n points, smooth, closePath, shape.smoothConstraint\r\n );\r\n\r\n ctx.moveTo(points[0][0], points[0][1]);\r\n const len = points.length;\r\n for (let i = 0; i < (closePath ? len : len - 1); i++) {\r\n const cp1 = controlPoints[i * 2];\r\n const cp2 = controlPoints[i * 2 + 1];\r\n const p = points[(i + 1) % len];\r\n ctx.bezierCurveTo(\r\n cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]\r\n );\r\n }\r\n }\r\n else {\r\n ctx.moveTo(points[0][0], points[0][1]);\r\n for (let i = 1, l = points.length; i < l; i++) {\r\n ctx.lineTo(points[i][0], points[i][1]);\r\n }\r\n }\r\n\r\n closePath && ctx.closePath();\r\n }\r\n}\r\n","/**\r\n * 多边形\r\n * @module zrender/shape/Polygon\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as polyHelper from '../helper/poly';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\nexport class PolygonShape {\r\n points: VectorArray[] = null\r\n smooth?: number = 0\r\n smoothConstraint?: VectorArray[] = null\r\n}\r\n\r\nexport interface PolygonProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Polygon extends Path {\r\n\r\n shape: PolygonShape\r\n\r\n constructor(opts?: PolygonProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new PolygonShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: PolygonShape) {\r\n polyHelper.buildPath(ctx, shape, true);\r\n }\r\n};\r\n\r\nPolygon.prototype.type = 'polygon';\r\n\r\nexport default Polygon;","/**\r\n * @module zrender/graphic/shape/Polyline\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as polyHelper from '../helper/poly';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\nexport class PolylineShape {\r\n points: VectorArray[] = null\r\n // Percent of displayed polyline. For animating purpose\r\n percent?: number = 1\r\n smooth?: number = 0\r\n smoothConstraint?: VectorArray[] = null\r\n}\r\n\r\nexport interface PolylineProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Polyline extends Path {\r\n\r\n shape: PolylineShape\r\n\r\n constructor(opts?: PolylineProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new PolylineShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: PolylineShape) {\r\n polyHelper.buildPath(ctx, shape, false);\r\n }\r\n}\r\n\r\nPolyline.prototype.type = 'polyline';\r\nexport default Polyline;","// TODO Should GradientObject been LinearGradientObject | RadialGradientObject\r\nexport interface GradientObject {\r\n\r\n id?: number\r\n\r\n type: string\r\n\r\n colorStops: GradientColorStop[]\r\n\r\n global?: boolean\r\n}\r\n\r\nexport interface InnerGradientObject extends GradientObject {\r\n __canvasGradient: CanvasGradient\r\n __width: number\r\n __height: number\r\n}\r\n\r\nexport interface GradientColorStop {\r\n offset: number\r\n color: string\r\n}\r\n\r\nexport default class Gradient {\r\n\r\n id?: number\r\n\r\n type: string\r\n\r\n colorStops: GradientColorStop[]\r\n\r\n global: boolean\r\n\r\n constructor(colorStops: GradientColorStop[]) {\r\n this.colorStops = colorStops || [];\r\n }\r\n\r\n addColorStop(offset: number, color: string) {\r\n this.colorStops.push({\r\n offset,\r\n color\r\n });\r\n }\r\n}","import Gradient, {GradientObject, GradientColorStop} from './Gradient';\r\n\r\nexport interface LinearGradientObject extends GradientObject {\r\n type: 'linear'\r\n\r\n x: number\r\n y: number\r\n x2: number\r\n y2: number\r\n}\r\n/**\r\n * x, y, x2, y2 are all percent from 0 to 1 when globalCoord is false\r\n */\r\n\r\nexport default class LinearGradient extends Gradient {\r\n\r\n type: 'linear'\r\n\r\n x: number\r\n y: number\r\n x2: number\r\n y2: number\r\n\r\n constructor(\r\n x: number, y: number, x2: number, y2: number,\r\n colorStops?: GradientColorStop[], globalCoord?: boolean\r\n ) {\r\n\r\n super(colorStops);\r\n\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {type: 'linear', colorStops: ...}`, where\r\n // this constructor will not be called.\r\n\r\n this.x = x == null ? 0 : x;\r\n\r\n this.y = y == null ? 0 : y;\r\n\r\n this.x2 = x2 == null ? 1 : x2;\r\n\r\n this.y2 = y2 == null ? 0 : y2;\r\n\r\n // Can be cloned\r\n this.type = 'linear';\r\n\r\n // If use global coord\r\n this.global = globalCoord || false;\r\n }\r\n};\r\n","import Gradient, {GradientColorStop, GradientObject} from './Gradient';\r\n\r\nexport interface RadialGradientObject extends GradientObject {\r\n type: 'radial'\r\n\r\n x: number\r\n y: number\r\n r: number\r\n}\r\n/**\r\n * x, y, r are all percent from 0 to 1 when globalCoord is false\r\n */\r\nclass RadialGradient extends Gradient {\r\n\r\n type: 'radial'\r\n\r\n x: number\r\n y: number\r\n r: number\r\n\r\n constructor(\r\n x: number, y: number, r: number,\r\n colorStops?: GradientColorStop[], globalCoord?: boolean\r\n ) {\r\n super(colorStops);\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {type: 'radial', colorStops: ...}`, where\r\n // this constructor will not be called.\r\n this.x = x == null ? 0.5 : x;\r\n\r\n this.y = y == null ? 0.5 : y;\r\n\r\n this.r = r == null ? 0.5 : r;\r\n\r\n // Can be cloned\r\n this.type = 'radial';\r\n\r\n // If use global coord\r\n this.global = globalCoord || false;\r\n }\r\n}\r\n\r\nexport default RadialGradient;","import Displayable, { DisplayableProps, DisplayableStatePropNames } from './Displayable';\nimport { getBoundingRect } from '../contain/text';\nimport BoundingRect from '../core/BoundingRect';\nimport { PathStyleProps, DEFAULT_PATH_STYLE } from './Path';\nimport { createObject, defaults } from '../core/util';\nimport { FontStyle, FontWeight, TextAlign, TextVerticalAlign } from '../core/types';\nimport { DEFAULT_FONT } from '../core/platform';\n\nexport interface TSpanStyleProps extends PathStyleProps {\n\n x?: number\n y?: number\n\n // TODO Text is assigned inside zrender\n text?: string\n\n // Final generated font string\n // Used in canvas, and when developers specified it.\n font?: string\n\n // Value for each part of font\n // Used in svg.\n // NOTE: font should always been sync with these 4 properties.\n fontSize?: number\n fontWeight?: FontWeight\n fontStyle?: FontStyle\n fontFamily?: string\n\n textAlign?: CanvasTextAlign\n\n textBaseline?: CanvasTextBaseline\n}\n\nexport const DEFAULT_TSPAN_STYLE: TSpanStyleProps = defaults({\n strokeFirst: true,\n font: DEFAULT_FONT,\n x: 0,\n y: 0,\n textAlign: 'left',\n textBaseline: 'top',\n miterLimit: 2\n} as TSpanStyleProps, DEFAULT_PATH_STYLE);\n\n\nexport interface TSpanProps extends DisplayableProps {\n style?: TSpanStyleProps\n}\n\nexport type TSpanState = Pick\n\nclass TSpan extends Displayable {\n\n style: TSpanStyleProps\n\n hasStroke() {\n const style = this.style;\n const stroke = style.stroke;\n return stroke != null && stroke !== 'none' && style.lineWidth > 0;\n }\n\n hasFill() {\n const style = this.style;\n const fill = style.fill;\n return fill != null && fill !== 'none';\n }\n\n /**\n * Create an image style object with default values in it's prototype.\n * @override\n */\n createStyle(obj?: TSpanStyleProps) {\n return createObject(DEFAULT_TSPAN_STYLE, obj);\n }\n\n /**\n * Set bounding rect calculated from Text\n * For reducing time of calculating bounding rect.\n */\n setBoundingRect(rect: BoundingRect) {\n this._rect = rect;\n }\n\n getBoundingRect(): BoundingRect {\n const style = this.style;\n\n if (!this._rect) {\n let text = style.text;\n text != null ? (text += '') : (text = '');\n\n const rect = getBoundingRect(\n text,\n style.font,\n style.textAlign as TextAlign,\n style.textBaseline as TextVerticalAlign\n );\n\n rect.x += style.x || 0;\n rect.y += style.y || 0;\n\n if (this.hasStroke()) {\n const w = style.lineWidth;\n rect.x -= w / 2;\n rect.y -= w / 2;\n rect.width += w;\n rect.height += w;\n }\n\n this._rect = rect;\n }\n\n return this._rect;\n }\n\n protected static initDefaultProps = (function () {\n const tspanProto = TSpan.prototype;\n // TODO Calculate tolerance smarter\n tspanProto.dirtyRectTolerance = 10;\n })()\n}\n\nTSpan.prototype.type = 'tspan';\n\nexport default TSpan;","import { isString } from '../core/util';\r\n\r\n/**\r\n * For big svg string, this method might be time consuming.\r\n */\r\nexport function parseXML(svg: Document | string | SVGElement): SVGElement {\r\n if (isString(svg)) {\r\n const parser = new DOMParser();\r\n svg = parser.parseFromString(svg, 'text/xml');\r\n }\r\n let svgNode: Node = svg;\r\n // Document node. If using $.get, doc node may be input.\r\n if (svgNode.nodeType === 9) {\r\n svgNode = svgNode.firstChild;\r\n }\r\n // nodeName of is also 'svg'.\r\n while (svgNode.nodeName.toLowerCase() !== 'svg' || svgNode.nodeType !== 1) {\r\n svgNode = svgNode.nextSibling;\r\n }\r\n\r\n return svgNode as SVGElement;\r\n}\r\n","import Group from '../graphic/Group';\nimport ZRImage from '../graphic/Image';\nimport Circle from '../graphic/shape/Circle';\nimport Rect from '../graphic/shape/Rect';\nimport Ellipse from '../graphic/shape/Ellipse';\nimport Line from '../graphic/shape/Line';\nimport Polygon from '../graphic/shape/Polygon';\nimport Polyline from '../graphic/shape/Polyline';\nimport * as matrix from '../core/matrix';\nimport { createFromString } from './path';\nimport { defaults, trim, each, map, keys, hasOwn } from '../core/util';\nimport Displayable from '../graphic/Displayable';\nimport Element from '../Element';\nimport { RectLike } from '../core/BoundingRect';\nimport { Dictionary } from '../core/types';\nimport { PatternObject } from '../graphic/Pattern';\nimport LinearGradient, { LinearGradientObject } from '../graphic/LinearGradient';\nimport RadialGradient, { RadialGradientObject } from '../graphic/RadialGradient';\nimport Gradient, { GradientObject } from '../graphic/Gradient';\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\nimport { parseXML } from './parseXML';\n\n\ninterface SVGParserOption {\n // Default width if svg width not specified or is a percent value.\n width?: number;\n // Default height if svg height not specified or is a percent value.\n height?: number;\n ignoreViewBox?: boolean;\n ignoreRootClip?: boolean;\n}\n\nexport interface SVGParserResult {\n // Group, The root of the the result tree of zrender shapes\n root: Group;\n // number, the viewport width of the SVG\n width: number;\n // number, the viewport height of the SVG\n height: number;\n // {x, y, width, height}, the declared viewBox rect of the SVG, if exists\n viewBoxRect: RectLike;\n // the {scale, position} calculated by viewBox and viewport, is exists\n viewBoxTransform: {\n x: number;\n y: number;\n scale: number;\n };\n named: SVGParserResultNamedItem[];\n}\nexport interface SVGParserResultNamedItem {\n name: string;\n // If a tag has no name attribute but its ancester is named,\n // `namedFrom` is set to the named item of the ancester .\n // Otherwise null/undefined\n namedFrom: SVGParserResultNamedItem;\n svgNodeTagLower: SVGNodeTagLower;\n el: Element;\n};\n\nexport type SVGNodeTagLower =\n 'g' | 'rect' | 'circle' | 'line' | 'ellipse' | 'polygon'\n | 'polyline' | 'image' | 'text' | 'tspan' | 'path' | 'defs' | 'switch';\n\n\ntype DefsId = string;\ntype DefsMap = { [id in DefsId]: LinearGradientObject | RadialGradientObject | PatternObject };\ntype DefsUsePending = [Displayable, 'fill' | 'stroke', DefsId][];\n\ntype ElementExtended = Element & {\n __inheritedStyle?: InheritedStyleByZRKey;\n __selfStyle?: SelfStyleByZRKey;\n}\ntype DisplayableExtended = Displayable & {\n __inheritedStyle?: InheritedStyleByZRKey;\n __selfStyle?: SelfStyleByZRKey;\n}\n\ntype TextStyleOptionExtended = TSpanStyleProps & {\n fontSize: number;\n fontFamily: string;\n fontWeight: string;\n fontStyle: string;\n}\nlet nodeParsers: {[name in SVGNodeTagLower]?: (\n this: SVGParser, xmlNode: SVGElement, parentGroup: Group\n) => Element};\n\ntype InheritedStyleByZRKey = {[name in InheritableStyleZRKey]?: string};\ntype InheritableStyleZRKey =\n typeof INHERITABLE_STYLE_ATTRIBUTES_MAP[keyof typeof INHERITABLE_STYLE_ATTRIBUTES_MAP];\nconst INHERITABLE_STYLE_ATTRIBUTES_MAP = {\n 'fill': 'fill',\n 'stroke': 'stroke',\n 'stroke-width': 'lineWidth',\n 'opacity': 'opacity',\n 'fill-opacity': 'fillOpacity',\n 'stroke-opacity': 'strokeOpacity',\n 'stroke-dasharray': 'lineDash',\n 'stroke-dashoffset': 'lineDashOffset',\n 'stroke-linecap': 'lineCap',\n 'stroke-linejoin': 'lineJoin',\n 'stroke-miterlimit': 'miterLimit',\n 'font-family': 'fontFamily',\n 'font-size': 'fontSize',\n 'font-style': 'fontStyle',\n 'font-weight': 'fontWeight',\n 'text-anchor': 'textAlign',\n 'visibility': 'visibility',\n 'display': 'display'\n} as const;\nconst INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS = keys(INHERITABLE_STYLE_ATTRIBUTES_MAP);\n\ntype SelfStyleByZRKey = {[name in SelfStyleZRKey]?: string};\ntype SelfStyleZRKey =\n typeof SELF_STYLE_ATTRIBUTES_MAP[keyof typeof SELF_STYLE_ATTRIBUTES_MAP];\nconst SELF_STYLE_ATTRIBUTES_MAP = {\n 'alignment-baseline': 'textBaseline',\n 'stop-color': 'stopColor'\n};\nconst SELF_STYLE_ATTRIBUTES_MAP_KEYS = keys(SELF_STYLE_ATTRIBUTES_MAP);\n\n\nclass SVGParser {\n\n private _defs: DefsMap = {};\n // The use of can be in front of declared.\n // So save them temporarily in `_defsUsePending`.\n private _defsUsePending: DefsUsePending;\n private _root: Group = null;\n\n private _textX: number;\n private _textY: number;\n\n parse(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult {\n opt = opt || {};\n\n const svg = parseXML(xml);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!svg) {\n throw new Error('Illegal svg');\n }\n }\n\n this._defsUsePending = [];\n let root = new Group();\n this._root = root;\n const named: SVGParserResult['named'] = [];\n // parse view port\n const viewBox = svg.getAttribute('viewBox') || '';\n\n // If width/height not specified, means \"100%\" of `opt.width/height`.\n // TODO: Other percent value not supported yet.\n let width = parseFloat((svg.getAttribute('width') || opt.width) as string);\n let height = parseFloat((svg.getAttribute('height') || opt.height) as string);\n // If width/height not specified, set as null for output.\n isNaN(width) && (width = null);\n isNaN(height) && (height = null);\n\n // Apply inline style on svg element.\n parseAttributes(svg, root, null, true, false);\n\n let child = svg.firstChild as SVGElement;\n while (child) {\n this._parseNode(child, root, named, null, false, false);\n child = child.nextSibling as SVGElement;\n }\n\n applyDefs(this._defs, this._defsUsePending);\n this._defsUsePending = [];\n\n let viewBoxRect;\n let viewBoxTransform;\n\n if (viewBox) {\n const viewBoxArr = splitNumberSequence(viewBox);\n // Some invalid case like viewBox: 'none'.\n if (viewBoxArr.length >= 4) {\n viewBoxRect = {\n x: parseFloat((viewBoxArr[0] || 0) as string),\n y: parseFloat((viewBoxArr[1] || 0) as string),\n width: parseFloat(viewBoxArr[2]),\n height: parseFloat(viewBoxArr[3])\n };\n }\n }\n\n if (viewBoxRect && width != null && height != null) {\n viewBoxTransform = makeViewBoxTransform(viewBoxRect, { x: 0, y: 0, width: width, height: height });\n\n if (!opt.ignoreViewBox) {\n // If set transform on the output group, it probably bring trouble when\n // some users only intend to show the clipped content inside the viewBox,\n // but not intend to transform the output group. So we keep the output\n // group no transform. If the user intend to use the viewBox as a\n // camera, just set `opt.ignoreViewBox` as `true` and set transfrom\n // manually according to the viewBox info in the output of this method.\n const elRoot = root;\n root = new Group();\n root.add(elRoot);\n elRoot.scaleX = elRoot.scaleY = viewBoxTransform.scale;\n elRoot.x = viewBoxTransform.x;\n elRoot.y = viewBoxTransform.y;\n }\n }\n\n // Some shapes might be overflow the viewport, which should be\n // clipped despite whether the viewBox is used, as the SVG does.\n if (!opt.ignoreRootClip && width != null && height != null) {\n root.setClipPath(new Rect({\n shape: {x: 0, y: 0, width: width, height: height}\n }));\n }\n\n // Set width/height on group just for output the viewport size.\n return {\n root: root,\n width: width,\n height: height,\n viewBoxRect: viewBoxRect,\n viewBoxTransform: viewBoxTransform,\n named: named\n };\n }\n\n private _parseNode(\n xmlNode: SVGElement,\n parentGroup: Group,\n named: SVGParserResultNamedItem[],\n namedFrom: SVGParserResultNamedItem['namedFrom'],\n isInDefs: boolean,\n isInText: boolean\n ): void {\n\n const nodeName = xmlNode.nodeName.toLowerCase() as SVGNodeTagLower;\n\n // TODO:\n // support in svg, where nodeName is 'style',\n // CSS classes is defined globally wherever the style tags are declared.\n\n let el;\n let namedFromForSub = namedFrom;\n\n if (nodeName === 'defs') {\n isInDefs = true;\n }\n if (nodeName === 'text') {\n isInText = true;\n }\n\n if (nodeName === 'defs' || nodeName === 'switch') {\n // Just make displayable. Do not support\n // the full feature of it.\n el = parentGroup;\n }\n else {\n // In , elments will not be rendered.\n // TODO:\n // do not support elements in yet, until requirement come.\n // other graphic elements can also be in and referenced by\n // \n // multiple times\n if (!isInDefs) {\n const parser = nodeParsers[nodeName];\n if (parser && hasOwn(nodeParsers, nodeName)) {\n\n el = parser.call(this, xmlNode, parentGroup);\n\n // Do not support empty string;\n const nameAttr = xmlNode.getAttribute('name');\n if (nameAttr) {\n const newNamed: SVGParserResultNamedItem = {\n name: nameAttr,\n namedFrom: null,\n svgNodeTagLower: nodeName,\n el: el\n };\n named.push(newNamed);\n if (nodeName === 'g') {\n namedFromForSub = newNamed;\n }\n }\n else if (namedFrom) {\n named.push({\n name: namedFrom.name,\n namedFrom: namedFrom,\n svgNodeTagLower: nodeName,\n el: el\n });\n }\n\n parentGroup.add(el);\n }\n }\n\n // Whether gradients/patterns are declared in or not,\n // they all work.\n const parser = paintServerParsers[nodeName];\n if (parser && hasOwn(paintServerParsers, nodeName)) {\n const def = parser.call(this, xmlNode);\n const id = xmlNode.getAttribute('id');\n if (id) {\n this._defs[id] = def;\n }\n }\n }\n\n // If xmlNode is , , , , ,\n // el will be a group, and traverse the children.\n if (el && el.isGroup) {\n let child = xmlNode.firstChild as SVGElement;\n while (child) {\n if (child.nodeType === 1) {\n this._parseNode(child, el as Group, named, namedFromForSub, isInDefs, isInText);\n }\n // Is plain text rather than a tagged node.\n else if (child.nodeType === 3 && isInText) {\n this._parseText(child, el as Group);\n }\n child = child.nextSibling as SVGElement;\n }\n }\n\n }\n\n private _parseText(xmlNode: SVGElement, parentGroup: Group): TSpan {\n const text = new TSpan({\n style: {\n text: xmlNode.textContent\n },\n silent: true,\n x: this._textX || 0,\n y: this._textY || 0\n });\n\n inheritStyle(parentGroup, text);\n\n parseAttributes(xmlNode, text, this._defsUsePending, false, false);\n\n applyTextAlignment(text, parentGroup);\n\n const textStyle = text.style as TextStyleOptionExtended;\n const fontSize = textStyle.fontSize;\n if (fontSize && fontSize < 9) {\n // PENDING\n textStyle.fontSize = 9;\n text.scaleX *= fontSize / 9;\n text.scaleY *= fontSize / 9;\n }\n\n const font = (textStyle.fontSize || textStyle.fontFamily) && [\n textStyle.fontStyle,\n textStyle.fontWeight,\n (textStyle.fontSize || 12) + 'px',\n // If font properties are defined, `fontFamily` should not be ignored.\n textStyle.fontFamily || 'sans-serif'\n ].join(' ');\n // Make font\n textStyle.font = font;\n\n const rect = text.getBoundingRect();\n this._textX += rect.width;\n\n parentGroup.add(text);\n\n return text;\n }\n\n static internalField = (function () {\n\n nodeParsers = {\n 'g': function (xmlNode, parentGroup) {\n const g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, false);\n\n return g;\n },\n 'rect': function (xmlNode, parentGroup) {\n const rect = new Rect();\n inheritStyle(parentGroup, rect);\n parseAttributes(xmlNode, rect, this._defsUsePending, false, false);\n\n rect.setShape({\n x: parseFloat(xmlNode.getAttribute('x') || '0'),\n y: parseFloat(xmlNode.getAttribute('y') || '0'),\n width: parseFloat(xmlNode.getAttribute('width') || '0'),\n height: parseFloat(xmlNode.getAttribute('height') || '0')\n });\n\n rect.silent = true;\n\n return rect;\n },\n 'circle': function (xmlNode, parentGroup) {\n const circle = new Circle();\n inheritStyle(parentGroup, circle);\n parseAttributes(xmlNode, circle, this._defsUsePending, false, false);\n\n circle.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n r: parseFloat(xmlNode.getAttribute('r') || '0')\n });\n\n circle.silent = true;\n\n return circle;\n },\n 'line': function (xmlNode, parentGroup) {\n const line = new Line();\n inheritStyle(parentGroup, line);\n parseAttributes(xmlNode, line, this._defsUsePending, false, false);\n\n line.setShape({\n x1: parseFloat(xmlNode.getAttribute('x1') || '0'),\n y1: parseFloat(xmlNode.getAttribute('y1') || '0'),\n x2: parseFloat(xmlNode.getAttribute('x2') || '0'),\n y2: parseFloat(xmlNode.getAttribute('y2') || '0')\n });\n\n line.silent = true;\n\n return line;\n },\n 'ellipse': function (xmlNode, parentGroup) {\n const ellipse = new Ellipse();\n inheritStyle(parentGroup, ellipse);\n parseAttributes(xmlNode, ellipse, this._defsUsePending, false, false);\n\n ellipse.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n rx: parseFloat(xmlNode.getAttribute('rx') || '0'),\n ry: parseFloat(xmlNode.getAttribute('ry') || '0')\n });\n\n ellipse.silent = true;\n\n return ellipse;\n },\n 'polygon': function (xmlNode, parentGroup) {\n const pointsStr = xmlNode.getAttribute('points');\n let pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n const polygon = new Polygon({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n\n inheritStyle(parentGroup, polygon);\n parseAttributes(xmlNode, polygon, this._defsUsePending, false, false);\n\n return polygon;\n },\n 'polyline': function (xmlNode, parentGroup) {\n const pointsStr = xmlNode.getAttribute('points');\n let pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n const polyline = new Polyline({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n\n inheritStyle(parentGroup, polyline);\n parseAttributes(xmlNode, polyline, this._defsUsePending, false, false);\n\n return polyline;\n },\n 'image': function (xmlNode, parentGroup) {\n const img = new ZRImage();\n inheritStyle(parentGroup, img);\n parseAttributes(xmlNode, img, this._defsUsePending, false, false);\n\n img.setStyle({\n image: xmlNode.getAttribute('xlink:href') || xmlNode.getAttribute('href'),\n x: +xmlNode.getAttribute('x'),\n y: +xmlNode.getAttribute('y'),\n width: +xmlNode.getAttribute('width'),\n height: +xmlNode.getAttribute('height')\n });\n img.silent = true;\n\n return img;\n },\n 'text': function (xmlNode, parentGroup) {\n const x = xmlNode.getAttribute('x') || '0';\n const y = xmlNode.getAttribute('y') || '0';\n const dx = xmlNode.getAttribute('dx') || '0';\n const dy = xmlNode.getAttribute('dy') || '0';\n\n this._textX = parseFloat(x) + parseFloat(dx);\n this._textY = parseFloat(y) + parseFloat(dy);\n\n const g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n\n return g;\n },\n 'tspan': function (xmlNode, parentGroup) {\n const x = xmlNode.getAttribute('x');\n const y = xmlNode.getAttribute('y');\n if (x != null) {\n // new offset x\n this._textX = parseFloat(x);\n }\n if (y != null) {\n // new offset y\n this._textY = parseFloat(y);\n }\n const dx = xmlNode.getAttribute('dx') || '0';\n const dy = xmlNode.getAttribute('dy') || '0';\n\n const g = new Group();\n\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n\n this._textX += parseFloat(dx);\n this._textY += parseFloat(dy);\n\n return g;\n },\n 'path': function (xmlNode, parentGroup) {\n // TODO svg fill rule\n // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule\n // path.style.globalCompositeOperation = 'xor';\n const d = xmlNode.getAttribute('d') || '';\n\n // Performance sensitive.\n\n const path = createFromString(d);\n\n inheritStyle(parentGroup, path);\n parseAttributes(xmlNode, path, this._defsUsePending, false, false);\n\n path.silent = true;\n\n return path;\n }\n };\n\n\n })();\n}\n\nconst paintServerParsers: Dictionary<(xmlNode: SVGElement) => any> = {\n\n 'lineargradient': function (xmlNode: SVGElement) {\n // TODO:\n // Support that x1,y1,x2,y2 are not declared lineargradient but in node.\n const x1 = parseInt(xmlNode.getAttribute('x1') || '0', 10);\n const y1 = parseInt(xmlNode.getAttribute('y1') || '0', 10);\n const x2 = parseInt(xmlNode.getAttribute('x2') || '10', 10);\n const y2 = parseInt(xmlNode.getAttribute('y2') || '0', 10);\n\n const gradient = new LinearGradient(x1, y1, x2, y2);\n\n parsePaintServerUnit(xmlNode, gradient);\n\n parseGradientColorStops(xmlNode, gradient);\n\n return gradient;\n },\n\n 'radialgradient': function (xmlNode) {\n // TODO:\n // Support that x1,y1,x2,y2 are not declared radialgradient but in node.\n // TODO:\n // Support fx, fy, fr.\n const cx = parseInt(xmlNode.getAttribute('cx') || '0', 10);\n const cy = parseInt(xmlNode.getAttribute('cy') || '0', 10);\n const r = parseInt(xmlNode.getAttribute('r') || '0', 10);\n\n const gradient = new RadialGradient(cx, cy, r);\n\n parsePaintServerUnit(xmlNode, gradient);\n\n parseGradientColorStops(xmlNode, gradient);\n\n return gradient;\n }\n\n // TODO\n // 'pattern': function (xmlNode: SVGElement) {\n // }\n};\n\nfunction parsePaintServerUnit(xmlNode: SVGElement, gradient: Gradient) {\n const gradientUnits = xmlNode.getAttribute('gradientUnits');\n if (gradientUnits === 'userSpaceOnUse') {\n gradient.global = true;\n }\n}\n\nfunction parseGradientColorStops(xmlNode: SVGElement, gradient: GradientObject): void {\n\n let stop = xmlNode.firstChild as SVGStopElement;\n\n while (stop) {\n if (stop.nodeType === 1\n // there might be some other irrelevant tags used by editor.\n && stop.nodeName.toLocaleLowerCase() === 'stop'\n ) {\n const offsetStr = stop.getAttribute('offset');\n let offset: number;\n if (offsetStr && offsetStr.indexOf('%') > 0) { // percentage\n offset = parseInt(offsetStr, 10) / 100;\n }\n else if (offsetStr) { // number from 0 to 1\n offset = parseFloat(offsetStr);\n }\n else {\n offset = 0;\n }\n\n // has higher priority than\n // \n const styleVals = {} as Dictionary;\n parseInlineStyle(stop, styleVals, styleVals);\n const stopColor = styleVals.stopColor\n || stop.getAttribute('stop-color')\n || '#000000';\n\n gradient.colorStops.push({\n offset: offset,\n color: stopColor\n });\n }\n stop = stop.nextSibling as SVGStopElement;\n }\n}\n\nfunction inheritStyle(parent: Element, child: Element): void {\n if (parent && (parent as ElementExtended).__inheritedStyle) {\n if (!(child as ElementExtended).__inheritedStyle) {\n (child as ElementExtended).__inheritedStyle = {};\n }\n defaults((child as ElementExtended).__inheritedStyle, (parent as ElementExtended).__inheritedStyle);\n }\n}\n\nfunction parsePoints(pointsString: string): number[][] {\n const list = splitNumberSequence(pointsString);\n const points = [];\n\n for (let i = 0; i < list.length; i += 2) {\n const x = parseFloat(list[i]);\n const y = parseFloat(list[i + 1]);\n points.push([x, y]);\n }\n return points;\n}\n\nfunction parseAttributes(\n xmlNode: SVGElement,\n el: Element,\n defsUsePending: DefsUsePending,\n onlyInlineStyle: boolean,\n isTextGroup: boolean\n): void {\n const disp = el as DisplayableExtended;\n const inheritedStyle = disp.__inheritedStyle = disp.__inheritedStyle || {};\n const selfStyle: SelfStyleByZRKey = {};\n\n // TODO Shadow\n if (xmlNode.nodeType === 1) {\n parseTransformAttribute(xmlNode, el);\n\n parseInlineStyle(xmlNode, inheritedStyle, selfStyle);\n\n if (!onlyInlineStyle) {\n parseAttributeStyle(xmlNode, inheritedStyle, selfStyle);\n }\n }\n\n disp.style = disp.style || {};\n\n if (inheritedStyle.fill != null) {\n disp.style.fill = getFillStrokeStyle(disp, 'fill', inheritedStyle.fill, defsUsePending);\n }\n if (inheritedStyle.stroke != null) {\n disp.style.stroke = getFillStrokeStyle(disp, 'stroke', inheritedStyle.stroke, defsUsePending);\n }\n\n each([\n 'lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize'\n ] as const, function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = parseFloat(inheritedStyle[propName]);\n }\n });\n\n each([\n 'lineDashOffset', 'lineCap', 'lineJoin', 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign'\n ] as const, function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = inheritedStyle[propName];\n }\n });\n\n // Because selfStyle only support textBaseline, so only text group need it.\n // in other cases selfStyle can be released.\n if (isTextGroup) {\n disp.__selfStyle = selfStyle;\n }\n\n if (inheritedStyle.lineDash) {\n disp.style.lineDash = map(splitNumberSequence(inheritedStyle.lineDash), function (str) {\n return parseFloat(str);\n });\n }\n\n if (inheritedStyle.visibility === 'hidden' || inheritedStyle.visibility === 'collapse') {\n disp.invisible = true;\n }\n\n if (inheritedStyle.display === 'none') {\n disp.ignore = true;\n }\n}\n\nfunction applyTextAlignment(\n text: TSpan,\n parentGroup: Group\n): void {\n const parentSelfStyle = (parentGroup as ElementExtended).__selfStyle;\n if (parentSelfStyle) {\n const textBaseline = parentSelfStyle.textBaseline;\n let zrTextBaseline = textBaseline as CanvasTextBaseline;\n if (!textBaseline || textBaseline === 'auto') {\n // FIXME: 'auto' means the value is the dominant-baseline of the script to\n // which the character belongs - i.e., use the dominant-baseline of the parent.\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'baseline') {\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'before-edge' || textBaseline === 'text-before-edge') {\n zrTextBaseline = 'top';\n }\n else if (textBaseline === 'after-edge' || textBaseline === 'text-after-edge') {\n zrTextBaseline = 'bottom';\n }\n else if (textBaseline === 'central' || textBaseline === 'mathematical') {\n zrTextBaseline = 'middle';\n }\n text.style.textBaseline = zrTextBaseline;\n }\n\n const parentInheritedStyle = (parentGroup as ElementExtended).__inheritedStyle;\n if (parentInheritedStyle) {\n // PENDING:\n // canvas `direction` is an experimental attribute.\n // so we do not support SVG direction \"rtl\" for text-anchor yet.\n const textAlign = parentInheritedStyle.textAlign;\n let zrTextAlign = textAlign as CanvasTextAlign;\n if (textAlign) {\n if (textAlign === 'middle') {\n zrTextAlign = 'center';\n }\n text.style.textAlign = zrTextAlign;\n }\n }\n}\n\n// Support `fill:url(#someId)`.\nconst urlRegex = /^url\\(\\s*#(.*?)\\)/;\nfunction getFillStrokeStyle(\n el: Displayable,\n method: 'fill' | 'stroke',\n str: string,\n defsUsePending: DefsUsePending\n): string {\n const urlMatch = str && str.match(urlRegex);\n if (urlMatch) {\n const url = trim(urlMatch[1]);\n defsUsePending.push([el, method, url]);\n return;\n }\n // SVG fill and stroke can be 'none'.\n if (str === 'none') {\n str = null;\n }\n return str;\n}\n\nfunction applyDefs(\n defs: DefsMap,\n defsUsePending: DefsUsePending\n): void {\n for (let i = 0; i < defsUsePending.length; i++) {\n const item = defsUsePending[i];\n item[0].style[item[1]] = defs[item[2]];\n }\n}\n\n// value can be like:\n// '2e-4', 'l.5.9' (ignore 0), 'M-10-10', 'l-2.43e-1,34.9983',\n// 'l-.5E1,54', '121-23-44-11' (no delimiter)\n// PENDING: here continuous commas are treat as one comma, but the\n// browser SVG parser treats this by printing error.\nconst numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction splitNumberSequence(rawStr: string): string[] {\n return rawStr.match(numberReg) || [];\n}\n// Most of the values can be separated by comma and/or white space.\n// const DILIMITER_REG = /[\\s,]+/;\n\n\nconst transformRegex = /(translate|scale|rotate|skewX|skewY|matrix)\\(([\\-\\s0-9\\.eE,]*)\\)/g;\nconst DEGREE_TO_ANGLE = Math.PI / 180;\n\nfunction parseTransformAttribute(xmlNode: SVGElement, node: Element): void {\n let transform = xmlNode.getAttribute('transform');\n if (transform) {\n transform = transform.replace(/,/g, ' ');\n const transformOps: string[] = [];\n let mt = null;\n transform.replace(transformRegex, function (str: string, type: string, value: string) {\n transformOps.push(type, value);\n return '';\n });\n\n for (let i = transformOps.length - 1; i > 0; i -= 2) {\n const value = transformOps[i];\n const type = transformOps[i - 1];\n const valueArr: string[] = splitNumberSequence(value);\n mt = mt || matrix.create();\n switch (type) {\n case 'translate':\n matrix.translate(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || '0')]);\n break;\n case 'scale':\n matrix.scale(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);\n break;\n case 'rotate':\n // TODO: zrender use different hand in coordinate system.\n matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [\n parseFloat(valueArr[1] || '0'),\n parseFloat(valueArr[2] || '0')\n ]);\n break;\n case 'skewX':\n const sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, 0, sx, 1, 0, 0], mt);\n break;\n case 'skewY':\n const sy = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, sy, 0, 1, 0, 0], mt);\n break;\n case 'matrix':\n mt[0] = parseFloat(valueArr[0]);\n mt[1] = parseFloat(valueArr[1]);\n mt[2] = parseFloat(valueArr[2]);\n mt[3] = parseFloat(valueArr[3]);\n mt[4] = parseFloat(valueArr[4]);\n mt[5] = parseFloat(valueArr[5]);\n break;\n }\n }\n node.setLocalTransform(mt);\n }\n}\n\n// Value may contain space.\nconst styleRegex = /([^\\s:;]+)\\s*:\\s*([^:;]+)/g;\nfunction parseInlineStyle(\n xmlNode: SVGElement,\n inheritableStyleResult: Dictionary,\n selfStyleResult: Dictionary\n): void {\n const style = xmlNode.getAttribute('style');\n\n if (!style) {\n return;\n }\n\n styleRegex.lastIndex = 0;\n let styleRegResult;\n while ((styleRegResult = styleRegex.exec(style)) != null) {\n const svgStlAttr = styleRegResult[1];\n\n const zrInheritableStlAttr = hasOwn(INHERITABLE_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? INHERITABLE_STYLE_ATTRIBUTES_MAP[svgStlAttr as keyof typeof INHERITABLE_STYLE_ATTRIBUTES_MAP]\n : null;\n if (zrInheritableStlAttr) {\n inheritableStyleResult[zrInheritableStlAttr] = styleRegResult[2];\n }\n\n const zrSelfStlAttr = hasOwn(SELF_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? SELF_STYLE_ATTRIBUTES_MAP[svgStlAttr as keyof typeof SELF_STYLE_ATTRIBUTES_MAP]\n : null;\n if (zrSelfStlAttr) {\n selfStyleResult[zrSelfStlAttr] = styleRegResult[2];\n }\n }\n}\n\nfunction parseAttributeStyle(\n xmlNode: SVGElement,\n inheritableStyleResult: Dictionary,\n selfStyleResult: Dictionary\n): void {\n for (let i = 0; i < INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n const svgAttrName = INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS[i];\n const attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n inheritableStyleResult[INHERITABLE_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n for (let i = 0; i < SELF_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n const svgAttrName = SELF_STYLE_ATTRIBUTES_MAP_KEYS[i];\n const attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n selfStyleResult[SELF_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n}\n\nexport function makeViewBoxTransform(viewBoxRect: RectLike, boundingRect: RectLike): {\n scale: number;\n x: number;\n y: number;\n} {\n const scaleX = boundingRect.width / viewBoxRect.width;\n const scaleY = boundingRect.height / viewBoxRect.height;\n const scale = Math.min(scaleX, scaleY);\n // preserveAspectRatio 'xMidYMid'\n\n return {\n scale,\n x: -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),\n y: -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2)\n };\n}\n\nexport function parseSVG(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult {\n const parser = new SVGParser();\n return parser.parse(xml, opt);\n}\n\n\n// Also export parseXML to avoid breaking change.\nexport {parseXML};\n","import PathProxy from '../../core/PathProxy';\nimport { isArray } from '../../core/util';\n\nconst PI = Math.PI;\nconst PI2 = PI * 2;\nconst mathSin = Math.sin;\nconst mathCos = Math.cos;\nconst mathACos = Math.acos;\nconst mathATan2 = Math.atan2;\nconst mathAbs = Math.abs;\nconst mathSqrt = Math.sqrt;\nconst mathMax = Math.max;\nconst mathMin = Math.min;\nconst e = 1e-4;\n\nfunction intersect(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number\n): [number, number] {\n const dx10 = x1 - x0;\n const dy10 = y1 - y0;\n const dx32 = x3 - x2;\n const dy32 = y3 - y2;\n let t = dy32 * dx10 - dx32 * dy10;\n if (t * t < e) {\n return;\n }\n t = (dx32 * (y0 - y2) - dy32 * (x0 - x2)) / t;\n return [x0 + t * dx10, y0 + t * dy10];\n}\n\n// Compute perpendicular offset line of length rc.\nfunction computeCornerTangents(\n x0: number, y0: number,\n x1: number, y1: number,\n radius: number, cr: number,\n clockwise: boolean\n) {\n const x01 = x0 - x1;\n const y01 = y0 - y1;\n const lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);\n const ox = lo * y01;\n const oy = -lo * x01;\n const x11 = x0 + ox;\n const y11 = y0 + oy;\n const x10 = x1 + ox;\n const y10 = y1 + oy;\n const x00 = (x11 + x10) / 2;\n const y00 = (y11 + y10) / 2;\n const dx = x10 - x11;\n const dy = y10 - y11;\n const d2 = dx * dx + dy * dy;\n const r = radius - cr;\n const s = x11 * y10 - x10 * y11;\n const d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax(0, r * r * d2 - s * s));\n let cx0 = (s * dy - dx * d) / d2;\n let cy0 = (-s * dx - dy * d) / d2;\n const cx1 = (s * dy + dx * d) / d2;\n const cy1 = (-s * dx + dy * d) / d2;\n const dx0 = cx0 - x00;\n const dy0 = cy0 - y00;\n const dx1 = cx1 - x00;\n const dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points\n // TODO: Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1;\n cy0 = cy1;\n }\n\n return {\n cx: cx0,\n cy: cy0,\n x0: -ox,\n y0: -oy,\n x1: cx0 * (radius / r - 1),\n y1: cy0 * (radius / r - 1)\n };\n}\n\n// For compatibility, don't use normalizeCssArray\n// 5 represents [5, 5, 5, 5]\n// [5] represents [5, 5, 0, 0]\n// [5, 10] represents [5, 5, 10, 10]\n// [5, 10, 15] represents [5, 10, 15, 15]\n// [5, 10, 15, 20] represents [5, 10, 15, 20]\nfunction normalizeCornerRadius(cr: number | number[]): number[] {\n let arr: number[];\n if (isArray(cr)) {\n const len = cr.length;\n if (!len) {\n return cr as number[];\n }\n if (len === 1) {\n arr = [cr[0], cr[0], 0, 0];\n }\n else if (len === 2) {\n arr = [cr[0], cr[0], cr[1], cr[1]];\n }\n else if (len === 3) {\n arr = cr.concat(cr[2]);\n }\n else {\n arr = cr;\n }\n }\n else {\n arr = [cr, cr, cr, cr];\n }\n return arr;\n}\n\nexport function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {\n cx: number\n cy: number\n startAngle: number\n endAngle: number\n clockwise?: boolean,\n r?: number,\n r0?: number,\n cornerRadius?: number | number[]\n}) {\n let radius = mathMax(shape.r, 0);\n let innerRadius = mathMax(shape.r0 || 0, 0);\n const hasRadius = radius > 0;\n const hasInnerRadius = innerRadius > 0;\n\n if (!hasRadius && !hasInnerRadius) {\n return;\n }\n\n if (!hasRadius) {\n // use innerRadius as radius if no radius\n radius = innerRadius;\n innerRadius = 0;\n }\n\n if (innerRadius > radius) {\n // swap, ensure that radius is always larger than innerRadius\n const tmp = radius;\n radius = innerRadius;\n innerRadius = tmp;\n }\n\n const { startAngle, endAngle } = shape;\n if (isNaN(startAngle) || isNaN(endAngle)) {\n return;\n }\n\n const { cx, cy } = shape;\n const clockwise = !!shape.clockwise;\n\n let arc = mathAbs(endAngle - startAngle);\n const mod = arc > PI2 && arc % PI2;\n mod > e && (arc = mod);\n\n // is a point\n if (!(radius > e)) {\n ctx.moveTo(cx, cy);\n }\n // is a circle or annulus\n else if (arc > PI2 - e) {\n ctx.moveTo(\n cx + radius * mathCos(startAngle),\n cy + radius * mathSin(startAngle)\n );\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n\n if (innerRadius > e) {\n ctx.moveTo(\n cx + innerRadius * mathCos(endAngle),\n cy + innerRadius * mathSin(endAngle)\n );\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n // is a circular or annular sector\n else {\n let icrStart;\n let icrEnd;\n let ocrStart;\n let ocrEnd;\n\n let ocrs;\n let ocre;\n let icrs;\n let icre;\n\n let ocrMax;\n let icrMax;\n let limitedOcrMax;\n let limitedIcrMax;\n\n let xre;\n let yre;\n let xirs;\n let yirs;\n\n const xrs = radius * mathCos(startAngle);\n const yrs = radius * mathSin(startAngle);\n const xire = innerRadius * mathCos(endAngle);\n const yire = innerRadius * mathSin(endAngle);\n\n const hasArc = arc > e;\n if (hasArc) {\n const cornerRadius = shape.cornerRadius;\n if (cornerRadius) {\n [icrStart, icrEnd, ocrStart, ocrEnd] = normalizeCornerRadius(cornerRadius);\n }\n\n const halfRd = mathAbs(radius - innerRadius) / 2;\n ocrs = mathMin(halfRd, ocrStart);\n ocre = mathMin(halfRd, ocrEnd);\n icrs = mathMin(halfRd, icrStart);\n icre = mathMin(halfRd, icrEnd);\n\n limitedOcrMax = ocrMax = mathMax(ocrs, ocre);\n limitedIcrMax = icrMax = mathMax(icrs, icre);\n\n // draw corner radius\n if (ocrMax > e || icrMax > e) {\n xre = radius * mathCos(endAngle);\n yre = radius * mathSin(endAngle);\n xirs = innerRadius * mathCos(startAngle);\n yirs = innerRadius * mathSin(startAngle);\n\n // restrict the max value of corner radius\n if (arc < PI) {\n const it = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);\n if (it) {\n const x0 = xrs - it[0];\n const y0 = yrs - it[1];\n const x1 = xre - it[0];\n const y1 = yre - it[1];\n const a = 1 / mathSin(\n // eslint-disable-next-line max-len\n mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2\n );\n const b = mathSqrt(it[0] * it[0] + it[1] * it[1]);\n limitedOcrMax = mathMin(ocrMax, (radius - b) / (a + 1));\n limitedIcrMax = mathMin(icrMax, (innerRadius - b) / (a - 1));\n }\n }\n }\n }\n\n // the sector is collapsed to a line\n if (!hasArc) {\n ctx.moveTo(cx + xrs, cy + yrs);\n }\n // the outer ring has corners\n else if (limitedOcrMax > e) {\n const crStart = mathMin(ocrStart, limitedOcrMax);\n const crEnd = mathMin(ocrEnd, limitedOcrMax);\n const ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, crStart, clockwise);\n const ct1 = computeCornerTangents(xre, yre, xire, yire, radius, crEnd, clockwise);\n\n ctx.moveTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n\n // Have the corners merged?\n if (limitedOcrMax < ocrMax && crStart === crEnd) {\n // eslint-disable-next-line max-len\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedOcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n else {\n // draw the two corners and the ring\n // eslint-disable-next-line max-len\n crStart > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crStart, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n // eslint-disable-next-line max-len\n ctx.arc(cx, cy, radius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), !clockwise);\n // eslint-disable-next-line max-len\n crEnd > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crEnd, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n // the outer ring is a circular arc\n else {\n ctx.moveTo(cx + xrs, cy + yrs);\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n }\n\n // no inner ring, is a circular sector\n if (!(innerRadius > e) || !hasArc) {\n ctx.lineTo(cx + xire, cy + yire);\n }\n // the inner ring has corners\n else if (limitedIcrMax > e) {\n const crStart = mathMin(icrStart, limitedIcrMax);\n const crEnd = mathMin(icrEnd, limitedIcrMax);\n const ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -crEnd, clockwise);\n const ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -crStart, clockwise);\n ctx.lineTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n\n // Have the corners merged?\n if (limitedIcrMax < icrMax && crStart === crEnd) {\n // eslint-disable-next-line max-len\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedIcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n // draw the two corners and the ring\n else {\n // eslint-disable-next-line max-len\n crEnd > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crEnd, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n // eslint-disable-next-line max-len\n ctx.arc(cx, cy, innerRadius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), clockwise);\n // eslint-disable-next-line max-len\n crStart > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crStart, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n // the inner ring is just a circular arc\n else {\n // FIXME: if no lineTo, svg renderer will perform an abnormal drawing behavior.\n ctx.lineTo(cx + xire, cy + yire);\n\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n\n ctx.closePath();\n}\n","import Path, { PathProps } from '../Path';\r\nimport * as roundSectorHelper from '../helper/roundSector';\r\n\r\nexport class SectorShape {\r\n cx = 0\r\n cy = 0\r\n r0 = 0\r\n r = 0\r\n startAngle = 0\r\n endAngle = Math.PI * 2\r\n clockwise = true\r\n /**\r\n * Corner radius of sector\r\n *\r\n * clockwise, from inside to outside, four corners are\r\n * inner start -> inner end\r\n * outer start -> outer end\r\n *\r\n * 5 => [5, 5, 5, 5]\r\n * [5] => [5, 5, 0, 0]\r\n * [5, 10] => [5, 5, 10, 10]\r\n * [5, 10, 15] => [5, 10, 15, 15]\r\n * [5, 10, 15, 20] => [5, 10, 15, 20]\r\n */\r\n cornerRadius: number | number[] = 0\r\n}\r\n\r\nexport interface SectorProps extends PathProps {\r\n shape?: Partial\r\n}\r\n\r\nclass Sector extends Path {\r\n\r\n shape: SectorShape\r\n\r\n constructor(opts?: SectorProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new SectorShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: SectorShape) {\r\n roundSectorHelper.buildPath(ctx, shape);\r\n }\r\n\r\n isZeroArea() {\r\n return this.shape.startAngle === this.shape.endAngle\r\n || this.shape.r === this.shape.r0;\r\n }\r\n}\r\n\r\nSector.prototype.type = 'sector';\r\n\r\nexport default Sector;\r\n","import { cubicSubdivide } from '../core/curve';\r\nimport PathProxy from '../core/PathProxy';\r\n\r\nconst CMD = PathProxy.CMD;\r\n\r\nfunction aroundEqual(a: number, b: number) {\r\n return Math.abs(a - b) < 1e-5;\r\n}\r\n\r\nexport function pathToBezierCurves(path: PathProxy) {\r\n\r\n const data = path.data;\r\n const len = path.len();\r\n\r\n const bezierArrayGroups: number[][] = [];\r\n let currentSubpath: number[];\r\n\r\n let xi = 0;\r\n let yi = 0;\r\n let x0 = 0;\r\n let y0 = 0;\r\n\r\n function createNewSubpath(x: number, y: number) {\r\n // More than one M command\r\n if (currentSubpath && currentSubpath.length > 2) {\r\n bezierArrayGroups.push(currentSubpath);\r\n }\r\n currentSubpath = [x, y];\r\n }\r\n\r\n function addLine(x0: number, y0: number, x1: number, y1: number) {\r\n if (!(aroundEqual(x0, x1) && aroundEqual(y0, y1))) {\r\n currentSubpath.push(x0, y0, x1, y1, x1, y1);\r\n }\r\n }\r\n\r\n function addArc(startAngle: number, endAngle: number, cx: number, cy: number, rx: number, ry: number) {\r\n // https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves\r\n const delta = Math.abs(endAngle - startAngle);\r\n const len = Math.tan(delta / 4) * 4 / 3;\r\n const dir = endAngle < startAngle ? -1 : 1;\r\n\r\n const c1 = Math.cos(startAngle);\r\n const s1 = Math.sin(startAngle);\r\n const c2 = Math.cos(endAngle);\r\n const s2 = Math.sin(endAngle);\r\n\r\n const x1 = c1 * rx + cx;\r\n const y1 = s1 * ry + cy;\r\n\r\n const x4 = c2 * rx + cx;\r\n const y4 = s2 * ry + cy;\r\n\r\n const hx = rx * len * dir;\r\n const hy = ry * len * dir;\r\n currentSubpath.push(\r\n // Move control points on tangent.\r\n x1 - hx * s1, y1 + hy * c1,\r\n x4 + hx * s2, y4 - hy * c2,\r\n x4, y4\r\n );\r\n }\r\n\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n for (let i = 0; i < len;) {\r\n const cmd = data[i++];\r\n const isFirst = i === 1;\r\n\r\n if (isFirst) {\r\n // 如果第一个命令是 L, C, Q\r\n // 则 previous point 同绘制命令的第一个 point\r\n // 第一个命令为 Arc 的情况下会在后面特殊处理\r\n xi = data[i];\r\n yi = data[i + 1];\r\n\r\n x0 = xi;\r\n y0 = yi;\r\n\r\n if (cmd === CMD.L || cmd === CMD.C || cmd === CMD.Q) {\r\n // Start point\r\n currentSubpath = [x0, y0];\r\n }\r\n }\r\n\r\n switch (cmd) {\r\n case CMD.M:\r\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\r\n // 在 closePath 的时候使用\r\n xi = x0 = data[i++];\r\n yi = y0 = data[i++];\r\n\r\n createNewSubpath(x0, y0);\r\n break;\r\n case CMD.L:\r\n x1 = data[i++];\r\n y1 = data[i++];\r\n addLine(xi, yi, x1, y1);\r\n xi = x1;\r\n yi = y1;\r\n break;\r\n case CMD.C:\r\n currentSubpath.push(\r\n data[i++], data[i++], data[i++], data[i++],\r\n xi = data[i++], yi = data[i++]\r\n );\r\n break;\r\n case CMD.Q:\r\n x1 = data[i++];\r\n y1 = data[i++];\r\n x2 = data[i++];\r\n y2 = data[i++];\r\n currentSubpath.push(\r\n // Convert quadratic to cubic\r\n xi + 2 / 3 * (x1 - xi), yi + 2 / 3 * (y1 - yi),\r\n x2 + 2 / 3 * (x1 - x2), y2 + 2 / 3 * (y1 - y2),\r\n x2, y2\r\n );\r\n xi = x2;\r\n yi = y2;\r\n break;\r\n case CMD.A:\r\n const cx = data[i++];\r\n const cy = data[i++];\r\n const rx = data[i++];\r\n const ry = data[i++];\r\n const startAngle = data[i++];\r\n const endAngle = data[i++] + startAngle;\r\n\r\n // TODO Arc rotation\r\n i += 1;\r\n const anticlockwise = !data[i++];\r\n\r\n x1 = Math.cos(startAngle) * rx + cx;\r\n y1 = Math.sin(startAngle) * ry + cy;\r\n if (isFirst) {\r\n // 直接使用 arc 命令\r\n // 第一个命令起点还未定义\r\n x0 = x1;\r\n y0 = y1;\r\n createNewSubpath(x0, y0);\r\n }\r\n else {\r\n // Connect a line between current point to arc start point.\r\n addLine(xi, yi, x1, y1);\r\n }\r\n\r\n xi = Math.cos(endAngle) * rx + cx;\r\n yi = Math.sin(endAngle) * ry + cy;\r\n\r\n const step = (anticlockwise ? -1 : 1) * Math.PI / 2;\r\n\r\n for (let angle = startAngle; anticlockwise ? angle > endAngle : angle < endAngle; angle += step) {\r\n const nextAngle = anticlockwise ? Math.max(angle + step, endAngle)\r\n : Math.min(angle + step, endAngle);\r\n addArc(angle, nextAngle, cx, cy, rx, ry);\r\n }\r\n\r\n break;\r\n case CMD.R:\r\n x0 = xi = data[i++];\r\n y0 = yi = data[i++];\r\n x1 = x0 + data[i++];\r\n y1 = y0 + data[i++];\r\n\r\n // rect is an individual path.\r\n createNewSubpath(x1, y0);\r\n addLine(x1, y0, x1, y1);\r\n addLine(x1, y1, x0, y1);\r\n addLine(x0, y1, x0, y0);\r\n addLine(x0, y0, x1, y0);\r\n break;\r\n case CMD.Z:\r\n currentSubpath && addLine(xi, yi, x0, y0);\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n }\r\n }\r\n\r\n if (currentSubpath && currentSubpath.length > 2) {\r\n bezierArrayGroups.push(currentSubpath);\r\n }\r\n\r\n return bezierArrayGroups;\r\n}\r\n\r\nfunction adpativeBezier(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n out: number[], scale: number\r\n) {\r\n // This bezier is used to simulates a line when converting path to beziers.\r\n if (aroundEqual(x0, x1) && aroundEqual(y0, y1) && aroundEqual(x2, x3) && aroundEqual(y2, y3)) {\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n const PIXEL_DISTANCE = 2 / scale;\r\n const PIXEL_DISTANCE_SQR = PIXEL_DISTANCE * PIXEL_DISTANCE;\r\n\r\n // Determine if curve is straight enough\r\n let dx = x3 - x0;\r\n let dy = y3 - y0;\r\n const d = Math.sqrt(dx * dx + dy * dy);\r\n dx /= d;\r\n dy /= d;\r\n\r\n const dx1 = x1 - x0;\r\n const dy1 = y1 - y0;\r\n const dx2 = x2 - x3;\r\n const dy2 = y2 - y3;\r\n\r\n const cp1LenSqr = dx1 * dx1 + dy1 * dy1;\r\n const cp2LenSqr = dx2 * dx2 + dy2 * dy2;\r\n\r\n if (cp1LenSqr < PIXEL_DISTANCE_SQR && cp2LenSqr < PIXEL_DISTANCE_SQR) {\r\n // Add small segment\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n // Project length of cp1\r\n const projLen1 = dx * dx1 + dy * dy1;\r\n // Project length of cp2\r\n const projLen2 = -dx * dx2 - dy * dy2;\r\n\r\n // Distance from cp1 to start-end line.\r\n const d1Sqr = cp1LenSqr - projLen1 * projLen1;\r\n // Distance from cp2 to start-end line.\r\n const d2Sqr = cp2LenSqr - projLen2 * projLen2;\r\n\r\n // IF the cp1 and cp2 is near to the start-line enough\r\n // We treat it straight enough\r\n if (d1Sqr < PIXEL_DISTANCE_SQR && projLen1 >= 0\r\n && d2Sqr < PIXEL_DISTANCE_SQR && projLen2 >= 0\r\n ) {\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n\r\n const tmpSegX: number[] = [];\r\n const tmpSegY: number[] = [];\r\n // Subdivide\r\n cubicSubdivide(x0, x1, x2, x3, 0.5, tmpSegX);\r\n cubicSubdivide(y0, y1, y2, y3, 0.5, tmpSegY);\r\n\r\n adpativeBezier(\r\n tmpSegX[0], tmpSegY[0], tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], tmpSegX[3], tmpSegY[3],\r\n out, scale\r\n );\r\n adpativeBezier(\r\n tmpSegX[4], tmpSegY[4], tmpSegX[5], tmpSegY[5], tmpSegX[6], tmpSegY[6], tmpSegX[7], tmpSegY[7],\r\n out, scale\r\n );\r\n}\r\n\r\nexport function pathToPolygons(path: PathProxy, scale?: number) {\r\n // TODO Optimize simple case like path is polygon and rect?\r\n const bezierArrayGroups = pathToBezierCurves(path);\r\n\r\n const polygons: number[][] = [];\r\n\r\n scale = scale || 1;\r\n\r\n for (let i = 0; i < bezierArrayGroups.length; i++) {\r\n const beziers = bezierArrayGroups[i];\r\n const polygon: number[] = [];\r\n let x0 = beziers[0];\r\n let y0 = beziers[1];\r\n\r\n polygon.push(x0, y0);\r\n\r\n for (let k = 2; k < beziers.length;) {\r\n\r\n const x1 = beziers[k++];\r\n const y1 = beziers[k++];\r\n const x2 = beziers[k++];\r\n const y2 = beziers[k++];\r\n const x3 = beziers[k++];\r\n const y3 = beziers[k++];\r\n\r\n adpativeBezier(x0, y0, x1, y1, x2, y2, x3, y3, polygon, scale);\r\n\r\n x0 = x3;\r\n y0 = y3;\r\n }\r\n\r\n polygons.push(polygon);\r\n }\r\n return polygons;\r\n}\r\n","import { fromPoints } from '../core/bbox';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport Point from '../core/Point';\r\nimport { map } from '../core/util';\r\nimport Path from '../graphic/Path';\r\nimport Polygon from '../graphic/shape/Polygon';\r\nimport Rect from '../graphic/shape/Rect';\r\nimport Sector from '../graphic/shape/Sector';\r\nimport { pathToPolygons } from './convertPath';\r\nimport { clonePath } from './path';\r\n\r\n// Default shape dividers\r\n// TODO divide polygon by grids.\r\ninterface BinaryDivide {\r\n (shape: Path['shape']): Path['shape'][]\r\n}\r\n\r\n/**\r\n * Calculating a grid to divide the shape.\r\n */\r\nfunction getDividingGrids(dimSize: number[], rowDim: number, count: number) {\r\n const rowSize = dimSize[rowDim];\r\n const columnSize = dimSize[1 - rowDim];\r\n\r\n const ratio = Math.abs(rowSize / columnSize);\r\n let rowCount = Math.ceil(Math.sqrt(ratio * count));\r\n let columnCount = Math.floor(count / rowCount);\r\n if (columnCount === 0) {\r\n columnCount = 1;\r\n rowCount = count;\r\n }\r\n\r\n const grids: number[] = [];\r\n for (let i = 0; i < rowCount; i++) {\r\n grids.push(columnCount);\r\n }\r\n const currentCount = rowCount * columnCount;\r\n // Distribute the remaind grid evenly on each row.\r\n const remained = count - currentCount;\r\n if (remained > 0) {\r\n // const stride = Math.max(Math.floor(rowCount / remained), 1);\r\n for (let i = 0; i < remained; i++) {\r\n grids[i % rowCount] += 1;\r\n }\r\n }\r\n return grids;\r\n}\r\n\r\n\r\n// TODO cornerRadius\r\nfunction divideSector(sectorShape: Sector['shape'], count: number, outShapes: Sector['shape'][]) {\r\n const r0 = sectorShape.r0;\r\n const r = sectorShape.r;\r\n const startAngle = sectorShape.startAngle;\r\n const endAngle = sectorShape.endAngle;\r\n const angle = Math.abs(endAngle - startAngle);\r\n const arcLen = angle * r;\r\n const deltaR = r - r0;\r\n\r\n const isAngleRow = arcLen > Math.abs(deltaR);\r\n const grids = getDividingGrids([arcLen, deltaR], isAngleRow ? 0 : 1, count);\r\n\r\n const rowSize = (isAngleRow ? angle : deltaR) / grids.length;\r\n\r\n for (let row = 0; row < grids.length; row++) {\r\n const columnSize = (isAngleRow ? deltaR : angle) / grids[row];\r\n for (let column = 0; column < grids[row]; column++) {\r\n const newShape = {} as Sector['shape'];\r\n\r\n if (isAngleRow) {\r\n newShape.startAngle = startAngle + rowSize * row;\r\n newShape.endAngle = startAngle + rowSize * (row + 1);\r\n newShape.r0 = r0 + columnSize * column;\r\n newShape.r = r0 + columnSize * (column + 1);\r\n }\r\n else {\r\n newShape.startAngle = startAngle + columnSize * column;\r\n newShape.endAngle = startAngle + columnSize * (column + 1);\r\n newShape.r0 = r0 + rowSize * row;\r\n newShape.r = r0 + rowSize * (row + 1);\r\n }\r\n\r\n newShape.clockwise = sectorShape.clockwise;\r\n newShape.cx = sectorShape.cx;\r\n newShape.cy = sectorShape.cy;\r\n\r\n outShapes.push(newShape);\r\n }\r\n }\r\n}\r\n\r\nfunction divideRect(rectShape: Rect['shape'], count: number, outShapes: Rect['shape'][]) {\r\n const width = rectShape.width;\r\n const height = rectShape.height;\r\n\r\n const isHorizontalRow = width > height;\r\n const grids = getDividingGrids([width, height], isHorizontalRow ? 0 : 1, count);\r\n const rowSizeDim = isHorizontalRow ? 'width' : 'height';\r\n const columnSizeDim = isHorizontalRow ? 'height' : 'width';\r\n const rowDim = isHorizontalRow ? 'x' : 'y';\r\n const columnDim = isHorizontalRow ? 'y' : 'x';\r\n const rowSize = rectShape[rowSizeDim] / grids.length;\r\n\r\n for (let row = 0; row < grids.length; row++) {\r\n const columnSize = rectShape[columnSizeDim] / grids[row];\r\n for (let column = 0; column < grids[row]; column++) {\r\n const newShape = {} as Rect['shape'];\r\n newShape[rowDim] = row * rowSize;\r\n newShape[columnDim] = column * columnSize;\r\n newShape[rowSizeDim] = rowSize;\r\n newShape[columnSizeDim] = columnSize;\r\n\r\n newShape.x += rectShape.x;\r\n newShape.y += rectShape.y;\r\n\r\n outShapes.push(newShape);\r\n }\r\n }\r\n}\r\n\r\nfunction crossProduct2d(x1: number, y1: number, x2: number, y2: number) {\r\n return x1 * y2 - x2 * y1;\r\n}\r\n\r\nfunction lineLineIntersect(\r\n a1x: number, a1y: number, a2x: number, a2y: number, // p1\r\n b1x: number, b1y: number, b2x: number, b2y: number // p2\r\n): Point {\r\n const mx = a2x - a1x;\r\n const my = a2y - a1y;\r\n const nx = b2x - b1x;\r\n const ny = b2y - b1y;\r\n\r\n const nmCrossProduct = crossProduct2d(nx, ny, mx, my);\r\n if (Math.abs(nmCrossProduct) < 1e-6) {\r\n return null;\r\n }\r\n\r\n const b1a1x = a1x - b1x;\r\n const b1a1y = a1y - b1y;\r\n\r\n const p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;\r\n if (p < 0 || p > 1) {\r\n return null;\r\n }\r\n // p2 is an infinite line\r\n return new Point(\r\n p * mx + a1x,\r\n p * my + a1y\r\n );\r\n}\r\n\r\nfunction projPtOnLine(pt: Point, lineA: Point, lineB: Point): number {\r\n const dir = new Point();\r\n Point.sub(dir, lineB, lineA);\r\n dir.normalize();\r\n const dir2 = new Point();\r\n Point.sub(dir2, pt, lineA);\r\n const len = dir2.dot(dir);\r\n return len;\r\n}\r\n\r\nfunction addToPoly(poly: number[][], pt: number[]) {\r\n const last = poly[poly.length - 1];\r\n if (last && last[0] === pt[0] && last[1] === pt[1]) {\r\n return;\r\n }\r\n poly.push(pt);\r\n}\r\n\r\nfunction splitPolygonByLine(points: number[][], lineA: Point, lineB: Point) {\r\n const len = points.length;\r\n const intersections: {\r\n projPt: number,\r\n pt: Point\r\n idx: number\r\n }[] = [];\r\n for (let i = 0; i < len; i++) {\r\n const p0 = points[i];\r\n const p1 = points[(i + 1) % len];\r\n const intersectionPt = lineLineIntersect(\r\n p0[0], p0[1], p1[0], p1[1],\r\n lineA.x, lineA.y, lineB.x, lineB.y\r\n );\r\n if (intersectionPt) {\r\n intersections.push({\r\n projPt: projPtOnLine(intersectionPt, lineA, lineB),\r\n pt: intersectionPt,\r\n idx: i\r\n });\r\n }\r\n }\r\n\r\n // TODO No intersection?\r\n if (intersections.length < 2) {\r\n // Do clone\r\n return [ { points}, {points} ];\r\n }\r\n\r\n // Find two farthest points.\r\n intersections.sort((a, b) => {\r\n return a.projPt - b.projPt;\r\n });\r\n let splitPt0 = intersections[0];\r\n let splitPt1 = intersections[intersections.length - 1];\r\n if (splitPt1.idx < splitPt0.idx) {\r\n const tmp = splitPt0;\r\n splitPt0 = splitPt1;\r\n splitPt1 = tmp;\r\n }\r\n\r\n const splitPt0Arr = [splitPt0.pt.x, splitPt0.pt.y];\r\n const splitPt1Arr = [splitPt1.pt.x, splitPt1.pt.y];\r\n\r\n const newPolyA: number[][] = [splitPt0Arr];\r\n const newPolyB: number[][] = [splitPt1Arr];\r\n\r\n for (let i = splitPt0.idx + 1; i <= splitPt1.idx; i++) {\r\n addToPoly(newPolyA, points[i].slice());\r\n }\r\n addToPoly(newPolyA, splitPt1Arr);\r\n // Close the path\r\n addToPoly(newPolyA, splitPt0Arr);\r\n\r\n for (let i = splitPt1.idx + 1; i <= splitPt0.idx + len; i++) {\r\n addToPoly(newPolyB, points[i % len].slice());\r\n }\r\n addToPoly(newPolyB, splitPt0Arr);\r\n // Close the path\r\n addToPoly(newPolyB, splitPt1Arr);\r\n\r\n return [{\r\n points: newPolyA\r\n }, {\r\n points: newPolyB\r\n }];\r\n}\r\n\r\nfunction binaryDividePolygon(\r\n polygonShape: Pick\r\n) {\r\n const points = polygonShape.points;\r\n const min: number[] = [];\r\n const max: number[] = [];\r\n fromPoints(points, min, max);\r\n const boundingRect = new BoundingRect(\r\n min[0], min[1], max[0] - min[0], max[1] - min[1]\r\n );\r\n\r\n const width = boundingRect.width;\r\n const height = boundingRect.height;\r\n const x = boundingRect.x;\r\n const y = boundingRect.y;\r\n\r\n const pt0 = new Point();\r\n const pt1 = new Point();\r\n if (width > height) {\r\n pt0.x = pt1.x = x + width / 2;\r\n pt0.y = y;\r\n pt1.y = y + height;\r\n }\r\n else {\r\n pt0.y = pt1.y = y + height / 2;\r\n pt0.x = x;\r\n pt1.x = x + width;\r\n }\r\n return splitPolygonByLine(points, pt0, pt1);\r\n}\r\n\r\n\r\nfunction binaryDivideRecursive(\r\n divider: BinaryDivide, shape: T, count: number, out: T[]\r\n): T[] {\r\n if (count === 1) {\r\n out.push(shape);\r\n }\r\n else {\r\n const mid = Math.floor(count / 2);\r\n const sub = divider(shape);\r\n binaryDivideRecursive(divider, sub[0], mid, out);\r\n binaryDivideRecursive(divider, sub[1], count - mid, out);\r\n }\r\n\r\n return out;\r\n}\r\n\r\nexport function clone(path: Path, count: number) {\r\n const paths = [];\r\n for (let i = 0; i < count; i++) {\r\n paths.push(clonePath(path));\r\n }\r\n return paths;\r\n}\r\n\r\nfunction copyPathProps(source: Path, target: Path) {\r\n target.setStyle(source.style);\r\n target.z = source.z;\r\n target.z2 = source.z2;\r\n target.zlevel = source.zlevel;\r\n}\r\n\r\nfunction polygonConvert(points: number[]): number[][] {\r\n const out = [];\r\n for (let i = 0; i < points.length;) {\r\n out.push([points[i++], points[i++]]);\r\n }\r\n return out;\r\n}\r\n\r\nexport function split(\r\n path: Path, count: number\r\n) {\r\n const outShapes: Path['shape'][] = [];\r\n const shape = path.shape;\r\n let OutShapeCtor: new() => Path;\r\n // TODO Use clone when shape size is small\r\n switch (path.type) {\r\n case 'rect':\r\n divideRect(shape as Rect['shape'], count, outShapes as Rect['shape'][]);\r\n OutShapeCtor = Rect;\r\n break;\r\n case 'sector':\r\n divideSector(shape as Sector['shape'], count, outShapes as Sector['shape'][]);\r\n OutShapeCtor = Sector;\r\n break;\r\n case 'circle':\r\n divideSector({\r\n r0: 0, r: shape.r, startAngle: 0, endAngle: Math.PI * 2,\r\n cx: shape.cx, cy: shape.cy\r\n } as Sector['shape'], count, outShapes as Sector['shape'][]);\r\n OutShapeCtor = Sector;\r\n break;\r\n default:\r\n const m = path.getComputedTransform();\r\n const scale = m ? Math.sqrt(Math.max(m[0] * m[0] + m[1] * m[1], m[2] * m[2] + m[3] * m[3])) : 1;\r\n const polygons = map(\r\n pathToPolygons(path.getUpdatedPathProxy(), scale),\r\n poly => polygonConvert(poly)\r\n );\r\n const polygonCount = polygons.length;\r\n if (polygonCount === 0) {\r\n binaryDivideRecursive(binaryDividePolygon, {\r\n points: polygons[0]\r\n }, count, outShapes);\r\n }\r\n else if (polygonCount === count) { // In case we only split batched paths to non-batched paths. No need to split.\r\n for (let i = 0; i < polygonCount; i++) {\r\n outShapes.push({\r\n points: polygons[i]\r\n } as Polygon['shape']);\r\n }\r\n }\r\n else {\r\n // Most complex case. Assign multiple subpath to each polygon based on it's area.\r\n let totalArea = 0;\r\n const items = map(polygons, poly => {\r\n const min: number[] = [];\r\n const max: number[] = [];\r\n fromPoints(poly, min, max);\r\n // TODO: polygon area?\r\n const area = (max[1] - min[1]) * (max[0] - min[0]);\r\n totalArea += area;\r\n return { poly, area };\r\n });\r\n items.sort((a, b) => b.area - a.area);\r\n\r\n let left = count;\r\n for (let i = 0; i < polygonCount; i++) {\r\n const item = items[i];\r\n if (left <= 0) {\r\n break;\r\n }\r\n\r\n const selfCount = i === polygonCount - 1\r\n ? left // Use the last piece directly\r\n : Math.ceil(item.area / totalArea * count);\r\n\r\n if (selfCount < 0) {\r\n continue;\r\n }\r\n\r\n binaryDivideRecursive(binaryDividePolygon, {\r\n points: item.poly\r\n }, selfCount, outShapes);\r\n left -= selfCount;\r\n };\r\n }\r\n OutShapeCtor = Polygon;\r\n break;\r\n }\r\n\r\n if (!OutShapeCtor) {\r\n // Unkown split algorithm. Use clone instead\r\n return clone(path, count);\r\n }\r\n const out: Path[] = [];\r\n\r\n for (let i = 0; i < outShapes.length; i++) {\r\n const subPath = new OutShapeCtor();\r\n subPath.setShape(outShapes[i]);\r\n copyPathProps(path, subPath);\r\n out.push(subPath);\r\n }\r\n\r\n return out;\r\n}","import PathProxy from '../core/PathProxy';\r\nimport { cubicSubdivide } from '../core/curve';\r\nimport Path from '../graphic/Path';\r\nimport Element, { ElementAnimateConfig } from '../Element';\r\nimport { defaults, map } from '../core/util';\r\nimport { lerp } from '../core/vector';\r\nimport Group, { GroupLike } from '../graphic/Group';\r\nimport { clonePath } from './path';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Transformable from '../core/Transformable';\r\nimport { ZRenderType } from '../zrender';\r\nimport { split } from './dividePath';\r\nimport { pathToBezierCurves } from './convertPath';\r\n\r\nfunction alignSubpath(subpath1: number[], subpath2: number[]): [number[], number[]] {\r\n const len1 = subpath1.length;\r\n const len2 = subpath2.length;\r\n if (len1 === len2) {\r\n return [subpath1, subpath2];\r\n }\r\n const tmpSegX: number[] = [];\r\n const tmpSegY: number[] = [];\r\n\r\n const shorterPath = len1 < len2 ? subpath1 : subpath2;\r\n const shorterLen = Math.min(len1, len2);\r\n // Should divide excatly\r\n const diff = Math.abs(len2 - len1) / 6;\r\n const shorterBezierCount = (shorterLen - 2) / 6;\r\n // Add `diff` number of beziers\r\n const eachCurveSubDivCount = Math.ceil(diff / shorterBezierCount) + 1;\r\n\r\n const newSubpath = [shorterPath[0], shorterPath[1]];\r\n let remained = diff;\r\n\r\n for (let i = 2; i < shorterLen;) {\r\n let x0 = shorterPath[i - 2];\r\n let y0 = shorterPath[i - 1];\r\n let x1 = shorterPath[i++];\r\n let y1 = shorterPath[i++];\r\n let x2 = shorterPath[i++];\r\n let y2 = shorterPath[i++];\r\n let x3 = shorterPath[i++];\r\n let y3 = shorterPath[i++];\r\n\r\n if (remained <= 0) {\r\n newSubpath.push(x1, y1, x2, y2, x3, y3);\r\n continue;\r\n }\r\n\r\n let actualSubDivCount = Math.min(remained, eachCurveSubDivCount - 1) + 1;\r\n for (let k = 1; k <= actualSubDivCount; k++) {\r\n const p = k / actualSubDivCount;\r\n\r\n cubicSubdivide(x0, x1, x2, x3, p, tmpSegX);\r\n cubicSubdivide(y0, y1, y2, y3, p, tmpSegY);\r\n\r\n // tmpSegX[3] === tmpSegX[4]\r\n x0 = tmpSegX[3];\r\n y0 = tmpSegY[3];\r\n\r\n newSubpath.push(tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], x0, y0);\r\n x1 = tmpSegX[5];\r\n y1 = tmpSegY[5];\r\n x2 = tmpSegX[6];\r\n y2 = tmpSegY[6];\r\n // The last point (x3, y3) is still the same.\r\n }\r\n remained -= actualSubDivCount - 1;\r\n }\r\n\r\n return shorterPath === subpath1 ? [newSubpath, subpath2] : [subpath1, newSubpath];\r\n}\r\n\r\nfunction createSubpath(lastSubpathSubpath: number[], otherSubpath: number[]) {\r\n const len = lastSubpathSubpath.length;\r\n const lastX = lastSubpathSubpath[len - 2];\r\n const lastY = lastSubpathSubpath[len - 1];\r\n\r\n const newSubpath: number[] = [];\r\n for (let i = 0; i < otherSubpath.length;) {\r\n newSubpath[i++] = lastX;\r\n newSubpath[i++] = lastY;\r\n }\r\n return newSubpath;\r\n}\r\n\r\n/**\r\n * Make two bezier arrays aligns on structure. To have better animation.\r\n *\r\n * It will:\r\n * Make two bezier arrays have same number of subpaths.\r\n * Make each subpath has equal number of bezier curves.\r\n *\r\n * array is the convert result of pathToBezierCurves.\r\n */\r\nexport function alignBezierCurves(array1: number[][], array2: number[][]) {\r\n\r\n let lastSubpath1;\r\n let lastSubpath2;\r\n\r\n let newArray1 = [];\r\n let newArray2 = [];\r\n\r\n for (let i = 0; i < Math.max(array1.length, array2.length); i++) {\r\n const subpath1 = array1[i];\r\n const subpath2 = array2[i];\r\n\r\n let newSubpath1;\r\n let newSubpath2;\r\n\r\n if (!subpath1) {\r\n newSubpath1 = createSubpath(lastSubpath1 || subpath2, subpath2);\r\n newSubpath2 = subpath2;\r\n }\r\n else if (!subpath2) {\r\n newSubpath2 = createSubpath(lastSubpath2 || subpath1, subpath1);\r\n newSubpath1 = subpath1;\r\n }\r\n else {\r\n [newSubpath1, newSubpath2] = alignSubpath(subpath1, subpath2);\r\n lastSubpath1 = newSubpath1;\r\n lastSubpath2 = newSubpath2;\r\n }\r\n\r\n newArray1.push(newSubpath1);\r\n newArray2.push(newSubpath2);\r\n }\r\n\r\n return [newArray1, newArray2];\r\n}\r\n\r\ninterface MorphingPath extends Path {\r\n __morphT: number;\r\n}\r\n\r\nexport interface CombineMorphingPath extends Path {\r\n childrenRef(): (CombineMorphingPath | Path)[]\r\n __isCombineMorphing: boolean;\r\n}\r\n\r\nexport function centroid(array: number[]) {\r\n // https://en.wikipedia.org/wiki/Centroid#Of_a_polygon\r\n let signedArea = 0;\r\n let cx = 0;\r\n let cy = 0;\r\n const len = array.length;\r\n // Polygon should been closed.\r\n for (let i = 0, j = len - 2; i < len; j = i, i += 2) {\r\n const x0 = array[j];\r\n const y0 = array[j + 1];\r\n const x1 = array[i];\r\n const y1 = array[i + 1];\r\n const a = x0 * y1 - x1 * y0;\r\n signedArea += a;\r\n cx += (x0 + x1) * a;\r\n cy += (y0 + y1) * a;\r\n }\r\n\r\n if (signedArea === 0) {\r\n return [array[0] || 0, array[1] || 0];\r\n }\r\n\r\n return [cx / signedArea / 3, cy / signedArea / 3, signedArea];\r\n}\r\n\r\n/**\r\n * Offset the points to find the nearest morphing distance.\r\n * Return beziers count needs to be offset.\r\n */\r\nfunction findBestRingOffset(\r\n fromSubBeziers: number[],\r\n toSubBeziers: number[],\r\n fromCp: number[],\r\n toCp: number[]\r\n) {\r\n const bezierCount = (fromSubBeziers.length - 2) / 6;\r\n let bestScore = Infinity;\r\n let bestOffset = 0;\r\n\r\n const len = fromSubBeziers.length;\r\n const len2 = len - 2;\r\n for (let offset = 0; offset < bezierCount; offset++) {\r\n const cursorOffset = offset * 6;\r\n let score = 0;\r\n\r\n for (let k = 0; k < len; k += 2) {\r\n let idx = k === 0 ? cursorOffset : ((cursorOffset + k - 2) % len2 + 2);\r\n\r\n const x0 = fromSubBeziers[idx] - fromCp[0];\r\n const y0 = fromSubBeziers[idx + 1] - fromCp[1];\r\n const x1 = toSubBeziers[k] - toCp[0];\r\n const y1 = toSubBeziers[k + 1] - toCp[1];\r\n\r\n const dx = x1 - x0;\r\n const dy = y1 - y0;\r\n score += dx * dx + dy * dy;\r\n }\r\n if (score < bestScore) {\r\n bestScore = score;\r\n bestOffset = offset;\r\n }\r\n }\r\n\r\n return bestOffset;\r\n}\r\n\r\nfunction reverse(array: number[]) {\r\n const newArr: number[] = [];\r\n const len = array.length;\r\n for (let i = 0; i < len; i += 2) {\r\n newArr[i] = array[len - i - 2];\r\n newArr[i + 1] = array[len - i - 1];\r\n }\r\n return newArr;\r\n}\r\n\r\ntype MorphingData = {\r\n from: number[];\r\n to: number[];\r\n fromCp: number[];\r\n toCp: number[];\r\n rotation: number;\r\n}[];\r\n\r\n/**\r\n * If we interpolating between two bezier curve arrays.\r\n * It will have many broken effects during the transition.\r\n * So we try to apply an extra rotation which can make each bezier curve morph as small as possible.\r\n */\r\nfunction findBestMorphingRotation(\r\n fromArr: number[][],\r\n toArr: number[][],\r\n searchAngleIteration: number,\r\n searchAngleRange: number\r\n): MorphingData {\r\n const result = [];\r\n\r\n let fromNeedsReverse: boolean;\r\n\r\n for (let i = 0; i < fromArr.length; i++) {\r\n let fromSubpathBezier = fromArr[i];\r\n const toSubpathBezier = toArr[i];\r\n\r\n const fromCp = centroid(fromSubpathBezier);\r\n const toCp = centroid(toSubpathBezier);\r\n\r\n if (fromNeedsReverse == null) {\r\n // Reverse from array if two have different directions.\r\n // Determine the clockwise based on the first subpath.\r\n // Reverse all subpaths or not. Avoid winding rule changed.\r\n fromNeedsReverse = fromCp[2] < 0 !== toCp[2] < 0;\r\n }\r\n\r\n const newFromSubpathBezier: number[] = [];\r\n const newToSubpathBezier: number[] = [];\r\n let bestAngle = 0;\r\n let bestScore = Infinity;\r\n let tmpArr: number[] = [];\r\n\r\n const len = fromSubpathBezier.length;\r\n if (fromNeedsReverse) {\r\n // Make sure clockwise\r\n fromSubpathBezier = reverse(fromSubpathBezier);\r\n }\r\n const offset = findBestRingOffset(fromSubpathBezier, toSubpathBezier, fromCp, toCp) * 6;\r\n\r\n const len2 = len - 2;\r\n for (let k = 0; k < len2; k += 2) {\r\n // Not include the start point.\r\n const idx = (offset + k) % len2 + 2;\r\n newFromSubpathBezier[k + 2] = fromSubpathBezier[idx] - fromCp[0];\r\n newFromSubpathBezier[k + 3] = fromSubpathBezier[idx + 1] - fromCp[1];\r\n }\r\n newFromSubpathBezier[0] = fromSubpathBezier[offset] - fromCp[0];\r\n newFromSubpathBezier[1] = fromSubpathBezier[offset + 1] - fromCp[1];\r\n\r\n if (searchAngleIteration > 0) {\r\n const step = searchAngleRange / searchAngleIteration;\r\n for (let angle = -searchAngleRange / 2; angle <= searchAngleRange / 2; angle += step) {\r\n const sa = Math.sin(angle);\r\n const ca = Math.cos(angle);\r\n let score = 0;\r\n\r\n for (let k = 0; k < fromSubpathBezier.length; k += 2) {\r\n const x0 = newFromSubpathBezier[k];\r\n const y0 = newFromSubpathBezier[k + 1];\r\n const x1 = toSubpathBezier[k] - toCp[0];\r\n const y1 = toSubpathBezier[k + 1] - toCp[1];\r\n\r\n // Apply rotation on the target point.\r\n const newX1 = x1 * ca - y1 * sa;\r\n const newY1 = x1 * sa + y1 * ca;\r\n\r\n tmpArr[k] = newX1;\r\n tmpArr[k + 1] = newY1;\r\n\r\n const dx = newX1 - x0;\r\n const dy = newY1 - y0;\r\n\r\n // Use dot product to have min direction change.\r\n // const d = Math.sqrt(x0 * x0 + y0 * y0);\r\n // score += x0 * dx / d + y0 * dy / d;\r\n score += dx * dx + dy * dy;\r\n }\r\n\r\n if (score < bestScore) {\r\n bestScore = score;\r\n bestAngle = angle;\r\n // Copy.\r\n for (let m = 0; m < tmpArr.length; m++) {\r\n newToSubpathBezier[m] = tmpArr[m];\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < len; i += 2) {\r\n newToSubpathBezier[i] = toSubpathBezier[i] - toCp[0];\r\n newToSubpathBezier[i + 1] = toSubpathBezier[i + 1] - toCp[1];\r\n }\r\n }\r\n\r\n result.push({\r\n from: newFromSubpathBezier,\r\n to: newToSubpathBezier,\r\n fromCp,\r\n toCp,\r\n rotation: -bestAngle\r\n });\r\n }\r\n return result;\r\n}\r\n\r\nexport function isCombineMorphing(path: Element): path is CombineMorphingPath {\r\n return (path as CombineMorphingPath).__isCombineMorphing;\r\n}\r\n\r\nexport function isMorphing(el: Element) {\r\n return (el as MorphingPath).__morphT >= 0;\r\n}\r\n\r\nconst SAVED_METHOD_PREFIX = '__mOriginal_';\r\nfunction saveAndModifyMethod(\r\n obj: T,\r\n methodName: M,\r\n modifiers: { replace?: T[M], after?: T[M], before?: T[M] }\r\n) {\r\n const savedMethodName = SAVED_METHOD_PREFIX + methodName;\r\n const originalMethod = (obj as any)[savedMethodName] || obj[methodName];\r\n if (!(obj as any)[savedMethodName]) {\r\n (obj as any)[savedMethodName] = obj[methodName];\r\n }\r\n const replace = modifiers.replace;\r\n const after = modifiers.after;\r\n const before = modifiers.before;\r\n\r\n (obj as any)[methodName] = function () {\r\n const args = arguments;\r\n let res;\r\n before && (before as unknown as Function).apply(this, args);\r\n // Still call the original method if not replacement.\r\n if (replace) {\r\n res = (replace as unknown as Function).apply(this, args);\r\n }\r\n else {\r\n res = originalMethod.apply(this, args);\r\n }\r\n after && (after as unknown as Function).apply(this, args);\r\n return res;\r\n };\r\n}\r\nfunction restoreMethod(\r\n obj: T,\r\n methodName: keyof T\r\n) {\r\n const savedMethodName = SAVED_METHOD_PREFIX + methodName;\r\n if ((obj as any)[savedMethodName]) {\r\n obj[methodName] = (obj as any)[savedMethodName];\r\n (obj as any)[savedMethodName] = null;\r\n }\r\n}\r\n\r\nfunction applyTransformOnBeziers(bezierCurves: number[][], mm: MatrixArray) {\r\n for (let i = 0; i < bezierCurves.length; i++) {\r\n const subBeziers = bezierCurves[i];\r\n for (let k = 0; k < subBeziers.length;) {\r\n const x = subBeziers[k];\r\n const y = subBeziers[k + 1];\r\n\r\n subBeziers[k++] = mm[0] * x + mm[2] * y + mm[4];\r\n subBeziers[k++] = mm[1] * x + mm[3] * y + mm[5];\r\n }\r\n }\r\n}\r\n\r\nfunction prepareMorphPath(\r\n fromPath: Path,\r\n toPath: Path\r\n) {\r\n const fromPathProxy = fromPath.getUpdatedPathProxy();\r\n const toPathProxy = toPath.getUpdatedPathProxy();\r\n\r\n const [fromBezierCurves, toBezierCurves] =\r\n alignBezierCurves(pathToBezierCurves(fromPathProxy), pathToBezierCurves(toPathProxy));\r\n\r\n const fromPathTransform = fromPath.getComputedTransform();\r\n const toPathTransform = toPath.getComputedTransform();\r\n function updateIdentityTransform(this: Transformable) {\r\n this.transform = null;\r\n }\r\n fromPathTransform && applyTransformOnBeziers(fromBezierCurves, fromPathTransform);\r\n toPathTransform && applyTransformOnBeziers(toBezierCurves, toPathTransform);\r\n // Just ignore transform\r\n saveAndModifyMethod(toPath, 'updateTransform', { replace: updateIdentityTransform });\r\n toPath.transform = null;\r\n\r\n const morphingData = findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI);\r\n\r\n const tmpArr: number[] = [];\r\n\r\n saveAndModifyMethod(toPath, 'buildPath', { replace(path: PathProxy) {\r\n const t = (toPath as MorphingPath).__morphT;\r\n const onet = 1 - t;\r\n\r\n const newCp: number[] = [];\r\n\r\n for (let i = 0; i < morphingData.length; i++) {\r\n const item = morphingData[i];\r\n const from = item.from;\r\n const to = item.to;\r\n const angle = item.rotation * t;\r\n const fromCp = item.fromCp;\r\n const toCp = item.toCp;\r\n const sa = Math.sin(angle);\r\n const ca = Math.cos(angle);\r\n\r\n lerp(newCp, fromCp, toCp, t);\r\n\r\n for (let m = 0; m < from.length; m += 2) {\r\n const x0 = from[m];\r\n const y0 = from[m + 1];\r\n const x1 = to[m];\r\n const y1 = to[m + 1];\r\n\r\n const x = x0 * onet + x1 * t;\r\n const y = y0 * onet + y1 * t;\r\n\r\n tmpArr[m] = (x * ca - y * sa) + newCp[0];\r\n tmpArr[m + 1] = (x * sa + y * ca) + newCp[1];\r\n }\r\n\r\n let x0 = tmpArr[0];\r\n let y0 = tmpArr[1];\r\n\r\n path.moveTo(x0, y0);\r\n\r\n for (let m = 2; m < from.length;) {\r\n const x1 = tmpArr[m++];\r\n const y1 = tmpArr[m++];\r\n const x2 = tmpArr[m++];\r\n const y2 = tmpArr[m++];\r\n const x3 = tmpArr[m++];\r\n const y3 = tmpArr[m++];\r\n\r\n // Is a line.\r\n if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {\r\n path.lineTo(x3, y3);\r\n }\r\n else {\r\n path.bezierCurveTo(x1, y1, x2, y2, x3, y3);\r\n }\r\n x0 = x3;\r\n y0 = y3;\r\n }\r\n }\r\n } });\r\n}\r\n\r\n/**\r\n * Morphing from old path to new path.\r\n */\r\nexport function morphPath(\r\n fromPath: Path,\r\n toPath: Path,\r\n animationOpts: ElementAnimateConfig\r\n): Path {\r\n if (!fromPath || !toPath) {\r\n return toPath;\r\n }\r\n\r\n const oldDone = animationOpts.done;\r\n // const oldAborted = animationOpts.aborted;\r\n const oldDuring = animationOpts.during;\r\n\r\n prepareMorphPath(fromPath, toPath);\r\n\r\n (toPath as MorphingPath).__morphT = 0;\r\n\r\n function restoreToPath() {\r\n restoreMethod(toPath, 'buildPath');\r\n restoreMethod(toPath, 'updateTransform');\r\n // Mark as not in morphing\r\n (toPath as MorphingPath).__morphT = -1;\r\n // Cleanup.\r\n toPath.createPathProxy();\r\n toPath.dirtyShape();\r\n }\r\n\r\n toPath.animateTo({\r\n __morphT: 1\r\n } as any, defaults({\r\n during(p) {\r\n toPath.dirtyShape();\r\n oldDuring && oldDuring(p);\r\n },\r\n done() {\r\n restoreToPath();\r\n oldDone && oldDone();\r\n }\r\n // NOTE: Don't do restore if aborted.\r\n // Because all status was just set when animation started.\r\n // aborted() {\r\n // oldAborted && oldAborted();\r\n // }\r\n } as ElementAnimateConfig, animationOpts));\r\n\r\n return toPath;\r\n}\r\n\r\n// https://github.com/mapbox/earcut/blob/master/src/earcut.js#L437\r\n// https://jsfiddle.net/pissang/2jk7x145/\r\n// function zOrder(x: number, y: number, minX: number, minY: number, maxX: number, maxY: number) {\r\n// // Normalize coords to 0 - 1\r\n// // The transformed into non-negative 15-bit integer range\r\n// x = (maxX === minX) ? 0 : Math.round(32767 * (x - minX) / (maxX - minX));\r\n// y = (maxY === minY) ? 0 : Math.round(32767 * (y - minY) / (maxY - minY));\r\n\r\n// x = (x | (x << 8)) & 0x00FF00FF;\r\n// x = (x | (x << 4)) & 0x0F0F0F0F;\r\n// x = (x | (x << 2)) & 0x33333333;\r\n// x = (x | (x << 1)) & 0x55555555;\r\n\r\n// y = (y | (y << 8)) & 0x00FF00FF;\r\n// y = (y | (y << 4)) & 0x0F0F0F0F;\r\n// y = (y | (y << 2)) & 0x33333333;\r\n// y = (y | (y << 1)) & 0x55555555;\r\n\r\n// return x | (y << 1);\r\n// }\r\n\r\n// https://github.com/w8r/hilbert/blob/master/hilbert.js#L30\r\n// https://jsfiddle.net/pissang/xdnbzg6v/\r\nfunction hilbert(x: number, y: number, minX: number, minY: number, maxX: number, maxY: number) {\r\n const bits = 16;\r\n x = (maxX === minX) ? 0 : Math.round(32767 * (x - minX) / (maxX - minX));\r\n y = (maxY === minY) ? 0 : Math.round(32767 * (y - minY) / (maxY - minY));\r\n\r\n let d = 0;\r\n let tmp: number;\r\n for (let s = (1 << bits) / 2; s > 0; s /= 2) {\r\n let rx = 0;\r\n let ry = 0;\r\n\r\n if ((x & s) > 0) {\r\n rx = 1;\r\n }\r\n if ((y & s) > 0) {\r\n ry = 1;\r\n }\r\n\r\n d += s * s * ((3 * rx) ^ ry);\r\n\r\n if (ry === 0) {\r\n if (rx === 1) {\r\n x = s - 1 - x;\r\n y = s - 1 - y;\r\n }\r\n tmp = x;\r\n x = y;\r\n y = tmp;\r\n }\r\n }\r\n return d;\r\n}\r\n\r\n// Sort paths on hilbert. Not using z-order because it may still have large cross.\r\n// So the left most source can animate to the left most target, not right most target.\r\n// Hope in this way. We can make sure each element is animated to the proper target. Not the farthest.\r\nfunction sortPaths(pathList: Path[]): Path[] {\r\n let xMin = Infinity;\r\n let yMin = Infinity;\r\n let xMax = -Infinity;\r\n let yMax = -Infinity;\r\n const cps = map(pathList, path => {\r\n const rect = path.getBoundingRect();\r\n const m = path.getComputedTransform();\r\n const x = rect.x + rect.width / 2 + (m ? m[4] : 0);\r\n const y = rect.y + rect.height / 2 + (m ? m[5] : 0);\r\n xMin = Math.min(x, xMin);\r\n yMin = Math.min(y, yMin);\r\n xMax = Math.max(x, xMax);\r\n yMax = Math.max(y, yMax);\r\n return [x, y];\r\n });\r\n\r\n const items = map(cps, (cp, idx) => {\r\n return {\r\n cp,\r\n z: hilbert(cp[0], cp[1], xMin, yMin, xMax, yMax),\r\n path: pathList[idx]\r\n };\r\n });\r\n\r\n return items.sort((a, b) => a.z - b.z).map(item => item.path);\r\n}\r\n\r\nexport interface DividePathParams {\r\n path: Path,\r\n count: number\r\n};\r\nexport interface DividePath {\r\n (params: DividePathParams): Path[]\r\n}\r\n\r\nexport interface IndividualDelay {\r\n (index: number, count: number, fromPath: Path, toPath: Path): number\r\n}\r\n\r\nfunction defaultDividePath(param: DividePathParams) {\r\n return split(param.path, param.count);\r\n}\r\nexport interface CombineConfig extends ElementAnimateConfig {\r\n /**\r\n * Transform of returned will be ignored.\r\n */\r\n dividePath?: DividePath\r\n /**\r\n * delay of each individual.\r\n * Because individual are sorted on z-order. The index is also sorted top-left / right-down.\r\n */\r\n individualDelay?: IndividualDelay\r\n /**\r\n * If sort splitted paths so the movement between them can be more natural\r\n */\r\n // sort?: boolean\r\n}\r\n\r\nfunction createEmptyReturn() {\r\n return {\r\n fromIndividuals: [] as Path[],\r\n toIndividuals: [] as Path[],\r\n count: 0\r\n };\r\n}\r\n/**\r\n * Make combine morphing from many paths to one.\r\n * Will return a group to replace the original path.\r\n */\r\nexport function combineMorph(\r\n fromList: (CombineMorphingPath | Path)[],\r\n toPath: Path,\r\n animationOpts: CombineConfig\r\n) {\r\n let fromPathList: Path[] = [];\r\n\r\n function addFromPath(fromList: Element[]) {\r\n for (let i = 0; i < fromList.length; i++) {\r\n const from = fromList[i];\r\n if (isCombineMorphing(from)) {\r\n addFromPath((from as GroupLike).childrenRef());\r\n }\r\n else if (from instanceof Path) {\r\n fromPathList.push(from);\r\n }\r\n }\r\n }\r\n addFromPath(fromList);\r\n\r\n const separateCount = fromPathList.length;\r\n\r\n // fromPathList.length is 0.\r\n if (!separateCount) {\r\n return createEmptyReturn();\r\n }\r\n\r\n const dividePath = animationOpts.dividePath || defaultDividePath;\r\n\r\n let toSubPathList = dividePath({\r\n path: toPath, count: separateCount\r\n });\r\n if (toSubPathList.length !== separateCount) {\r\n console.error('Invalid morphing: unmatched splitted path');\r\n return createEmptyReturn();\r\n }\r\n\r\n fromPathList = sortPaths(fromPathList);\r\n toSubPathList = sortPaths(toSubPathList);\r\n\r\n const oldDone = animationOpts.done;\r\n // const oldAborted = animationOpts.aborted;\r\n const oldDuring = animationOpts.during;\r\n const individualDelay = animationOpts.individualDelay;\r\n\r\n const identityTransform = new Transformable();\r\n\r\n for (let i = 0; i < separateCount; i++) {\r\n const from = fromPathList[i];\r\n const to = toSubPathList[i];\r\n\r\n to.parent = toPath as unknown as Group;\r\n\r\n // Ignore transform in each subpath.\r\n to.copyTransform(identityTransform);\r\n\r\n // Will do morphPath for each individual if individualDelay is set.\r\n if (!individualDelay) {\r\n prepareMorphPath(from, to);\r\n }\r\n }\r\n\r\n (toPath as CombineMorphingPath).__isCombineMorphing = true;\r\n (toPath as CombineMorphingPath).childrenRef = function () {\r\n return toSubPathList;\r\n };\r\n\r\n function addToSubPathListToZr(zr: ZRenderType) {\r\n for (let i = 0; i < toSubPathList.length; i++) {\r\n toSubPathList[i].addSelfToZr(zr);\r\n }\r\n }\r\n saveAndModifyMethod(toPath, 'addSelfToZr', {\r\n after(zr) {\r\n addToSubPathListToZr(zr);\r\n }\r\n });\r\n saveAndModifyMethod(toPath, 'removeSelfFromZr', {\r\n after(zr) {\r\n for (let i = 0; i < toSubPathList.length; i++) {\r\n toSubPathList[i].removeSelfFromZr(zr);\r\n }\r\n }\r\n });\r\n\r\n function restoreToPath() {\r\n (toPath as CombineMorphingPath).__isCombineMorphing = false;\r\n // Mark as not in morphing\r\n (toPath as MorphingPath).__morphT = -1;\r\n (toPath as CombineMorphingPath).childrenRef = null;\r\n\r\n restoreMethod(toPath, 'addSelfToZr');\r\n restoreMethod(toPath, 'removeSelfFromZr');\r\n }\r\n\r\n const toLen = toSubPathList.length;\r\n\r\n if (individualDelay) {\r\n let animating = toLen;\r\n const eachDone = () => {\r\n animating--;\r\n if (animating === 0) {\r\n restoreToPath();\r\n oldDone && oldDone();\r\n }\r\n };\r\n // Animate each element individually.\r\n for (let i = 0; i < toLen; i++) {\r\n // TODO only call during once?\r\n const indivdualAnimationOpts = individualDelay ? defaults({\r\n delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toSubPathList[i]),\r\n done: eachDone\r\n } as ElementAnimateConfig, animationOpts) : animationOpts;\r\n morphPath(fromPathList[i], toSubPathList[i], indivdualAnimationOpts);\r\n }\r\n }\r\n else {\r\n (toPath as MorphingPath).__morphT = 0;\r\n toPath.animateTo({\r\n __morphT: 1\r\n } as any, defaults({\r\n during(p) {\r\n for (let i = 0; i < toLen; i++) {\r\n const child = toSubPathList[i] as MorphingPath;\r\n child.__morphT = (toPath as MorphingPath).__morphT;\r\n child.dirtyShape();\r\n }\r\n oldDuring && oldDuring(p);\r\n },\r\n done() {\r\n restoreToPath();\r\n for (let i = 0; i < fromList.length; i++) {\r\n restoreMethod(fromList[i], 'updateTransform');\r\n }\r\n oldDone && oldDone();\r\n }\r\n } as ElementAnimateConfig, animationOpts));\r\n }\r\n\r\n if (toPath.__zr) {\r\n addToSubPathListToZr(toPath.__zr);\r\n }\r\n\r\n return {\r\n fromIndividuals: fromPathList,\r\n toIndividuals: toSubPathList,\r\n count: toLen\r\n };\r\n}\r\nexport interface SeparateConfig extends ElementAnimateConfig {\r\n dividePath?: DividePath\r\n individualDelay?: IndividualDelay\r\n /**\r\n * If sort splitted paths so the movement between them can be more natural\r\n */\r\n // sort?: boolean\r\n // // If the from path of separate animation is doing combine animation.\r\n // // And the paths number is not same with toPathList. We need to do enter/leave animation\r\n // // on the missing/spare paths.\r\n // enter?: (el: Path) => void\r\n // leave?: (el: Path) => void\r\n}\r\n\r\n/**\r\n * Make separate morphing from one path to many paths.\r\n * Make the MorphingKind of `toPath` become `'ONE_ONE'`.\r\n */\r\nexport function separateMorph(\r\n fromPath: Path,\r\n toPathList: Path[],\r\n animationOpts: SeparateConfig\r\n) {\r\n const toLen = toPathList.length;\r\n let fromPathList: Path[] = [];\r\n\r\n const dividePath = animationOpts.dividePath || defaultDividePath;\r\n\r\n function addFromPath(fromList: Element[]) {\r\n for (let i = 0; i < fromList.length; i++) {\r\n const from = fromList[i];\r\n if (isCombineMorphing(from)) {\r\n addFromPath((from as GroupLike).childrenRef());\r\n }\r\n else if (from instanceof Path) {\r\n fromPathList.push(from);\r\n }\r\n }\r\n }\r\n // This case most happen when a combining path is called to reverse the animation\r\n // to its original separated state.\r\n if (isCombineMorphing(fromPath)) {\r\n addFromPath(fromPath.childrenRef());\r\n\r\n const fromLen = fromPathList.length;\r\n if (fromLen < toLen) {\r\n let k = 0;\r\n for (let i = fromLen; i < toLen; i++) {\r\n // Create a clone\r\n fromPathList.push(clonePath(fromPathList[k++ % fromLen]));\r\n }\r\n }\r\n // Else simply remove if fromLen > toLen\r\n fromPathList.length = toLen;\r\n }\r\n else {\r\n fromPathList = dividePath({ path: fromPath, count: toLen });\r\n const fromPathTransform = fromPath.getComputedTransform();\r\n for (let i = 0; i < fromPathList.length; i++) {\r\n // Force use transform of source path.\r\n fromPathList[i].setLocalTransform(fromPathTransform);\r\n }\r\n if (fromPathList.length !== toLen) {\r\n console.error('Invalid morphing: unmatched splitted path');\r\n return createEmptyReturn();\r\n }\r\n }\r\n\r\n fromPathList = sortPaths(fromPathList);\r\n toPathList = sortPaths(toPathList);\r\n\r\n const individualDelay = animationOpts.individualDelay;\r\n for (let i = 0; i < toLen; i++) {\r\n const indivdualAnimationOpts = individualDelay ? defaults({\r\n delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toPathList[i])\r\n } as ElementAnimateConfig, animationOpts) : animationOpts;\r\n morphPath(fromPathList[i], toPathList[i], indivdualAnimationOpts);\r\n }\r\n\r\n return {\r\n fromIndividuals: fromPathList,\r\n toIndividuals: toPathList,\r\n count: toPathList.length\r\n };\r\n}\r\n\r\nexport { split as defaultDividePath };\r\n","// CompoundPath to improve performance\r\n\r\nimport Path from './Path';\r\nimport PathProxy from '../core/PathProxy';\r\n\r\nexport interface CompoundPathShape {\r\n paths: Path[]\r\n}\r\n\r\nexport default class CompoundPath extends Path {\r\n\r\n type = 'compound'\r\n\r\n shape: CompoundPathShape\r\n\r\n private _updatePathDirty() {\r\n const paths = this.shape.paths;\r\n let dirtyPath = this.shapeChanged();\r\n for (let i = 0; i < paths.length; i++) {\r\n // Mark as dirty if any subpath is dirty\r\n dirtyPath = dirtyPath || paths[i].shapeChanged();\r\n }\r\n if (dirtyPath) {\r\n this.dirtyShape();\r\n }\r\n }\r\n\r\n beforeBrush() {\r\n this._updatePathDirty();\r\n const paths = this.shape.paths || [];\r\n const scale = this.getGlobalScale();\r\n // Update path scale\r\n for (let i = 0; i < paths.length; i++) {\r\n if (!paths[i].path) {\r\n paths[i].createPathProxy();\r\n }\r\n paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);\r\n }\r\n }\r\n\r\n buildPath(ctx: PathProxy | CanvasRenderingContext2D, shape: CompoundPathShape) {\r\n const paths = shape.paths || [];\r\n for (let i = 0; i < paths.length; i++) {\r\n paths[i].buildPath(ctx, paths[i].shape, true);\r\n }\r\n }\r\n\r\n afterBrush() {\r\n const paths = this.shape.paths || [];\r\n for (let i = 0; i < paths.length; i++) {\r\n paths[i].pathUpdated();\r\n }\r\n }\r\n\r\n getBoundingRect() {\r\n this._updatePathDirty.call(this);\r\n return Path.prototype.getBoundingRect.call(this);\r\n }\r\n}","/**\r\n * Displayable for incremental rendering. It will be rendered in a separate layer\r\n * IncrementalDisplay have two main methods. `clearDisplayables` and `addDisplayables`\r\n * addDisplayables will render the added displayables incremetally.\r\n *\r\n * It use a notClear flag to tell the painter don't clear the layer if it's the first element.\r\n *\r\n * It's not available for SVG rendering.\r\n */\r\nimport Displayble from './Displayable';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Group from './Group';\r\n\r\nconst m: MatrixArray = [];\r\n// TODO Style override ?\r\n\r\nexport default class IncrementalDisplayable extends Displayble {\r\n\r\n notClear: boolean = true\r\n\r\n incremental = true\r\n\r\n private _displayables: Displayble[] = []\r\n private _temporaryDisplayables: Displayble[] = []\r\n\r\n private _cursor = 0\r\n\r\n traverse(\r\n cb: (this: T, el: this) => void,\r\n context: T\r\n ) {\r\n cb.call(context, this);\r\n }\r\n\r\n useStyle() {\r\n // Use an empty style\r\n // PENDING\r\n this.style = {};\r\n }\r\n\r\n // getCurrentCursor / updateCursorAfterBrush\r\n // is used in graphic.ts. It's not provided for developers\r\n getCursor() {\r\n return this._cursor;\r\n }\r\n // Update cursor after brush.\r\n innerAfterBrush() {\r\n this._cursor = this._displayables.length;\r\n }\r\n\r\n clearDisplaybles() {\r\n this._displayables = [];\r\n this._temporaryDisplayables = [];\r\n this._cursor = 0;\r\n this.markRedraw();\r\n\r\n this.notClear = false;\r\n }\r\n\r\n clearTemporalDisplayables() {\r\n this._temporaryDisplayables = [];\r\n }\r\n\r\n addDisplayable(displayable: Displayble, notPersistent?: boolean) {\r\n if (notPersistent) {\r\n this._temporaryDisplayables.push(displayable);\r\n }\r\n else {\r\n this._displayables.push(displayable);\r\n }\r\n this.markRedraw();\r\n }\r\n\r\n addDisplayables(displayables: Displayble[], notPersistent?: boolean) {\r\n notPersistent = notPersistent || false;\r\n for (let i = 0; i < displayables.length; i++) {\r\n this.addDisplayable(displayables[i], notPersistent);\r\n }\r\n }\r\n\r\n getDisplayables(): Displayble[] {\r\n return this._displayables;\r\n }\r\n\r\n getTemporalDisplayables(): Displayble[] {\r\n return this._temporaryDisplayables;\r\n }\r\n\r\n eachPendingDisplayable(cb: (displayable: Displayble) => void) {\r\n for (let i = this._cursor; i < this._displayables.length; i++) {\r\n cb && cb(this._displayables[i]);\r\n }\r\n for (let i = 0; i < this._temporaryDisplayables.length; i++) {\r\n cb && cb(this._temporaryDisplayables[i]);\r\n }\r\n }\r\n\r\n update() {\r\n this.updateTransform();\r\n for (let i = this._cursor; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n // PENDING\r\n displayable.parent = this as unknown as Group;\r\n displayable.update();\r\n displayable.parent = null;\r\n }\r\n for (let i = 0; i < this._temporaryDisplayables.length; i++) {\r\n const displayable = this._temporaryDisplayables[i];\r\n // PENDING\r\n displayable.parent = this as unknown as Group;\r\n displayable.update();\r\n displayable.parent = null;\r\n }\r\n }\r\n\r\n getBoundingRect() {\r\n if (!this._rect) {\r\n const rect = new BoundingRect(Infinity, Infinity, -Infinity, -Infinity);\r\n for (let i = 0; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n const childRect = displayable.getBoundingRect().clone();\r\n if (displayable.needLocalTransform()) {\r\n childRect.applyTransform(displayable.getLocalTransform(m));\r\n }\r\n rect.union(childRect);\r\n }\r\n this._rect = rect;\r\n }\r\n return this._rect;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const localPos = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n\r\n if (rect.contain(localPos[0], localPos[1])) {\r\n for (let i = 0; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n if (displayable.contain(x, y)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n}","\r\nimport LRU from '../../core/LRU';\r\nimport { platformApi } from '../../core/platform';\r\nimport { ImageLike } from '../../core/types';\r\n\r\nconst globalImageCache = new LRU(50);\r\n\r\ntype PendingWrap = {\r\n hostEl: {dirty: () => void}\r\n cb: (image: ImageLike, payload: any) => void\r\n cbPayload: any\r\n}\r\n\r\ntype CachedImageObj = {\r\n image: ImageLike\r\n pending: PendingWrap[]\r\n}\r\n\r\nexport function findExistImage(newImageOrSrc: string | ImageLike): ImageLike {\r\n if (typeof newImageOrSrc === 'string') {\r\n const cachedImgObj = globalImageCache.get(newImageOrSrc);\r\n return cachedImgObj && cachedImgObj.image;\r\n }\r\n else {\r\n return newImageOrSrc;\r\n }\r\n}\r\n\r\n/**\r\n * Caution: User should cache loaded images, but not just count on LRU.\r\n * Consider if required images more than LRU size, will dead loop occur?\r\n *\r\n * @param newImageOrSrc\r\n * @param image Existent image.\r\n * @param hostEl For calling `dirty`.\r\n * @param onload params: (image, cbPayload)\r\n * @param cbPayload Payload on cb calling.\r\n * @return image\r\n */\r\nexport function createOrUpdateImage(\r\n newImageOrSrc: string | ImageLike,\r\n image: ImageLike,\r\n hostEl: { dirty: () => void },\r\n onload?: (image: ImageLike, payload: T) => void,\r\n cbPayload?: T\r\n) {\r\n if (!newImageOrSrc) {\r\n return image;\r\n }\r\n else if (typeof newImageOrSrc === 'string') {\r\n\r\n // Image should not be loaded repeatly.\r\n if ((image && (image as any).__zrImageSrc === newImageOrSrc) || !hostEl) {\r\n return image;\r\n }\r\n\r\n // Only when there is no existent image or existent image src\r\n // is different, this method is responsible for load.\r\n const cachedImgObj = globalImageCache.get(newImageOrSrc);\r\n\r\n const pendingWrap = {hostEl: hostEl, cb: onload, cbPayload: cbPayload};\r\n\r\n if (cachedImgObj) {\r\n image = cachedImgObj.image;\r\n !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);\r\n }\r\n else {\r\n image = platformApi.loadImage(\r\n newImageOrSrc, imageOnLoad, imageOnLoad\r\n );\r\n (image as any).__zrImageSrc = newImageOrSrc;\r\n\r\n globalImageCache.put(\r\n newImageOrSrc,\r\n (image as any).__cachedImgObj = {\r\n image: image,\r\n pending: [pendingWrap]\r\n }\r\n );\r\n }\r\n\r\n return image;\r\n }\r\n // newImageOrSrc is an HTMLImageElement or HTMLCanvasElement or Canvas\r\n else {\r\n return newImageOrSrc;\r\n }\r\n}\r\n\r\nfunction imageOnLoad(this: any) {\r\n const cachedImgObj = this.__cachedImgObj;\r\n this.onload = this.onerror = this.__cachedImgObj = null;\r\n\r\n for (let i = 0; i < cachedImgObj.pending.length; i++) {\r\n const pendingWrap = cachedImgObj.pending[i];\r\n const cb = pendingWrap.cb;\r\n cb && cb(this, pendingWrap.cbPayload);\r\n pendingWrap.hostEl.dirty();\r\n }\r\n cachedImgObj.pending.length = 0;\r\n}\r\n\r\nexport function isImageReady(image: ImageLike) {\r\n return image && image.width && image.height;\r\n}\r\n\r\n","import * as imageHelper from '../helper/image';\nimport {\n extend,\n retrieve2,\n retrieve3,\n reduce\n} from '../../core/util';\nimport { TextAlign, TextVerticalAlign, ImageLike, Dictionary } from '../../core/types';\nimport { TextStyleProps } from '../Text';\nimport { getLineHeight, getWidth, parsePercent } from '../../contain/text';\n\nconst STYLE_REG = /\\{([a-zA-Z0-9_]+)\\|([^}]*)\\}/g;\n\ninterface InnerTruncateOption {\n maxIteration?: number\n // If truncate result are less than minChar, ellipsis will not show\n // which is better for user hint in some cases\n minChar?: number\n // When all truncated, use the placeholder\n placeholder?: string\n\n maxIterations?: number\n}\n\ninterface InnerPreparedTruncateOption extends Required {\n font: string\n\n ellipsis: string\n ellipsisWidth: number\n contentWidth: number\n\n containerWidth: number\n cnCharWidth: number\n ascCharWidth: number\n}\n\n/**\n * Show ellipsis if overflow.\n */\nexport function truncateText(\n text: string,\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): string {\n const out = {} as Parameters[0];\n truncateText2(out, text, containerWidth, font, ellipsis, options);\n return out.text;\n}\n\n// PENDING: not sure whether `truncateText` is used outside zrender, since it has an `export`\n// specifier. So keep it and perform the interface modification in `truncateText2`.\nfunction truncateText2(\n out: {text: string, isTruncated: boolean},\n text: string,\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): void {\n if (!containerWidth) {\n out.text = '';\n out.isTruncated = false;\n return;\n }\n\n const textLines = (text + '').split('\\n');\n options = prepareTruncateOptions(containerWidth, font, ellipsis, options);\n\n // FIXME\n // It is not appropriate that every line has '...' when truncate multiple lines.\n let isTruncated = false;\n const truncateOut = {} as Parameters[0];\n for (let i = 0, len = textLines.length; i < len; i++) {\n truncateSingleLine(truncateOut, textLines[i], options as InnerPreparedTruncateOption);\n textLines[i] = truncateOut.textLine;\n isTruncated = isTruncated || truncateOut.isTruncated;\n }\n\n out.text = textLines.join('\\n');\n out.isTruncated = isTruncated;\n}\n\nfunction prepareTruncateOptions(\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): InnerPreparedTruncateOption {\n options = options || {};\n let preparedOpts = extend({}, options) as InnerPreparedTruncateOption;\n\n preparedOpts.font = font;\n ellipsis = retrieve2(ellipsis, '...');\n preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);\n const minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);\n // FIXME\n // Other languages?\n preparedOpts.cnCharWidth = getWidth('国', font);\n // FIXME\n // Consider proportional font?\n const ascCharWidth = preparedOpts.ascCharWidth = getWidth('a', font);\n preparedOpts.placeholder = retrieve2(options.placeholder, '');\n\n // Example 1: minChar: 3, text: 'asdfzxcv', truncate result: 'asdf', but not: 'a...'.\n // Example 2: minChar: 3, text: '维度', truncate result: '维', but not: '...'.\n let contentWidth = containerWidth = Math.max(0, containerWidth - 1); // Reserve some gap.\n for (let i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {\n contentWidth -= ascCharWidth;\n }\n\n let ellipsisWidth = getWidth(ellipsis, font);\n if (ellipsisWidth > contentWidth) {\n ellipsis = '';\n ellipsisWidth = 0;\n }\n\n contentWidth = containerWidth - ellipsisWidth;\n\n preparedOpts.ellipsis = ellipsis;\n preparedOpts.ellipsisWidth = ellipsisWidth;\n preparedOpts.contentWidth = contentWidth;\n preparedOpts.containerWidth = containerWidth;\n\n return preparedOpts;\n}\n\nfunction truncateSingleLine(\n out: {textLine: string, isTruncated: boolean},\n textLine: string,\n options: InnerPreparedTruncateOption\n): void {\n const containerWidth = options.containerWidth;\n const font = options.font;\n const contentWidth = options.contentWidth;\n\n if (!containerWidth) {\n out.textLine = '';\n out.isTruncated = false;\n return;\n }\n\n let lineWidth = getWidth(textLine, font);\n\n if (lineWidth <= containerWidth) {\n out.textLine = textLine;\n out.isTruncated = false;\n return;\n }\n\n for (let j = 0; ; j++) {\n if (lineWidth <= contentWidth || j >= options.maxIterations) {\n textLine += options.ellipsis;\n break;\n }\n\n const subLength = j === 0\n ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth)\n : lineWidth > 0\n ? Math.floor(textLine.length * contentWidth / lineWidth)\n : 0;\n\n textLine = textLine.substr(0, subLength);\n lineWidth = getWidth(textLine, font);\n }\n\n if (textLine === '') {\n textLine = options.placeholder;\n }\n\n out.textLine = textLine;\n out.isTruncated = true;\n}\n\nfunction estimateLength(\n text: string, contentWidth: number, ascCharWidth: number, cnCharWidth: number\n): number {\n let width = 0;\n let i = 0;\n for (let len = text.length; i < len && width < contentWidth; i++) {\n const charCode = text.charCodeAt(i);\n width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;\n }\n return i;\n}\n\nexport interface PlainTextContentBlock {\n lineHeight: number\n // Line height of actual content.\n calculatedLineHeight: number\n\n contentWidth: number\n contentHeight: number\n\n width: number\n height: number\n\n /**\n * Real text width containing padding.\n * It should be the same as `width` if background is rendered\n * and `width` is set by user.\n */\n outerWidth: number\n outerHeight: number\n\n lines: string[]\n\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`\n isTruncated: boolean\n}\n\nexport function parsePlainText(\n text: string,\n style?: TextStyleProps\n): PlainTextContentBlock {\n text != null && (text += '');\n\n // textPadding has been normalized\n const overflow = style.overflow;\n const padding = style.padding as number[];\n const font = style.font;\n const truncate = overflow === 'truncate';\n const calculatedLineHeight = getLineHeight(font);\n const lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);\n const bgColorDrawn = !!(style.backgroundColor);\n\n const truncateLineOverflow = style.lineOverflow === 'truncate';\n let isTruncated = false;\n\n let width = style.width;\n let lines: string[];\n\n if (width != null && (overflow === 'break' || overflow === 'breakAll')) {\n lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];\n }\n else {\n lines = text ? text.split('\\n') : [];\n }\n\n const contentHeight = lines.length * lineHeight;\n const height = retrieve2(style.height, contentHeight);\n\n // Truncate lines.\n if (contentHeight > height && truncateLineOverflow) {\n const lineCount = Math.floor(height / lineHeight);\n\n isTruncated = isTruncated || (lines.length > lineCount);\n lines = lines.slice(0, lineCount);\n\n // TODO If show ellipse for line truncate\n // if (style.ellipsis) {\n // const options = prepareTruncateOptions(width, font, style.ellipsis, {\n // minChar: style.truncateMinChar,\n // placeholder: style.placeholder\n // });\n // lines[lineCount - 1] = truncateSingleLine(lastLine, options);\n // }\n }\n\n if (text && truncate && width != null) {\n const options = prepareTruncateOptions(width, font, style.ellipsis, {\n minChar: style.truncateMinChar,\n placeholder: style.placeholder\n });\n // Having every line has '...' when truncate multiple lines.\n const singleOut = {} as Parameters[0];\n for (let i = 0; i < lines.length; i++) {\n truncateSingleLine(singleOut, lines[i], options);\n lines[i] = singleOut.textLine;\n isTruncated = isTruncated || singleOut.isTruncated;\n }\n }\n\n // Calculate real text width and height\n let outerHeight = height;\n let contentWidth = 0;\n for (let i = 0; i < lines.length; i++) {\n contentWidth = Math.max(getWidth(lines[i], font), contentWidth);\n }\n if (width == null) {\n // When width is not explicitly set, use outerWidth as width.\n width = contentWidth;\n }\n\n let outerWidth = contentWidth;\n if (padding) {\n outerHeight += padding[0] + padding[2];\n outerWidth += padding[1] + padding[3];\n width += padding[1] + padding[3];\n }\n\n if (bgColorDrawn) {\n // When render background, outerWidth should be the same as width.\n outerWidth = width;\n }\n\n return {\n lines: lines,\n height: height,\n outerWidth: outerWidth,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n calculatedLineHeight: calculatedLineHeight,\n contentWidth: contentWidth,\n contentHeight: contentHeight,\n width: width,\n isTruncated: isTruncated\n };\n}\n\nclass RichTextToken {\n styleName: string\n text: string\n width: number\n height: number\n\n // Inner height exclude padding\n innerHeight: number\n\n // Width and height of actual text content.\n contentHeight: number\n contentWidth: number\n\n lineHeight: number\n font: string\n align: TextAlign\n verticalAlign: TextVerticalAlign\n\n textPadding: number[]\n percentWidth?: string\n\n isLineHolder: boolean\n}\nclass RichTextLine {\n lineHeight: number\n width: number\n tokens: RichTextToken[] = []\n\n constructor(tokens?: RichTextToken[]) {\n if (tokens) {\n this.tokens = tokens;\n }\n }\n}\nexport class RichTextContentBlock {\n // width/height of content\n width: number = 0\n height: number = 0\n // Calculated text height\n contentWidth: number = 0\n contentHeight: number = 0\n // outerWidth/outerHeight with padding\n outerWidth: number = 0\n outerHeight: number = 0\n lines: RichTextLine[] = []\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`\n isTruncated: boolean = false\n}\n\ntype WrapInfo = {\n width: number,\n accumWidth: number,\n breakAll: boolean\n}\n/**\n * For example: 'some text {a|some text}other text{b|some text}xxx{c|}xxx'\n * Also consider 'bbbb{a|xxx\\nzzz}xxxx\\naaaa'.\n * If styleName is undefined, it is plain text.\n */\nexport function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock {\n const contentBlock = new RichTextContentBlock();\n\n text != null && (text += '');\n if (!text) {\n return contentBlock;\n }\n\n const topWidth = style.width;\n const topHeight = style.height;\n const overflow = style.overflow;\n let wrapInfo: WrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null\n ? {width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll'}\n : null;\n\n let lastIndex = STYLE_REG.lastIndex = 0;\n let result;\n while ((result = STYLE_REG.exec(text)) != null) {\n const matchedIndex = result.index;\n if (matchedIndex > lastIndex) {\n pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);\n }\n pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);\n lastIndex = STYLE_REG.lastIndex;\n }\n\n if (lastIndex < text.length) {\n pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);\n }\n\n // For `textWidth: xx%`\n let pendingList = [];\n\n let calculatedHeight = 0;\n let calculatedWidth = 0;\n\n const stlPadding = style.padding as number[];\n\n const truncate = overflow === 'truncate';\n const truncateLine = style.lineOverflow === 'truncate';\n const tmpTruncateOut = {} as Parameters[0];\n\n // let prevToken: RichTextToken;\n\n function finishLine(line: RichTextLine, lineWidth: number, lineHeight: number) {\n line.width = lineWidth;\n line.lineHeight = lineHeight;\n calculatedHeight += lineHeight;\n calculatedWidth = Math.max(calculatedWidth, lineWidth);\n }\n // Calculate layout info of tokens.\n outer: for (let i = 0; i < contentBlock.lines.length; i++) {\n const line = contentBlock.lines[i];\n let lineHeight = 0;\n let lineWidth = 0;\n\n for (let j = 0; j < line.tokens.length; j++) {\n const token = line.tokens[j];\n const tokenStyle = token.styleName && style.rich[token.styleName] || {};\n // textPadding should not inherit from style.\n const textPadding = token.textPadding = tokenStyle.padding as number[];\n const paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;\n\n const font = token.font = tokenStyle.font || style.font;\n\n token.contentHeight = getLineHeight(font);\n // textHeight can be used when textVerticalAlign is specified in token.\n let tokenHeight = retrieve2(\n // textHeight should not be inherited, consider it can be specified\n // as box height of the block.\n tokenStyle.height, token.contentHeight\n );\n token.innerHeight = tokenHeight;\n\n textPadding && (tokenHeight += textPadding[0] + textPadding[2]);\n token.height = tokenHeight;\n // Inlcude padding in lineHeight.\n token.lineHeight = retrieve3(\n tokenStyle.lineHeight, style.lineHeight, tokenHeight\n );\n\n token.align = tokenStyle && tokenStyle.align || style.align;\n token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';\n\n if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {\n // TODO Add ellipsis on the previous token.\n // prevToken.text =\n const originalLength = contentBlock.lines.length;\n if (j > 0) {\n line.tokens = line.tokens.slice(0, j);\n finishLine(line, lineWidth, lineHeight);\n contentBlock.lines = contentBlock.lines.slice(0, i + 1);\n }\n else {\n contentBlock.lines = contentBlock.lines.slice(0, i);\n }\n contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);\n break outer;\n }\n\n let styleTokenWidth = tokenStyle.width;\n let tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === 'auto';\n\n // Percent width, can be `100%`, can be used in drawing separate\n // line when box width is needed to be auto.\n if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {\n token.percentWidth = styleTokenWidth;\n pendingList.push(token);\n\n token.contentWidth = getWidth(token.text, font);\n // Do not truncate in this case, because there is no user case\n // and it is too complicated.\n }\n else {\n if (tokenWidthNotSpecified) {\n // FIXME: If image is not loaded and textWidth is not specified, calling\n // `getBoundingRect()` will not get correct result.\n const textBackgroundColor = tokenStyle.backgroundColor;\n let bgImg = textBackgroundColor && (textBackgroundColor as { image: ImageLike }).image;\n\n if (bgImg) {\n bgImg = imageHelper.findExistImage(bgImg);\n if (imageHelper.isImageReady(bgImg)) {\n // Update token width from image size.\n token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);\n }\n }\n }\n\n const remainTruncWidth = truncate && topWidth != null\n ? topWidth - lineWidth : null;\n\n if (remainTruncWidth != null && remainTruncWidth < token.width) {\n if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {\n token.text = '';\n token.width = token.contentWidth = 0;\n }\n else {\n truncateText2(\n tmpTruncateOut,\n token.text, remainTruncWidth - paddingH, font, style.ellipsis,\n {minChar: style.truncateMinChar}\n );\n token.text = tmpTruncateOut.text;\n contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;\n token.width = token.contentWidth = getWidth(token.text, font);\n }\n }\n else {\n token.contentWidth = getWidth(token.text, font);\n }\n }\n\n token.width += paddingH;\n\n lineWidth += token.width;\n tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));\n\n // prevToken = token;\n }\n\n finishLine(line, lineWidth, lineHeight);\n }\n\n contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);\n contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);\n contentBlock.contentHeight = calculatedHeight;\n contentBlock.contentWidth = calculatedWidth;\n\n if (stlPadding) {\n contentBlock.outerWidth += stlPadding[1] + stlPadding[3];\n contentBlock.outerHeight += stlPadding[0] + stlPadding[2];\n }\n\n for (let i = 0; i < pendingList.length; i++) {\n const token = pendingList[i];\n const percentWidth = token.percentWidth;\n // Should not base on outerWidth, because token can not be placed out of padding.\n token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;\n }\n\n return contentBlock;\n}\n\ntype TokenStyle = TextStyleProps['rich'][string];\n\nfunction pushTokens(\n block: RichTextContentBlock,\n str: string,\n style: TextStyleProps,\n wrapInfo: WrapInfo,\n styleName?: string\n) {\n const isEmptyStr = str === '';\n const tokenStyle: TokenStyle = styleName && style.rich[styleName] || {};\n const lines = block.lines;\n const font = tokenStyle.font || style.font;\n let newLine = false;\n let strLines;\n let linesWidths;\n\n if (wrapInfo) {\n const tokenPadding = tokenStyle.padding as number[];\n let tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;\n if (tokenStyle.width != null && tokenStyle.width !== 'auto') {\n // Wrap the whole token if tokenWidth if fixed.\n const outerWidth = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;\n if (lines.length > 0) { // Not first line\n if (outerWidth + wrapInfo.accumWidth > wrapInfo.width) {\n // TODO Support wrap text in token.\n strLines = str.split('\\n');\n newLine = true;\n }\n }\n\n wrapInfo.accumWidth = outerWidth;\n }\n else {\n const res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);\n wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;\n linesWidths = res.linesWidths;\n strLines = res.lines;\n }\n }\n else {\n strLines = str.split('\\n');\n }\n\n for (let i = 0; i < strLines.length; i++) {\n const text = strLines[i];\n const token = new RichTextToken();\n token.styleName = styleName;\n token.text = text;\n token.isLineHolder = !text && !isEmptyStr;\n\n if (typeof tokenStyle.width === 'number') {\n token.width = tokenStyle.width;\n }\n else {\n token.width = linesWidths\n ? linesWidths[i] // Caculated width in the wrap\n : getWidth(text, font);\n }\n\n // The first token should be appended to the last line if not new line.\n if (!i && !newLine) {\n const tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;\n\n // Consider cases:\n // (1) ''.split('\\n') => ['', '\\n', ''], the '' at the first item\n // (which is a placeholder) should be replaced by new token.\n // (2) A image backage, where token likes {a|}.\n // (3) A redundant '' will affect textAlign in line.\n // (4) tokens with the same tplName should not be merged, because\n // they should be displayed in different box (with border and padding).\n const tokensLen = tokens.length;\n (tokensLen === 1 && tokens[0].isLineHolder)\n ? (tokens[0] = token)\n // Consider text is '', only insert when it is the \"lineHolder\" or\n // \"emptyStr\". Otherwise a redundant '' will affect textAlign in line.\n : ((text || !tokensLen || isEmptyStr) && tokens.push(token));\n }\n // Other tokens always start a new line.\n else {\n // If there is '', insert it as a placeholder.\n lines.push(new RichTextLine([token]));\n }\n }\n}\n\n\nfunction isAlphabeticLetter(ch: string) {\n // Unicode Character Ranges\n // https://jrgraphix.net/research/unicode_blocks.php\n // The following ranges may not cover all letter ranges but only the more\n // popular ones. Developers could make pull requests when they find those\n // not covered.\n let code = ch.charCodeAt(0);\n return code >= 0x20 && code <= 0x24F // Latin\n || code >= 0x370 && code <= 0x10FF // Greek, Coptic, Cyrilic, and etc.\n || code >= 0x1200 && code <= 0x13FF // Ethiopic and Cherokee\n || code >= 0x1E00 && code <= 0x206F; // Latin and Greek extended\n}\n\nconst breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {\n obj[ch] = true;\n return obj;\n}, {} as Dictionary);\n/**\n * If break by word. For latin languages.\n */\nfunction isWordBreakChar(ch: string) {\n if (isAlphabeticLetter(ch)) {\n if (breakCharMap[ch]) {\n return true;\n }\n return false;\n }\n return true;\n}\n\nfunction wrapText(\n text: string,\n font: string,\n lineWidth: number,\n isBreakAll: boolean,\n lastAccumWidth: number\n) {\n let lines: string[] = [];\n let linesWidths: number[] = [];\n let line = '';\n let currentWord = '';\n let currentWordWidth = 0;\n let accumWidth = 0;\n\n for (let i = 0; i < text.length; i++) {\n\n const ch = text.charAt(i);\n if (ch === '\\n') {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n // Reset\n line = '';\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = 0;\n continue;\n }\n\n const chWidth = getWidth(ch, font);\n const inWord = isBreakAll ? false : !isWordBreakChar(ch);\n\n if (!lines.length\n ? lastAccumWidth + accumWidth + chWidth > lineWidth\n : accumWidth + chWidth > lineWidth\n ) {\n if (!accumWidth) { // If nothing appended yet.\n if (inWord) {\n // The word length is still too long for one line\n // Force break the word\n lines.push(currentWord);\n linesWidths.push(currentWordWidth);\n\n currentWord = ch;\n currentWordWidth = chWidth;\n }\n else {\n // lineWidth is too small for ch\n lines.push(ch);\n linesWidths.push(chWidth);\n }\n }\n else if (line || currentWord) {\n if (inWord) {\n if (!line) {\n // The one word is still too long for one line\n // Force break the word\n // TODO Keep the word?\n line = currentWord;\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = currentWordWidth;\n }\n\n lines.push(line);\n linesWidths.push(accumWidth - currentWordWidth);\n\n // Break the whole word\n currentWord += ch;\n currentWordWidth += chWidth;\n line = '';\n accumWidth = currentWordWidth;\n }\n else {\n // Append lastWord if have\n if (currentWord) {\n line += currentWord;\n currentWord = '';\n currentWordWidth = 0;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n\n line = ch;\n accumWidth = chWidth;\n }\n }\n\n continue;\n }\n\n accumWidth += chWidth;\n\n if (inWord) {\n currentWord += ch;\n currentWordWidth += chWidth;\n }\n else {\n // Append whole word\n if (currentWord) {\n line += currentWord;\n // Reset\n currentWord = '';\n currentWordWidth = 0;\n }\n\n // Append character\n line += ch;\n }\n }\n\n if (!lines.length && !line) {\n line = text;\n currentWord = '';\n currentWordWidth = 0;\n }\n\n // Append last line.\n if (currentWord) {\n line += currentWord;\n }\n if (line) {\n lines.push(line);\n linesWidths.push(accumWidth);\n }\n\n if (lines.length === 1) {\n // No new line.\n accumWidth += lastAccumWidth;\n }\n\n return {\n // Accum width of last line\n accumWidth,\n lines: lines,\n linesWidths\n };\n}","/**\n * RichText is a container that manages complex text label.\n * It will parse text string and create sub displayble elements respectively.\n */\nimport { TextAlign, TextVerticalAlign, ImageLike, Dictionary, MapToType, FontWeight, FontStyle } from '../core/types';\nimport { parseRichText, parsePlainText } from './helper/parseText';\nimport TSpan, { TSpanStyleProps } from './TSpan';\nimport { retrieve2, each, normalizeCssArray, trim, retrieve3, extend, keys, defaults } from '../core/util';\nimport { adjustTextX, adjustTextY } from '../contain/text';\nimport ZRImage from './Image';\nimport Rect from './shape/Rect';\nimport BoundingRect from '../core/BoundingRect';\nimport { MatrixArray } from '../core/matrix';\nimport Displayable, {\n DisplayableStatePropNames,\n DisplayableProps,\n DEFAULT_COMMON_ANIMATION_PROPS\n} from './Displayable';\nimport { ZRenderType } from '../zrender';\nimport Animator from '../animation/Animator';\nimport Transformable from '../core/Transformable';\nimport { ElementCommonState } from '../Element';\nimport { GroupLike } from './Group';\nimport { DEFAULT_FONT, DEFAULT_FONT_SIZE } from '../core/platform';\n\ntype TextContentBlock = ReturnType\ntype TextLine = TextContentBlock['lines'][0]\ntype TextToken = TextLine['tokens'][0]\n\n// TODO Default value?\nexport interface TextStylePropsPart {\n // TODO Text is assigned inside zrender\n text?: string\n\n fill?: string\n stroke?: string\n strokeNoScale?: boolean\n\n opacity?: number\n fillOpacity?: number\n strokeOpacity?: number\n /**\n * textStroke may be set as some color as a default\n * value in upper applicaion, where the default value\n * of lineWidth should be 0 to make sure that\n * user can choose to do not use text stroke.\n */\n lineWidth?: number\n lineDash?: false | number[]\n lineDashOffset?: number\n borderDash?: false | number[]\n borderDashOffset?: number\n\n /**\n * If `fontSize` or `fontFamily` exists, `font` will be reset by\n * `fontSize`, `fontStyle`, `fontWeight`, `fontFamily`.\n * So do not visit it directly in upper application (like echarts),\n * but use `contain/text#makeFont` instead.\n */\n font?: string\n /**\n * The same as font. Use font please.\n * @deprecated\n */\n textFont?: string\n\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontStyle?: FontStyle\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontWeight?: FontWeight\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontFamily?: string\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n * Should be 12 but not '12px'.\n */\n fontSize?: number | string\n\n align?: TextAlign\n verticalAlign?: TextVerticalAlign\n\n /**\n * Line height. Default to be text height of '国'\n */\n lineHeight?: number\n /**\n * Width of text block. Not include padding\n * Used for background, truncate, wrap\n */\n width?: number | string\n /**\n * Height of text block. Not include padding\n * Used for background, truncate\n */\n height?: number\n /**\n * Reserved for special functinality, like 'hr'.\n */\n tag?: string\n\n textShadowColor?: string\n textShadowBlur?: number\n textShadowOffsetX?: number\n textShadowOffsetY?: number\n\n // Shadow, background, border of text box.\n backgroundColor?: string | {\n image: ImageLike | string\n }\n\n /**\n * Can be `2` or `[2, 4]` or `[2, 3, 4, 5]`\n */\n padding?: number | number[]\n /**\n * Margin of label. Used when layouting the label.\n */\n margin?: number\n\n borderColor?: string\n borderWidth?: number\n borderRadius?: number | number[]\n\n /**\n * Shadow color for background box.\n */\n shadowColor?: string\n /**\n * Shadow blur for background box.\n */\n shadowBlur?: number\n /**\n * Shadow offset x for background box.\n */\n shadowOffsetX?: number\n /**\n * Shadow offset y for background box.\n */\n shadowOffsetY?: number\n}\nexport interface TextStyleProps extends TextStylePropsPart {\n\n text?: string\n\n x?: number\n y?: number\n\n /**\n * Only support number in the top block.\n */\n width?: number\n /**\n * Text styles for rich text.\n */\n rich?: Dictionary\n\n /**\n * Strategy when calculated text width exceeds textWidth.\n * break: break by word\n * break: will break inside the word\n * truncate: truncate the text and show ellipsis\n * Do nothing if not set\n */\n overflow?: 'break' | 'breakAll' | 'truncate' | 'none'\n\n /**\n * Strategy when text lines exceeds textHeight.\n * Do nothing if not set\n */\n lineOverflow?: 'truncate'\n\n /**\n * Epllipsis used if text is truncated\n */\n ellipsis?: string\n /**\n * Placeholder used if text is truncated to empty\n */\n placeholder?: string\n /**\n * Min characters for truncating\n */\n truncateMinChar?: number\n}\n\nexport interface TextProps extends DisplayableProps {\n style?: TextStyleProps\n\n zlevel?: number\n z?: number\n z2?: number\n\n culling?: boolean\n cursor?: string\n}\n\nexport type TextState = Pick & ElementCommonState\n\nexport type DefaultTextStyle = Pick & {\n autoStroke?: boolean\n};\n\nconst DEFAULT_RICH_TEXT_COLOR = {\n fill: '#000'\n};\nconst DEFAULT_STROKE_LINE_WIDTH = 2;\n\n// const DEFAULT_TEXT_STYLE: TextStyleProps = {\n// x: 0,\n// y: 0,\n// fill: '#000',\n// stroke: null,\n// opacity: 0,\n// fillOpacity:\n// }\n\nexport const DEFAULT_TEXT_ANIMATION_PROPS: MapToType = {\n style: defaults, MapToType>({\n fill: true,\n stroke: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineWidth: true,\n fontSize: true,\n lineHeight: true,\n width: true,\n height: true,\n textShadowColor: true,\n textShadowBlur: true,\n textShadowOffsetX: true,\n textShadowOffsetY: true,\n backgroundColor: true,\n padding: true, // TODO needs normalize padding before animate\n borderColor: true,\n borderWidth: true,\n borderRadius: true // TODO needs normalize radius before animate\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n };\n\n\ninterface ZRText {\n animate(key?: '', loop?: boolean): Animator\n animate(key: 'style', loop?: boolean): Animator\n\n getState(stateName: string): TextState\n ensureState(stateName: string): TextState\n\n states: Dictionary\n stateProxy: (stateName: string) => TextState\n}\n\nclass ZRText extends Displayable implements GroupLike {\n\n type = 'text'\n\n style: TextStyleProps\n\n /**\n * How to handling label overlap\n *\n * hidden:\n */\n overlap: 'hidden' | 'show' | 'blur'\n\n /**\n * Will use this to calculate transform matrix\n * instead of Element itseelf if it's give.\n * Not exposed to developers\n */\n innerTransformable: Transformable\n\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`. Based on this the caller can\n // take some action like showing the original text in a particular tip.\n // Only take effect after rendering. So do not visit it before it.\n isTruncated: boolean\n\n private _children: (ZRImage | Rect | TSpan)[] = []\n\n private _childCursor: 0\n\n private _defaultStyle: DefaultTextStyle = DEFAULT_RICH_TEXT_COLOR\n\n constructor(opts?: TextProps) {\n super();\n this.attr(opts);\n }\n\n childrenRef() {\n return this._children;\n }\n\n update() {\n\n super.update();\n\n // Update children\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n // Set common properties.\n child.zlevel = this.zlevel;\n child.z = this.z;\n child.z2 = this.z2;\n child.culling = this.culling;\n child.cursor = this.cursor;\n child.invisible = this.invisible;\n }\n }\n\n updateTransform() {\n const innerTransformable = this.innerTransformable;\n if (innerTransformable) {\n innerTransformable.updateTransform();\n if (innerTransformable.transform) {\n this.transform = innerTransformable.transform;\n }\n }\n else {\n super.updateTransform();\n }\n }\n\n getLocalTransform(m?: MatrixArray): MatrixArray {\n const innerTransformable = this.innerTransformable;\n return innerTransformable\n ? innerTransformable.getLocalTransform(m)\n : super.getLocalTransform(m);\n }\n\n // TODO override setLocalTransform?\n getComputedTransform() {\n if (this.__hostTarget) {\n // Update host target transform\n this.__hostTarget.getComputedTransform();\n // Update text position.\n this.__hostTarget.updateInnerText(true);\n }\n\n return super.getComputedTransform();\n }\n\n private _updateSubTexts() {\n // Reset child visit cursor\n this._childCursor = 0;\n\n normalizeTextStyle(this.style);\n this.style.rich\n ? this._updateRichTexts()\n : this._updatePlainTexts();\n\n this._children.length = this._childCursor;\n\n this.styleUpdated();\n }\n\n addSelfToZr(zr: ZRenderType) {\n super.addSelfToZr(zr);\n for (let i = 0; i < this._children.length; i++) {\n // Also need mount __zr for case like hover detection.\n // The case: hover on a label (position: 'top') causes host el\n // scaled and label Y position lifts a bit so that out of the\n // pointer, then mouse move should be able to trigger \"mouseout\".\n this._children[i].__zr = zr;\n }\n }\n\n removeSelfFromZr(zr: ZRenderType) {\n super.removeSelfFromZr(zr);\n for (let i = 0; i < this._children.length; i++) {\n this._children[i].__zr = null;\n }\n }\n\n getBoundingRect(): BoundingRect {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n if (!this._rect) {\n // TODO: Optimize when using width and overflow: wrap/truncate\n const tmpRect = new BoundingRect(0, 0, 0, 0);\n const children = this._children;\n const tmpMat: MatrixArray = [];\n let rect = null;\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const childRect = child.getBoundingRect();\n const transform = child.getLocalTransform(tmpMat);\n\n if (transform) {\n tmpRect.copy(childRect);\n tmpRect.applyTransform(transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n this._rect = rect || tmpRect;\n }\n return this._rect;\n }\n\n // Can be set in Element. To calculate text fill automatically when textContent is inside element\n setDefaultTextStyle(defaultTextStyle: DefaultTextStyle) {\n // Use builtin if defaultTextStyle is not given.\n this._defaultStyle = defaultTextStyle || DEFAULT_RICH_TEXT_COLOR;\n }\n\n setTextContent(textContent: never) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Can\\'t attach text on another text');\n }\n }\n\n // getDefaultStyleValue(key: T): TextStyleProps[T] {\n // // Default value is on the prototype.\n // return this.style.prototype[key];\n // }\n\n protected _mergeStyle(targetStyle: TextStyleProps, sourceStyle: TextStyleProps) {\n if (!sourceStyle) {\n return targetStyle;\n }\n\n // DO deep merge on rich configurations.\n const sourceRich = sourceStyle.rich;\n const targetRich = targetStyle.rich || (sourceRich && {}); // Create a new one if source have rich but target don't\n\n extend(targetStyle, sourceStyle);\n\n if (sourceRich && targetRich) {\n // merge rich and assign rich again.\n this._mergeRich(targetRich, sourceRich);\n targetStyle.rich = targetRich;\n }\n else if (targetRich) {\n // If source rich not exists. DON'T override the target rich\n targetStyle.rich = targetRich;\n }\n\n return targetStyle;\n }\n\n private _mergeRich(targetRich: TextStyleProps['rich'], sourceRich: TextStyleProps['rich']) {\n const richNames = keys(sourceRich);\n // Merge by rich names.\n for (let i = 0; i < richNames.length; i++) {\n const richName = richNames[i];\n targetRich[richName] = targetRich[richName] || {};\n extend(targetRich[richName], sourceRich[richName]);\n }\n }\n\n getAnimationStyleProps() {\n return DEFAULT_TEXT_ANIMATION_PROPS;\n }\n\n\n private _getOrCreateChild(Ctor: {new(): TSpan}): TSpan\n private _getOrCreateChild(Ctor: {new(): ZRImage}): ZRImage\n private _getOrCreateChild(Ctor: {new(): Rect}): Rect\n private _getOrCreateChild(Ctor: {new(): TSpan | Rect | ZRImage}): TSpan | Rect | ZRImage {\n let child = this._children[this._childCursor];\n if (!child || !(child instanceof Ctor)) {\n child = new Ctor();\n }\n this._children[this._childCursor++] = child;\n child.__zr = this.__zr;\n // TODO to users parent can only be group.\n child.parent = this as any;\n return child;\n }\n\n private _updatePlainTexts() {\n const style = this.style;\n const textFont = style.font || DEFAULT_FONT;\n const textPadding = style.padding as number[];\n\n const text = getStyleText(style);\n const contentBlock = parsePlainText(text, style);\n const needDrawBg = needDrawBackground(style);\n const bgColorDrawn = !!(style.backgroundColor);\n\n const outerHeight = contentBlock.outerHeight;\n const outerWidth = contentBlock.outerWidth;\n const contentWidth = contentBlock.contentWidth;\n\n const textLines = contentBlock.lines;\n const lineHeight = contentBlock.lineHeight;\n\n const defaultStyle = this._defaultStyle;\n\n this.isTruncated = !!contentBlock.isTruncated;\n\n const baseX = style.x || 0;\n const baseY = style.y || 0;\n const textAlign = style.align || defaultStyle.align || 'left';\n const verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';\n\n let textX = baseX;\n let textY = adjustTextY(baseY, contentBlock.contentHeight, verticalAlign);\n\n if (needDrawBg || textPadding) {\n // Consider performance, do not call getTextWidth util necessary.\n const boxX = adjustTextX(baseX, outerWidth, textAlign);\n const boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n needDrawBg && this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n\n // `textBaseline` is set as 'middle'.\n textY += lineHeight / 2;\n\n if (textPadding) {\n textX = getTextXForPadding(baseX, textAlign, textPadding);\n if (verticalAlign === 'top') {\n textY += textPadding[0];\n }\n else if (verticalAlign === 'bottom') {\n textY -= textPadding[2];\n }\n }\n\n let defaultLineWidth = 0;\n let useDefaultFill = false;\n const textFill = getFill(\n 'fill' in style\n ? style.fill\n : (useDefaultFill = true, defaultStyle.fill)\n );\n const textStroke = getStroke(\n 'stroke' in style\n ? style.stroke\n : (!bgColorDrawn\n // If we use \"auto lineWidth\" widely, it probably bring about some bad case.\n // So the current strategy is:\n // If `style.fill` is specified (i.e., `useDefaultFill` is `false`)\n // (A) And if `textConfig.insideStroke/outsideStroke` is not specified as a color\n // (i.e., `defaultStyle.autoStroke` is `true`), we do not actually display\n // the auto stroke because we can not make sure wether the stoke is approperiate to\n // the given `fill`.\n // (B) But if `textConfig.insideStroke/outsideStroke` is specified as a color,\n // we give the auto lineWidth to display the given stoke color.\n && (!defaultStyle.autoStroke || useDefaultFill)\n )\n ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null\n );\n\n const hasShadow = style.textShadowBlur > 0;\n\n const fixedBoundingRect = style.width != null\n && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');\n const calculatedLineHeight = contentBlock.calculatedLineHeight;\n\n for (let i = 0; i < textLines.length; i++) {\n const el = this._getOrCreateChild(TSpan);\n // Always create new style.\n const subElStyle: TSpanStyleProps = el.createStyle();\n el.useStyle(subElStyle);\n subElStyle.text = textLines[i];\n subElStyle.x = textX;\n subElStyle.y = textY;\n // Always set textAlign and textBase line, because it is difficute to calculate\n // textAlign from prevEl, and we dont sure whether textAlign will be reset if\n // font set happened.\n if (textAlign) {\n subElStyle.textAlign = textAlign;\n }\n // Force baseline to be \"middle\". Otherwise, if using \"top\", the\n // text will offset downward a little bit in font \"Microsoft YaHei\".\n subElStyle.textBaseline = 'middle';\n subElStyle.opacity = style.opacity;\n // Fill after stroke so the outline will not cover the main part.\n subElStyle.strokeFirst = true;\n\n if (hasShadow) {\n subElStyle.shadowBlur = style.textShadowBlur || 0;\n subElStyle.shadowColor = style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = style.textShadowOffsetY || 0;\n }\n\n // Always override default fill and stroke value.\n subElStyle.stroke = textStroke as string;\n subElStyle.fill = textFill as string;\n\n if (textStroke) {\n subElStyle.lineWidth = style.lineWidth || defaultLineWidth;\n subElStyle.lineDash = style.lineDash;\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n }\n\n subElStyle.font = textFont;\n setSeparateFont(subElStyle, style);\n\n textY += lineHeight;\n\n if (fixedBoundingRect) {\n el.setBoundingRect(new BoundingRect(\n adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign as TextAlign),\n adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline as TextVerticalAlign),\n /**\n * Text boundary should be the real text width.\n * Otherwise, there will be extra space in the\n * bounding rect calculated.\n */\n contentWidth,\n calculatedLineHeight\n ));\n }\n }\n }\n\n\n private _updateRichTexts() {\n const style = this.style;\n\n // TODO Only parse when text changed?\n const text = getStyleText(style);\n const contentBlock = parseRichText(text, style);\n\n const contentWidth = contentBlock.width;\n const outerWidth = contentBlock.outerWidth;\n const outerHeight = contentBlock.outerHeight;\n const textPadding = style.padding as number[];\n\n const baseX = style.x || 0;\n const baseY = style.y || 0;\n const defaultStyle = this._defaultStyle;\n const textAlign = style.align || defaultStyle.align;\n const verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;\n\n this.isTruncated = !!contentBlock.isTruncated;\n\n const boxX = adjustTextX(baseX, outerWidth, textAlign);\n const boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n let xLeft = boxX;\n let lineTop = boxY;\n\n if (textPadding) {\n xLeft += textPadding[3];\n lineTop += textPadding[0];\n }\n\n let xRight = xLeft + contentWidth;\n\n if (needDrawBackground(style)) {\n this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n const bgColorDrawn = !!(style.backgroundColor);\n\n for (let i = 0; i < contentBlock.lines.length; i++) {\n const line = contentBlock.lines[i];\n const tokens = line.tokens;\n const tokenCount = tokens.length;\n const lineHeight = line.lineHeight;\n\n let remainedWidth = line.width;\n let leftIndex = 0;\n let lineXLeft = xLeft;\n let lineXRight = xRight;\n let rightIndex = tokenCount - 1;\n let token;\n\n while (\n leftIndex < tokenCount\n && (token = tokens[leftIndex], !token.align || token.align === 'left')\n ) {\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft, 'left', bgColorDrawn);\n remainedWidth -= token.width;\n lineXLeft += token.width;\n leftIndex++;\n }\n\n while (\n rightIndex >= 0\n && (token = tokens[rightIndex], token.align === 'right')\n ) {\n this._placeToken(token, style, lineHeight, lineTop, lineXRight, 'right', bgColorDrawn);\n remainedWidth -= token.width;\n lineXRight -= token.width;\n rightIndex--;\n }\n\n // The other tokens are placed as textAlign 'center' if there is enough space.\n lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - remainedWidth) / 2;\n while (leftIndex <= rightIndex) {\n token = tokens[leftIndex];\n // Consider width specified by user, use 'center' rather than 'left'.\n this._placeToken(\n token, style, lineHeight, lineTop,\n lineXLeft + token.width / 2, 'center', bgColorDrawn\n );\n lineXLeft += token.width;\n leftIndex++;\n }\n\n lineTop += lineHeight;\n }\n }\n\n private _placeToken(\n token: TextToken,\n style: TextStyleProps,\n lineHeight: number,\n lineTop: number,\n x: number,\n textAlign: string,\n parentBgColorDrawn: boolean\n ) {\n const tokenStyle = style.rich[token.styleName] || {};\n tokenStyle.text = token.text;\n\n // 'ctx.textBaseline' is always set as 'middle', for sake of\n // the bias of \"Microsoft YaHei\".\n const verticalAlign = token.verticalAlign;\n let y = lineTop + lineHeight / 2;\n if (verticalAlign === 'top') {\n y = lineTop + token.height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y = lineTop + lineHeight - token.height / 2;\n }\n\n const needDrawBg = !token.isLineHolder && needDrawBackground(tokenStyle);\n needDrawBg && this._renderBackground(\n tokenStyle,\n style,\n textAlign === 'right'\n ? x - token.width\n : textAlign === 'center'\n ? x - token.width / 2\n : x,\n y - token.height / 2,\n token.width,\n token.height\n );\n const bgColorDrawn = !!tokenStyle.backgroundColor;\n\n const textPadding = token.textPadding;\n if (textPadding) {\n x = getTextXForPadding(x, textAlign, textPadding);\n y -= token.height / 2 - textPadding[0] - token.innerHeight / 2;\n }\n\n const el = this._getOrCreateChild(TSpan);\n const subElStyle: TSpanStyleProps = el.createStyle();\n // Always create new style.\n el.useStyle(subElStyle);\n\n const defaultStyle = this._defaultStyle;\n let useDefaultFill = false;\n let defaultLineWidth = 0;\n const textFill = getFill(\n 'fill' in tokenStyle ? tokenStyle.fill\n : 'fill' in style ? style.fill\n : (useDefaultFill = true, defaultStyle.fill)\n );\n const textStroke = getStroke(\n 'stroke' in tokenStyle ? tokenStyle.stroke\n : 'stroke' in style ? style.stroke\n : (\n !bgColorDrawn\n && !parentBgColorDrawn\n // See the strategy explained above.\n && (!defaultStyle.autoStroke || useDefaultFill)\n ) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null\n );\n\n const hasShadow = tokenStyle.textShadowBlur > 0\n || style.textShadowBlur > 0;\n\n subElStyle.text = token.text;\n subElStyle.x = x;\n subElStyle.y = y;\n if (hasShadow) {\n subElStyle.shadowBlur = tokenStyle.textShadowBlur || style.textShadowBlur || 0;\n subElStyle.shadowColor = tokenStyle.textShadowColor || style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = tokenStyle.textShadowOffsetX || style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = tokenStyle.textShadowOffsetY || style.textShadowOffsetY || 0;\n }\n\n subElStyle.textAlign = textAlign as CanvasTextAlign;\n // Force baseline to be \"middle\". Otherwise, if using \"top\", the\n // text will offset downward a little bit in font \"Microsoft YaHei\".\n subElStyle.textBaseline = 'middle';\n subElStyle.font = token.font || DEFAULT_FONT;\n subElStyle.opacity = retrieve3(tokenStyle.opacity, style.opacity, 1);\n\n\n // TODO inherit each item from top style in token style?\n setSeparateFont(subElStyle, tokenStyle);\n\n if (textStroke) {\n subElStyle.lineWidth = retrieve3(tokenStyle.lineWidth, style.lineWidth, defaultLineWidth);\n subElStyle.lineDash = retrieve2(tokenStyle.lineDash, style.lineDash);\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n subElStyle.stroke = textStroke;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n\n const textWidth = token.contentWidth;\n const textHeight = token.contentHeight;\n // NOTE: Should not call dirtyStyle after setBoundingRect. Or it will be cleared.\n el.setBoundingRect(new BoundingRect(\n adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign as TextAlign),\n adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline as TextVerticalAlign),\n textWidth,\n textHeight\n ));\n }\n\n private _renderBackground(\n style: TextStylePropsPart,\n topStyle: TextStylePropsPart,\n x: number,\n y: number,\n width: number,\n height: number\n ) {\n const textBackgroundColor = style.backgroundColor;\n const textBorderWidth = style.borderWidth;\n const textBorderColor = style.borderColor;\n const isImageBg = textBackgroundColor && (textBackgroundColor as {image: ImageLike}).image;\n const isPlainOrGradientBg = textBackgroundColor && !isImageBg;\n const textBorderRadius = style.borderRadius;\n const self = this;\n\n let rectEl: Rect;\n let imgEl: ZRImage;\n if (isPlainOrGradientBg || style.lineHeight || (textBorderWidth && textBorderColor)) {\n // Background is color\n rectEl = this._getOrCreateChild(Rect);\n rectEl.useStyle(rectEl.createStyle()); // Create an empty style.\n rectEl.style.fill = null;\n const rectShape = rectEl.shape;\n rectShape.x = x;\n rectShape.y = y;\n rectShape.width = width;\n rectShape.height = height;\n rectShape.r = textBorderRadius;\n rectEl.dirtyShape();\n }\n\n if (isPlainOrGradientBg) {\n const rectStyle = rectEl.style;\n rectStyle.fill = textBackgroundColor as string || null;\n rectStyle.fillOpacity = retrieve2(style.fillOpacity, 1);\n }\n else if (isImageBg) {\n imgEl = this._getOrCreateChild(ZRImage);\n imgEl.onload = function () {\n // Refresh and relayout after image loaded.\n self.dirtyStyle();\n };\n const imgStyle = imgEl.style;\n imgStyle.image = (textBackgroundColor as {image: ImageLike}).image;\n imgStyle.x = x;\n imgStyle.y = y;\n imgStyle.width = width;\n imgStyle.height = height;\n }\n\n if (textBorderWidth && textBorderColor) {\n const rectStyle = rectEl.style;\n rectStyle.lineWidth = textBorderWidth;\n rectStyle.stroke = textBorderColor;\n rectStyle.strokeOpacity = retrieve2(style.strokeOpacity, 1);\n rectStyle.lineDash = style.borderDash;\n rectStyle.lineDashOffset = style.borderDashOffset || 0;\n rectEl.strokeContainThreshold = 0;\n\n // Making shadow looks better.\n if (rectEl.hasFill() && rectEl.hasStroke()) {\n rectStyle.strokeFirst = true;\n rectStyle.lineWidth *= 2;\n }\n }\n\n const commonStyle = (rectEl || imgEl).style;\n commonStyle.shadowBlur = style.shadowBlur || 0;\n commonStyle.shadowColor = style.shadowColor || 'transparent';\n commonStyle.shadowOffsetX = style.shadowOffsetX || 0;\n commonStyle.shadowOffsetY = style.shadowOffsetY || 0;\n commonStyle.opacity = retrieve3(style.opacity, topStyle.opacity, 1);\n }\n\n static makeFont(style: TextStylePropsPart): string {\n // FIXME in node-canvas fontWeight is before fontStyle\n // Use `fontSize` `fontFamily` to check whether font properties are defined.\n let font = '';\n if (hasSeparateFont(style)) {\n font = [\n style.fontStyle,\n style.fontWeight,\n parseFontSize(style.fontSize),\n // If font properties are defined, `fontFamily` should not be ignored.\n style.fontFamily || 'sans-serif'\n ].join(' ');\n }\n return font && trim(font) || style.textFont || style.font;\n }\n}\n\n\nconst VALID_TEXT_ALIGN = {left: true, right: 1, center: 1};\nconst VALID_TEXT_VERTICAL_ALIGN = {top: 1, bottom: 1, middle: 1};\n\nconst FONT_PARTS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily'] as const;\n\nexport function parseFontSize(fontSize: number | string) {\n if (\n typeof fontSize === 'string'\n && (\n fontSize.indexOf('px') !== -1\n || fontSize.indexOf('rem') !== -1\n || fontSize.indexOf('em') !== -1\n )\n ) {\n return fontSize;\n }\n else if (!isNaN(+fontSize)) {\n return fontSize + 'px';\n }\n else {\n return DEFAULT_FONT_SIZE + 'px';\n }\n}\n\nfunction setSeparateFont(\n targetStyle: TSpanStyleProps,\n sourceStyle: TextStylePropsPart\n) {\n for (let i = 0; i < FONT_PARTS.length; i++) {\n const fontProp = FONT_PARTS[i];\n const val = sourceStyle[fontProp];\n if (val != null) {\n (targetStyle as any)[fontProp] = val;\n }\n }\n}\n\nexport function hasSeparateFont(style: Pick) {\n return style.fontSize != null || style.fontFamily || style.fontWeight;\n}\n\nexport function normalizeTextStyle(style: TextStyleProps): TextStyleProps {\n normalizeStyle(style);\n // TODO inherit each item from top style in token style?\n each(style.rich, normalizeStyle);\n return style;\n}\n\nfunction normalizeStyle(style: TextStylePropsPart) {\n if (style) {\n style.font = ZRText.makeFont(style);\n let textAlign = style.align;\n // 'middle' is invalid, convert it to 'center'\n (textAlign as string) === 'middle' && (textAlign = 'center');\n style.align = (\n textAlign == null || VALID_TEXT_ALIGN[textAlign]\n ) ? textAlign : 'left';\n\n // Compatible with textBaseline.\n let verticalAlign = style.verticalAlign;\n (verticalAlign as string) === 'center' && (verticalAlign = 'middle');\n style.verticalAlign = (\n verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign]\n ) ? verticalAlign : 'top';\n\n // TODO Should not change the orignal value.\n const textPadding = style.padding;\n if (textPadding) {\n style.padding = normalizeCssArray(style.padding);\n }\n }\n}\n\n/**\n * @param stroke If specified, do not check style.textStroke.\n * @param lineWidth If specified, do not check style.textStroke.\n */\nfunction getStroke(\n stroke?: TextStylePropsPart['stroke'],\n lineWidth?: number\n) {\n return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')\n ? null\n : ((stroke as any).image || (stroke as any).colorStops)\n ? '#000'\n : stroke;\n}\n\nfunction getFill(\n fill?: TextStylePropsPart['fill']\n) {\n return (fill == null || fill === 'none')\n ? null\n // TODO pattern and gradient?\n : ((fill as any).image || (fill as any).colorStops)\n ? '#000'\n : fill;\n}\n\nfunction getTextXForPadding(x: number, textAlign: string, textPadding: number[]): number {\n return textAlign === 'right'\n ? (x - textPadding[1])\n : textAlign === 'center'\n ? (x + textPadding[3] / 2 - textPadding[1] / 2)\n : (x + textPadding[3]);\n}\n\nfunction getStyleText(style: TextStylePropsPart): string {\n // Compat: set number to text is supported.\n // set null/undefined to text is supported.\n let text = style.text;\n text != null && (text += '');\n return text;\n}\n\n/**\n * If needs draw background\n * @param style Style of element\n */\nfunction needDrawBackground(style: TextStylePropsPart): boolean {\n return !!(\n style.backgroundColor\n || style.lineHeight\n || (style.borderWidth && style.borderColor)\n );\n}\n\nexport default ZRText;","/**\r\n * 圆弧\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class ArcShape {\r\n cx = 0;\r\n cy = 0;\r\n r = 0;\r\n startAngle = 0;\r\n endAngle = Math.PI * 2\r\n clockwise? = true\r\n}\r\n\r\nexport interface ArcProps extends PathProps {\r\n shape?: Partial\r\n}\r\n\r\nclass Arc extends Path {\r\n\r\n shape: ArcShape\r\n\r\n constructor(opts?: ArcProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new ArcShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: ArcShape) {\r\n\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const r = Math.max(shape.r, 0);\r\n const startAngle = shape.startAngle;\r\n const endAngle = shape.endAngle;\r\n const clockwise = shape.clockwise;\r\n\r\n const unitX = Math.cos(startAngle);\r\n const unitY = Math.sin(startAngle);\r\n\r\n ctx.moveTo(unitX * r + x, unitY * r + y);\r\n ctx.arc(x, y, r, startAngle, endAngle, !clockwise);\r\n }\r\n}\r\n\r\nArc.prototype.type = 'arc';\r\n\r\nexport default Arc;","/**\r\n * 贝塞尔曲线\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as vec2 from '../../core/vector';\r\nimport {\r\n quadraticSubdivide,\r\n cubicSubdivide,\r\n quadraticAt,\r\n cubicAt,\r\n quadraticDerivativeAt,\r\n cubicDerivativeAt\r\n} from '../../core/curve';\r\n\r\nconst out: number[] = [];\r\n\r\nexport class BezierCurveShape {\r\n x1 = 0\r\n y1 = 0\r\n x2 = 0\r\n y2 = 0\r\n cpx1 = 0\r\n cpy1 = 0\r\n cpx2?: number\r\n cpy2?: number\r\n // Curve show percent, for animating\r\n percent = 1\r\n}\r\n\r\nfunction someVectorAt(shape: BezierCurveShape, t: number, isTangent: boolean) {\r\n const cpx2 = shape.cpx2;\r\n const cpy2 = shape.cpy2;\r\n if (cpx2 != null || cpy2 != null) {\r\n return [\r\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),\r\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)\r\n ];\r\n }\r\n else {\r\n return [\r\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),\r\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)\r\n ];\r\n }\r\n}\r\n\r\nexport interface BezierCurveProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass BezierCurve extends Path {\r\n\r\n shape: BezierCurveShape\r\n\r\n constructor(opts?: BezierCurveProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new BezierCurveShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: BezierCurveShape) {\r\n let x1 = shape.x1;\r\n let y1 = shape.y1;\r\n let x2 = shape.x2;\r\n let y2 = shape.y2;\r\n let cpx1 = shape.cpx1;\r\n let cpy1 = shape.cpy1;\r\n let cpx2 = shape.cpx2;\r\n let cpy2 = shape.cpy2;\r\n let percent = shape.percent;\r\n if (percent === 0) {\r\n return;\r\n }\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n if (cpx2 == null || cpy2 == null) {\r\n if (percent < 1) {\r\n quadraticSubdivide(x1, cpx1, x2, percent, out);\r\n cpx1 = out[1];\r\n x2 = out[2];\r\n quadraticSubdivide(y1, cpy1, y2, percent, out);\r\n cpy1 = out[1];\r\n y2 = out[2];\r\n }\r\n\r\n ctx.quadraticCurveTo(\r\n cpx1, cpy1,\r\n x2, y2\r\n );\r\n }\r\n else {\r\n if (percent < 1) {\r\n cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);\r\n cpx1 = out[1];\r\n cpx2 = out[2];\r\n x2 = out[3];\r\n cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);\r\n cpy1 = out[1];\r\n cpy2 = out[2];\r\n y2 = out[3];\r\n }\r\n ctx.bezierCurveTo(\r\n cpx1, cpy1,\r\n cpx2, cpy2,\r\n x2, y2\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get point at percent\r\n */\r\n pointAt(t: number) {\r\n return someVectorAt(this.shape, t, false);\r\n }\r\n\r\n /**\r\n * Get tangent at percent\r\n */\r\n tangentAt(t: number) {\r\n const p = someVectorAt(this.shape, t, true);\r\n return vec2.normalize(p, p);\r\n }\r\n};\r\n\r\nBezierCurve.prototype.type = 'bezier-curve';\r\n\r\nexport default BezierCurve;\r\n","/**\r\n * 水滴形状\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class DropletShape {\r\n cx = 0\r\n cy = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface DropletProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Droplet extends Path {\r\n\r\n shape: DropletShape\r\n\r\n constructor(opts?: DropletProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new DropletShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: DropletShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.width;\r\n const b = shape.height;\r\n\r\n ctx.moveTo(x, y + a);\r\n ctx.bezierCurveTo(\r\n x + a,\r\n y + a,\r\n x + a * 3 / 2,\r\n y - a / 3,\r\n x,\r\n y - b\r\n );\r\n ctx.bezierCurveTo(\r\n x - a * 3 / 2,\r\n y - a / 3,\r\n x - a,\r\n y + a,\r\n x,\r\n y + a\r\n );\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nDroplet.prototype.type = 'droplet';\r\n\r\nexport default Droplet;\r\n","/**\r\n * 心形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class HeartShape {\r\n cx = 0\r\n cy = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface HeartProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Heart extends Path {\r\n\r\n shape: HeartShape\r\n\r\n constructor(opts?: HeartProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new HeartShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: HeartShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.width;\r\n const b = shape.height;\r\n ctx.moveTo(x, y);\r\n ctx.bezierCurveTo(\r\n x + a / 2, y - b * 2 / 3,\r\n x + a * 2, y + b / 3,\r\n x, y + b\r\n );\r\n ctx.bezierCurveTo(\r\n x - a * 2, y + b / 3,\r\n x - a / 2, y - b * 2 / 3,\r\n x, y\r\n );\r\n }\r\n}\r\n\r\n\r\nHeart.prototype.type = 'heart';\r\n\r\nexport default Heart;","/**\r\n * 正多边形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst PI = Math.PI;\r\nconst sin = Math.sin;\r\nconst cos = Math.cos;\r\n\r\nexport class IsogonShape {\r\n x = 0\r\n y = 0\r\n r = 0\r\n n = 0\r\n}\r\n\r\nexport interface IsogonProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Isogon extends Path {\r\n\r\n shape: IsogonShape\r\n\r\n constructor(opts?: IsogonProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new IsogonShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: IsogonShape) {\r\n const n = shape.n;\r\n if (!n || n < 2) {\r\n return;\r\n }\r\n\r\n const x = shape.x;\r\n const y = shape.y;\r\n const r = shape.r;\r\n\r\n const dStep = 2 * PI / n;\r\n let deg = -PI / 2;\r\n\r\n ctx.moveTo(x + r * cos(deg), y + r * sin(deg));\r\n for (let i = 0, end = n - 1; i < end; i++) {\r\n deg += dStep;\r\n ctx.lineTo(x + r * cos(deg), y + r * sin(deg));\r\n }\r\n\r\n ctx.closePath();\r\n\r\n return;\r\n }\r\n}\r\n\r\nIsogon.prototype.type = 'isogon';\r\n\r\nexport default Isogon;\r\n","/**\r\n * 圆环\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class RingShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n r0 = 0\r\n}\r\n\r\nexport interface RingProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Ring extends Path {\r\n\r\n shape: RingShape\r\n\r\n constructor(opts?: RingProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new RingShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RingShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const PI2 = Math.PI * 2;\r\n ctx.moveTo(x + shape.r, y);\r\n ctx.arc(x, y, shape.r, 0, PI2, false);\r\n ctx.moveTo(x + shape.r0, y);\r\n ctx.arc(x, y, shape.r0, 0, PI2, true);\r\n }\r\n}\r\n\r\nRing.prototype.type = 'ring';\r\nexport default Ring;","/**\r\n * 玫瑰线\r\n * @module zrender/graphic/shape/Rose\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst sin = Math.sin;\r\nconst cos = Math.cos;\r\nconst radian = Math.PI / 180;\r\n\r\nexport class RoseShape {\r\n cx = 0\r\n cy = 0\r\n r: number[] = []\r\n k = 0\r\n n = 1\r\n}\r\n\r\nexport interface RoseProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Rose extends Path {\r\n\r\n shape: RoseShape\r\n\r\n constructor(opts?: RoseProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new RoseShape();\r\n }\r\n\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RoseShape) {\r\n const R = shape.r;\r\n const k = shape.k;\r\n const n = shape.n;\r\n const x0 = shape.cx;\r\n const y0 = shape.cy;\r\n let x;\r\n let y;\r\n let r;\r\n\r\n\r\n ctx.moveTo(x0, y0);\r\n\r\n for (let i = 0, len = R.length; i < len; i++) {\r\n r = R[i];\r\n\r\n for (let j = 0; j <= 360 * n; j++) {\r\n x = r\r\n * sin(k / n * j % 360 * radian)\r\n * cos(j * radian)\r\n + x0;\r\n y = r\r\n * sin(k / n * j % 360 * radian)\r\n * sin(j * radian)\r\n + y0;\r\n ctx.lineTo(x, y);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRose.prototype.type = 'rose';\r\n\r\nexport default Rose;","/**\r\n * n角星(n>3)\r\n * @module zrender/graphic/shape/Star\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst PI = Math.PI;\r\nconst cos = Math.cos;\r\nconst sin = Math.sin;\r\n\r\nexport class StarShape {\r\n cx = 0\r\n cy = 0\r\n n = 3\r\n r0: number\r\n r = 0\r\n}\r\n\r\nexport interface StarProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Star extends Path {\r\n\r\n shape: StarShape\r\n\r\n constructor(opts?: StarProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new StarShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: StarShape) {\r\n\r\n const n = shape.n;\r\n if (!n || n < 2) {\r\n return;\r\n }\r\n\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const r = shape.r;\r\n let r0 = shape.r0;\r\n\r\n // 如果未指定内部顶点外接圆半径,则自动计算\r\n if (r0 == null) {\r\n r0 = n > 4\r\n // 相隔的外部顶点的连线的交点,\r\n // 被取为内部交点,以此计算r0\r\n ? r * cos(2 * PI / n) / cos(PI / n)\r\n // 二三四角星的特殊处理\r\n : r / 3;\r\n }\r\n\r\n const dStep = PI / n;\r\n let deg = -PI / 2;\r\n const xStart = x + r * cos(deg);\r\n const yStart = y + r * sin(deg);\r\n deg += dStep;\r\n\r\n // 记录边界点,用于判断inside\r\n ctx.moveTo(xStart, yStart);\r\n for (let i = 0, end = n * 2 - 1, ri; i < end; i++) {\r\n ri = i % 2 === 0 ? r0 : r;\r\n ctx.lineTo(x + ri * cos(deg), y + ri * sin(deg));\r\n deg += dStep;\r\n }\r\n\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nStar.prototype.type = 'star';\r\nexport default Star;","/**\r\n * 内外旋轮曲线\r\n * @module zrender/graphic/shape/Trochold\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst cos = Math.cos;\r\nconst sin = Math.sin;\r\n\r\nexport class TrochoidShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n r0 = 0\r\n d = 0\r\n location = 'out'\r\n}\r\n\r\nexport interface TrochoidProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Trochoid extends Path {\r\n\r\n shape: TrochoidShape\r\n\r\n constructor(opts?: TrochoidProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new TrochoidShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: TrochoidShape) {\r\n const R = shape.r;\r\n const r = shape.r0;\r\n const d = shape.d;\r\n const offsetX = shape.cx;\r\n const offsetY = shape.cy;\r\n const delta = shape.location === 'out' ? 1 : -1;\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n if (shape.location && R <= r) {\r\n return;\r\n }\r\n\r\n let num = 0;\r\n let i = 1;\r\n let theta;\r\n\r\n x1 = (R + delta * r) * cos(0)\r\n - delta * d * cos(0) + offsetX;\r\n y1 = (R + delta * r) * sin(0)\r\n - d * sin(0) + offsetY;\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n // 计算结束时的i\r\n do {\r\n num++;\r\n }\r\n while ((r * num) % (R + delta * r) !== 0);\r\n\r\n do {\r\n theta = Math.PI / 180 * i;\r\n x2 = (R + delta * r) * cos(theta)\r\n - delta * d * cos((R / r + delta) * theta)\r\n + offsetX;\r\n y2 = (R + delta * r) * sin(theta)\r\n - d * sin((R / r + delta) * theta)\r\n + offsetY;\r\n ctx.lineTo(x2, y2);\r\n i++;\r\n }\r\n while (i <= (r * num) / (R + delta * r) * 360);\r\n\r\n }\r\n}\r\n\r\nTrochoid.prototype.type = 'trochoid';\r\nexport default Trochoid;","import { ImageLike } from '../core/types';\r\nimport { SVGVNode } from '../svg/core';\r\n\r\ntype ImagePatternRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'\r\n\r\nexport interface PatternObjectBase {\r\n id?: number\r\n // type is now unused, so make it optional\r\n type?: 'pattern'\r\n\r\n x?: number\r\n y?: number\r\n rotation?: number\r\n scaleX?: number\r\n scaleY?: number\r\n}\r\n\r\nexport interface ImagePatternObject extends PatternObjectBase {\r\n image: ImageLike | string\r\n repeat?: ImagePatternRepeat\r\n\r\n /**\r\n * Width and height of image.\r\n * `imageWidth` and `imageHeight` are only used in svg-ssr renderer.\r\n * Because we can't get the size of image in svg-ssr renderer.\r\n * They need to be give explictly.\r\n */\r\n imageWidth?: number\r\n imageHeight?: number\r\n}\r\n\r\nexport interface InnerImagePatternObject extends ImagePatternObject {\r\n // Cached image. Which is created in the canvas painter.\r\n __image?: ImageLike\r\n}\r\n\r\nexport interface SVGPatternObject extends PatternObjectBase {\r\n /**\r\n * svg vnode can only be used in svg renderer currently.\r\n * svgWidth, svgHeight defines width and height used for pattern.\r\n */\r\n svgElement?: SVGVNode\r\n svgWidth?: number\r\n svgHeight?: number\r\n}\r\n\r\nexport type PatternObject = ImagePatternObject | SVGPatternObject\r\n\r\nclass Pattern {\r\n\r\n type: 'pattern'\r\n\r\n image: ImageLike | string\r\n /**\r\n * svg element can only be used in svg renderer currently.\r\n *\r\n * Will be string if using SSR rendering.\r\n */\r\n svgElement: SVGElement | string\r\n\r\n repeat: ImagePatternRepeat\r\n\r\n x: number\r\n y: number\r\n rotation: number\r\n scaleX: number\r\n scaleY: number\r\n\r\n constructor(image: ImageLike | string, repeat: ImagePatternRepeat) {\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {image: ...}`, where this constructor will not be called.\r\n this.image = image;\r\n this.repeat = repeat;\r\n\r\n this.x = 0;\r\n this.y = 0;\r\n this.rotation = 0;\r\n this.scaleX = 1;\r\n this.scaleY = 1;\r\n }\r\n}\r\n\r\nexport default Pattern;","/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\r\n\r\nimport Point, { PointLike } from './Point';\r\nimport BoundingRect from './BoundingRect';\r\nimport { MatrixArray } from './matrix';\r\n\r\nconst extent = [0, 0];\r\nconst extent2 = [0, 0];\r\n\r\nconst minTv = new Point();\r\nconst maxTv = new Point();\r\n\r\nclass OrientedBoundingRect {\r\n\r\n // lt, rt, rb, lb\r\n private _corners: Point[] = [];\r\n\r\n private _axes: Point[] = [];\r\n\r\n private _origin: number[] = [0, 0];\r\n\r\n constructor(rect?: BoundingRect, transform?: MatrixArray) {\r\n for (let i = 0; i < 4; i++) {\r\n this._corners[i] = new Point();\r\n }\r\n for (let i = 0; i < 2; i++) {\r\n this._axes[i] = new Point();\r\n }\r\n\r\n if (rect) {\r\n this.fromBoundingRect(rect, transform);\r\n }\r\n }\r\n\r\n fromBoundingRect(rect: BoundingRect, transform?: MatrixArray) {\r\n const corners = this._corners;\r\n const axes = this._axes;\r\n const x = rect.x;\r\n const y = rect.y;\r\n const x2 = x + rect.width;\r\n const y2 = y + rect.height;\r\n corners[0].set(x, y);\r\n corners[1].set(x2, y);\r\n corners[2].set(x2, y2);\r\n corners[3].set(x, y2);\r\n\r\n if (transform) {\r\n for (let i = 0; i < 4; i++) {\r\n corners[i].transform(transform);\r\n }\r\n }\r\n\r\n // Calculate axes\r\n Point.sub(axes[0], corners[1], corners[0]);\r\n Point.sub(axes[1], corners[3], corners[0]);\r\n axes[0].normalize();\r\n axes[1].normalize();\r\n\r\n // Calculate projected origin\r\n for (let i = 0; i < 2; i++) {\r\n this._origin[i] = axes[i].dot(corners[0]);\r\n }\r\n }\r\n\r\n /**\r\n * If intersect with another OBB\r\n * @param other Bounding rect to be intersected with\r\n * @param mtv Calculated .\r\n * If it's not overlapped. it means needs to move given rect with Maximum Translation Vector to be overlapped.\r\n * Else it means needs to move given rect with Minimum Translation Vector to be not overlapped.\r\n */\r\n intersect(other: OrientedBoundingRect, mtv?: PointLike): boolean {\r\n // OBB collision with SAT method\r\n\r\n let overlapped = true;\r\n const noMtv = !mtv;\r\n minTv.set(Infinity, Infinity);\r\n maxTv.set(0, 0);\r\n // Check two axes for both two obb.\r\n if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {\r\n overlapped = false;\r\n if (noMtv) {\r\n // Early return if no need to calculate mtv\r\n return overlapped;\r\n }\r\n }\r\n if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {\r\n overlapped = false;\r\n if (noMtv) {\r\n return overlapped;\r\n }\r\n }\r\n\r\n if (!noMtv) {\r\n Point.copy(mtv, overlapped ? minTv : maxTv);\r\n }\r\n\r\n return overlapped;\r\n }\r\n\r\n\r\n private _intersectCheckOneSide(\r\n self: OrientedBoundingRect,\r\n other: OrientedBoundingRect,\r\n minTv: Point,\r\n maxTv: Point,\r\n noMtv: boolean,\r\n inverse: 1 | -1\r\n ): boolean {\r\n let overlapped = true;\r\n for (let i = 0; i < 2; i++) {\r\n const axis = this._axes[i];\r\n this._getProjMinMaxOnAxis(i, self._corners, extent);\r\n this._getProjMinMaxOnAxis(i, other._corners, extent2);\r\n\r\n // Not overlap on the any axis.\r\n if (extent[1] < extent2[0] || extent[0] > extent2[1]) {\r\n overlapped = false;\r\n if (noMtv) {\r\n return overlapped;\r\n }\r\n const dist0 = Math.abs(extent2[0] - extent[1]);\r\n const dist1 = Math.abs(extent[0] - extent2[1]);\r\n\r\n // Find longest distance of all axes.\r\n if (Math.min(dist0, dist1) > maxTv.len()) {\r\n if (dist0 < dist1) {\r\n Point.scale(maxTv, axis, -dist0 * inverse);\r\n }\r\n else {\r\n Point.scale(maxTv, axis, dist1 * inverse);\r\n }\r\n }\r\n }\r\n else if (minTv) {\r\n const dist0 = Math.abs(extent2[0] - extent[1]);\r\n const dist1 = Math.abs(extent[0] - extent2[1]);\r\n\r\n if (Math.min(dist0, dist1) < minTv.len()) {\r\n if (dist0 < dist1) {\r\n Point.scale(minTv, axis, dist0 * inverse);\r\n }\r\n else {\r\n Point.scale(minTv, axis, -dist1 * inverse);\r\n }\r\n }\r\n }\r\n }\r\n return overlapped;\r\n }\r\n\r\n private _getProjMinMaxOnAxis(dim: number, corners: Point[], out: number[]) {\r\n const axis = this._axes[dim];\r\n const origin = this._origin;\r\n const proj = corners[0].dot(axis) + origin[dim];\r\n let min = proj;\r\n let max = proj;\r\n\r\n for (let i = 1; i < corners.length; i++) {\r\n const proj = corners[i].dot(axis) + origin[dim];\r\n min = Math.min(proj, min);\r\n max = Math.max(proj, max);\r\n }\r\n\r\n out[0] = min;\r\n out[1] = max;\r\n }\r\n}\r\n\r\nexport default OrientedBoundingRect;","import type { ZRenderType } from '../zrender';\r\nimport type CanvasPainter from '../canvas/Painter';\r\nimport type BoundingRect from '../core/BoundingRect';\r\nimport { extend } from '../core/util';\r\n\r\nclass DebugRect {\r\n\r\n dom: HTMLDivElement\r\n\r\n private _hideTimeout: number\r\n\r\n constructor(style: Opts['style']) {\r\n const dom = this.dom = document.createElement('div');\r\n dom.className = 'ec-debug-dirty-rect';\r\n\r\n style = extend({}, style);\r\n extend(style, {\r\n backgroundColor: 'rgba(0, 0, 255, 0.2)',\r\n border: '1px solid #00f'\r\n });\r\n dom.style.cssText = `\r\nposition: absolute;\r\nopacity: 0;\r\ntransition: opacity 0.5s linear;\r\npointer-events: none;\r\n`;\r\n\r\n for (let key in style) {\r\n if (style.hasOwnProperty(key)) {\r\n (dom.style as any)[key] = (style as any)[key];\r\n }\r\n }\r\n }\r\n\r\n update(rect: BoundingRect) {\r\n const domStyle = this.dom.style;\r\n domStyle.width = rect.width + 'px';\r\n domStyle.height = rect.height + 'px';\r\n domStyle.left = rect.x + 'px';\r\n domStyle.top = rect.y + 'px';\r\n }\r\n\r\n hide() {\r\n this.dom.style.opacity = '0';\r\n }\r\n show(autoHideDelay?: number) {\r\n clearTimeout(this._hideTimeout);\r\n\r\n this.dom.style.opacity = '1';\r\n\r\n // Auto hide after 2 second\r\n this._hideTimeout = setTimeout(() => {\r\n this.hide();\r\n }, autoHideDelay || 1000) as unknown as number;\r\n }\r\n\r\n}\r\n\r\ninterface Opts {\r\n style?: {\r\n backgroundColor?: string\r\n color?: string\r\n }\r\n\r\n autoHideDelay?: number\r\n}\r\n\r\nexport default function showDebugDirtyRect(zr: ZRenderType, opts?: Opts) {\r\n opts = opts || {};\r\n const painter = zr.painter as CanvasPainter;\r\n if (!painter.getLayers) {\r\n throw new Error('Debug dirty rect can only been used on canvas renderer.');\r\n }\r\n if (painter.isSingleCanvas()) {\r\n throw new Error('Debug dirty rect can only been used on zrender inited with container.');\r\n }\r\n const debugViewRoot = document.createElement('div');\r\n debugViewRoot.style.cssText = `\r\nposition:absolute;\r\nleft:0;\r\ntop:0;\r\nright:0;\r\nbottom:0;\r\npointer-events:none;\r\n`;\r\n debugViewRoot.className = 'ec-debug-dirty-rect-container';\r\n\r\n const debugRects: DebugRect[] = [];\r\n const dom = zr.dom;\r\n dom.appendChild(debugViewRoot);\r\n const computedStyle = getComputedStyle(dom);\r\n if (computedStyle.position === 'static') {\r\n dom.style.position = 'relative';\r\n }\r\n\r\n zr.on('rendered', function () {\r\n if (painter.getLayers) {\r\n let idx = 0;\r\n painter.eachBuiltinLayer((layer) => {\r\n if (!layer.debugGetPaintRects) {\r\n return;\r\n }\r\n const paintRects = layer.debugGetPaintRects();\r\n for (let i = 0; i < paintRects.length; i++) {\r\n if (!paintRects[i].width || !paintRects[i].height) {\r\n continue;\r\n }\r\n\r\n if (!debugRects[idx]) {\r\n debugRects[idx] = new DebugRect(opts.style);\r\n debugViewRoot.appendChild(debugRects[idx].dom);\r\n }\r\n debugRects[idx].show(opts.autoHideDelay);\r\n debugRects[idx].update(paintRects[i]);\r\n idx++;\r\n }\r\n });\r\n for (let i = idx; i < debugRects.length; i++) {\r\n debugRects[i].hide();\r\n }\r\n }\r\n });\r\n}","import { LinearGradientObject } from '../graphic/LinearGradient';\r\nimport { RadialGradientObject } from '../graphic/RadialGradient';\r\nimport { GradientObject } from '../graphic/Gradient';\r\nimport { RectLike } from '../core/BoundingRect';\r\nimport Path from '../graphic/Path';\r\n\r\nfunction isSafeNum(num: number) {\r\n // NaN、Infinity、undefined、'xx'\r\n return isFinite(num);\r\n}\r\n\r\nexport function createLinearGradient(\r\n this: void,\r\n ctx: CanvasRenderingContext2D,\r\n obj: LinearGradientObject,\r\n rect: RectLike\r\n) {\r\n let x = obj.x == null ? 0 : obj.x;\r\n let x2 = obj.x2 == null ? 1 : obj.x2;\r\n let y = obj.y == null ? 0 : obj.y;\r\n let y2 = obj.y2 == null ? 0 : obj.y2;\r\n\r\n if (!obj.global) {\r\n x = x * rect.width + rect.x;\r\n x2 = x2 * rect.width + rect.x;\r\n y = y * rect.height + rect.y;\r\n y2 = y2 * rect.height + rect.y;\r\n }\r\n\r\n // Fix NaN when rect is Infinity\r\n x = isSafeNum(x) ? x : 0;\r\n x2 = isSafeNum(x2) ? x2 : 1;\r\n y = isSafeNum(y) ? y : 0;\r\n y2 = isSafeNum(y2) ? y2 : 0;\r\n\r\n const canvasGradient = ctx.createLinearGradient(x, y, x2, y2);\r\n\r\n return canvasGradient;\r\n}\r\n\r\nexport function createRadialGradient(\r\n this: void,\r\n ctx: CanvasRenderingContext2D,\r\n obj: RadialGradientObject,\r\n rect: RectLike\r\n) {\r\n const width = rect.width;\r\n const height = rect.height;\r\n const min = Math.min(width, height);\r\n\r\n let x = obj.x == null ? 0.5 : obj.x;\r\n let y = obj.y == null ? 0.5 : obj.y;\r\n let r = obj.r == null ? 0.5 : obj.r;\r\n\r\n if (!obj.global) {\r\n x = x * width + rect.x;\r\n y = y * height + rect.y;\r\n r = r * min;\r\n }\r\n\r\n x = isSafeNum(x) ? x : 0.5;\r\n y = isSafeNum(y) ? y : 0.5;\r\n r = r >= 0 && isSafeNum(r) ? r : 0.5;\r\n\r\n const canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r);\r\n\r\n return canvasGradient;\r\n}\r\n\r\nexport function getCanvasGradient(this: void, ctx: CanvasRenderingContext2D, obj: GradientObject, rect: RectLike) {\r\n // TODO Cache?\r\n const canvasGradient = obj.type === 'radial'\r\n ? createRadialGradient(ctx, obj as RadialGradientObject, rect)\r\n : createLinearGradient(ctx, obj as LinearGradientObject, rect);\r\n\r\n const colorStops = obj.colorStops;\r\n for (let i = 0; i < colorStops.length; i++) {\r\n canvasGradient.addColorStop(\r\n colorStops[i].offset, colorStops[i].color\r\n );\r\n }\r\n return canvasGradient;\r\n}\r\n\r\nexport function isClipPathChanged(clipPaths: Path[], prevClipPaths: Path[]): boolean {\r\n // displayable.__clipPaths can only be `null`/`undefined` or an non-empty array.\r\n if (clipPaths === prevClipPaths || (!clipPaths && !prevClipPaths)) {\r\n return false;\r\n }\r\n if (!clipPaths || !prevClipPaths || (clipPaths.length !== prevClipPaths.length)) {\r\n return true;\r\n }\r\n for (let i = 0; i < clipPaths.length; i++) {\r\n if (clipPaths[i] !== prevClipPaths[i]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction parseInt10(val: string) {\r\n return parseInt(val, 10);\r\n}\r\nexport function getSize(\r\n root: HTMLElement,\r\n whIdx: number,\r\n opts: { width?: number | string, height?: number | string}\r\n) {\r\n\r\n const wh = ['width', 'height'][whIdx] as 'width' | 'height';\r\n const cwh = ['clientWidth', 'clientHeight'][whIdx] as 'clientWidth' | 'clientHeight';\r\n const plt = ['paddingLeft', 'paddingTop'][whIdx] as 'paddingLeft' | 'paddingTop';\r\n const prb = ['paddingRight', 'paddingBottom'][whIdx] as 'paddingRight' | 'paddingBottom';\r\n\r\n if (opts[wh] != null && opts[wh] !== 'auto') {\r\n return parseFloat(opts[wh] as string);\r\n }\r\n\r\n // IE8 does not support getComputedStyle, but it use VML.\r\n const stl = document.defaultView.getComputedStyle(root);\r\n\r\n return (\r\n (root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))\r\n - (parseInt10(stl[plt]) || 0)\r\n - (parseInt10(stl[prb]) || 0)\r\n ) | 0;\r\n}","import { isArray, isNumber, map } from '../core/util';\r\nimport Path from '../graphic/Path';\r\nimport TSpan from '../graphic/TSpan';\r\n\r\nexport function normalizeLineDash(lineType: any, lineWidth?: number): number[] | false {\r\n if (!lineType || lineType === 'solid' || !(lineWidth > 0)) {\r\n return null;\r\n }\r\n return lineType === 'dashed'\r\n ? [4 * lineWidth, 2 * lineWidth]\r\n : lineType === 'dotted'\r\n ? [lineWidth]\r\n : isNumber(lineType)\r\n ? [lineType] : isArray(lineType) ? lineType : null;\r\n}\r\nexport function getLineDash(el: Path | TSpan): [number[] | false, number] {\r\n const style = el.style;\r\n\r\n let lineDash = style.lineDash && style.lineWidth > 0 && normalizeLineDash(style.lineDash, style.lineWidth);\r\n let lineDashOffset = style.lineDashOffset;\r\n\r\n if (lineDash) {\r\n const lineScale = (style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1;\r\n if (lineScale && lineScale !== 1) {\r\n lineDash = map(lineDash, function (rawVal) {\r\n return rawVal / lineScale;\r\n });\r\n lineDashOffset /= lineScale;\r\n }\r\n }\r\n return [lineDash, lineDashOffset];\r\n}","import Displayable, { DEFAULT_COMMON_STYLE } from '../graphic/Displayable';\nimport PathProxy from '../core/PathProxy';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject, InnerImagePatternObject } from '../graphic/Pattern';\nimport { LinearGradientObject } from '../graphic/LinearGradient';\nimport { RadialGradientObject } from '../graphic/RadialGradient';\nimport { ZRCanvasRenderingContext } from '../core/types';\nimport { createOrUpdateImage, isImageReady } from '../graphic/helper/image';\nimport { getCanvasGradient, isClipPathChanged } from './helper';\nimport Path, { PathStyleProps } from '../graphic/Path';\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\nimport TSpan, {TSpanStyleProps} from '../graphic/TSpan';\nimport { MatrixArray } from '../core/matrix';\nimport { RADIAN_TO_DEGREE } from '../core/util';\nimport { getLineDash } from './dashStyle';\nimport { REDRAW_BIT, SHAPE_CHANGED_BIT } from '../graphic/constants';\nimport type IncrementalDisplayable from '../graphic/IncrementalDisplayable';\nimport { DEFAULT_FONT } from '../core/platform';\n\nconst pathProxyForDraw = new PathProxy(true);\n\n// Not use el#hasStroke because style may be different.\nfunction styleHasStroke(style: PathStyleProps) {\n const stroke = style.stroke;\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\n}\n\n// ignore lineWidth and must be string\n// Expected color but found '[' when color is gradient\nfunction isValidStrokeFillStyle(\n strokeOrFill: PathStyleProps['stroke'] | PathStyleProps['fill']\n): strokeOrFill is string {\n return typeof strokeOrFill === 'string' && strokeOrFill !== 'none';\n}\n\nfunction styleHasFill(style: PathStyleProps) {\n const fill = style.fill;\n return fill != null && fill !== 'none';\n}\nfunction doFillPath(ctx: CanvasRenderingContext2D, style: PathStyleProps) {\n if (style.fillOpacity != null && style.fillOpacity !== 1) {\n const originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.fillOpacity * style.opacity;\n ctx.fill();\n // Set back globalAlpha\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.fill();\n }\n}\n\nfunction doStrokePath(ctx: CanvasRenderingContext2D, style: PathStyleProps) {\n if (style.strokeOpacity != null && style.strokeOpacity !== 1) {\n const originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.strokeOpacity * style.opacity;\n ctx.stroke();\n // Set back globalAlpha\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.stroke();\n }\n}\n\nexport function createCanvasPattern(\n this: void,\n ctx: CanvasRenderingContext2D,\n pattern: ImagePatternObject,\n el: {dirty: () => void}\n): CanvasPattern {\n const image = createOrUpdateImage(pattern.image, (pattern as InnerImagePatternObject).__image, el);\n if (isImageReady(image)) {\n const canvasPattern = ctx.createPattern(image, pattern.repeat || 'repeat');\n if (\n typeof DOMMatrix === 'function'\n && canvasPattern // image may be not ready\n && canvasPattern.setTransform // setTransform may not be supported in some old devices.\n ) {\n const matrix = new DOMMatrix();\n matrix.translateSelf((pattern.x || 0), (pattern.y || 0));\n matrix.rotateSelf(0, 0, (pattern.rotation || 0) * RADIAN_TO_DEGREE);\n matrix.scaleSelf((pattern.scaleX || 1), (pattern.scaleY || 1));\n canvasPattern.setTransform(matrix);\n }\n return canvasPattern;\n }\n}\n\n// Draw Path Elements\nfunction brushPath(ctx: CanvasRenderingContext2D, el: Path, style: PathStyleProps, inBatch: boolean) {\n let hasStroke = styleHasStroke(style);\n let hasFill = styleHasFill(style);\n\n const strokePercent = style.strokePercent;\n const strokePart = strokePercent < 1;\n\n // TODO Reduce path memory cost.\n const firstDraw = !el.path;\n // Create path for each element when:\n // 1. Element has interactions.\n // 2. Element draw part of the line.\n if ((!el.silent || strokePart) && firstDraw) {\n el.createPathProxy();\n }\n\n const path = el.path || pathProxyForDraw;\n const dirtyFlag = el.__dirty;\n\n if (!inBatch) {\n const fill = style.fill;\n const stroke = style.stroke;\n\n const hasFillGradient = hasFill && !!(fill as GradientObject).colorStops;\n const hasStrokeGradient = hasStroke && !!(stroke as GradientObject).colorStops;\n const hasFillPattern = hasFill && !!(fill as ImagePatternObject).image;\n const hasStrokePattern = hasStroke && !!(stroke as ImagePatternObject).image;\n\n let fillGradient;\n let strokeGradient;\n let fillPattern;\n let strokePattern;\n let rect;\n if (hasFillGradient || hasStrokeGradient) {\n rect = el.getBoundingRect();\n }\n\n // Update gradient because bounding rect may changed\n if (hasFillGradient) {\n fillGradient = dirtyFlag\n ? getCanvasGradient(ctx, fill as (LinearGradientObject | RadialGradientObject), rect)\n : el.__canvasFillGradient;\n // No need to clear cache when fill is not gradient.\n // It will always been updated when fill changed back to gradient.\n el.__canvasFillGradient = fillGradient;\n }\n if (hasStrokeGradient) {\n strokeGradient = dirtyFlag\n ? getCanvasGradient(ctx, stroke as (LinearGradientObject | RadialGradientObject), rect)\n : el.__canvasStrokeGradient;\n el.__canvasStrokeGradient = strokeGradient;\n }\n if (hasFillPattern) {\n // Pattern might be null if image not ready (even created from dataURI)\n fillPattern = (dirtyFlag || !el.__canvasFillPattern)\n ? createCanvasPattern(ctx, fill as ImagePatternObject, el)\n : el.__canvasFillPattern;\n el.__canvasFillPattern = fillPattern;\n }\n if (hasStrokePattern) {\n // Pattern might be null if image not ready (even created from dataURI)\n strokePattern = (dirtyFlag || !el.__canvasStrokePattern)\n ? createCanvasPattern(ctx, stroke as ImagePatternObject, el)\n : el.__canvasStrokePattern;\n el.__canvasStrokePattern = fillPattern;\n }\n // Use the gradient or pattern\n if (hasFillGradient) {\n // PENDING If may have affect the state\n ctx.fillStyle = fillGradient;\n }\n else if (hasFillPattern) {\n if (fillPattern) { // createCanvasPattern may return false if image is not ready.\n ctx.fillStyle = fillPattern;\n }\n else {\n // Don't fill if image is not ready\n hasFill = false;\n }\n }\n if (hasStrokeGradient) {\n ctx.strokeStyle = strokeGradient;\n }\n else if (hasStrokePattern) {\n if (strokePattern) {\n ctx.strokeStyle = strokePattern;\n }\n else {\n // Don't stroke if image is not ready\n hasStroke = false;\n }\n }\n }\n\n // Update path sx, sy\n const scale = el.getGlobalScale();\n path.setScale(scale[0], scale[1], el.segmentIgnoreThreshold);\n\n let lineDash;\n let lineDashOffset;\n if (ctx.setLineDash && style.lineDash) {\n [lineDash, lineDashOffset] = getLineDash(el);\n }\n\n let needsRebuild = true;\n\n if (firstDraw || (dirtyFlag & SHAPE_CHANGED_BIT)) {\n path.setDPR((ctx as any).dpr);\n if (strokePart) {\n // Use rebuildPath for percent stroke, so no context.\n path.setContext(null);\n }\n else {\n path.setContext(ctx);\n needsRebuild = false;\n }\n path.reset();\n\n el.buildPath(path, el.shape, inBatch);\n path.toStatic();\n\n // Clear path dirty flag\n el.pathUpdated();\n }\n\n // Not support separate fill and stroke. For the compatibility of SVG\n if (needsRebuild) {\n path.rebuildPath(ctx, strokePart ? strokePercent : 1);\n }\n\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n\n if (!inBatch) {\n if (style.strokeFirst) {\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n if (hasFill) {\n doFillPath(ctx, style);\n }\n }\n else {\n if (hasFill) {\n doFillPath(ctx, style);\n }\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n }\n }\n\n if (lineDash) {\n // PENDING\n // Remove lineDash\n ctx.setLineDash([]);\n }\n}\n\n// Draw Image Elements\nfunction brushImage(ctx: CanvasRenderingContext2D, el: ZRImage, style: ImageStyleProps) {\n const image = el.__image = createOrUpdateImage(\n style.image,\n el.__image,\n el,\n el.onload\n );\n\n if (!image || !isImageReady(image)) {\n return;\n }\n\n const x = style.x || 0;\n const y = style.y || 0;\n let width = el.getWidth();\n let height = el.getHeight();\n const aspect = image.width / image.height;\n if (width == null && height != null) {\n // Keep image/height ratio\n width = height * aspect;\n }\n else if (height == null && width != null) {\n height = width / aspect;\n }\n else if (width == null && height == null) {\n width = image.width;\n height = image.height;\n }\n\n if (style.sWidth && style.sHeight) {\n const sx = style.sx || 0;\n const sy = style.sy || 0;\n ctx.drawImage(\n image,\n sx, sy, style.sWidth, style.sHeight,\n x, y, width, height\n );\n }\n else if (style.sx && style.sy) {\n const sx = style.sx;\n const sy = style.sy;\n const sWidth = width - sx;\n const sHeight = height - sy;\n ctx.drawImage(\n image,\n sx, sy, sWidth, sHeight,\n x, y, width, height\n );\n }\n else {\n ctx.drawImage(image, x, y, width, height);\n }\n}\n\n// Draw Text Elements\nfunction brushText(ctx: CanvasRenderingContext2D, el: TSpan, style: TSpanStyleProps) {\n\n let text = style.text;\n // Convert to string\n text != null && (text += '');\n\n if (text) {\n ctx.font = style.font || DEFAULT_FONT;\n ctx.textAlign = style.textAlign;\n ctx.textBaseline = style.textBaseline;\n\n let lineDash;\n let lineDashOffset;\n if (ctx.setLineDash && style.lineDash) {\n [lineDash, lineDashOffset] = getLineDash(el);\n }\n\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n\n if (style.strokeFirst) {\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n }\n else {\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n }\n\n if (lineDash) {\n // Remove lineDash\n ctx.setLineDash([]);\n }\n }\n\n}\n\nconst SHADOW_NUMBER_PROPS = ['shadowBlur', 'shadowOffsetX', 'shadowOffsetY'] as const;\nconst STROKE_PROPS = [\n ['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]\n] as const;\n\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\n// type ShadowPropNames = typeof SHADOW_PROPS[number][0];\n// type StrokePropNames = typeof STROKE_PROPS[number][0];\n// type DrawPropNames = typeof DRAW_PROPS[number][0];\n\nfunction bindCommonProps(\n ctx: CanvasRenderingContext2D,\n style: AllStyleOption,\n prevStyle: AllStyleOption,\n forceSetAll: boolean,\n scope: BrushScope\n): boolean {\n let styleChanged = false;\n\n if (!forceSetAll) {\n prevStyle = prevStyle || {};\n\n // Shared same style.\n if (style === prevStyle) {\n return false;\n }\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n // Ensure opacity is between 0 ~ 1. Invalid opacity will lead to a failure set and use the leaked opacity from the previous.\n const opacity = Math.max(Math.min(style.opacity, 1), 0);\n ctx.globalAlpha = isNaN(opacity) ? DEFAULT_COMMON_STYLE.opacity : opacity;\n }\n\n if (forceSetAll || style.blend !== prevStyle.blend) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalCompositeOperation = style.blend || DEFAULT_COMMON_STYLE.blend;\n }\n for (let i = 0; i < SHADOW_NUMBER_PROPS.length; i++) {\n const propName = SHADOW_NUMBER_PROPS[i];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n // FIXME Invalid property value will cause style leak from previous element.\n ctx[propName] = (ctx as ZRCanvasRenderingContext).dpr * (style[propName] || 0);\n }\n }\n if (forceSetAll || style.shadowColor !== prevStyle.shadowColor) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.shadowColor = style.shadowColor || DEFAULT_COMMON_STYLE.shadowColor;\n }\n return styleChanged;\n}\n\nfunction bindPathAndTextCommonStyle(\n ctx: CanvasRenderingContext2D,\n el: TSpan | Path,\n prevEl: TSpan | Path,\n forceSetAll: boolean,\n scope: BrushScope\n) {\n const style = getStyle(el, scope.inHover);\n const prevStyle = forceSetAll\n ? null\n : (prevEl && getStyle(prevEl, scope.inHover) || {});\n // Shared same style. prevStyle will be null if forceSetAll.\n if (style === prevStyle) {\n return false;\n }\n\n let styleChanged = bindCommonProps(ctx, style, prevStyle, forceSetAll, scope);\n\n if (forceSetAll || style.fill !== prevStyle.fill) {\n if (!styleChanged) {\n // Flush before set\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.fill) && (ctx.fillStyle = style.fill);\n }\n if (forceSetAll || style.stroke !== prevStyle.stroke) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.stroke) && (ctx.strokeStyle = style.stroke);\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;\n }\n if (el.hasStroke()) {\n const lineWidth = style.lineWidth;\n const newLineWidth = lineWidth / (\n (style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1\n );\n if (ctx.lineWidth !== newLineWidth) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.lineWidth = newLineWidth;\n }\n }\n\n for (let i = 0; i < STROKE_PROPS.length; i++) {\n const prop = STROKE_PROPS[i];\n const propName = prop[0];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n // FIXME Invalid property value will cause style leak from previous element.\n (ctx as any)[propName] = style[propName] || prop[1];\n }\n }\n\n return styleChanged;\n}\n\nfunction bindImageStyle(\n ctx: CanvasRenderingContext2D,\n el: ZRImage,\n prevEl: ZRImage,\n // forceSetAll must be true if prevEl is null\n forceSetAll: boolean,\n scope: BrushScope\n) {\n return bindCommonProps(\n ctx,\n getStyle(el, scope.inHover),\n prevEl && getStyle(prevEl, scope.inHover),\n forceSetAll,\n scope\n );\n}\n\nfunction setContextTransform(ctx: CanvasRenderingContext2D, el: Displayable) {\n const m = el.transform;\n const dpr = (ctx as ZRCanvasRenderingContext).dpr || 1;\n if (m) {\n ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);\n }\n else {\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n }\n}\n\nfunction updateClipStatus(clipPaths: Path[], ctx: CanvasRenderingContext2D, scope: BrushScope) {\n let allClipped = false;\n for (let i = 0; i < clipPaths.length; i++) {\n const clipPath = clipPaths[i];\n // Ignore draw following elements if clipPath has zero area.\n allClipped = allClipped || clipPath.isZeroArea();\n\n setContextTransform(ctx, clipPath);\n ctx.beginPath();\n clipPath.buildPath(ctx, clipPath.shape);\n ctx.clip();\n }\n scope.allClipped = allClipped;\n}\n\nfunction isTransformChanged(m0: MatrixArray, m1: MatrixArray): boolean {\n if (m0 && m1) {\n return m0[0] !== m1[0]\n || m0[1] !== m1[1]\n || m0[2] !== m1[2]\n || m0[3] !== m1[3]\n || m0[4] !== m1[4]\n || m0[5] !== m1[5];\n }\n else if (!m0 && !m1) { // All identity matrix.\n return false;\n }\n\n return true;\n}\n\nconst DRAW_TYPE_PATH = 1;\nconst DRAW_TYPE_IMAGE = 2;\nconst DRAW_TYPE_TEXT = 3;\nconst DRAW_TYPE_INCREMENTAL = 4;\n\nexport type BrushScope = {\n inHover: boolean\n\n // width / height of viewport\n viewWidth: number\n viewHeight: number\n\n // Status for clipping\n prevElClipPaths?: Path[]\n prevEl?: Displayable\n allClipped?: boolean // If the whole element can be clipped\n\n // Status for batching\n batchFill?: string\n batchStroke?: string\n\n lastDrawType?: number\n}\n\n// If path can be batched\nfunction canPathBatch(style: PathStyleProps) {\n\n const hasFill = styleHasFill(style);\n const hasStroke = styleHasStroke(style);\n\n return !(\n // Line dash is dynamically set in brush function.\n style.lineDash\n // Can't batch if element is both set fill and stroke. Or both not set\n || !(+hasFill ^ +hasStroke)\n // Can't batch if element is drawn with gradient or pattern.\n || (hasFill && typeof style.fill !== 'string')\n || (hasStroke && typeof style.stroke !== 'string')\n // Can't batch if element only stroke part of line.\n || style.strokePercent < 1\n // Has stroke or fill opacity\n || style.strokeOpacity < 1\n || style.fillOpacity < 1\n );\n}\n\nfunction flushPathDrawn(ctx: CanvasRenderingContext2D, scope: BrushScope) {\n // Force flush all after drawn last element\n scope.batchFill && ctx.fill();\n scope.batchStroke && ctx.stroke();\n scope.batchFill = '';\n scope.batchStroke = '';\n}\n\nfunction getStyle(el: Displayable, inHover?: boolean) {\n return inHover ? (el.__hoverStyle || el.style) : el.style;\n}\n\nexport function brushSingle(ctx: CanvasRenderingContext2D, el: Displayable) {\n brush(ctx, el, { inHover: false, viewWidth: 0, viewHeight: 0 }, true);\n}\n\n// Brush different type of elements.\nexport function brush(\n ctx: CanvasRenderingContext2D,\n el: Displayable,\n scope: BrushScope,\n isLast: boolean\n) {\n const m = el.transform;\n\n if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {\n // Needs to mark el rendered.\n // Or this element will always been rendered in progressive rendering.\n // But other dirty bit should not be cleared, otherwise it cause the shape\n // can not be updated in this case.\n el.__dirty &= ~REDRAW_BIT;\n el.__isRendered = false;\n return;\n }\n\n // HANDLE CLIPPING\n const clipPaths = el.__clipPaths;\n const prevElClipPaths = scope.prevElClipPaths;\n\n let forceSetTransform = false;\n let forceSetStyle = false;\n // Optimize when clipping on group with several elements\n if (!prevElClipPaths || isClipPathChanged(clipPaths, prevElClipPaths)) {\n // If has previous clipping state, restore from it\n if (prevElClipPaths && prevElClipPaths.length) {\n // Flush restore\n flushPathDrawn(ctx, scope);\n\n ctx.restore();\n // Must set all style and transform because context changed by restore\n forceSetStyle = forceSetTransform = true;\n\n scope.prevElClipPaths = null;\n scope.allClipped = false;\n // Reset prevEl since context has been restored\n scope.prevEl = null;\n }\n // New clipping state\n if (clipPaths && clipPaths.length) {\n // Flush before clip\n flushPathDrawn(ctx, scope);\n\n ctx.save();\n updateClipStatus(clipPaths, ctx, scope);\n // Must set transform because it's changed when clip.\n forceSetTransform = true;\n }\n scope.prevElClipPaths = clipPaths;\n }\n\n // Not rendering elements if it's clipped by a zero area path.\n // Or it may cause bug on some version of IE11 (like 11.0.9600.178**),\n // where exception \"unexpected call to method or property access\"\n // might be thrown when calling ctx.fill or ctx.stroke after a path\n // whose area size is zero is drawn and ctx.clip() is called and\n // shadowBlur is set. See #4572, #3112, #5777.\n // (e.g.,\n // ctx.moveTo(10, 10);\n // ctx.lineTo(20, 10);\n // ctx.closePath();\n // ctx.clip();\n // ctx.shadowBlur = 10;\n // ...\n // ctx.fill();\n // )\n if (scope.allClipped) {\n el.__isRendered = false;\n return;\n }\n\n // START BRUSH\n el.beforeBrush && el.beforeBrush();\n el.innerBeforeBrush();\n\n const prevEl = scope.prevEl;\n // TODO el type changed.\n if (!prevEl) {\n forceSetStyle = forceSetTransform = true;\n }\n\n let canBatchPath = el instanceof Path // Only path supports batch\n && el.autoBatch\n && canPathBatch(el.style);\n\n if (forceSetTransform || isTransformChanged(m, prevEl.transform)) {\n // Flush\n flushPathDrawn(ctx, scope);\n setContextTransform(ctx, el);\n }\n else if (!canBatchPath) {\n // Flush\n flushPathDrawn(ctx, scope);\n }\n\n const style = getStyle(el, scope.inHover);\n if (el instanceof Path) {\n // PENDING do we need to rebind all style if displayable type changed?\n if (scope.lastDrawType !== DRAW_TYPE_PATH) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_PATH;\n }\n\n bindPathAndTextCommonStyle(ctx, el as Path, prevEl as Path, forceSetStyle, scope);\n // Begin path at start\n if (!canBatchPath || (!scope.batchFill && !scope.batchStroke)) {\n ctx.beginPath();\n }\n brushPath(ctx, el as Path, style, canBatchPath);\n\n if (canBatchPath) {\n scope.batchFill = style.fill as string || '';\n scope.batchStroke = style.stroke as string || '';\n }\n }\n else {\n if (el instanceof TSpan) {\n if (scope.lastDrawType !== DRAW_TYPE_TEXT) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_TEXT;\n }\n\n bindPathAndTextCommonStyle(ctx, el as TSpan, prevEl as TSpan, forceSetStyle, scope);\n brushText(ctx, el as TSpan, style);\n }\n else if (el instanceof ZRImage) {\n if (scope.lastDrawType !== DRAW_TYPE_IMAGE) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_IMAGE;\n }\n\n bindImageStyle(ctx, el as ZRImage, prevEl as ZRImage, forceSetStyle, scope);\n brushImage(ctx, el as ZRImage, style);\n }\n // Assume it's a IncrementalDisplayable\n else if ((el as IncrementalDisplayable).getTemporalDisplayables) {\n if (scope.lastDrawType !== DRAW_TYPE_INCREMENTAL) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_INCREMENTAL;\n }\n\n brushIncremental(ctx, el as IncrementalDisplayable, scope);\n }\n\n }\n\n if (canBatchPath && isLast) {\n flushPathDrawn(ctx, scope);\n }\n\n el.innerAfterBrush();\n el.afterBrush && el.afterBrush();\n\n scope.prevEl = el;\n\n // Mark as painted.\n el.__dirty = 0;\n el.__isRendered = true;\n}\n\nfunction brushIncremental(\n ctx: CanvasRenderingContext2D,\n el: IncrementalDisplayable,\n scope: BrushScope\n) {\n let displayables = el.getDisplayables();\n let temporalDisplayables = el.getTemporalDisplayables();\n // Provide an inner scope.\n // Save current context and restore after brushed.\n ctx.save();\n let innerScope: BrushScope = {\n prevElClipPaths: null,\n prevEl: null,\n allClipped: false,\n viewWidth: scope.viewWidth,\n viewHeight: scope.viewHeight,\n inHover: scope.inHover\n };\n let i;\n let len;\n // Render persistant displayables.\n for (i = el.getCursor(), len = displayables.length; i < len; i++) {\n const displayable = displayables[i];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i === len - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n // Render temporary displayables.\n for (let i = 0, len = temporalDisplayables.length; i < len; i++) {\n const displayable = temporalDisplayables[i];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i === len - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n el.clearTemporalDisplayables();\n el.notClear = true;\n\n ctx.restore();\n}","import * as util from '../core/util';\nimport {devicePixelRatio} from '../config';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport CanvasPainter from './Painter';\nimport { GradientObject, InnerGradientObject } from '../graphic/Gradient';\nimport { ZRCanvasRenderingContext } from '../core/types';\nimport Eventful from '../core/Eventful';\nimport { ElementEventCallback } from '../Element';\nimport { getCanvasGradient } from './helper';\nimport { createCanvasPattern } from './graphic';\nimport Displayable from '../graphic/Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { REDRAW_BIT } from '../graphic/constants';\nimport { platformApi } from '../core/platform';\n\nfunction createDom(id: string, painter: CanvasPainter, dpr: number) {\n const newDom = platformApi.createCanvas();\n const width = painter.getWidth();\n const height = painter.getHeight();\n\n const newDomStyle = newDom.style;\n if (newDomStyle) { // In node or some other non-browser environment\n newDomStyle.position = 'absolute';\n newDomStyle.left = '0';\n newDomStyle.top = '0';\n newDomStyle.width = width + 'px';\n newDomStyle.height = height + 'px';\n\n newDom.setAttribute('data-zr-dom-id', id);\n }\n\n newDom.width = width * dpr;\n newDom.height = height * dpr;\n\n return newDom;\n}\n\nexport interface LayerConfig {\n // 每次清空画布的颜色\n clearColor?: string | GradientObject | ImagePatternObject\n // 是否开启动态模糊\n motionBlur?: boolean\n // 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显\n lastFrameAlpha?: number\n};\n\nexport default class Layer extends Eventful {\n\n id: string\n\n dom: HTMLCanvasElement\n domBack: HTMLCanvasElement\n\n ctx: CanvasRenderingContext2D\n ctxBack: CanvasRenderingContext2D\n\n painter: CanvasPainter\n\n // Configs\n /**\n * 每次清空画布的颜色\n */\n clearColor: string | GradientObject | ImagePatternObject\n /**\n * 是否开启动态模糊\n */\n motionBlur = false\n /**\n * 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显\n */\n lastFrameAlpha = 0.7\n /**\n * Layer dpr\n */\n dpr = 1\n\n /**\n * Virtual layer will not be inserted into dom.\n */\n virtual = false\n\n config = {}\n\n incremental = false\n\n zlevel = 0\n\n maxRepaintRectCount = 5\n\n private _paintRects: BoundingRect[]\n\n __dirty = true\n __firstTimePaint = true\n\n __used = false\n\n __drawIndex = 0\n __startIndex = 0\n __endIndex = 0\n\n // indices in the previous frame\n __prevStartIndex: number = null\n __prevEndIndex: number = null\n\n __builtin__: boolean\n\n constructor(id: string | HTMLCanvasElement, painter: CanvasPainter, dpr?: number) {\n super();\n\n let dom;\n dpr = dpr || devicePixelRatio;\n if (typeof id === 'string') {\n dom = createDom(id, painter, dpr);\n }\n // Not using isDom because in node it will return false\n else if (util.isObject(id)) {\n dom = id;\n id = dom.id;\n }\n this.id = id as string;\n this.dom = dom;\n\n const domStyle = dom.style;\n if (domStyle) { // Not in node\n util.disableUserSelect(dom);\n dom.onselectstart = () => false;\n domStyle.padding = '0';\n domStyle.margin = '0';\n domStyle.borderWidth = '0';\n }\n\n this.painter = painter;\n\n this.dpr = dpr;\n }\n\n getElementCount() {\n return this.__endIndex - this.__startIndex;\n }\n\n afterBrush() {\n this.__prevStartIndex = this.__startIndex;\n this.__prevEndIndex = this.__endIndex;\n }\n\n initContext() {\n this.ctx = this.dom.getContext('2d');\n (this.ctx as ZRCanvasRenderingContext).dpr = this.dpr;\n }\n\n setUnpainted() {\n this.__firstTimePaint = true;\n }\n\n createBackBuffer() {\n const dpr = this.dpr;\n\n this.domBack = createDom('back-' + this.id, this.painter, dpr);\n this.ctxBack = this.domBack.getContext('2d');\n\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n }\n\n /**\n * Create repaint list when using dirty rect rendering.\n *\n * @param displayList current rendering list\n * @param prevList last frame rendering list\n * @return repaint rects. null for the first frame, [] for no element dirty\n */\n createRepaintRects(\n displayList: Displayable[],\n prevList: Displayable[],\n viewWidth: number,\n viewHeight: number\n ) {\n if (this.__firstTimePaint) {\n this.__firstTimePaint = false;\n return null;\n }\n\n const mergedRepaintRects: BoundingRect[] = [];\n const maxRepaintRectCount = this.maxRepaintRectCount;\n let full = false;\n const pendingRect = new BoundingRect(0, 0, 0, 0);\n\n function addRectToMergePool(rect: BoundingRect) {\n if (!rect.isFinite() || rect.isZero()) {\n return;\n }\n\n if (mergedRepaintRects.length === 0) {\n // First rect, create new merged rect\n const boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n else {\n let isMerged = false;\n let minDeltaArea = Infinity;\n let bestRectToMergeIdx = 0;\n for (let i = 0; i < mergedRepaintRects.length; ++i) {\n const mergedRect = mergedRepaintRects[i];\n\n // Merge if has intersection\n if (mergedRect.intersect(rect)) {\n const pendingRect = new BoundingRect(0, 0, 0, 0);\n pendingRect.copy(mergedRect);\n pendingRect.union(rect);\n mergedRepaintRects[i] = pendingRect;\n isMerged = true;\n break;\n }\n else if (full) {\n // Merged to exists rectangles if full\n pendingRect.copy(rect);\n pendingRect.union(mergedRect);\n const aArea = rect.width * rect.height;\n const bArea = mergedRect.width * mergedRect.height;\n const pendingArea = pendingRect.width * pendingRect.height;\n const deltaArea = pendingArea - aArea - bArea;\n if (deltaArea < minDeltaArea) {\n minDeltaArea = deltaArea;\n bestRectToMergeIdx = i;\n }\n }\n }\n\n if (full) {\n mergedRepaintRects[bestRectToMergeIdx].union(rect);\n isMerged = true;\n }\n\n if (!isMerged) {\n // Create new merged rect if cannot merge with current\n const boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n if (!full) {\n full = mergedRepaintRects.length >= maxRepaintRectCount;\n }\n }\n }\n\n /**\n * Loop the paint list of this frame and get the dirty rects of elements\n * in this frame.\n */\n for (let i = this.__startIndex; i < this.__endIndex; ++i) {\n const el = displayList[i];\n if (el) {\n /**\n * `shouldPaint` is true only when the element is not ignored or\n * invisible and all its ancestors are not ignored.\n * `shouldPaint` being true means it will be brushed this frame.\n *\n * `__isRendered` being true means the element is currently on\n * the canvas.\n *\n * `__dirty` being true means the element should be brushed this\n * frame.\n *\n * We only need to repaint the element's previous painting rect\n * if it's currently on the canvas and needs repaint this frame\n * or not painted this frame.\n */\n const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);\n const prevRect = el.__isRendered && ((el.__dirty & REDRAW_BIT) || !shouldPaint)\n ? el.getPrevPaintRect()\n : null;\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n\n /**\n * On the other hand, we only need to paint the current rect\n * if the element should be brushed this frame and either being\n * dirty or not rendered before.\n */\n const curRect = shouldPaint && ((el.__dirty & REDRAW_BIT) || !el.__isRendered)\n ? el.getPaintRect()\n : null;\n if (curRect) {\n addRectToMergePool(curRect);\n }\n }\n }\n\n /**\n * The above loop calculates the dirty rects of elements that are in the\n * paint list this frame, which does not include those elements removed\n * in this frame. So we loop the `prevList` to get the removed elements.\n */\n for (let i = this.__prevStartIndex; i < this.__prevEndIndex; ++i) {\n const el = prevList[i];\n /**\n * Consider the elements whose ancestors are invisible, they should\n * not be painted and their previous painting rects should be\n * cleared if they are rendered on the canvas (`__isRendered` being\n * true). `!shouldPaint` means the element is not brushed in this\n * frame.\n *\n * `!el.__zr` means it's removed from the storage.\n *\n * In conclusion, an element needs to repaint the previous painting\n * rect if and only if it's not painted this frame and was\n * previously painted on the canvas.\n */\n const shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);\n if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {\n // el was removed\n const prevRect = el.getPrevPaintRect();\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n }\n }\n\n // Merge intersected rects in the result\n let hasIntersections;\n do {\n hasIntersections = false;\n for (let i = 0; i < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].isZero()) {\n mergedRepaintRects.splice(i, 1);\n continue;\n }\n for (let j = i + 1; j < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].intersect(mergedRepaintRects[j])) {\n hasIntersections = true;\n mergedRepaintRects[i].union(mergedRepaintRects[j]);\n mergedRepaintRects.splice(j, 1);\n }\n else {\n j++;\n }\n }\n i++;\n }\n } while (hasIntersections);\n\n this._paintRects = mergedRepaintRects;\n\n return mergedRepaintRects;\n }\n\n /**\n * Get paint rects for debug usage.\n */\n debugGetPaintRects() {\n return (this._paintRects || []).slice();\n }\n\n resize(width: number, height: number) {\n const dpr = this.dpr;\n\n const dom = this.dom;\n const domStyle = dom.style;\n const domBack = this.domBack;\n\n if (domStyle) {\n domStyle.width = width + 'px';\n domStyle.height = height + 'px';\n }\n\n dom.width = width * dpr;\n dom.height = height * dpr;\n\n if (domBack) {\n domBack.width = width * dpr;\n domBack.height = height * dpr;\n\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n }\n }\n\n /**\n * 清空该层画布\n */\n clear(\n clearAll?: boolean,\n clearColor?: string | GradientObject | ImagePatternObject,\n repaintRects?: BoundingRect[]\n ) {\n const dom = this.dom;\n const ctx = this.ctx;\n const width = dom.width;\n const height = dom.height;\n\n clearColor = clearColor || this.clearColor;\n const haveMotionBLur = this.motionBlur && !clearAll;\n const lastFrameAlpha = this.lastFrameAlpha;\n\n const dpr = this.dpr;\n const self = this;\n\n if (haveMotionBLur) {\n if (!this.domBack) {\n this.createBackBuffer();\n }\n\n this.ctxBack.globalCompositeOperation = 'copy';\n this.ctxBack.drawImage(\n dom, 0, 0,\n width / dpr,\n height / dpr\n );\n }\n\n const domBack = this.domBack;\n\n function doClear(x: number, y: number, width: number, height: number) {\n ctx.clearRect(x, y, width, height);\n if (clearColor && clearColor !== 'transparent') {\n let clearColorGradientOrPattern;\n // Gradient\n if (util.isGradientObject(clearColor)) {\n // shouldn't cache when clearColor is not global and size changed\n const shouldCache = clearColor.global || (\n (clearColor as InnerGradientObject).__width === width\n && (clearColor as InnerGradientObject).__height === height\n );\n // Cache canvas gradient\n clearColorGradientOrPattern = shouldCache\n && (clearColor as InnerGradientObject).__canvasGradient\n || getCanvasGradient(ctx, clearColor, {\n x: 0,\n y: 0,\n width: width,\n height: height\n });\n\n (clearColor as InnerGradientObject).__canvasGradient = clearColorGradientOrPattern;\n (clearColor as InnerGradientObject).__width = width;\n (clearColor as InnerGradientObject).__height = height;\n }\n // Pattern\n else if (util.isImagePatternObject(clearColor)) {\n // scale pattern by dpr\n clearColor.scaleX = clearColor.scaleX || dpr;\n clearColor.scaleY = clearColor.scaleY || dpr;\n clearColorGradientOrPattern = createCanvasPattern(\n ctx, clearColor, {\n dirty() {\n self.setUnpainted();\n self.painter.refresh();\n }\n }\n );\n }\n ctx.save();\n ctx.fillStyle = clearColorGradientOrPattern || (clearColor as string);\n ctx.fillRect(x, y, width, height);\n ctx.restore();\n }\n\n if (haveMotionBLur) {\n ctx.save();\n ctx.globalAlpha = lastFrameAlpha;\n ctx.drawImage(domBack, x, y, width, height);\n ctx.restore();\n }\n };\n\n if (!repaintRects || haveMotionBLur) {\n // Clear the full canvas\n doClear(0, 0, width, height);\n }\n else if (repaintRects.length) {\n // Clear the repaint areas\n util.each(repaintRects, rect => {\n doClear(\n rect.x * dpr,\n rect.y * dpr,\n rect.width * dpr,\n rect.height * dpr\n );\n });\n }\n }\n\n // Interface of refresh\n refresh: (clearColor?: string | GradientObject | ImagePatternObject) => void\n\n // Interface of renderToCanvas in getRenderedCanvas\n renderToCanvas: (ctx: CanvasRenderingContext2D) => void\n\n // Events\n onclick: ElementEventCallback\n ondblclick: ElementEventCallback\n onmouseover: ElementEventCallback\n onmouseout: ElementEventCallback\n onmousemove: ElementEventCallback\n onmousewheel: ElementEventCallback\n onmousedown: ElementEventCallback\n onmouseup: ElementEventCallback\n oncontextmenu: ElementEventCallback\n\n ondrag: ElementEventCallback\n ondragstart: ElementEventCallback\n ondragend: ElementEventCallback\n ondragenter: ElementEventCallback\n ondragleave: ElementEventCallback\n ondragover: ElementEventCallback\n ondrop: ElementEventCallback\n}\n","import {devicePixelRatio} from '../config';\nimport * as util from '../core/util';\nimport Layer, { LayerConfig } from './Layer';\nimport requestAnimationFrame from '../animation/requestAnimationFrame';\nimport env from '../core/env';\nimport Displayable from '../graphic/Displayable';\nimport { WXCanvasRenderingContext } from '../core/types';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport Storage from '../Storage';\nimport { brush, BrushScope, brushSingle } from './graphic';\nimport { PainterBase } from '../PainterBase';\nimport BoundingRect from '../core/BoundingRect';\nimport { REDRAW_BIT } from '../graphic/constants';\nimport { getSize } from './helper';\nimport type IncrementalDisplayable from '../graphic/IncrementalDisplayable';\n\nconst HOVER_LAYER_ZLEVEL = 1e5;\nconst CANVAS_ZLEVEL = 314159;\n\nconst EL_AFTER_INCREMENTAL_INC = 0.01;\nconst INCREMENTAL_INC = 0.001;\n\n\nfunction isLayerValid(layer: Layer) {\n if (!layer) {\n return false;\n }\n\n if (layer.__builtin__) {\n return true;\n }\n\n if (typeof (layer.resize) !== 'function'\n || typeof (layer.refresh) !== 'function'\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction createRoot(width: number, height: number) {\n const domRoot = document.createElement('div');\n\n // domRoot.onselectstart = returnFalse; // Avoid page selected\n domRoot.style.cssText = [\n 'position:relative',\n // IOS13 safari probably has a compositing bug (z order of the canvas and the consequent\n // dom does not act as expected) when some of the parent dom has\n // `-webkit-overflow-scrolling: touch;` and the webpage is longer than one screen and\n // the canvas is not at the top part of the page.\n // Check `https://bugs.webkit.org/show_bug.cgi?id=203681` for more details. We remove\n // this `overflow:hidden` to avoid the bug.\n // 'overflow:hidden',\n 'width:' + width + 'px',\n 'height:' + height + 'px',\n 'padding:0',\n 'margin:0',\n 'border-width:0'\n ].join(';') + ';';\n\n return domRoot;\n}\n\ninterface CanvasPainterOption {\n devicePixelRatio?: number\n width?: number | string // Can be 10 / 10px / auto\n height?: number | string,\n useDirtyRect?: boolean\n}\n\nexport default class CanvasPainter implements PainterBase {\n\n type = 'canvas'\n\n root: HTMLElement\n\n dpr: number\n\n storage: Storage\n\n private _singleCanvas: boolean\n\n private _opts: CanvasPainterOption\n\n private _zlevelList: number[] = []\n\n private _prevDisplayList: Displayable[] = []\n\n private _layers: {[key: number]: Layer} = {} // key is zlevel\n\n private _layerConfig: {[key: number]: LayerConfig} = {} // key is zlevel\n\n /**\n * zrender will do compositing when root is a canvas and have multiple zlevels.\n */\n private _needsManuallyCompositing = false\n\n private _width: number\n private _height: number\n\n private _domRoot: HTMLElement\n\n private _hoverlayer: Layer\n\n private _redrawId: number\n\n private _backgroundColor: string | GradientObject | ImagePatternObject\n\n\n constructor(root: HTMLElement, storage: Storage, opts: CanvasPainterOption, id: number) {\n\n this.type = 'canvas';\n\n // In node environment using node-canvas\n const singleCanvas = !root.nodeName // In node ?\n || root.nodeName.toUpperCase() === 'CANVAS';\n\n this._opts = opts = util.extend({}, opts || {}) as CanvasPainterOption;\n\n /**\n * @type {number}\n */\n this.dpr = opts.devicePixelRatio || devicePixelRatio;\n /**\n * @type {boolean}\n * @private\n */\n this._singleCanvas = singleCanvas;\n /**\n * 绘图容器\n * @type {HTMLElement}\n */\n this.root = root;\n\n const rootStyle = root.style;\n\n if (rootStyle) {\n // @ts-ignore\n util.disableUserSelect(root);\n root.innerHTML = '';\n }\n\n /**\n * @type {module:zrender/Storage}\n */\n this.storage = storage;\n\n const zlevelList: number[] = this._zlevelList;\n\n this._prevDisplayList = [];\n\n const layers = this._layers;\n\n if (!singleCanvas) {\n this._width = getSize(root, 0, opts);\n this._height = getSize(root, 1, opts);\n\n const domRoot = this._domRoot = createRoot(\n this._width, this._height\n );\n root.appendChild(domRoot);\n }\n else {\n const rootCanvas = root as HTMLCanvasElement;\n let width = rootCanvas.width;\n let height = rootCanvas.height;\n\n if (opts.width != null) {\n // TODO sting?\n width = opts.width as number;\n }\n if (opts.height != null) {\n // TODO sting?\n height = opts.height as number;\n }\n this.dpr = opts.devicePixelRatio || 1;\n\n // Use canvas width and height directly\n rootCanvas.width = width * this.dpr;\n rootCanvas.height = height * this.dpr;\n\n this._width = width;\n this._height = height;\n\n // Create layer if only one given canvas\n // Device can be specified to create a high dpi image.\n const mainLayer = new Layer(rootCanvas, this, this.dpr);\n mainLayer.__builtin__ = true;\n mainLayer.initContext();\n // FIXME Use canvas width and height\n // mainLayer.resize(width, height);\n layers[CANVAS_ZLEVEL] = mainLayer;\n mainLayer.zlevel = CANVAS_ZLEVEL;\n // Not use common zlevel.\n zlevelList.push(CANVAS_ZLEVEL);\n\n this._domRoot = root;\n }\n }\n\n\n getType() {\n return 'canvas';\n }\n\n /**\n * If painter use a single canvas\n */\n isSingleCanvas() {\n return this._singleCanvas;\n }\n\n getViewportRoot() {\n return this._domRoot;\n }\n\n getViewportRootOffset() {\n const viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n }\n\n /**\n * 刷新\n * @param paintAll 强制绘制所有displayable\n */\n refresh(paintAll?: boolean) {\n const list = this.storage.getDisplayList(true);\n const prevList = this._prevDisplayList;\n\n const zlevelList = this._zlevelList;\n\n this._redrawId = Math.random();\n\n this._paintList(list, prevList, paintAll, this._redrawId);\n\n // Paint custum layers\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (!layer.__builtin__ && layer.refresh) {\n const clearColor = i === 0 ? this._backgroundColor : null;\n layer.refresh(clearColor);\n }\n }\n\n if (this._opts.useDirtyRect) {\n this._prevDisplayList = list.slice();\n }\n\n return this;\n }\n\n\n refreshHover() {\n this._paintHoverList(this.storage.getDisplayList(false));\n }\n\n private _paintHoverList(list: Displayable[]) {\n let len = list.length;\n let hoverLayer = this._hoverlayer;\n hoverLayer && hoverLayer.clear();\n\n if (!len) {\n return;\n }\n\n const scope: BrushScope = {\n inHover: true,\n viewWidth: this._width,\n viewHeight: this._height\n };\n\n let ctx;\n for (let i = 0; i < len; i++) {\n const el = list[i];\n if (el.__inHover) {\n // Use a extream large zlevel\n // FIXME?\n if (!hoverLayer) {\n hoverLayer = this._hoverlayer = this.getLayer(HOVER_LAYER_ZLEVEL);\n }\n\n if (!ctx) {\n ctx = hoverLayer.ctx;\n ctx.save();\n }\n\n brush(ctx, el, scope, i === len - 1);\n }\n }\n if (ctx) {\n ctx.restore();\n }\n }\n\n getHoverLayer() {\n return this.getLayer(HOVER_LAYER_ZLEVEL);\n }\n\n paintOne(ctx: CanvasRenderingContext2D, el: Displayable) {\n brushSingle(ctx, el);\n }\n\n private _paintList(list: Displayable[], prevList: Displayable[], paintAll: boolean, redrawId?: number) {\n if (this._redrawId !== redrawId) {\n return;\n }\n\n paintAll = paintAll || false;\n\n this._updateLayerStatus(list);\n\n const {finished, needsRefreshHover} = this._doPaintList(list, prevList, paintAll);\n\n if (this._needsManuallyCompositing) {\n this._compositeManually();\n }\n\n if (needsRefreshHover) {\n this._paintHoverList(list);\n }\n\n if (!finished) {\n const self = this;\n requestAnimationFrame(function () {\n self._paintList(list, prevList, paintAll, redrawId);\n });\n }\n else {\n this.eachLayer(layer => {\n layer.afterBrush && layer.afterBrush();\n });\n }\n }\n\n private _compositeManually() {\n const ctx = this.getLayer(CANVAS_ZLEVEL).ctx;\n const width = (this._domRoot as HTMLCanvasElement).width;\n const height = (this._domRoot as HTMLCanvasElement).height;\n ctx.clearRect(0, 0, width, height);\n // PENDING, If only builtin layer?\n this.eachBuiltinLayer(function (layer) {\n if (layer.virtual) {\n ctx.drawImage(layer.dom, 0, 0, width, height);\n }\n });\n }\n\n private _doPaintList(\n list: Displayable[],\n prevList: Displayable[],\n paintAll?: boolean\n ): {\n finished: boolean\n needsRefreshHover: boolean\n } {\n const layerList = [];\n const useDirtyRect = this._opts.useDirtyRect;\n for (let zi = 0; zi < this._zlevelList.length; zi++) {\n const zlevel = this._zlevelList[zi];\n const layer = this._layers[zlevel];\n if (layer.__builtin__\n && layer !== this._hoverlayer\n && (layer.__dirty || paintAll)\n // Layer with hover elements can't be redrawn.\n // && !layer.__hasHoverLayerELement\n ) {\n layerList.push(layer);\n }\n }\n\n let finished = true;\n let needsRefreshHover = false;\n\n for (let k = 0; k < layerList.length; k++) {\n const layer = layerList[k];\n const ctx = layer.ctx;\n\n const repaintRects = useDirtyRect\n && layer.createRepaintRects(list, prevList, this._width, this._height);\n\n let start = paintAll ? layer.__startIndex : layer.__drawIndex;\n\n const useTimer = !paintAll && layer.incremental && Date.now;\n const startTime = useTimer && Date.now();\n\n const clearColor = layer.zlevel === this._zlevelList[0]\n ? this._backgroundColor : null;\n\n // All elements in this layer are removed.\n if (layer.__startIndex === layer.__endIndex) {\n layer.clear(false, clearColor, repaintRects);\n }\n else if (start === layer.__startIndex) {\n const firstEl = list[start];\n if (!firstEl.incremental || !(firstEl as IncrementalDisplayable).notClear || paintAll) {\n layer.clear(false, clearColor, repaintRects);\n }\n }\n if (start === -1) {\n console.error('For some unknown reason. drawIndex is -1');\n start = layer.__startIndex;\n }\n let i: number;\n /* eslint-disable-next-line */\n const repaint = (repaintRect?: BoundingRect) => {\n const scope: BrushScope = {\n inHover: false,\n allClipped: false,\n prevEl: null,\n viewWidth: this._width,\n viewHeight: this._height\n };\n\n for (i = start; i < layer.__endIndex; i++) {\n const el = list[i];\n\n if (el.__inHover) {\n needsRefreshHover = true;\n }\n\n this._doPaintEl(el, layer, useDirtyRect, repaintRect, scope, i === layer.__endIndex - 1);\n\n if (useTimer) {\n // Date.now can be executed in 13,025,305 ops/second.\n const dTime = Date.now() - startTime;\n // Give 15 millisecond to draw.\n // The rest elements will be drawn in the next frame.\n if (dTime > 15) {\n break;\n }\n }\n }\n\n if (scope.prevElClipPaths) {\n // Needs restore the state. If last drawn element is in the clipping area.\n ctx.restore();\n }\n };\n\n if (repaintRects) {\n if (repaintRects.length === 0) {\n // Nothing to repaint, mark as finished\n i = layer.__endIndex;\n }\n else {\n const dpr = this.dpr;\n // Set repaintRect as clipPath\n for (var r = 0; r < repaintRects.length; ++r) {\n const rect = repaintRects[r];\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(\n rect.x * dpr,\n rect.y * dpr,\n rect.width * dpr,\n rect.height * dpr\n );\n ctx.clip();\n\n repaint(rect);\n ctx.restore();\n }\n }\n }\n else {\n // Paint all once\n ctx.save();\n repaint();\n ctx.restore();\n }\n\n layer.__drawIndex = i;\n\n if (layer.__drawIndex < layer.__endIndex) {\n finished = false;\n }\n }\n\n if (env.wxa) {\n // Flush for weixin application\n util.each(this._layers, function (layer) {\n if (layer && layer.ctx && (layer.ctx as WXCanvasRenderingContext).draw) {\n (layer.ctx as WXCanvasRenderingContext).draw();\n }\n });\n }\n\n return {\n finished,\n needsRefreshHover\n };\n }\n\n private _doPaintEl(\n el: Displayable,\n currentLayer: Layer,\n useDirtyRect: boolean,\n repaintRect: BoundingRect,\n scope: BrushScope,\n isLast: boolean\n ) {\n const ctx = currentLayer.ctx;\n if (useDirtyRect) {\n const paintRect = el.getPaintRect();\n if (!repaintRect || paintRect && paintRect.intersect(repaintRect)) {\n brush(ctx, el, scope, isLast);\n el.setPrevPaintRect(paintRect);\n }\n }\n else {\n brush(ctx, el, scope, isLast);\n }\n }\n\n /**\n * 获取 zlevel 所在层,如果不存在则会创建一个新的层\n * @param zlevel\n * @param virtual Virtual layer will not be inserted into dom.\n */\n getLayer(zlevel: number, virtual?: boolean) {\n if (this._singleCanvas && !this._needsManuallyCompositing) {\n zlevel = CANVAS_ZLEVEL;\n }\n let layer = this._layers[zlevel];\n if (!layer) {\n // Create a new layer\n layer = new Layer('zr_' + zlevel, this, this.dpr);\n layer.zlevel = zlevel;\n layer.__builtin__ = true;\n\n if (this._layerConfig[zlevel]) {\n util.merge(layer, this._layerConfig[zlevel], true);\n }\n // TODO Remove EL_AFTER_INCREMENTAL_INC magic number\n else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {\n util.merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);\n }\n\n if (virtual) {\n layer.virtual = virtual;\n }\n\n this.insertLayer(zlevel, layer);\n\n // Context is created after dom inserted to document\n // Or excanvas will get 0px clientWidth and clientHeight\n layer.initContext();\n }\n\n return layer;\n }\n\n insertLayer(zlevel: number, layer: Layer) {\n\n const layersMap = this._layers;\n const zlevelList = this._zlevelList;\n const len = zlevelList.length;\n const domRoot = this._domRoot;\n let prevLayer = null;\n let i = -1;\n\n if (layersMap[zlevel]) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('ZLevel ' + zlevel + ' has been used already');\n }\n return;\n }\n // Check if is a valid layer\n if (!isLayerValid(layer)) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('Layer of zlevel ' + zlevel + ' is not valid');\n }\n return;\n }\n\n if (len > 0 && zlevel > zlevelList[0]) {\n for (i = 0; i < len - 1; i++) {\n if (\n zlevelList[i] < zlevel\n && zlevelList[i + 1] > zlevel\n ) {\n break;\n }\n }\n prevLayer = layersMap[zlevelList[i]];\n }\n zlevelList.splice(i + 1, 0, zlevel);\n\n layersMap[zlevel] = layer;\n\n // Virtual layer will not directly show on the screen.\n // (It can be a WebGL layer and assigned to a ZRImage element)\n // But it still under management of zrender.\n if (!layer.virtual) {\n if (prevLayer) {\n const prevDom = prevLayer.dom;\n if (prevDom.nextSibling) {\n domRoot.insertBefore(\n layer.dom,\n prevDom.nextSibling\n );\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n else {\n if (domRoot.firstChild) {\n domRoot.insertBefore(layer.dom, domRoot.firstChild);\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n }\n\n layer.painter || (layer.painter = this);\n }\n\n // Iterate each layer\n eachLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n cb.call(context, this._layers[z], z);\n }\n }\n\n // Iterate each buildin layer\n eachBuiltinLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n }\n\n // Iterate each other layer except buildin layer\n eachOtherLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (!layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n }\n\n /**\n * 获取所有已创建的层\n * @param prevLayer\n */\n getLayers() {\n return this._layers;\n }\n\n _updateLayerStatus(list: Displayable[]) {\n\n this.eachBuiltinLayer(function (layer, z) {\n layer.__dirty = layer.__used = false;\n });\n\n function updatePrevLayer(idx: number) {\n if (prevLayer) {\n if (prevLayer.__endIndex !== idx) {\n prevLayer.__dirty = true;\n }\n prevLayer.__endIndex = idx;\n }\n }\n\n if (this._singleCanvas) {\n for (let i = 1; i < list.length; i++) {\n const el = list[i];\n if (el.zlevel !== list[i - 1].zlevel || el.incremental) {\n this._needsManuallyCompositing = true;\n break;\n }\n }\n }\n\n let prevLayer: Layer = null;\n let incrementalLayerCount = 0;\n let prevZlevel;\n let i;\n\n for (i = 0; i < list.length; i++) {\n const el = list[i];\n const zlevel = el.zlevel;\n let layer;\n\n if (prevZlevel !== zlevel) {\n prevZlevel = zlevel;\n incrementalLayerCount = 0;\n }\n\n // TODO Not use magic number on zlevel.\n\n // Each layer with increment element can be separated to 3 layers.\n // (Other Element drawn after incremental element)\n // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------\n // (Incremental element)\n // ----------------------zlevel + INCREMENTAL_INC------------------------\n // (Element drawn before incremental element)\n // --------------------------------zlevel--------------------------------\n if (el.incremental) {\n layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);\n layer.incremental = true;\n incrementalLayerCount = 1;\n }\n else {\n layer = this.getLayer(\n zlevel + (incrementalLayerCount > 0 ? EL_AFTER_INCREMENTAL_INC : 0),\n this._needsManuallyCompositing\n );\n }\n\n if (!layer.__builtin__) {\n util.logError('ZLevel ' + zlevel + ' has been used by unkown layer ' + layer.id);\n }\n\n if (layer !== prevLayer) {\n layer.__used = true;\n if (layer.__startIndex !== i) {\n layer.__dirty = true;\n }\n layer.__startIndex = i;\n if (!layer.incremental) {\n layer.__drawIndex = i;\n }\n else {\n // Mark layer draw index needs to update.\n layer.__drawIndex = -1;\n }\n updatePrevLayer(i);\n prevLayer = layer;\n }\n if ((el.__dirty & REDRAW_BIT) && !el.__inHover) { // Ignore dirty elements in hover layer.\n layer.__dirty = true;\n if (layer.incremental && layer.__drawIndex < 0) {\n // Start draw from the first dirty element.\n layer.__drawIndex = i;\n }\n }\n }\n\n updatePrevLayer(i);\n\n this.eachBuiltinLayer(function (layer, z) {\n // Used in last frame but not in this frame. Needs clear\n if (!layer.__used && layer.getElementCount() > 0) {\n layer.__dirty = true;\n layer.__startIndex = layer.__endIndex = layer.__drawIndex = 0;\n }\n // For incremental layer. In case start index changed and no elements are dirty.\n if (layer.__dirty && layer.__drawIndex < 0) {\n layer.__drawIndex = layer.__startIndex;\n }\n });\n }\n\n /**\n * 清除hover层外所有内容\n */\n clear() {\n this.eachBuiltinLayer(this._clearLayer);\n return this;\n }\n\n _clearLayer(layer: Layer) {\n layer.clear();\n }\n\n setBackgroundColor(backgroundColor: string | GradientObject | ImagePatternObject) {\n this._backgroundColor = backgroundColor;\n\n util.each(this._layers, layer => {\n layer.setUnpainted();\n });\n }\n\n /**\n * 修改指定zlevel的绘制参数\n */\n configLayer(zlevel: number, config: LayerConfig) {\n if (config) {\n const layerConfig = this._layerConfig;\n if (!layerConfig[zlevel]) {\n layerConfig[zlevel] = config;\n }\n else {\n util.merge(layerConfig[zlevel], config, true);\n }\n\n for (let i = 0; i < this._zlevelList.length; i++) {\n const _zlevel = this._zlevelList[i];\n // TODO Remove EL_AFTER_INCREMENTAL_INC magic number\n if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {\n const layer = this._layers[_zlevel];\n util.merge(layer, layerConfig[zlevel], true);\n }\n }\n }\n }\n\n /**\n * 删除指定层\n * @param zlevel 层所在的zlevel\n */\n delLayer(zlevel: number) {\n const layers = this._layers;\n const zlevelList = this._zlevelList;\n const layer = layers[zlevel];\n if (!layer) {\n return;\n }\n layer.dom.parentNode.removeChild(layer.dom);\n delete layers[zlevel];\n\n zlevelList.splice(util.indexOf(zlevelList, zlevel), 1);\n }\n\n /**\n * 区域大小变化后重绘\n */\n resize(\n width?: number | string,\n height?: number | string\n ) {\n if (!this._domRoot.style) { // Maybe in node or worker\n if (width == null || height == null) {\n return;\n }\n // TODO width / height may be string\n this._width = width as number;\n this._height = height as number;\n\n this.getLayer(CANVAS_ZLEVEL).resize(width as number, height as number);\n }\n else {\n const domRoot = this._domRoot;\n // FIXME Why ?\n domRoot.style.display = 'none';\n\n // Save input w/h\n const opts = this._opts;\n const root = this.root;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n\n domRoot.style.display = '';\n\n // 优化没有实际改变的resize\n if (this._width !== width || height !== this._height) {\n domRoot.style.width = width + 'px';\n domRoot.style.height = height + 'px';\n\n for (let id in this._layers) {\n if (this._layers.hasOwnProperty(id)) {\n this._layers[id].resize(width, height);\n }\n }\n\n this.refresh(true);\n }\n\n this._width = width;\n this._height = height;\n\n }\n return this;\n }\n\n /**\n * 清除单独的一个层\n * @param {number} zlevel\n */\n clearLayer(zlevel: number) {\n const layer = this._layers[zlevel];\n if (layer) {\n layer.clear();\n }\n }\n\n /**\n * 释放\n */\n dispose() {\n this.root.innerHTML = '';\n\n this.root =\n this.storage =\n\n this._domRoot =\n this._layers = null;\n }\n\n /**\n * Get canvas which has all thing rendered\n */\n getRenderedCanvas(opts?: {\n backgroundColor?: string | GradientObject | ImagePatternObject\n pixelRatio?: number\n }) {\n opts = opts || {};\n if (this._singleCanvas && !this._compositeManually) {\n return this._layers[CANVAS_ZLEVEL].dom;\n }\n\n const imageLayer = new Layer('image', this, opts.pixelRatio || this.dpr);\n imageLayer.initContext();\n imageLayer.clear(false, opts.backgroundColor || this._backgroundColor);\n\n const ctx = imageLayer.ctx;\n\n if (opts.pixelRatio <= this.dpr) {\n this.refresh();\n\n const width = imageLayer.dom.width;\n const height = imageLayer.dom.height;\n this.eachLayer(function (layer) {\n if (layer.__builtin__) {\n ctx.drawImage(layer.dom, 0, 0, width, height);\n }\n else if (layer.renderToCanvas) {\n ctx.save();\n layer.renderToCanvas(ctx);\n ctx.restore();\n }\n });\n }\n else {\n // PENDING, echarts-gl and incremental rendering.\n const scope = {\n inHover: false,\n viewWidth: this._width,\n viewHeight: this._height\n };\n const displayList = this.storage.getDisplayList(true);\n for (let i = 0, len = displayList.length; i < len; i++) {\n const el = displayList[i];\n brush(ctx, el, scope, i === len - 1);\n }\n }\n\n return imageLayer.dom;\n }\n /**\n * 获取绘图区域宽度\n */\n getWidth() {\n return this._width;\n }\n\n /**\n * 获取绘图区域高度\n */\n getHeight() {\n return this._height;\n }\n};","import { PathRebuilder } from '../core/PathProxy';\r\nimport { isAroundZero } from './helper';\r\n\r\nconst mathSin = Math.sin;\r\nconst mathCos = Math.cos;\r\nconst PI = Math.PI;\r\nconst PI2 = Math.PI * 2;\r\nconst degree = 180 / PI;\r\n\r\n\r\nexport default class SVGPathRebuilder implements PathRebuilder {\r\n private _d: (string | number)[]\r\n private _str: string\r\n private _invalid: boolean\r\n\r\n // If is start of subpath\r\n private _start: boolean\r\n private _p: number\r\n\r\n reset(precision?: number) {\r\n this._start = true;\r\n this._d = [];\r\n this._str = '';\r\n\r\n this._p = Math.pow(10, precision || 4);\r\n }\r\n moveTo(x: number, y: number) {\r\n this._add('M', x, y);\r\n }\r\n lineTo(x: number, y: number) {\r\n this._add('L', x, y);\r\n }\r\n bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number) {\r\n this._add('C', x, y, x2, y2, x3, y3);\r\n }\r\n quadraticCurveTo(x: number, y: number, x2: number, y2: number) {\r\n this._add('Q', x, y, x2, y2);\r\n }\r\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean) {\r\n this.ellipse(cx, cy, r, r, 0, startAngle, endAngle, anticlockwise);\r\n }\r\n ellipse(\r\n cx: number, cy: number,\r\n rx: number, ry: number,\r\n psi: number,\r\n startAngle: number,\r\n endAngle: number,\r\n anticlockwise: boolean\r\n ) {\r\n let dTheta = endAngle - startAngle;\r\n const clockwise = !anticlockwise;\r\n\r\n const dThetaPositive = Math.abs(dTheta);\r\n const isCircle = isAroundZero(dThetaPositive - PI2)\r\n || (clockwise ? dTheta >= PI2 : -dTheta >= PI2);\r\n\r\n // Mapping to 0~2PI\r\n const unifiedTheta = dTheta > 0 ? dTheta % PI2 : (dTheta % PI2 + PI2);\r\n\r\n let large = false;\r\n if (isCircle) {\r\n large = true;\r\n }\r\n else if (isAroundZero(dThetaPositive)) {\r\n large = false;\r\n }\r\n else {\r\n large = (unifiedTheta >= PI) === !!clockwise;\r\n }\r\n\r\n const x0 = cx + rx * mathCos(startAngle);\r\n const y0 = cy + ry * mathSin(startAngle);\r\n\r\n if (this._start) {\r\n // Move to (x0, y0) only when CMD.A comes at the\r\n // first position of a shape.\r\n // For instance, when drawing a ring, CMD.A comes\r\n // after CMD.M, so it's unnecessary to move to\r\n // (x0, y0).\r\n this._add('M', x0, y0);\r\n }\r\n\r\n const xRot = Math.round(psi * degree);\r\n // It will not draw if start point and end point are exactly the same\r\n // We need to add two arcs\r\n if (isCircle) {\r\n const p = 1 / this._p;\r\n const dTheta = (clockwise ? 1 : -1) * (PI2 - p);\r\n this._add(\r\n 'A', rx, ry, xRot, 1, +clockwise,\r\n cx + rx * mathCos(startAngle + dTheta),\r\n cy + ry * mathSin(startAngle + dTheta)\r\n );\r\n // TODO.\r\n // Usually we can simply divide the circle into two halfs arcs.\r\n // But it will cause slightly diff with previous screenshot.\r\n // We can't tell it but visual regression test can. To avoid too much breaks.\r\n // We keep the logic on the browser as before.\r\n // But in SSR mode wich has lower precision. We close the circle by adding another arc.\r\n if (p > 1e-2) {\r\n this._add('A', rx, ry, xRot, 0, +clockwise, x0, y0);\r\n }\r\n }\r\n else {\r\n const x = cx + rx * mathCos(endAngle);\r\n const y = cy + ry * mathSin(endAngle);\r\n\r\n // FIXME Ellipse\r\n this._add('A', rx, ry, xRot, +large, +clockwise, x, y);\r\n }\r\n\r\n }\r\n rect(x: number, y: number, w: number, h: number) {\r\n this._add('M', x, y);\r\n // Use relative coordinates to reduce the size.\r\n this._add('l', w, 0);\r\n this._add('l', 0, h);\r\n this._add('l', -w, 0);\r\n // this._add('L', x, y);\r\n this._add('Z');\r\n }\r\n closePath() {\r\n // Not use Z as first command\r\n if (this._d.length > 0) {\r\n this._add('Z');\r\n }\r\n }\r\n\r\n _add(cmd: string, a?: number, b?: number, c?: number, d?: number, e?: number, f?: number, g?: number, h?: number) {\r\n const vals = [];\r\n const p = this._p;\r\n for (let i = 1; i < arguments.length; i++) {\r\n const val = arguments[i];\r\n if (isNaN(val)) {\r\n this._invalid = true;\r\n return;\r\n }\r\n vals.push(Math.round(val * p) / p);\r\n }\r\n this._d.push(cmd + vals.join(' '));\r\n this._start = cmd === 'Z';\r\n }\r\n\r\n generateStr() {\r\n this._str = this._invalid ? '' : this._d.join('');\r\n this._d = [];\r\n }\r\n getStr() {\r\n return this._str;\r\n }\r\n}","\r\nimport Path, { DEFAULT_PATH_STYLE, PathStyleProps } from '../graphic/Path';\r\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\r\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\r\nimport { getLineDash } from '../canvas/dashStyle';\r\nimport { map } from '../core/util';\r\nimport { normalizeColor } from './helper';\r\n\r\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\r\n\r\nconst NONE = 'none';\r\nconst mathRound = Math.round;\r\n\r\nfunction pathHasFill(style: AllStyleOption): style is PathStyleProps {\r\n const fill = (style as PathStyleProps).fill;\r\n return fill != null && fill !== NONE;\r\n}\r\n\r\nfunction pathHasStroke(style: AllStyleOption): style is PathStyleProps {\r\n const stroke = (style as PathStyleProps).stroke;\r\n return stroke != null && stroke !== NONE;\r\n}\r\n\r\nconst strokeProps = ['lineCap', 'miterLimit', 'lineJoin'] as const;\r\nconst svgStrokeProps = map(strokeProps, prop => `stroke-${prop.toLowerCase()}`);\r\n\r\nexport default function mapStyleToAttrs(\r\n updateAttr: (key: string, val: string | number) => void,\r\n style: AllStyleOption,\r\n el: Path | TSpan | ZRImage,\r\n /**\r\n * Will try not to set the attribute if it's using default value if not using forceUpdate.\r\n * Mainly for reduce the generated size in svg-ssr mode.\r\n */\r\n forceUpdate: boolean\r\n): void {\r\n const opacity = style.opacity == null ? 1 : style.opacity;\r\n\r\n // only set opacity. stroke and fill cannot be applied to svg image\r\n if (el instanceof ZRImage) {\r\n updateAttr('opacity', opacity);\r\n return;\r\n }\r\n\r\n if (pathHasFill(style)) {\r\n const fill = normalizeColor(style.fill as string);\r\n updateAttr('fill', fill.color);\r\n const fillOpacity = style.fillOpacity != null\r\n ? style.fillOpacity * fill.opacity * opacity\r\n : fill.opacity * opacity;\r\n if (forceUpdate || fillOpacity < 1) {\r\n updateAttr('fill-opacity', fillOpacity);\r\n }\r\n }\r\n else {\r\n updateAttr('fill', NONE);\r\n }\r\n\r\n if (pathHasStroke(style)) {\r\n const stroke = normalizeColor(style.stroke as string);\r\n updateAttr('stroke', stroke.color);\r\n const strokeScale = style.strokeNoScale\r\n ? (el as Path).getLineScale()\r\n : 1;\r\n const strokeWidth = (strokeScale ? (style.lineWidth || 0) / strokeScale : 0);\r\n const strokeOpacity = style.strokeOpacity != null\r\n ? style.strokeOpacity * stroke.opacity * opacity\r\n : stroke.opacity * opacity;\r\n const strokeFirst = style.strokeFirst;\r\n\r\n if (forceUpdate || strokeWidth !== 1) {\r\n updateAttr('stroke-width', strokeWidth);\r\n }\r\n // stroke then fill for text; fill then stroke for others\r\n if (forceUpdate || strokeFirst) {\r\n updateAttr('paint-order', strokeFirst ? 'stroke' : 'fill');\r\n }\r\n if (forceUpdate || strokeOpacity < 1) {\r\n updateAttr('stroke-opacity', strokeOpacity);\r\n }\r\n\r\n if (style.lineDash) {\r\n let [lineDash, lineDashOffset] = getLineDash(el);\r\n if (lineDash) {\r\n lineDashOffset = mathRound(lineDashOffset || 0);\r\n updateAttr('stroke-dasharray', lineDash.join(','));\r\n if (lineDashOffset || forceUpdate) {\r\n updateAttr('stroke-dashoffset', lineDashOffset);\r\n }\r\n }\r\n }\r\n else if (forceUpdate) {\r\n // Reset if force update.\r\n updateAttr('stroke-dasharray', NONE);\r\n }\r\n\r\n // PENDING reset\r\n for (let i = 0; i < strokeProps.length; i++) {\r\n const propName = strokeProps[i];\r\n if (forceUpdate || style[propName] !== DEFAULT_PATH_STYLE[propName]) {\r\n const val = style[propName] || DEFAULT_PATH_STYLE[propName];\r\n // TODO reset\r\n val && updateAttr(svgStrokeProps[i], val);\r\n }\r\n }\r\n }\r\n else if (forceUpdate) {\r\n updateAttr('stroke', NONE);\r\n }\r\n}\r\n","import { keys, map } from '../core/util';\nimport { encodeHTML } from '../core/dom';\n\nexport type CSSSelectorVNode = Record\nexport type CSSAnimationVNode = Record>\n\nexport const SVGNS = 'http://www.w3.org/2000/svg';\nexport const XLINKNS = 'http://www.w3.org/1999/xlink';\nexport const XMLNS = 'http://www.w3.org/2000/xmlns/';\nexport const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\nexport const META_DATA_PREFIX = 'ecmeta_';\n\nexport function createElement(name: string) {\n return document.createElementNS(SVGNS, name);\n}\n\nexport type SVGVNodeAttrs = Record\nexport interface SVGVNode {\n tag: string,\n attrs: SVGVNodeAttrs,\n children?: SVGVNode[],\n text?: string\n\n // For patching\n elm?: Node\n key: string\n};\nexport function createVNode(\n tag: string,\n key: string,\n attrs?: SVGVNodeAttrs,\n children?: SVGVNode[],\n text?: string\n): SVGVNode {\n return {\n tag,\n attrs: attrs || {},\n children,\n text,\n key\n };\n}\n\nfunction createElementOpen(name: string, attrs?: SVGVNodeAttrs) {\n const attrsStr: string[] = [];\n if (attrs) {\n // eslint-disable-next-line\n for (let key in attrs) {\n const val = attrs[key];\n let part = key;\n // Same with the logic in patch.\n if (val === false) {\n continue;\n }\n else if (val !== true && val != null) {\n part += `=\"${val}\"`;\n }\n attrsStr.push(part);\n }\n }\n return `<${name} ${attrsStr.join(' ')}>`;\n}\n\nfunction createElementClose(name: string) {\n return ``;\n}\n\nexport function vNodeToString(el: SVGVNode, opts?: {\n newline?: boolean\n}) {\n opts = opts || {};\n const S = opts.newline ? '\\n' : '';\n function convertElToString(el: SVGVNode): string {\n const {children, tag, attrs, text} = el;\n return createElementOpen(tag, attrs)\n + (tag !== 'style' ? encodeHTML(text) : text || '')\n + (children ? `${S}${map(children, child => convertElToString(child)).join(S)}${S}` : '')\n + createElementClose(tag);\n }\n return convertElToString(el);\n}\n\nexport function getCssString(\n selectorNodes: Record,\n animationNodes: Record,\n opts?: {\n newline?: boolean\n }\n) {\n opts = opts || {};\n const S = opts.newline ? '\\n' : '';\n const bracketBegin = ` {${S}`;\n const bracketEnd = `${S}}`;\n const selectors = map(keys(selectorNodes), className => {\n return className + bracketBegin + map(keys(selectorNodes[className]), attrName => {\n return `${attrName}:${selectorNodes[className][attrName]};`;\n }).join(S) + bracketEnd;\n }).join(S);\n const animations = map(keys(animationNodes), (animationName) => {\n return `@keyframes ${animationName}${bracketBegin}` + map(keys(animationNodes[animationName]), percent => {\n return percent + bracketBegin + map(keys(animationNodes[animationName][percent]), attrName => {\n let val = animationNodes[animationName][percent][attrName];\n // postprocess\n if (attrName === 'd') {\n val = `path(\"${val}\")`;\n }\n return `${attrName}:${val};`;\n }).join(S) + bracketEnd;\n }).join(S) + bracketEnd;\n }).join(S);\n\n if (!selectors && !animations) {\n return '';\n }\n\n return [''].join(S);\n}\n\n\nexport interface BrushScope {\n zrId: string\n\n shadowCache: Record\n gradientCache: Record\n patternCache: Record\n clipPathCache: Record\n\n defs: Record\n\n cssNodes: Record\n cssAnims: Record>>\n /**\n * Cache for css style string, mapping from style string to class name.\n */\n cssStyleCache: Record\n\n cssAnimIdx: number\n\n shadowIdx: number\n gradientIdx: number\n patternIdx: number\n clipPathIdx: number\n // configs\n /**\n * If create animates nodes.\n */\n animation?: boolean,\n /**\n * If create emphasis styles.\n */\n emphasis?: boolean,\n\n /**\n * If will update. Some optimization for string generation can't be applied.\n */\n willUpdate?: boolean\n\n /**\n * If compress the output string.\n */\n compress?: boolean\n\n ssr?: boolean\n}\n\nexport function createBrushScope(zrId: string): BrushScope {\n return {\n zrId,\n shadowCache: {},\n patternCache: {},\n gradientCache: {},\n clipPathCache: {},\n defs: {},\n\n cssNodes: {},\n cssAnims: {},\n cssStyleCache: {},\n\n cssAnimIdx: 0,\n\n shadowIdx: 0,\n gradientIdx: 0,\n patternIdx: 0,\n clipPathIdx: 0\n };\n}\n\nexport function createSVGVNode(\n width: number | string,\n height: number | string,\n children?: SVGVNode[],\n useViewBox?: boolean\n) {\n return createVNode(\n 'svg',\n 'root',\n {\n 'width': width,\n 'height': height,\n 'xmlns': SVGNS,\n 'xmlns:xlink': XLINKNS,\n 'version': '1.1',\n 'baseProfile': 'full',\n 'viewBox': useViewBox ? `0 0 ${width} ${height}` : false\n },\n children\n );\n}","let cssClassIdx = 0;\n\nexport function getClassId() {\n return cssClassIdx++;\n}\n","import Transformable, { copyTransform } from '../core/Transformable';\nimport Displayable from '../graphic/Displayable';\nimport { SVGVNodeAttrs, BrushScope, createBrushScope} from './core';\nimport Path from '../graphic/Path';\nimport SVGPathRebuilder from './SVGPathRebuilder';\nimport PathProxy from '../core/PathProxy';\nimport { getPathPrecision, getSRTTransformString } from './helper';\nimport { each, extend, filter, isNumber, isString, keys } from '../core/util';\nimport Animator from '../animation/Animator';\nimport CompoundPath from '../graphic/CompoundPath';\nimport { AnimationEasing } from '../animation/easing';\nimport { createCubicEasingFunc } from '../animation/cubicEasing';\nimport { getClassId } from './cssClassId';\n\nexport const EASING_MAP: Record = {\n // From https://easings.net/\n cubicIn: '0.32,0,0.67,0',\n cubicOut: '0.33,1,0.68,1',\n cubicInOut: '0.65,0,0.35,1',\n quadraticIn: '0.11,0,0.5,0',\n quadraticOut: '0.5,1,0.89,1',\n quadraticInOut: '0.45,0,0.55,1',\n quarticIn: '0.5,0,0.75,0',\n quarticOut: '0.25,1,0.5,1',\n quarticInOut: '0.76,0,0.24,1',\n quinticIn: '0.64,0,0.78,0',\n quinticOut: '0.22,1,0.36,1',\n quinticInOut: '0.83,0,0.17,1',\n sinusoidalIn: '0.12,0,0.39,0',\n sinusoidalOut: '0.61,1,0.88,1',\n sinusoidalInOut: '0.37,0,0.63,1',\n exponentialIn: '0.7,0,0.84,0',\n exponentialOut: '0.16,1,0.3,1',\n exponentialInOut: '0.87,0,0.13,1',\n circularIn: '0.55,0,1,0.45',\n circularOut: '0,0.55,0.45,1',\n circularInOut: '0.85,0,0.15,1'\n // TODO elastic, bounce\n};\n\nconst transformOriginKey = 'transform-origin';\n\nfunction buildPathString(el: Path, kfShape: Path['shape'], path: PathProxy) {\n const shape = extend({}, el.shape);\n extend(shape, kfShape);\n\n el.buildPath(path, shape);\n const svgPathBuilder = new SVGPathRebuilder();\n svgPathBuilder.reset(getPathPrecision(el));\n path.rebuildPath(svgPathBuilder, 1);\n svgPathBuilder.generateStr();\n // will add path(\"\") when generated to css string in the final step.\n return svgPathBuilder.getStr();\n}\n\nfunction setTransformOrigin(target: Record, transform: Transformable) {\n const {originX, originY} = transform;\n if (originX || originY) {\n target[transformOriginKey] = `${originX}px ${originY}px`;\n }\n}\n\nexport const ANIMATE_STYLE_MAP: Record = {\n fill: 'fill',\n opacity: 'opacity',\n lineWidth: 'stroke-width',\n lineDashOffset: 'stroke-dashoffset'\n // TODO shadow is not supported.\n};\n\ntype CssKF = Record;\n\nfunction addAnimation(cssAnim: Record, scope: BrushScope) {\n const animationName = scope.zrId + '-ani-' + scope.cssAnimIdx++;\n scope.cssAnims[animationName] = cssAnim;\n return animationName;\n}\n\nfunction createCompoundPathCSSAnimation(\n el: CompoundPath,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const paths = el.shape.paths;\n const composedAnim: Record = {};\n let cssAnimationCfg: string;\n let cssAnimationName: string;\n each(paths, path => {\n const subScope = createBrushScope(scope.zrId);\n subScope.animation = true;\n createCSSAnimation(path, {}, subScope, true);\n const cssAnims = subScope.cssAnims;\n const cssNodes = subScope.cssNodes;\n const animNames = keys(cssAnims);\n const len = animNames.length;\n if (!len) {\n return;\n }\n cssAnimationName = animNames[len - 1];\n // Only use last animation because they are conflicted.\n const lastAnim = cssAnims[cssAnimationName];\n // eslint-disable-next-line\n for (let percent in lastAnim) {\n const kf = lastAnim[percent];\n composedAnim[percent] = composedAnim[percent] || { d: '' };\n composedAnim[percent].d += kf.d || '';\n }\n // eslint-disable-next-line\n for (let className in cssNodes) {\n const val = cssNodes[className].animation;\n if (val.indexOf(cssAnimationName) >= 0) {\n // Only pick the animation configuration of last subpath.\n cssAnimationCfg = val;\n }\n }\n });\n\n if (!cssAnimationCfg) {\n return;\n }\n\n // Remove the attrs in the element because it will be set by animation.\n // Reduce the size.\n attrs.d = false;\n const animationName = addAnimation(composedAnim, scope);\n return cssAnimationCfg.replace(cssAnimationName, animationName);\n}\n\nfunction getEasingFunc(easing: AnimationEasing) {\n return isString(easing)\n ? EASING_MAP[easing]\n ? `cubic-bezier(${EASING_MAP[easing]})`\n : createCubicEasingFunc(easing) ? easing : ''\n : '';\n}\n\nexport function createCSSAnimation(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope,\n onlyShape?: boolean\n) {\n const animators = el.animators;\n const len = animators.length;\n\n const cssAnimations: string[] = [];\n\n if (el instanceof CompoundPath) {\n const animationCfg = createCompoundPathCSSAnimation(el, attrs, scope);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n else if (!len) {\n return;\n }\n }\n else if (!len) {\n return;\n }\n // Group animators by it's configuration\n const groupAnimators: Record[]]> = {};\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const cfgArr: (string | number)[] = [animator.getMaxTime() / 1000 + 's'];\n const easing = getEasingFunc(animator.getClip().easing);\n const delay = animator.getDelay();\n\n if (easing) {\n cfgArr.push(easing);\n }\n else {\n cfgArr.push('linear');\n }\n if (delay) {\n cfgArr.push(delay / 1000 + 's');\n }\n if (animator.getLoop()) {\n cfgArr.push('infinite');\n }\n const cfg = cfgArr.join(' ');\n\n // TODO fill mode\n groupAnimators[cfg] = groupAnimators[cfg] || [cfg, [] as Animator[]];\n groupAnimators[cfg][1].push(animator);\n }\n\n function createSingleCSSAnimation(groupAnimator: [string, Animator[]]) {\n const animators = groupAnimator[1];\n const len = animators.length;\n const transformKfs: Record = {};\n const shapeKfs: Record = {};\n\n const finalKfs: Record = {};\n\n const animationTimingFunctionAttrName = 'animation-timing-function';\n\n function saveAnimatorTrackToCssKfs(\n animator: Animator,\n cssKfs: Record,\n toCssAttrName?: (propName: string) => string\n ) {\n const tracks = animator.getTracks();\n const maxTime = animator.getMaxTime();\n for (let k = 0; k < tracks.length; k++) {\n const track = tracks[k];\n if (track.needsAnimate()) {\n const kfs = track.keyframes;\n let attrName = track.propName;\n toCssAttrName && (attrName = toCssAttrName(attrName));\n if (attrName) {\n for (let i = 0; i < kfs.length; i++) {\n const kf = kfs[i];\n const percent = Math.round(kf.time / maxTime * 100) + '%';\n const kfEasing = getEasingFunc(kf.easing);\n const rawValue = kf.rawValue;\n\n // TODO gradient\n if (isString(rawValue) || isNumber(rawValue)) {\n cssKfs[percent] = cssKfs[percent] || {};\n cssKfs[percent][attrName] = kf.rawValue;\n\n if (kfEasing) {\n // TODO. If different property have different easings.\n cssKfs[percent][animationTimingFunctionAttrName] = kfEasing;\n }\n }\n }\n }\n }\n }\n }\n\n // Find all transform animations.\n // TODO origin, parent\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const targetProp = animator.targetName;\n if (!targetProp) {\n !onlyShape && saveAnimatorTrackToCssKfs(animator, transformKfs);\n }\n else if (targetProp === 'shape') {\n saveAnimatorTrackToCssKfs(animator, shapeKfs);\n }\n }\n\n // eslint-disable-next-line\n for (let percent in transformKfs) {\n const transform = {} as Transformable;\n copyTransform(transform, el);\n extend(transform, transformKfs[percent]);\n const str = getSRTTransformString(transform);\n const timingFunction = transformKfs[percent][animationTimingFunctionAttrName];\n finalKfs[percent] = str ? {\n transform: str\n } : {};\n // TODO set transform origin in element?\n setTransformOrigin(finalKfs[percent], transform);\n\n // Save timing function\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n };\n\n\n let path: PathProxy;\n let canAnimateShape = true;\n // eslint-disable-next-line\n for (let percent in shapeKfs) {\n finalKfs[percent] = finalKfs[percent] || {};\n\n const isFirst = !path;\n const timingFunction = shapeKfs[percent][animationTimingFunctionAttrName];\n\n if (isFirst) {\n path = new PathProxy();\n }\n let len = path.len();\n path.reset();\n finalKfs[percent].d = buildPathString(el as Path, shapeKfs[percent], path);\n let newLen = path.len();\n // Path data don't match.\n if (!isFirst && len !== newLen) {\n canAnimateShape = false;\n break;\n }\n\n // Save timing function\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n };\n if (!canAnimateShape) {\n // eslint-disable-next-line\n for (let percent in finalKfs) {\n delete finalKfs[percent].d;\n }\n }\n\n if (!onlyShape) {\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const targetProp = animator.targetName;\n if (targetProp === 'style') {\n saveAnimatorTrackToCssKfs(\n animator, finalKfs, (propName) => ANIMATE_STYLE_MAP[propName]\n );\n }\n }\n }\n\n const percents = keys(finalKfs);\n\n // Set transform origin in attribute to reduce the size.\n let allTransformOriginSame = true;\n let transformOrigin;\n for (let i = 1; i < percents.length; i++) {\n const p0 = percents[i - 1];\n const p1 = percents[i];\n if (finalKfs[p0][transformOriginKey] !== finalKfs[p1][transformOriginKey]) {\n allTransformOriginSame = false;\n break;\n }\n transformOrigin = finalKfs[p0][transformOriginKey];\n }\n if (allTransformOriginSame && transformOrigin) {\n for (const percent in finalKfs) {\n if (finalKfs[percent][transformOriginKey]) {\n delete finalKfs[percent][transformOriginKey];\n }\n }\n attrs[transformOriginKey] = transformOrigin;\n }\n\n if (filter(\n percents, (percent) => keys(finalKfs[percent]).length > 0\n ).length) {\n const animationName = addAnimation(finalKfs, scope);\n // eslint-disable-next-line\n // for (const attrName in finalKfs[percents[0]]) {\n // // Remove the attrs in the element because it will be set by animation.\n // // Reduce the size.\n // attrs[attrName] = false;\n // }\n // animationName {duration easing delay loop} fillMode\n return `${animationName} ${groupAnimator[0]} both`;\n }\n }\n\n // eslint-disable-next-line\n for (let key in groupAnimators) {\n const animationCfg = createSingleCSSAnimation(groupAnimators[key]);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n }\n\n if (cssAnimations.length) {\n const className = scope.zrId + '-cls-' + getClassId();\n scope.cssNodes['.' + className] = {\n animation: cssAnimations.join(',')\n };\n // TODO exists class?\n attrs.class = className;\n }\n}","import Displayable from '../graphic/Displayable';\nimport { liftColor } from '../tool/color';\nimport { BrushScope, SVGVNodeAttrs } from './core';\nimport { getClassId } from './cssClassId';\n\nexport function createCSSEmphasis(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n if (!el.ignore) {\n if (el.isSilent()) {\n // If el is silent, it can not be hovered nor selected.\n // So set pointer-events to pass through.\n const style = {\n 'pointer-events': 'none'\n };\n setClassAttribute(style, attrs, scope, true);\n }\n else {\n const emphasisStyle = el.states.emphasis && el.states.emphasis.style\n ? el.states.emphasis.style\n : {};\n let fill = emphasisStyle.fill;\n if (!fill) {\n // No empahsis fill, lift color\n const normalFill = el.style && el.style.fill;\n const selectFill = el.states.select\n && el.states.select.style\n && el.states.select.style.fill;\n const fromFill = el.currentStates.indexOf('select') >= 0\n ? (selectFill || normalFill)\n : normalFill;\n if (fromFill) {\n fill = liftColor(fromFill);\n }\n }\n let lineWidth = emphasisStyle.lineWidth;\n if (lineWidth) {\n // Symbols use transform to set size, so lineWidth\n // should be divided by scaleX\n const scaleX = (!emphasisStyle.strokeNoScale && el.transform)\n ? el.transform[0]\n : 1;\n lineWidth = lineWidth / scaleX;\n }\n const style = {\n cursor: 'pointer', // TODO: Should this be customized?\n } as any;\n if (fill) {\n style.fill = fill;\n }\n if (emphasisStyle.stroke) {\n style.stroke = emphasisStyle.stroke;\n }\n if (lineWidth) {\n style['stroke-width'] = lineWidth;\n }\n setClassAttribute(style, attrs, scope, true);\n }\n }\n}\n\nfunction setClassAttribute(style: object, attrs: SVGVNodeAttrs, scope: BrushScope, withHover: boolean) {\n const styleKey = JSON.stringify(style);\n let className = scope.cssStyleCache[styleKey];\n if (!className) {\n className = scope.zrId + '-cls-' + getClassId();\n scope.cssStyleCache[styleKey] = className;\n scope.cssNodes['.' + className + (withHover ? ':hover' : '')] = style as any;\n }\n attrs.class = attrs.class ? (attrs.class + ' ' + className) : className;\n}\n","// TODO\n// 1. shadow\n// 2. Image: sx, sy, sw, sh\n\nimport {\n adjustTextY,\n getIdURL,\n getMatrixStr,\n getPathPrecision,\n getShadowKey,\n getSRTTransformString,\n hasShadow,\n isAroundZero,\n isGradient,\n isImagePattern,\n isLinearGradient,\n isPattern,\n isRadialGradient,\n normalizeColor,\n round4,\n TEXT_ALIGN_TO_ANCHOR\n} from './helper';\nimport Path, { PathStyleProps } from '../graphic/Path';\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\nimport { getLineHeight } from '../contain/text';\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\nimport SVGPathRebuilder from './SVGPathRebuilder';\nimport mapStyleToAttrs from './mapStyleToAttrs';\nimport { SVGVNodeAttrs, createVNode, SVGVNode, vNodeToString, BrushScope, META_DATA_PREFIX } from './core';\nimport { MatrixArray } from '../core/matrix';\nimport Displayable from '../graphic/Displayable';\nimport { assert, clone, isFunction, isString, logError, map, retrieve2 } from '../core/util';\nimport Polyline from '../graphic/shape/Polyline';\nimport Polygon from '../graphic/shape/Polygon';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject, SVGPatternObject } from '../graphic/Pattern';\nimport { createOrUpdateImage } from '../graphic/helper/image';\nimport { ImageLike } from '../core/types';\nimport { createCSSAnimation } from './cssAnimation';\nimport { hasSeparateFont, parseFontSize } from '../graphic/Text';\nimport { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform';\nimport { createCSSEmphasis } from './cssEmphasis';\nimport { getElementSSRData } from '../zrender';\n\nconst round = Math.round;\n\nfunction isImageLike(val: any): val is HTMLImageElement {\n return val && isString(val.src);\n}\nfunction isCanvasLike(val: any): val is HTMLCanvasElement {\n return val && isFunction(val.toDataURL);\n}\n\n\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\n\nfunction setStyleAttrs(attrs: SVGVNodeAttrs, style: AllStyleOption, el: Path | TSpan | ZRImage, scope: BrushScope) {\n mapStyleToAttrs((key, val) => {\n const isFillStroke = key === 'fill' || key === 'stroke';\n if (isFillStroke && isGradient(val)) {\n setGradient(style, attrs, key, scope);\n }\n else if (isFillStroke && isPattern(val)) {\n setPattern(el, attrs, key, scope);\n }\n else {\n attrs[key] = val;\n }\n if (isFillStroke && scope.ssr && val === 'none') {\n // When is none, it cannot be interacted when ssr\n // Setting `pointer-events` as `visible` to make it responding\n // See also https://www.w3.org/TR/SVG/interact.html#PointerEventsProperty\n attrs['pointer-events'] = 'visible';\n }\n }, style, el, false);\n\n setShadow(el, attrs, scope);\n}\n\nfunction setMetaData(attrs: SVGVNodeAttrs, el: Path | TSpan | ZRImage) {\n const metaData = getElementSSRData(el);\n if (metaData) {\n metaData.each((val, key) => {\n val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + '');\n });\n if (el.isSilent()) {\n attrs[META_DATA_PREFIX + 'silent'] = 'true';\n }\n }\n}\n\nfunction noRotateScale(m: MatrixArray) {\n return isAroundZero(m[0] - 1)\n && isAroundZero(m[1])\n && isAroundZero(m[2])\n && isAroundZero(m[3] - 1);\n}\n\nfunction noTranslate(m: MatrixArray) {\n return isAroundZero(m[4]) && isAroundZero(m[5]);\n}\n\nfunction setTransform(attrs: SVGVNodeAttrs, m: MatrixArray, compress?: boolean) {\n if (m && !(noTranslate(m) && noRotateScale(m))) {\n const mul = compress ? 10 : 1e4;\n // Use translate possible to reduce the size a bit.\n attrs.transform = noRotateScale(m)\n ? `translate(${round(m[4] * mul) / mul} ${round(m[5] * mul) / mul})` : getMatrixStr(m);\n }\n}\n\ntype ShapeMapDesc = (string | [string, string])[];\ntype ConvertShapeToAttr = (shape: any, attrs: SVGVNodeAttrs, mul?: number) => void;\ntype ShapeValidator = (shape: any) => boolean;\n\nfunction convertPolyShape(shape: Polygon['shape'], attrs: SVGVNodeAttrs, mul: number) {\n const points = shape.points;\n const strArr = [];\n for (let i = 0; i < points.length; i++) {\n strArr.push(round(points[i][0] * mul) / mul);\n strArr.push(round(points[i][1] * mul) / mul);\n }\n attrs.points = strArr.join(' ');\n}\n\nfunction validatePolyShape(shape: Polyline['shape']) {\n return !shape.smooth;\n}\n\nfunction createAttrsConvert(desc: ShapeMapDesc): ConvertShapeToAttr {\n const normalizedDesc: [string, string][] = map(desc, (item) =>\n (typeof item === 'string' ? [item, item] : item)\n );\n\n return function (shape, attrs, mul) {\n for (let i = 0; i < normalizedDesc.length; i++) {\n const item = normalizedDesc[i];\n const val = shape[item[0]];\n if (val != null) {\n attrs[item[1]] = round(val * mul) / mul;\n }\n }\n };\n}\n\nconst builtinShapesDef: Record = {\n circle: [createAttrsConvert(['cx', 'cy', 'r'])],\n polyline: [convertPolyShape, validatePolyShape],\n polygon: [convertPolyShape, validatePolyShape]\n // Ignore line because it will be larger.\n};\n\ninterface PathWithSVGBuildPath extends Path {\n __svgPathVersion: number\n __svgPathBuilder: SVGPathRebuilder\n __svgPathStrokePercent: number\n}\n\nfunction hasShapeAnimation(el: Displayable) {\n const animators = el.animators;\n for (let i = 0; i < animators.length; i++) {\n if (animators[i].targetName === 'shape') {\n return true;\n }\n }\n return false;\n}\n\nexport function brushSVGPath(el: Path, scope: BrushScope) {\n const style = el.style;\n const shape = el.shape;\n const builtinShpDef = builtinShapesDef[el.type];\n const attrs: SVGVNodeAttrs = {};\n const needsAnimate = scope.animation;\n let svgElType = 'path';\n const strokePercent = el.style.strokePercent;\n const precision = (scope.compress && getPathPrecision(el)) || 4;\n // Using SVG builtin shapes if possible\n if (builtinShpDef\n // Force to use path if it will update later.\n // To avoid some animation(like morph) fail\n && !scope.willUpdate\n && !(builtinShpDef[1] && !builtinShpDef[1](shape))\n // use `path` to simplify the animate element creation logic.\n && !(needsAnimate && hasShapeAnimation(el))\n && !(strokePercent < 1)\n ) {\n svgElType = el.type;\n const mul = Math.pow(10, precision);\n builtinShpDef[0](shape, attrs, mul);\n }\n else {\n const needBuildPath = !el.path || el.shapeChanged();\n if (!el.path) {\n el.createPathProxy();\n }\n const path = el.path;\n\n if (needBuildPath) {\n path.beginPath();\n el.buildPath(path, el.shape);\n el.pathUpdated();\n }\n const pathVersion = path.getVersion();\n const elExt = el as PathWithSVGBuildPath;\n\n let svgPathBuilder = elExt.__svgPathBuilder;\n if (elExt.__svgPathVersion !== pathVersion\n || !svgPathBuilder\n || strokePercent !== elExt.__svgPathStrokePercent\n ) {\n if (!svgPathBuilder) {\n svgPathBuilder = elExt.__svgPathBuilder = new SVGPathRebuilder();\n }\n svgPathBuilder.reset(precision);\n path.rebuildPath(svgPathBuilder, strokePercent);\n svgPathBuilder.generateStr();\n elExt.__svgPathVersion = pathVersion;\n elExt.__svgPathStrokePercent = strokePercent;\n }\n\n attrs.d = svgPathBuilder.getStr();\n }\n\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n scope.emphasis && createCSSEmphasis(el, attrs, scope);\n\n return createVNode(svgElType, el.id + '', attrs);\n}\n\nexport function brushSVGImage(el: ZRImage, scope: BrushScope) {\n const style = el.style;\n let image = style.image;\n\n if (image && !isString(image)) {\n if (isImageLike(image)) {\n image = image.src;\n }\n // heatmap layer in geo may be a canvas\n else if (isCanvasLike(image)) {\n image = image.toDataURL();\n }\n }\n\n if (!image) {\n return;\n }\n\n const x = style.x || 0;\n const y = style.y || 0;\n\n const dw = style.width;\n const dh = style.height;\n\n const attrs: SVGVNodeAttrs = {\n href: image as string,\n width: dw,\n height: dh\n };\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n\n return createVNode('image', el.id + '', attrs);\n};\n\nexport function brushSVGTSpan(el: TSpan, scope: BrushScope) {\n const style = el.style;\n\n let text = style.text;\n // Convert to string\n text != null && (text += '');\n if (!text || isNaN(style.x) || isNaN(style.y)) {\n return;\n }\n\n // style.font has been normalized by `normalizeTextStyle`.\n const font = style.font || DEFAULT_FONT;\n\n // Consider different font display differently in vertical align, we always\n // set verticalAlign as 'middle', and use 'y' to locate text vertically.\n const x = style.x || 0;\n const y = adjustTextY(style.y || 0, getLineHeight(font), style.textBaseline);\n const textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign as keyof typeof TEXT_ALIGN_TO_ANCHOR]\n || style.textAlign;\n\n const attrs: SVGVNodeAttrs = {\n 'dominant-baseline': 'central',\n 'text-anchor': textAlign\n };\n\n if (hasSeparateFont(style)) {\n // Set separate font attributes if possible. Or some platform like PowerPoint may not support it.\n let separatedFontStr = '';\n const fontStyle = style.fontStyle;\n const fontSize = parseFontSize(style.fontSize);\n if (!parseFloat(fontSize)) { // is 0px\n return;\n }\n\n const fontFamily = style.fontFamily || DEFAULT_FONT_FAMILY;\n const fontWeight = style.fontWeight;\n separatedFontStr += `font-size:${fontSize};font-family:${fontFamily};`;\n\n // TODO reduce the attribute to set. But should it inherit from the container element?\n if (fontStyle && fontStyle !== 'normal') {\n separatedFontStr += `font-style:${fontStyle};`;\n }\n if (fontWeight && fontWeight !== 'normal') {\n separatedFontStr += `font-weight:${fontWeight};`;\n }\n attrs.style = separatedFontStr;\n }\n else {\n // Use set font manually\n attrs.style = `font: ${font}`;\n }\n\n\n if (text.match(/\\s/)) {\n // only enabled when have space in text.\n attrs['xml:space'] = 'preserve';\n }\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n\n return createVNode('text', el.id + '', attrs, undefined, text);\n}\n\nexport function brush(el: Displayable, scope: BrushScope): SVGVNode {\n if (el instanceof Path) {\n return brushSVGPath(el, scope);\n }\n else if (el instanceof ZRImage) {\n return brushSVGImage(el, scope);\n }\n else if (el instanceof TSpan) {\n return brushSVGTSpan(el, scope);\n }\n}\n\nfunction setShadow(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const style = el.style;\n if (hasShadow(style)) {\n const shadowKey = getShadowKey(el);\n const shadowCache = scope.shadowCache;\n let shadowId = shadowCache[shadowKey];\n if (!shadowId) {\n const globalScale = el.getGlobalScale();\n const scaleX = globalScale[0];\n const scaleY = globalScale[1];\n if (!scaleX || !scaleY) {\n return;\n }\n\n const offsetX = style.shadowOffsetX || 0;\n const offsetY = style.shadowOffsetY || 0;\n const blur = style.shadowBlur;\n const {opacity, color} = normalizeColor(style.shadowColor);\n const stdDx = blur / 2 / scaleX;\n const stdDy = blur / 2 / scaleY;\n const stdDeviation = stdDx + ' ' + stdDy;\n // Use a simple prefix to reduce the size\n shadowId = scope.zrId + '-s' + scope.shadowIdx++;\n scope.defs[shadowId] = createVNode(\n 'filter', shadowId,\n {\n 'id': shadowId,\n 'x': '-100%',\n 'y': '-100%',\n 'width': '300%',\n 'height': '300%'\n },\n [\n createVNode('feDropShadow', '', {\n 'dx': offsetX / scaleX,\n 'dy': offsetY / scaleY,\n 'stdDeviation': stdDeviation,\n 'flood-color': color,\n 'flood-opacity': opacity\n })\n ]\n );\n shadowCache[shadowKey] = shadowId;\n }\n attrs.filter = getIdURL(shadowId);\n }\n}\n\nexport function setGradient(\n style: PathStyleProps,\n attrs: SVGVNodeAttrs,\n target: 'fill' | 'stroke',\n scope: BrushScope\n) {\n const val = style[target] as GradientObject;\n let gradientTag;\n let gradientAttrs: SVGVNodeAttrs = {\n 'gradientUnits': val.global\n ? 'userSpaceOnUse' // x1, x2, y1, y2 in range of 0 to canvas width or height\n : 'objectBoundingBox' // x1, x2, y1, y2 in range of 0 to 1]\n };\n if (isLinearGradient(val)) {\n gradientTag = 'linearGradient';\n gradientAttrs.x1 = val.x;\n gradientAttrs.y1 = val.y;\n gradientAttrs.x2 = val.x2;\n gradientAttrs.y2 = val.y2;\n }\n else if (isRadialGradient(val)) {\n gradientTag = 'radialGradient';\n gradientAttrs.cx = retrieve2(val.x, 0.5);\n gradientAttrs.cy = retrieve2(val.y, 0.5);\n gradientAttrs.r = retrieve2(val.r, 0.5);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logError('Illegal gradient type.');\n }\n return;\n }\n\n const colors = val.colorStops;\n\n const colorStops = [];\n for (let i = 0, len = colors.length; i < len; ++i) {\n const offset = round4(colors[i].offset) * 100 + '%';\n\n const stopColor = colors[i].color;\n // Fix Safari bug that stop-color not recognizing alpha #9014\n const {color, opacity} = normalizeColor(stopColor);\n\n const stopsAttrs: SVGVNodeAttrs = {\n 'offset': offset\n };\n // stop-color cannot be color, since:\n // The opacity value used for the gradient calculation is the\n // *product* of the value of stop-opacity and the opacity of the\n // value of stop-color.\n // See https://www.w3.org/TR/SVG2/pservers.html#StopOpacityProperty\n\n stopsAttrs['stop-color'] = color;\n if (opacity < 1) {\n stopsAttrs['stop-opacity'] = opacity;\n }\n colorStops.push(\n createVNode('stop', i + '', stopsAttrs)\n );\n }\n\n // Use the whole html as cache key.\n const gradientVNode = createVNode(gradientTag, '', gradientAttrs, colorStops);\n const gradientKey = vNodeToString(gradientVNode);\n const gradientCache = scope.gradientCache;\n let gradientId = gradientCache[gradientKey];\n if (!gradientId) {\n gradientId = scope.zrId + '-g' + scope.gradientIdx++;\n gradientCache[gradientKey] = gradientId;\n\n gradientAttrs.id = gradientId;\n scope.defs[gradientId] = createVNode(\n gradientTag, gradientId, gradientAttrs, colorStops\n );\n }\n\n attrs[target] = getIdURL(gradientId);\n}\n\nexport function setPattern(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n target: 'fill' | 'stroke',\n scope: BrushScope\n) {\n const val = el.style[target] as ImagePatternObject | SVGPatternObject;\n const boundingRect = el.getBoundingRect();\n const patternAttrs: SVGVNodeAttrs = {};\n const repeat = (val as ImagePatternObject).repeat;\n const noRepeat = repeat === 'no-repeat';\n const repeatX = repeat === 'repeat-x';\n const repeatY = repeat === 'repeat-y';\n let child: SVGVNode;\n if (isImagePattern(val)) {\n let imageWidth = val.imageWidth;\n let imageHeight = val.imageHeight;\n let imageSrc;\n const patternImage = val.image;\n if (isString(patternImage)) {\n imageSrc = patternImage;\n }\n else if (isImageLike(patternImage)) {\n imageSrc = patternImage.src;\n }\n else if (isCanvasLike(patternImage)) {\n imageSrc = patternImage.toDataURL();\n }\n\n if (typeof Image === 'undefined') {\n const errMsg = 'Image width/height must been given explictly in svg-ssr renderer.';\n assert(imageWidth, errMsg);\n assert(imageHeight, errMsg);\n }\n else if (imageWidth == null || imageHeight == null) {\n // TODO\n const setSizeToVNode = (vNode: SVGVNode, img: ImageLike) => {\n if (vNode) {\n const svgEl = vNode.elm as SVGElement;\n let width = imageWidth || img.width;\n let height = imageHeight || img.height;\n if (vNode.tag === 'pattern') {\n if (repeatX) {\n height = 1;\n width /= boundingRect.width;\n }\n else if (repeatY) {\n width = 1;\n height /= boundingRect.height;\n }\n }\n vNode.attrs.width = width;\n vNode.attrs.height = height;\n if (svgEl) {\n svgEl.setAttribute('width', width as any);\n svgEl.setAttribute('height', height as any);\n }\n }\n };\n const createdImage = createOrUpdateImage(\n imageSrc, null, el, (img) => {\n noRepeat || setSizeToVNode(patternVNode, img);\n setSizeToVNode(child, img);\n }\n );\n if (createdImage && createdImage.width && createdImage.height) {\n // Loaded before\n imageWidth = imageWidth || createdImage.width;\n imageHeight = imageHeight || createdImage.height;\n }\n }\n\n child = createVNode(\n 'image',\n 'img',\n {\n href: imageSrc,\n width: imageWidth,\n height: imageHeight\n }\n );\n patternAttrs.width = imageWidth;\n patternAttrs.height = imageHeight;\n }\n else if (val.svgElement) { // Only string supported in SSR.\n // TODO it's not so good to use textContent as innerHTML\n child = clone(val.svgElement);\n patternAttrs.width = val.svgWidth;\n patternAttrs.height = val.svgHeight;\n }\n if (!child) {\n return;\n }\n\n let patternWidth;\n let patternHeight;\n if (noRepeat) {\n patternWidth = patternHeight = 1;\n }\n else if (repeatX) {\n patternHeight = 1;\n patternWidth = (patternAttrs.width as number) / boundingRect.width;\n }\n else if (repeatY) {\n patternWidth = 1;\n patternHeight = (patternAttrs.height as number) / boundingRect.height;\n }\n else {\n patternAttrs.patternUnits = 'userSpaceOnUse';\n }\n\n if (patternWidth != null && !isNaN(patternWidth)) {\n patternAttrs.width = patternWidth;\n }\n if (patternHeight != null && !isNaN(patternHeight)) {\n patternAttrs.height = patternHeight;\n }\n\n const patternTransform = getSRTTransformString(val);\n patternTransform && (patternAttrs.patternTransform = patternTransform);\n\n // Use the whole html as cache key.\n let patternVNode = createVNode(\n 'pattern',\n '',\n patternAttrs,\n [child]\n );\n const patternKey = vNodeToString(patternVNode);\n const patternCache = scope.patternCache;\n let patternId = patternCache[patternKey];\n if (!patternId) {\n patternId = scope.zrId + '-p' + scope.patternIdx++;\n patternCache[patternKey] = patternId;\n patternAttrs.id = patternId;\n patternVNode = scope.defs[patternId] = createVNode(\n 'pattern',\n patternId,\n patternAttrs,\n [child]\n );\n }\n\n attrs[target] = getIdURL(patternId);\n}\n\nexport function setClipPath(\n clipPath: Path,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const {clipPathCache, defs} = scope;\n let clipPathId = clipPathCache[clipPath.id];\n if (!clipPathId) {\n clipPathId = scope.zrId + '-c' + scope.clipPathIdx++;\n const clipPathAttrs: SVGVNodeAttrs = {\n id: clipPathId\n };\n\n clipPathCache[clipPath.id] = clipPathId;\n defs[clipPathId] = createVNode(\n 'clipPath', clipPathId, clipPathAttrs,\n [brushSVGPath(clipPath, scope)]\n );\n }\n attrs['clip-path'] = getIdURL(clipPathId);\n}\n","export function createTextNode(text: string): Text {\r\n return document.createTextNode(text);\r\n}\r\n\r\nexport function createComment(text: string): Comment {\r\n return document.createComment(text);\r\n}\r\n\r\nexport function insertBefore(\r\n parentNode: Node,\r\n newNode: Node,\r\n referenceNode: Node | null\r\n): void {\r\n parentNode.insertBefore(newNode, referenceNode);\r\n}\r\n\r\nexport function removeChild(node: Node, child: Node): void {\r\n node.removeChild(child);\r\n}\r\n\r\nexport function appendChild(node: Node, child: Node): void {\r\n node.appendChild(child);\r\n}\r\n\r\nexport function parentNode(node: Node): Node | null {\r\n return node.parentNode;\r\n}\r\n\r\nexport function nextSibling(node: Node): Node | null {\r\n return node.nextSibling;\r\n}\r\n\r\nexport function tagName(elm: Element): string {\r\n return elm.tagName;\r\n}\r\n\r\nexport function setTextContent(node: Node, text: string | null): void {\r\n node.textContent = text;\r\n}\r\n\r\nexport function getTextContent(node: Node): string | null {\r\n return node.textContent;\r\n}\r\n\r\nexport function isElement(node: Node): node is Element {\r\n return node.nodeType === 1;\r\n}\r\n\r\nexport function isText(node: Node): node is Text {\r\n return node.nodeType === 3;\r\n}\r\n\r\nexport function isComment(node: Node): node is Comment {\r\n return node.nodeType === 8;\r\n}\r\n","/**\n * Virtual DOM patching\n * Modified from snabbdom https://github.com/snabbdom/snabbdom/blob/master/src/init.ts\n *\n * The design has been simplified to focus on the purpose in SVG rendering in SVG.\n *\n * Licensed under the MIT License\n * https://github.com/paldepind/snabbdom/blob/master/LICENSE\n */\n\nimport { isArray, isObject } from '../core/util';\nimport { createElement, createVNode, SVGVNode, XMLNS, XML_NAMESPACE, XLINKNS } from './core';\nimport * as api from './domapi';\n\nconst colonChar = 58;\nconst xChar = 120;\nconst emptyNode = createVNode('', '');\n\ntype NonUndefined = T extends undefined ? never : T;\n\nfunction isUndef(s: any): boolean {\n return s === undefined;\n}\n\nfunction isDef(s: A): s is NonUndefined {\n return s !== undefined;\n}\n\nfunction createKeyToOldIdx(\n children: SVGVNode[],\n beginIdx: number,\n endIdx: number\n): KeyToIndexMap {\n const map: KeyToIndexMap = {};\n for (let i = beginIdx; i <= endIdx; ++i) {\n const key = children[i].key;\n if (key !== undefined) {\n if (process.env.NODE_ENV !== 'production') {\n if (map[key] != null) {\n console.error(`Duplicate key ${key}`);\n }\n }\n map[key] = i;\n }\n }\n return map;\n}\n\nfunction sameVnode(vnode1: SVGVNode, vnode2: SVGVNode): boolean {\n const isSameKey = vnode1.key === vnode2.key;\n const isSameTag = vnode1.tag === vnode2.tag;\n\n return isSameTag && isSameKey;\n}\n\ntype KeyToIndexMap = { [key: string]: number };\n\nfunction createElm(vnode: SVGVNode): Node {\n let i: any;\n const children = vnode.children;\n const tag = vnode.tag;\n // if (tag === '!') {\n // if (isUndef(vnode.text)) {\n // vnode.text = '';\n // }\n // vnode.elm = api.createComment(vnode.text!);\n // }\n // else\n if (isDef(tag)) {\n const elm = (vnode.elm = createElement(tag));\n\n updateAttrs(emptyNode, vnode);\n\n if (isArray(children)) {\n for (i = 0; i < children.length; ++i) {\n const ch = children[i];\n if (ch != null) {\n api.appendChild(elm, createElm(ch));\n }\n }\n }\n else if (isDef(vnode.text) && !isObject(vnode.text)) {\n api.appendChild(elm, api.createTextNode(vnode.text));\n }\n }\n else {\n vnode.elm = api.createTextNode(vnode.text!);\n }\n return vnode.elm;\n}\n\nfunction addVnodes(\n parentElm: Node,\n before: Node | null,\n vnodes: SVGVNode[],\n startIdx: number,\n endIdx: number\n) {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx];\n if (ch != null) {\n api.insertBefore(parentElm, createElm(ch), before);\n }\n }\n}\n\nfunction removeVnodes(parentElm: Node, vnodes: SVGVNode[], startIdx: number, endIdx: number): void {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx];\n if (ch != null) {\n if (isDef(ch.tag)) {\n const parent = api.parentNode(ch.elm);\n api.removeChild(parent, ch.elm);\n }\n else {\n // Text node\n api.removeChild(parentElm, ch.elm!);\n }\n }\n }\n}\n\nexport function updateAttrs(oldVnode: SVGVNode, vnode: SVGVNode): void {\n let key: string;\n const elm = vnode.elm as SVGElement;\n const oldAttrs = oldVnode && oldVnode.attrs || {};\n const attrs = vnode.attrs || {};\n\n if (oldAttrs === attrs) {\n return;\n }\n\n // update modified attributes, add new attributes\n // eslint-disable-next-line\n for (key in attrs) {\n const cur = attrs[key];\n const old = oldAttrs[key];\n if (old !== cur) {\n if (cur === true) {\n elm.setAttribute(key, '');\n }\n else if (cur === false) {\n elm.removeAttribute(key);\n }\n else {\n if (key === 'style') {\n elm.style.cssText = cur as string;\n }\n else if (key.charCodeAt(0) !== xChar) {\n elm.setAttribute(key, cur as any);\n }\n // TODO\n else if (key === 'xmlns:xlink' || key === 'xmlns') {\n elm.setAttributeNS(XMLNS, key, cur as any);\n }\n else if (key.charCodeAt(3) === colonChar) {\n // Assume xml namespace\n elm.setAttributeNS(XML_NAMESPACE, key, cur as any);\n }\n else if (key.charCodeAt(5) === colonChar) {\n // Assume xlink namespace\n elm.setAttributeNS(XLINKNS, key, cur as any);\n }\n else {\n elm.setAttribute(key, cur as any);\n }\n }\n }\n }\n\n // remove removed attributes\n // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)\n // the other option is to remove all attributes with value == undefined\n for (key in oldAttrs) {\n if (!(key in attrs)) {\n elm.removeAttribute(key);\n }\n }\n}\n\n\nfunction updateChildren(parentElm: Node, oldCh: SVGVNode[], newCh: SVGVNode[]) {\n let oldStartIdx = 0;\n let newStartIdx = 0;\n let oldEndIdx = oldCh.length - 1;\n let oldStartVnode = oldCh[0];\n let oldEndVnode = oldCh[oldEndIdx];\n let newEndIdx = newCh.length - 1;\n let newStartVnode = newCh[0];\n let newEndVnode = newCh[newEndIdx];\n let oldKeyToIdx: KeyToIndexMap | undefined;\n let idxInOld: number;\n let elmToMove: SVGVNode;\n let before: any;\n\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (oldStartVnode == null) {\n oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left\n }\n else if (oldEndVnode == null) {\n oldEndVnode = oldCh[--oldEndIdx];\n }\n else if (newStartVnode == null) {\n newStartVnode = newCh[++newStartIdx];\n }\n else if (newEndVnode == null) {\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else if (sameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newEndVnode)) {\n // Vnode moved right\n patchVnode(oldStartVnode, newEndVnode);\n api.insertBefore(parentElm, oldStartVnode.elm!, api.nextSibling(oldEndVnode.elm!));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldEndVnode, newStartVnode)) {\n // Vnode moved left\n patchVnode(oldEndVnode, newStartVnode);\n api.insertBefore(parentElm, oldEndVnode.elm!, oldStartVnode.elm!);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else {\n if (isUndef(oldKeyToIdx)) {\n oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n }\n idxInOld = oldKeyToIdx[newStartVnode.key];\n if (isUndef(idxInOld)) {\n // New element\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm!);\n }\n else {\n elmToMove = oldCh[idxInOld];\n if (elmToMove.tag !== newStartVnode.tag) {\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm!);\n }\n else {\n patchVnode(elmToMove, newStartVnode);\n oldCh[idxInOld] = undefined;\n api.insertBefore(parentElm, elmToMove.elm!, oldStartVnode.elm!);\n }\n }\n newStartVnode = newCh[++newStartIdx];\n }\n }\n if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {\n if (oldStartIdx > oldEndIdx) {\n before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;\n addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);\n }\n else {\n removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n }\n }\n}\n\nfunction patchVnode(oldVnode: SVGVNode, vnode: SVGVNode) {\n const elm = (vnode.elm = oldVnode.elm)!;\n const oldCh = oldVnode.children;\n const ch = vnode.children;\n if (oldVnode === vnode) {\n return;\n }\n\n updateAttrs(oldVnode, vnode);\n\n if (isUndef(vnode.text)) {\n if (isDef(oldCh) && isDef(ch)) {\n if (oldCh !== ch) {\n updateChildren(elm, oldCh, ch);\n }\n }\n else if (isDef(ch)) {\n if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n addVnodes(elm, null, ch, 0, ch.length - 1);\n }\n else if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n else if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n }\n else if (oldVnode.text !== vnode.text) {\n if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n api.setTextContent(elm, vnode.text!);\n }\n}\n\nexport default function patch(oldVnode: SVGVNode, vnode: SVGVNode): SVGVNode {\n if (sameVnode(oldVnode, vnode)) {\n patchVnode(oldVnode, vnode);\n }\n else {\n const elm = oldVnode.elm!;\n const parent = api.parentNode(elm);\n\n createElm(vnode);\n\n if (parent !== null) {\n api.insertBefore(parent, vnode.elm!, api.nextSibling(elm));\n removeVnodes(parent, [oldVnode], 0, 0);\n }\n }\n\n return vnode;\n}\n","/**\n * SVG Painter\n */\n\nimport {\n brush,\n setClipPath,\n setGradient,\n setPattern\n} from './graphic';\nimport Displayable from '../graphic/Displayable';\nimport Storage from '../Storage';\nimport { PainterBase } from '../PainterBase';\nimport {\n createElement,\n createVNode,\n vNodeToString,\n SVGVNodeAttrs,\n SVGVNode,\n getCssString,\n BrushScope,\n createBrushScope,\n createSVGVNode\n} from './core';\nimport { normalizeColor, encodeBase64, isGradient, isPattern } from './helper';\nimport { extend, keys, logError, map, noop, retrieve2 } from '../core/util';\nimport Path from '../graphic/Path';\nimport patch, { updateAttrs } from './patch';\nimport { getSize } from '../canvas/helper';\nimport { GradientObject } from '../graphic/Gradient';\nimport { PatternObject } from '../graphic/Pattern';\n\nlet svgId = 0;\n\ninterface SVGPainterOption {\n width?: number\n height?: number\n ssr?: boolean\n}\n\ntype SVGPainterBackgroundColor = string | GradientObject | PatternObject;\n\nclass SVGPainter implements PainterBase {\n\n type = 'svg'\n\n storage: Storage\n\n root: HTMLElement\n\n private _svgDom: SVGElement\n private _viewport: HTMLElement\n\n private _opts: SVGPainterOption\n\n private _oldVNode: SVGVNode\n private _bgVNode: SVGVNode\n private _mainVNode: SVGVNode\n\n private _width: number\n private _height: number\n\n private _backgroundColor: SVGPainterBackgroundColor\n\n private _id: string\n\n constructor(root: HTMLElement, storage: Storage, opts: SVGPainterOption) {\n this.storage = storage;\n this._opts = opts = extend({}, opts);\n\n this.root = root;\n // A unique id for generating svg ids.\n this._id = 'zr' + svgId++;\n\n this._oldVNode = createSVGVNode(opts.width, opts.height);\n\n if (root && !opts.ssr) {\n const viewport = this._viewport = document.createElement('div');\n viewport.style.cssText = 'position:relative;overflow:hidden';\n const svgDom = this._svgDom = this._oldVNode.elm = createElement('svg');\n updateAttrs(null, this._oldVNode);\n viewport.appendChild(svgDom);\n root.appendChild(viewport);\n }\n\n this.resize(opts.width, opts.height);\n }\n\n getType() {\n return this.type;\n }\n\n getViewportRoot() {\n return this._viewport;\n }\n getViewportRootOffset() {\n const viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n }\n\n getSvgDom() {\n return this._svgDom;\n }\n\n refresh() {\n if (this.root) {\n const vnode = this.renderToVNode({\n willUpdate: true\n });\n // Disable user selection.\n vnode.attrs.style = 'position:absolute;left:0;top:0;user-select:none';\n patch(this._oldVNode, vnode);\n this._oldVNode = vnode;\n }\n }\n\n renderOneToVNode(el: Displayable) {\n return brush(el, createBrushScope(this._id));\n }\n\n renderToVNode(opts?: {\n animation?: boolean,\n willUpdate?: boolean,\n compress?: boolean,\n useViewBox?: boolean,\n emphasis?: boolean\n }) {\n\n opts = opts || {};\n\n const list = this.storage.getDisplayList(true);\n const width = this._width;\n const height = this._height;\n\n const scope = createBrushScope(this._id);\n scope.animation = opts.animation;\n scope.willUpdate = opts.willUpdate;\n scope.compress = opts.compress;\n scope.emphasis = opts.emphasis;\n scope.ssr = this._opts.ssr;\n\n const children: SVGVNode[] = [];\n\n const bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);\n bgVNode && children.push(bgVNode);\n\n // Ignore the root g if wan't the output to be more tight.\n const mainVNode = !opts.compress\n ? (this._mainVNode = createVNode('g', 'main', {}, [])) : null;\n this._paintList(list, scope, mainVNode ? mainVNode.children : children);\n mainVNode && children.push(mainVNode);\n\n const defs = map(keys(scope.defs), (id) => scope.defs[id]);\n if (defs.length) {\n children.push(createVNode('defs', 'defs', {}, defs));\n }\n\n if (opts.animation) {\n const animationCssStr = getCssString(scope.cssNodes, scope.cssAnims, { newline: true });\n if (animationCssStr) {\n const styleNode = createVNode('style', 'stl', {}, [], animationCssStr);\n children.push(styleNode);\n }\n }\n\n return createSVGVNode(width, height, children, opts.useViewBox);\n }\n\n renderToString(opts?: {\n /**\n * If add css animation.\n * @default true\n */\n cssAnimation?: boolean,\n /**\n * If add css emphasis.\n * @default true\n */\n cssEmphasis?: boolean,\n /**\n * If use viewBox\n * @default true\n */\n useViewBox?: boolean\n }) {\n opts = opts || {};\n return vNodeToString(this.renderToVNode({\n animation: retrieve2(opts.cssAnimation, true),\n emphasis: retrieve2(opts.cssEmphasis, true),\n willUpdate: false,\n compress: true,\n useViewBox: retrieve2(opts.useViewBox, true)\n }), { newline: true });\n }\n\n setBackgroundColor(backgroundColor: SVGPainterBackgroundColor) {\n this._backgroundColor = backgroundColor;\n }\n\n getSvgRoot() {\n return this._mainVNode && this._mainVNode.elm as SVGElement;\n }\n\n _paintList(list: Displayable[], scope: BrushScope, out?: SVGVNode[]) {\n const listLen = list.length;\n\n const clipPathsGroupsStack: SVGVNode[] = [];\n let clipPathsGroupsStackDepth = 0;\n let currentClipPathGroup;\n let prevClipPaths: Path[];\n let clipGroupNodeIdx = 0;\n for (let i = 0; i < listLen; i++) {\n const displayable = list[i];\n if (!displayable.invisible) {\n const clipPaths = displayable.__clipPaths;\n const len = clipPaths && clipPaths.length || 0;\n const prevLen = prevClipPaths && prevClipPaths.length || 0;\n let lca;\n // Find the lowest common ancestor\n for (lca = Math.max(len - 1, prevLen - 1); lca >= 0; lca--) {\n if (clipPaths && prevClipPaths\n && clipPaths[lca] === prevClipPaths[lca]\n ) {\n break;\n }\n }\n // pop the stack\n for (let i = prevLen - 1; i > lca; i--) {\n clipPathsGroupsStackDepth--;\n // svgEls.push(closeGroup);\n currentClipPathGroup = clipPathsGroupsStack[clipPathsGroupsStackDepth - 1];\n }\n // Pop clip path group for clipPaths not match the previous.\n for (let i = lca + 1; i < len; i++) {\n const groupAttrs: SVGVNodeAttrs = {};\n setClipPath(\n clipPaths[i],\n groupAttrs,\n scope\n );\n const g = createVNode(\n 'g',\n 'clip-g-' + clipGroupNodeIdx++,\n groupAttrs,\n []\n );\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(g);\n clipPathsGroupsStack[clipPathsGroupsStackDepth++] = g;\n currentClipPathGroup = g;\n }\n prevClipPaths = clipPaths;\n\n const ret = brush(displayable, scope);\n if (ret) {\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(ret);\n }\n }\n }\n }\n\n resize(width: number, height: number) {\n // Save input w/h\n const opts = this._opts;\n const root = this.root;\n const viewport = this._viewport;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n\n if (root && viewport) {\n // FIXME Why ?\n viewport.style.display = 'none';\n\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n\n viewport.style.display = '';\n }\n\n if (this._width !== width || this._height !== height) {\n this._width = width;\n this._height = height;\n\n if (viewport) {\n const viewportStyle = viewport.style;\n viewportStyle.width = width + 'px';\n viewportStyle.height = height + 'px';\n }\n\n if (!isPattern(this._backgroundColor)) {\n const svgDom = this._svgDom;\n if (svgDom) {\n // Set width by 'svgRoot.width = width' is invalid\n svgDom.setAttribute('width', width as any);\n svgDom.setAttribute('height', height as any);\n }\n\n const bgEl = this._bgVNode && this._bgVNode.elm as SVGElement;\n if (bgEl) {\n bgEl.setAttribute('width', width as any);\n bgEl.setAttribute('height', height as any);\n }\n }\n else {\n // pattern backgroundColor requires a full refresh\n this.refresh();\n }\n }\n }\n\n /**\n * 获取绘图区域宽度\n */\n getWidth() {\n return this._width;\n }\n\n /**\n * 获取绘图区域高度\n */\n getHeight() {\n return this._height;\n }\n\n dispose() {\n if (this.root) {\n this.root.innerHTML = '';\n }\n\n this._svgDom =\n this._viewport =\n this.storage =\n this._oldVNode =\n this._bgVNode =\n this._mainVNode = null;\n }\n clear() {\n if (this._svgDom) {\n this._svgDom.innerHTML = null;\n }\n this._oldVNode = null;\n }\n toDataURL(base64?: boolean) {\n let str = this.renderToString();\n const prefix = 'data:image/svg+xml;';\n if (base64) {\n str = encodeBase64(str);\n return str && prefix + 'base64,' + str;\n }\n return prefix + 'charset=UTF-8,' + encodeURIComponent(str);\n }\n\n refreshHover = createMethodNotSupport('refreshHover') as PainterBase['refreshHover'];\n configLayer = createMethodNotSupport('configLayer') as PainterBase['configLayer'];\n}\n\n\n// Not supported methods\nfunction createMethodNotSupport(method: string): any {\n return function () {\n if (process.env.NODE_ENV !== 'production') {\n logError('In SVG mode painter not support method \"' + method + '\"');\n }\n };\n}\n\nfunction createBackgroundVNode(\n width: number,\n height: number,\n backgroundColor: SVGPainterBackgroundColor,\n scope: BrushScope\n) {\n let bgVNode;\n if (backgroundColor && backgroundColor !== 'none') {\n bgVNode = createVNode(\n 'rect',\n 'bg',\n {\n width,\n height,\n x: '0',\n y: '0'\n }\n );\n if (isGradient(backgroundColor)) {\n setGradient({ fill: backgroundColor as any }, bgVNode.attrs, 'fill', scope);\n }\n else if (isPattern(backgroundColor)) {\n setPattern({\n style: {\n fill: backgroundColor\n },\n dirty: noop,\n getBoundingRect: () => ({ width, height })\n } as any, bgVNode.attrs, 'fill', scope);\n }\n else {\n const { color, opacity } = normalizeColor(backgroundColor);\n bgVNode.attrs.fill = color;\n opacity < 1 && (bgVNode.attrs['fill-opacity'] = opacity);\n }\n }\n return bgVNode;\n}\n\nexport default SVGPainter;\n","export * from './zrender';\r\nexport * from './export';\r\n\r\nimport {registerPainter} from './zrender';\r\nimport CanvasPainter from './canvas/Painter';\r\nimport SVGPainter from './svg/Painter';\r\nregisterPainter('canvas', CanvasPainter);\r\nregisterPainter('svg', SVGPainter);\r\n"],"names":["clone","eventUtil.clientToLocal","dist","create","copy","mul","scale","matrix.create","matrix.translate","matrix.scale","eventTool.stop","util.each","vec2.dist","timsort","util.indexOf","v2Create","v2DistSquare","lerp","EPSILON","isAroundZero","color.parse","requestAnimationFrame","zrUtil.map","zrUtil.noop","zrUtil.each","matrix.identity","isNotAroundZero","matrix.mul","matrix.copy","matrix.invert","vector.applyTransform","matrix.rotate","adjustTextY","zrUtil.indexOf","zrUtil.keys","HandlerProxy","zrUtil.retrieve2","zrUtil.guid","PRIMARY_STATES_KEYS","tmpRect","mathMin","mathMax","vec2.create","cubicExtrema","curve.cubicExtrema","cubicAt","curve.cubicAt","quadraticExtremum","curve.quadraticExtremum","quadraticAt","curve.quadraticAt","min","max","vec2.min","vec2.max","mathCos","mathSin","PI2","dpr","containStroke","curve.cubicProjectPoint","CMD","curve.cubicRootAt","curve.quadraticRootAt","line.containStroke","cubic.containStroke","quadratic.containStroke","arc.containStroke","pathContain.containStroke","pathContain.contain","mathSqrt","v2ApplyTransform","PI","roundRectHelper.buildPath","subPixelOptimizeOutputShape","v2Min","v2Max","v2Clone","v2Sub","v2Scale","v2Distance","v2Add","buildPath","polyHelper.buildPath","numberReg","mathAbs","roundSectorHelper.buildPath","Displayble","imageHelper.findExistImage","imageHelper.isImageReady","vec2.normalize","sin","cos","minTv","maxTv","util.isObject","util.disableUserSelect","util.isGradientObject","util.isImagePatternObject","util.extend","util.merge","util.logError","mathRound","round","isImageLike","brush","api.appendChild","api.createTextNode","api.insertBefore","api.parentNode","api.removeChild","api.nextSibling","api.setTextContent"],"mappings":";;;;;;IAIA;QAAA;YACI,YAAO,GAAG,KAAK,CAAA;YACf,OAAE,GAAG,KAAK,CAAA;YACV,SAAI,GAAG,KAAK,CAAA;YACZ,YAAO,GAAG,KAAK,CAAA;YACf,WAAM,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AI,EAAE,eAAe;qBACxB;oBACD,KAAK,EAAE,IAAI;oBACX,eAAe,EAAE,cAAM,QAAC,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,IAAC;iBACtC,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;aAC3C;iBACI;gBACK,IAAA,KAAqB,cAAc,CAAC,eAAe,CAAC,EAAlD,KAAK,WAAA,EAAE,OAAO,aAAoC,CAAC;gBAC3D,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;gBAC3B,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,CAAC;aAC5D;SACJ;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;;ICjZD,eAAe,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACzC,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"zrender.js","sources":["../src/core/env.ts","../src/core/platform.ts","../src/core/util.ts","../src/core/vector.ts","../src/mixin/Draggable.ts","../src/core/Eventful.ts","../src/core/fourPointsTransform.ts","../src/core/dom.ts","../src/core/event.ts","../src/core/GestureMgr.ts","../src/core/matrix.ts","../src/core/Point.ts","../src/core/BoundingRect.ts","../src/Handler.ts","../src/core/timsort.ts","../src/graphic/constants.ts","../src/Storage.ts","../src/animation/requestAnimationFrame.ts","../src/animation/easing.ts","../src/core/curve.ts","../src/animation/cubicEasing.ts","../src/animation/Clip.ts","../src/core/LRU.ts","../src/tool/color.ts","../src/svg/helper.ts","../src/animation/Animator.ts","../src/animation/Animation.ts","../src/dom/HandlerProxy.ts","../src/config.ts","../src/core/Transformable.ts","../src/contain/text.ts","../src/Element.ts","../src/graphic/Group.ts","../src/zrender.ts","../src/graphic/Displayable.ts","../src/core/bbox.ts","../src/core/PathProxy.ts","../src/contain/line.ts","../src/contain/cubic.ts","../src/contain/quadratic.ts","../src/contain/util.ts","../src/contain/arc.ts","../src/contain/windingLine.ts","../src/contain/path.ts","../src/graphic/Path.ts","../src/tool/transformPath.ts","../src/tool/path.ts","../src/graphic/Image.ts","../src/graphic/shape/Circle.ts","../src/graphic/helper/roundRect.ts","../src/graphic/helper/subPixelOptimize.ts","../src/graphic/shape/Rect.ts","../src/graphic/shape/Ellipse.ts","../src/graphic/shape/Line.ts","../src/graphic/helper/smoothBezier.ts","../src/graphic/helper/poly.ts","../src/graphic/shape/Polygon.ts","../src/graphic/shape/Polyline.ts","../src/graphic/Gradient.ts","../src/graphic/LinearGradient.ts","../src/graphic/RadialGradient.ts","../src/graphic/TSpan.ts","../src/tool/parseXML.ts","../src/tool/parseSVG.ts","../src/graphic/helper/roundSector.ts","../src/graphic/shape/Sector.ts","../src/tool/convertPath.ts","../src/tool/dividePath.ts","../src/tool/morphPath.ts","../src/graphic/CompoundPath.ts","../src/graphic/IncrementalDisplayable.ts","../src/graphic/helper/image.ts","../src/graphic/helper/parseText.ts","../src/graphic/Text.ts","../src/graphic/shape/Arc.ts","../src/graphic/shape/BezierCurve.ts","../src/graphic/shape/Droplet.ts","../src/graphic/shape/Heart.ts","../src/graphic/shape/Isogon.ts","../src/graphic/shape/Ring.ts","../src/graphic/shape/Rose.ts","../src/graphic/shape/Star.ts","../src/graphic/shape/Trochoid.ts","../src/graphic/Pattern.ts","../src/core/OrientedBoundingRect.ts","../src/debug/showDebugDirtyRect.ts","../src/canvas/helper.ts","../src/canvas/dashStyle.ts","../src/canvas/graphic.ts","../src/canvas/Layer.ts","../src/canvas/Painter.ts","../src/svg/SVGPathRebuilder.ts","../src/svg/mapStyleToAttrs.ts","../src/svg/core.ts","../src/svg/cssClassId.ts","../src/svg/cssAnimation.ts","../src/svg/cssEmphasis.ts","../src/svg/graphic.ts","../src/svg/domapi.ts","../src/svg/patch.ts","../src/svg/Painter.ts","../src/all.ts"],"sourcesContent":["declare const wx: {\n getSystemInfoSync: Function\n};\n\nclass Browser {\n firefox = false\n ie = false\n edge = false\n newEdge = false\n weChat = false\n version: string | number\n}\n\nclass Env {\n browser = new Browser()\n node = false\n wxa = false\n worker = false\n\n svgSupported = false\n touchEventsSupported = false\n pointerEventsSupported = false\n domSupported = false\n transformSupported = false\n transform3dSupported = false\n\n hasGlobalWindow = typeof window !== 'undefined'\n}\n\nconst env = new Env();\n\nif (typeof wx === 'object' && typeof wx.getSystemInfoSync === 'function') {\n env.wxa = true;\n env.touchEventsSupported = true;\n}\nelse if (typeof document === 'undefined' && typeof self !== 'undefined') {\n // In worker\n env.worker = true;\n}\nelse if (!env.hasGlobalWindow || 'Deno' in window) {\n // In node\n env.node = true;\n env.svgSupported = true;\n}\nelse {\n detect(navigator.userAgent, env);\n}\n\n// Zepto.js\n// (c) 2010-2013 Thomas Fuchs\n// Zepto.js may be freely distributed under the MIT license.\n\nfunction detect(ua: string, env: Env) {\n const browser = env.browser;\n const firefox = ua.match(/Firefox\\/([\\d.]+)/);\n const ie = ua.match(/MSIE\\s([\\d.]+)/)\n // IE 11 Trident/7.0; rv:11.0\n || ua.match(/Trident\\/.+?rv:(([\\d.]+))/);\n const edge = ua.match(/Edge?\\/([\\d.]+)/); // IE 12 and 12+\n\n const weChat = (/micromessenger/i).test(ua);\n\n if (firefox) {\n browser.firefox = true;\n browser.version = firefox[1];\n }\n if (ie) {\n browser.ie = true;\n browser.version = ie[1];\n }\n\n if (edge) {\n browser.edge = true;\n browser.version = edge[1];\n browser.newEdge = +edge[1].split('.')[0] > 18;\n }\n\n // It is difficult to detect WeChat in Win Phone precisely, because ua can\n // not be set on win phone. So we do not consider Win Phone.\n if (weChat) {\n browser.weChat = true;\n }\n\n env.svgSupported = typeof SVGRect !== 'undefined';\n env.touchEventsSupported = 'ontouchstart' in window && !browser.ie && !browser.edge;\n env.pointerEventsSupported = 'onpointerdown' in window\n && (browser.edge || (browser.ie && +browser.version >= 11));\n env.domSupported = typeof document !== 'undefined';\n\n const style = document.documentElement.style;\n\n env.transform3dSupported = (\n // IE9 only supports transform 2D\n // transform 3D supported since IE10\n // we detect it by whether 'transition' is in style\n (browser.ie && 'transition' in style)\n // edge\n || browser.edge\n // webkit\n || (('WebKitCSSMatrix' in window) && ('m11' in new WebKitCSSMatrix()))\n // gecko-based browsers\n || 'MozPerspective' in style\n ) // Opera supports CSS transforms after version 12\n && !('OTransition' in style);\n\n // except IE 6-8 and very old firefox 2-3 & opera 10.1\n // other browsers all support `transform`\n env.transformSupported = env.transform3dSupported\n // transform 2D is supported in IE9\n || (browser.ie && +browser.version >= 9);\n\n}\n\n\nexport default env;\n","export const DEFAULT_FONT_SIZE = 12;\nexport const DEFAULT_FONT_FAMILY = 'sans-serif';\nexport const DEFAULT_FONT = `${DEFAULT_FONT_SIZE}px ${DEFAULT_FONT_FAMILY}`;\n\ninterface Platform {\n // TODO CanvasLike?\n createCanvas(): HTMLCanvasElement\n measureText(text: string, font?: string): { width: number }\n loadImage(\n src: string,\n onload: () => void | HTMLImageElement['onload'],\n onerror: () => void | HTMLImageElement['onerror']\n ): HTMLImageElement\n}\n\n// Text width map used for environment there is no canvas\n// Only common ascii is used for size concern.\n\n// Generated from following code\n//\n// ctx.font = '12px sans-serif';\n// const asciiRange = [32, 126];\n// let mapStr = '';\n// for (let i = asciiRange[0]; i <= asciiRange[1]; i++) {\n// const char = String.fromCharCode(i);\n// const width = ctx.measureText(char).width;\n// const ratio = Math.round(width / 12 * 100);\n// mapStr += String.fromCharCode(ratio + 20))\n// }\n// mapStr.replace(/\\\\/g, '\\\\\\\\');\nconst OFFSET = 20;\nconst SCALE = 100;\n// TODO other basic fonts?\n// eslint-disable-next-line\nconst defaultWidthMapStr = `007LLmW'55;N0500LLLLLLLLLL00NNNLzWW\\\\\\\\WQb\\\\0FWLg\\\\bWb\\\\WQ\\\\WrWWQ000CL5LLFLL0LL**F*gLLLL5F0LF\\\\FFF5.5N`;\n\nfunction getTextWidthMap(mapStr: string): Record {\n const map: Record = {};\n if (typeof JSON === 'undefined') {\n return map;\n }\n for (let i = 0; i < mapStr.length; i++) {\n const char = String.fromCharCode(i + 32);\n const size = (mapStr.charCodeAt(i) - OFFSET) / SCALE;\n map[char] = size;\n }\n return map;\n}\n\nexport const DEFAULT_TEXT_WIDTH_MAP = getTextWidthMap(defaultWidthMapStr);\n\nexport const platformApi: Platform = {\n // Export methods\n createCanvas() {\n return typeof document !== 'undefined'\n && document.createElement('canvas');\n },\n\n measureText: (function () {\n\n let _ctx: CanvasRenderingContext2D;\n let _cachedFont: string;\n return (text: string, font?: string) => {\n if (!_ctx) {\n const canvas = platformApi.createCanvas();\n _ctx = canvas && canvas.getContext('2d');\n }\n if (_ctx) {\n if (_cachedFont !== font) {\n _cachedFont = _ctx.font = font || DEFAULT_FONT;\n }\n return _ctx.measureText(text);\n }\n else {\n text = text || '';\n font = font || DEFAULT_FONT;\n // Use font size if there is no other method can be used.\n const res = /((?:\\d+)?\\.?\\d*)px/.exec(font);\n const fontSize = res && +res[1] || DEFAULT_FONT_SIZE;\n let width = 0;\n if (font.indexOf('mono') >= 0) { // is monospace\n width = fontSize * text.length;\n }\n else {\n for (let i = 0; i < text.length; i++) {\n const preCalcWidth = DEFAULT_TEXT_WIDTH_MAP[text[i]];\n width += preCalcWidth == null ? fontSize : (preCalcWidth * fontSize);\n }\n }\n return { width };\n }\n };\n })(),\n\n loadImage(src, onload, onerror) {\n const image = new Image();\n image.onload = onload;\n image.onerror = onerror;\n image.src = src;\n return image;\n }\n};\n\nexport function setPlatformAPI(newPlatformApis: Partial) {\n for (let key in platformApi) {\n // Don't assign unknown methods.\n if ((newPlatformApis as any)[key]) {\n (platformApi as any)[key] = (newPlatformApis as any)[key];\n }\n }\n}\n","/* global: defineProperty */\nimport { Dictionary, ArrayLike, KeyOfDistributive } from './types';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport { platformApi } from './platform';\n\n// 用于处理merge时无法遍历Date等对象的问题\nconst BUILTIN_OBJECT: Record = reduce([\n 'Function',\n 'RegExp',\n 'Date',\n 'Error',\n 'CanvasGradient',\n 'CanvasPattern',\n // For node-canvas\n 'Image',\n 'Canvas'\n], (obj, val) => {\n obj['[object ' + val + ']'] = true;\n return obj;\n}, {} as Record);\n\nconst TYPED_ARRAY: Record = reduce([\n 'Int8',\n 'Uint8',\n 'Uint8Clamped',\n 'Int16',\n 'Uint16',\n 'Int32',\n 'Uint32',\n 'Float32',\n 'Float64'\n], (obj, val) => {\n obj['[object ' + val + 'Array]'] = true;\n return obj;\n}, {} as Record);\n\nconst objToString = Object.prototype.toString;\n\nconst arrayProto = Array.prototype;\nconst nativeForEach = arrayProto.forEach;\nconst nativeFilter = arrayProto.filter;\nconst nativeSlice = arrayProto.slice;\nconst nativeMap = arrayProto.map;\n// In case some env may redefine the global variable `Function`.\nconst ctorFunction = function () {}.constructor;\nconst protoFunction = ctorFunction ? ctorFunction.prototype : null;\nconst protoKey = '__proto__';\n\n\nlet idStart = 0x0907;\n\n/**\n * Generate unique id\n */\nexport function guid(): number {\n return idStart++;\n}\n\nexport function logError(...args: any[]) {\n if (typeof console !== 'undefined') {\n console.error.apply(console, args);\n }\n}\n/**\n * Those data types can be cloned:\n * Plain object, Array, TypedArray, number, string, null, undefined.\n * Those data types will be assigned using the original data:\n * BUILTIN_OBJECT\n * Instance of user defined class will be cloned to a plain object, without\n * properties in prototype.\n * Other data types is not supported (not sure what will happen).\n *\n * Caution: do not support clone Date, for performance consideration.\n * (There might be a large number of date in `series.data`).\n * So date should not be modified in and out of echarts.\n */\nexport function clone(source: T): T {\n if (source == null || typeof source !== 'object') {\n return source;\n }\n\n let result = source as any;\n const typeStr = objToString.call(source);\n\n if (typeStr === '[object Array]') {\n if (!isPrimitive(source)) {\n result = [] as any;\n for (let i = 0, len = (source as any[]).length; i < len; i++) {\n result[i] = clone((source as any[])[i]);\n }\n }\n }\n else if (TYPED_ARRAY[typeStr]) {\n if (!isPrimitive(source)) {\n /* eslint-disable-next-line */\n const Ctor = source.constructor as typeof Float32Array;\n if (Ctor.from) {\n result = Ctor.from(source as Float32Array);\n }\n else {\n result = new Ctor((source as Float32Array).length);\n for (let i = 0, len = (source as Float32Array).length; i < len; i++) {\n result[i] = (source as Float32Array)[i];\n }\n }\n }\n }\n else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {\n result = {} as any;\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n result[key] = clone(source[key]);\n }\n }\n }\n\n return result;\n}\n\nexport function merge<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S, overwrite?: boolean): T & S;\nexport function merge<\n T extends any,\n S extends any\n>(target: T, source: S, overwrite?: boolean): T | S;\nexport function merge(target: any, source: any, overwrite?: boolean): any {\n // We should escapse that source is string\n // and enter for ... in ...\n if (!isObject(source) || !isObject(target)) {\n return overwrite ? clone(source) : target;\n }\n\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n const targetProp = target[key];\n const sourceProp = source[key];\n\n if (isObject(sourceProp)\n && isObject(targetProp)\n && !isArray(sourceProp)\n && !isArray(targetProp)\n && !isDom(sourceProp)\n && !isDom(targetProp)\n && !isBuiltInObject(sourceProp)\n && !isBuiltInObject(targetProp)\n && !isPrimitive(sourceProp)\n && !isPrimitive(targetProp)\n ) {\n // 如果需要递归覆盖,就递归调用merge\n merge(targetProp, sourceProp, overwrite);\n }\n else if (overwrite || !(key in target)) {\n // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况\n // NOTE,在 target[key] 不存在的时候也是直接覆盖\n target[key] = clone(source[key]);\n }\n }\n }\n\n return target;\n}\n\n/**\n * @param targetAndSources The first item is target, and the rests are source.\n * @param overwrite\n * @return Merged result\n */\nexport function mergeAll(targetAndSources: any[], overwrite?: boolean): any {\n let result = targetAndSources[0];\n for (let i = 1, len = targetAndSources.length; i < len; i++) {\n result = merge(result, targetAndSources[i], overwrite);\n }\n return result;\n}\n\nexport function extend<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S): T & S {\n // @ts-ignore\n if (Object.assign) {\n // @ts-ignore\n Object.assign(target, source);\n }\n else {\n for (let key in source) {\n // Check if key is __proto__ to avoid prototype pollution\n if (source.hasOwnProperty(key) && key !== protoKey) {\n (target as S & T)[key] = (source as T & S)[key];\n }\n }\n }\n return target as T & S;\n}\n\nexport function defaults<\n T extends Dictionary,\n S extends Dictionary\n>(target: T, source: S, overlay?: boolean): T & S {\n const keysArr = keys(source);\n for (let i = 0, len = keysArr.length; i < len; i++) {\n let key = keysArr[i];\n if ((overlay ? source[key] != null : (target as T & S)[key] == null)) {\n (target as S & T)[key] = (source as T & S)[key];\n }\n }\n return target as T & S;\n}\n\n// Expose createCanvas in util for compatibility\nexport const createCanvas = platformApi.createCanvas;\n\n/**\n * 查询数组中元素的index\n */\nexport function indexOf(array: T[] | readonly T[] | ArrayLike, value: T): number {\n if (array) {\n if ((array as T[]).indexOf) {\n return (array as T[]).indexOf(value);\n }\n for (let i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * 构造类继承关系\n *\n * @param clazz 源类\n * @param baseClazz 基类\n */\nexport function inherits(clazz: Function, baseClazz: Function) {\n const clazzPrototype = clazz.prototype;\n function F() {}\n F.prototype = baseClazz.prototype;\n clazz.prototype = new (F as any)();\n\n for (let prop in clazzPrototype) {\n if (clazzPrototype.hasOwnProperty(prop)) {\n clazz.prototype[prop] = clazzPrototype[prop];\n }\n }\n clazz.prototype.constructor = clazz;\n (clazz as any).superClass = baseClazz;\n}\n\nexport function mixin(target: T | Function, source: S | Function, override?: boolean) {\n target = 'prototype' in target ? target.prototype : target;\n source = 'prototype' in source ? source.prototype : source;\n // If build target is ES6 class. prototype methods is not enumerable. Use getOwnPropertyNames instead\n // TODO: Determine if source is ES6 class?\n if (Object.getOwnPropertyNames) {\n const keyList = Object.getOwnPropertyNames(source);\n for (let i = 0; i < keyList.length; i++) {\n const key = keyList[i];\n if (key !== 'constructor') {\n if ((override ? (source as any)[key] != null : (target as any)[key] == null)) {\n (target as any)[key] = (source as any)[key];\n }\n }\n }\n }\n else {\n defaults(target, source, override);\n }\n}\n\n/**\n * Consider typed array.\n * @param data\n */\nexport function isArrayLike(data: any): data is ArrayLike {\n if (!data) {\n return false;\n }\n if (typeof data === 'string') {\n return false;\n }\n return typeof data.length === 'number';\n}\n\n/**\n * 数组或对象遍历\n */\nexport function each | any[] | readonly any[] | ArrayLike, Context>(\n arr: I,\n cb: (\n this: Context,\n // Use unknown to avoid to infer to \"any\", which may disable typo check.\n value: I extends (infer T)[] | readonly (infer T)[] | ArrayLike ? T\n // Use Dictionary may cause infer fail when I is an interface.\n // So here use a Record to infer type.\n : I extends Dictionary ? I extends Record ? T : unknown : unknown,\n index?: I extends any[] | readonly any[] | ArrayLike ? number : keyof I & string, // keyof Dictionary will return number | string\n arr?: I\n ) => void,\n context?: Context\n) {\n if (!(arr && cb)) {\n return;\n }\n if ((arr as any).forEach && (arr as any).forEach === nativeForEach) {\n (arr as any).forEach(cb, context);\n }\n else if (arr.length === +arr.length) {\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided item be travelled? like `[33,,55]`.\n cb.call(context, (arr as any[])[i], i as any, arr);\n }\n }\n else {\n for (let key in arr) {\n if (arr.hasOwnProperty(key) && key !== protoKey) {\n cb.call(context, (arr as Dictionary)[key], key as any, arr);\n }\n }\n }\n}\n\n/**\n * Array mapping.\n * @typeparam T Type in Array\n * @typeparam R Type Returned\n * @return Must be an array.\n */\nexport function map(\n arr: readonly T[],\n cb: (this: Context, val: T, index?: number, arr?: readonly T[]) => R,\n context?: Context\n): R[] {\n // Take the same behavior with lodash when !arr and !cb,\n // which might be some common sense.\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr) as unknown[] as R[];\n }\n if (arr.map && arr.map === nativeMap) {\n return arr.map(cb, context);\n }\n else {\n const result = [];\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided item be travelled, like `[33,,55]`.\n result.push(cb.call(context, arr[i], i, arr));\n }\n return result;\n }\n}\n\nexport function reduce(\n arr: readonly T[],\n cb: (this: Context, previousValue: S, currentValue: T, currentIndex?: number, arr?: readonly T[]) => S,\n memo?: S,\n context?: Context\n): S {\n if (!(arr && cb)) {\n return;\n }\n for (let i = 0, len = arr.length; i < len; i++) {\n memo = cb.call(context, memo, arr[i], i, arr);\n }\n return memo;\n}\n\n/**\n * Array filtering.\n * @return Must be an array.\n */\nexport function filter(\n arr: readonly T[],\n cb: (this: Context, value: T, index: number, arr: readonly T[]) => boolean,\n context?: Context\n): T[] {\n // Take the same behavior with lodash when !arr and !cb,\n // which might be some common sense.\n if (!arr) {\n return [];\n }\n if (!cb) {\n return slice(arr);\n }\n if (arr.filter && arr.filter === nativeFilter) {\n return arr.filter(cb, context);\n }\n else {\n const result = [];\n for (let i = 0, len = arr.length; i < len; i++) {\n // FIXME: should the elided items be travelled? like `[33,,55]`.\n if (cb.call(context, arr[i], i, arr)) {\n result.push(arr[i]);\n }\n }\n return result;\n }\n}\n\n/**\n * 数组项查找\n */\nexport function find(\n arr: readonly T[],\n cb: (this: Context, value: T, index?: number, arr?: readonly T[]) => boolean,\n context?: Context\n): T {\n if (!(arr && cb)) {\n return;\n }\n for (let i = 0, len = arr.length; i < len; i++) {\n if (cb.call(context, arr[i], i, arr)) {\n return arr[i];\n }\n }\n}\n\n/**\n * Get all object keys\n *\n * Will return an empty array if obj is null/undefined\n */\nexport function keys(obj: T): (KeyOfDistributive & string)[] {\n if (!obj) {\n return [];\n }\n // Return type should be `keyof T` but exclude `number`, becuase\n // `Object.keys` only return string rather than `number | string`.\n type TKeys = KeyOfDistributive & string;\n if (Object.keys) {\n return filter(Object.keys(obj) as TKeys[], key => key !== protoKey);\n }\n let keyList: TKeys[] = [];\n for (let key in obj) {\n if (obj.hasOwnProperty(key) && key !== protoKey) {\n keyList.push(key as any);\n }\n }\n return keyList;\n}\n\n// Remove this type in returned function. Or it will conflicts wicth callback with given context. Like Eventful.\n// According to lib.es5.d.ts\n/* eslint-disable max-len*/\nexport type Bind1 = F extends (this: Ctx, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind2 = F extends (this: Ctx, a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind3 = F extends (this: Ctx, a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind4 = F extends (this: Ctx, a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Bind5 = F extends (this: Ctx, a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown;\ntype BindFunc = (this: Ctx, ...arg: any[]) => any\n\ninterface FunctionBind {\n , Ctx>(func: F, ctx: Ctx): Bind1\n , Ctx, T1 extends Parameters[0]>(func: F, ctx: Ctx, a: T1): Bind2\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1]>(func: F, ctx: Ctx, a: T1, b: T2): Bind3\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3): Bind4\n , Ctx, T1 extends Parameters[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, ctx: Ctx, a: T1, b: T2, c: T3, d: T4): Bind5\n}\nfunction bindPolyfill any>(\n func: Fn, context: Ctx, ...args: any[]\n): (...args: Parameters) => ReturnType {\n return function (this: Ctx) {\n return func.apply(context, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport const bind: FunctionBind = (protoFunction && isFunction(protoFunction.bind))\n ? protoFunction.call.bind(protoFunction.bind)\n : bindPolyfill;\n\nexport type Curry1 = F extends (a: T1, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry2 = F extends (a: T1, b: T2, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry3 = F extends (a: T1, b: T2, c: T3, ...args: infer A) => infer R ? (...args: A) => R : unknown;\nexport type Curry4 = F extends (a: T1, b: T2, c: T3, d: T4, ...args: infer A) => infer R ? (...args: A) => R : unknown;\ntype CurryFunc = (...arg: any[]) => any\n\nfunction curry[0]>(func: F, a: T1): Curry1\nfunction curry[0], T2 extends Parameters[1]>(func: F, a: T1, b: T2): Curry2\nfunction curry[0], T2 extends Parameters[1], T3 extends Parameters[2]>(func: F, a: T1, b: T2, c: T3): Curry3\nfunction curry[0], T2 extends Parameters[1], T3 extends Parameters[2], T4 extends Parameters[3]>(func: F, a: T1, b: T2, c: T3, d: T4): Curry4\nfunction curry(func: Function, ...args: any[]): Function {\n return function (this: any) {\n return func.apply(this, args.concat(nativeSlice.call(arguments)));\n };\n}\nexport {curry};\n/* eslint-enable max-len*/\n\nexport function isArray(value: any): value is any[] {\n if (Array.isArray) {\n return Array.isArray(value);\n }\n return objToString.call(value) === '[object Array]';\n}\n\nexport function isFunction(value: any): value is Function {\n return typeof value === 'function';\n}\n\nexport function isString(value: any): value is string {\n // Faster than `objToString.call` several times in chromium and webkit.\n // And `new String()` is rarely used.\n return typeof value === 'string';\n}\n\nexport function isStringSafe(value: any): value is string {\n return objToString.call(value) === '[object String]';\n}\n\nexport function isNumber(value: any): value is number {\n // Faster than `objToString.call` several times in chromium and webkit.\n // And `new Number()` is rarely used.\n return typeof value === 'number';\n}\n\n// Usage: `isObject(xxx)` or `isObject(SomeType)(xxx)`\n// Generic T can be used to avoid \"ts type gruards\" casting the `value` from its original\n// type `Object` implicitly so that loose its original type info in the subsequent code.\nexport function isObject(value: T): value is (object & T) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n const type = typeof value;\n return type === 'function' || (!!value && type === 'object');\n}\n\nexport function isBuiltInObject(value: any): boolean {\n return !!BUILTIN_OBJECT[objToString.call(value)];\n}\n\nexport function isTypedArray(value: any): boolean {\n return !!TYPED_ARRAY[objToString.call(value)];\n}\n\nexport function isDom(value: any): value is HTMLElement {\n return typeof value === 'object'\n && typeof value.nodeType === 'number'\n && typeof value.ownerDocument === 'object';\n}\n\nexport function isGradientObject(value: any): value is GradientObject {\n return (value as GradientObject).colorStops != null;\n}\n\nexport function isImagePatternObject(value: any): value is ImagePatternObject {\n return (value as ImagePatternObject).image != null;\n}\n\nexport function isRegExp(value: unknown): value is RegExp {\n return objToString.call(value) === '[object RegExp]';\n}\n\n/**\n * Whether is exactly NaN. Notice isNaN('a') returns true.\n */\nexport function eqNaN(value: any): boolean {\n /* eslint-disable-next-line no-self-compare */\n return value !== value;\n}\n\n/**\n * If value1 is not null, then return value1, otherwise judget rest of values.\n * Low performance.\n * @return Final value\n */\nexport function retrieve(...args: T[]): T {\n for (let i = 0, len = args.length; i < len; i++) {\n if (args[i] != null) {\n return args[i];\n }\n }\n}\n\nexport function retrieve2(value0: T, value1: R): T | R {\n return value0 != null\n ? value0\n : value1;\n}\n\nexport function retrieve3(value0: T, value1: R, value2: W): T | R | W {\n return value0 != null\n ? value0\n : value1 != null\n ? value1\n : value2;\n}\n\ntype SliceParams = Parameters;\nexport function slice(arr: ArrayLike, ...args: SliceParams): T[] {\n return nativeSlice.apply(arr, args as any[]);\n}\n\n/**\n * Normalize css liked array configuration\n * e.g.\n * 3 => [3, 3, 3, 3]\n * [4, 2] => [4, 2, 4, 2]\n * [4, 3, 2] => [4, 3, 2, 3]\n */\nexport function normalizeCssArray(val: number | number[]) {\n if (typeof (val) === 'number') {\n return [val, val, val, val];\n }\n const len = val.length;\n if (len === 2) {\n // vertical | horizontal\n return [val[0], val[1], val[0], val[1]];\n }\n else if (len === 3) {\n // top | horizontal | bottom\n return [val[0], val[1], val[2], val[1]];\n }\n return val;\n}\n\nexport function assert(condition: any, message?: string) {\n if (!condition) {\n throw new Error(message);\n }\n}\n\n/**\n * @param str string to be trimmed\n * @return trimmed string\n */\nexport function trim(str: string): string {\n if (str == null) {\n return null;\n }\n else if (typeof str.trim === 'function') {\n return str.trim();\n }\n else {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n }\n}\n\nconst primitiveKey = '__ec_primitive__';\n/**\n * Set an object as primitive to be ignored traversing children in clone or merge\n */\nexport function setAsPrimitive(obj: any) {\n obj[primitiveKey] = true;\n}\n\nexport function isPrimitive(obj: any): boolean {\n return obj[primitiveKey];\n}\n\ninterface MapInterface {\n delete(key: KEY): boolean;\n has(key: KEY): boolean;\n get(key: KEY): T | undefined;\n set(key: KEY, value: T): this;\n keys(): KEY[];\n forEach(callback: (value: T, key: KEY) => void): void;\n}\n\nclass MapPolyfill implements MapInterface {\n private data: Record = {} as Record;\n\n delete(key: KEY): boolean {\n const existed = this.has(key);\n if (existed) {\n delete this.data[key];\n }\n return existed;\n }\n has(key: KEY): boolean {\n return this.data.hasOwnProperty(key);\n }\n get(key: KEY): T | undefined {\n return this.data[key];\n }\n set(key: KEY, value: T): this {\n this.data[key] = value;\n return this;\n }\n keys(): KEY[] {\n return keys(this.data);\n }\n forEach(callback: (value: T, key: KEY) => void): void {\n // This is a potential performance bottleneck, see details in\n // https://github.com/ecomfe/zrender/issues/965, however it is now\n // less likely to occur as we default to native maps when possible.\n const data = this.data;\n for (const key in data) {\n if (data.hasOwnProperty(key)) {\n callback(data[key], key);\n }\n }\n }\n}\n\n// We want to use native Map if it is available, but we do not want to polyfill the global scope\n// in case users ship their own polyfills or patch the native map object in any way.\nconst isNativeMapSupported = typeof Map === 'function';\nfunction maybeNativeMap(): MapInterface {\n // Map may be a native class if we are running in an ES6 compatible environment.\n // eslint-disable-next-line\n return (isNativeMapSupported ? new Map() : new MapPolyfill()) as MapInterface;\n}\n\n/**\n * @constructor\n * @param {Object} obj\n */\nexport class HashMap {\n data: MapInterface\n\n constructor(obj?: HashMap | { [key in KEY]?: T } | KEY[]) {\n const isArr = isArray(obj);\n // Key should not be set on this, otherwise\n // methods get/set/... may be overridden.\n this.data = maybeNativeMap();\n const thisMap = this;\n\n (obj instanceof HashMap)\n ? obj.each(visit)\n : (obj && each(obj, visit));\n\n function visit(value: any, key: any) {\n isArr ? thisMap.set(value, key) : thisMap.set(key, value);\n }\n }\n\n // `hasKey` instead of `has` for potential misleading.\n hasKey(key: KEY): boolean {\n return this.data.has(key);\n }\n get(key: KEY): T {\n return this.data.get(key);\n }\n set(key: KEY, value: T): T {\n // Comparing with invocation chaining, `return value` is more commonly\n // used in this case: `const someVal = map.set('a', genVal());`\n this.data.set(key, value);\n return value;\n }\n // Although util.each can be performed on this hashMap directly, user\n // should not use the exposed keys, who are prefixed.\n each(\n cb: (this: Context, value?: T, key?: KEY) => void,\n context?: Context\n ) {\n this.data.forEach((value, key) => {\n cb.call(context, value, key);\n });\n }\n keys(): KEY[] {\n const keys = this.data.keys();\n return isNativeMapSupported\n // Native map returns an iterator so we need to convert it to an array\n ? Array.from(keys)\n : keys;\n }\n // Do not use this method if performance sensitive.\n removeKey(key: KEY): void {\n this.data.delete(key);\n }\n}\n\nexport function createHashMap(\n obj?: HashMap | { [key in KEY]?: T } | KEY[]\n) {\n return new HashMap(obj);\n}\n\nexport function concatArray(a: ArrayLike, b: ArrayLike): ArrayLike {\n const newArray = new (a as any).constructor(a.length + b.length);\n for (let i = 0; i < a.length; i++) {\n newArray[i] = a[i];\n }\n const offset = a.length;\n for (let i = 0; i < b.length; i++) {\n newArray[i + offset] = b[i];\n }\n return newArray;\n}\n\nexport function createObject(proto?: object, properties?: T): T {\n // Performance of Object.create\n // https://jsperf.com/style-strategy-proto-or-others\n let obj: T;\n if (Object.create) {\n obj = Object.create(proto);\n }\n else {\n const StyleCtor = function () {};\n StyleCtor.prototype = proto;\n obj = new (StyleCtor as any)();\n }\n if (properties) {\n extend(obj, properties);\n }\n\n return obj;\n}\n\n\nexport function disableUserSelect(dom: HTMLElement) {\n const domStyle = dom.style;\n domStyle.webkitUserSelect = 'none';\n domStyle.userSelect = 'none';\n // @ts-ignore\n domStyle.webkitTapHighlightColor = 'rgba(0,0,0,0)';\n (domStyle as any)['-webkit-touch-callout'] = 'none';\n}\n\nexport function hasOwn(own: object, prop: string): boolean {\n return own.hasOwnProperty(prop);\n}\n\nexport function noop() {}\n\nexport const RADIAN_TO_DEGREE = 180 / Math.PI;","/**\r\n * @deprecated\r\n * Use zrender.Point class instead\r\n */\r\nimport { MatrixArray } from './matrix';\r\n\r\n/* global Float32Array */\r\n\r\n// const ArrayCtor = typeof Float32Array === 'undefined'\r\n// ? Array\r\n// : Float32Array;\r\n\r\nexport type VectorArray = number[]\r\n/**\r\n * 创建一个向量\r\n */\r\nexport function create(x?: number, y?: number): VectorArray {\r\n if (x == null) {\r\n x = 0;\r\n }\r\n if (y == null) {\r\n y = 0;\r\n }\r\n return [x, y];\r\n}\r\n\r\n/**\r\n * 复制向量数据\r\n */\r\nexport function copy(out: T, v: VectorArray): T {\r\n out[0] = v[0];\r\n out[1] = v[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 克隆一个向量\r\n */\r\nexport function clone(v: VectorArray): VectorArray {\r\n return [v[0], v[1]];\r\n}\r\n\r\n/**\r\n * 设置向量的两个项\r\n */\r\nexport function set(out: T, a: number, b: number): T {\r\n out[0] = a;\r\n out[1] = b;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量相加\r\n */\r\nexport function add(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] + v2[0];\r\n out[1] = v1[1] + v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量缩放后相加\r\n */\r\nexport function scaleAndAdd(out: T, v1: VectorArray, v2: VectorArray, a: number): T {\r\n out[0] = v1[0] + v2[0] * a;\r\n out[1] = v1[1] + v2[1] * a;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量相减\r\n */\r\nexport function sub(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] - v2[0];\r\n out[1] = v1[1] - v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量长度\r\n */\r\nexport function len(v: VectorArray): number {\r\n return Math.sqrt(lenSquare(v));\r\n}\r\nexport const length = len;\r\n\r\n/**\r\n * 向量长度平方\r\n */\r\nexport function lenSquare(v: VectorArray): number {\r\n return v[0] * v[0] + v[1] * v[1];\r\n}\r\nexport const lengthSquare = lenSquare;\r\n\r\n/**\r\n * 向量乘法\r\n */\r\nexport function mul(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] * v2[0];\r\n out[1] = v1[1] * v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量除法\r\n */\r\nexport function div(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = v1[0] / v2[0];\r\n out[1] = v1[1] / v2[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量点乘\r\n */\r\nexport function dot(v1: VectorArray, v2: VectorArray) {\r\n return v1[0] * v2[0] + v1[1] * v2[1];\r\n}\r\n\r\n/**\r\n * 向量缩放\r\n */\r\nexport function scale(out: T, v: VectorArray, s: number): T {\r\n out[0] = v[0] * s;\r\n out[1] = v[1] * s;\r\n return out;\r\n}\r\n\r\n/**\r\n * 向量归一化\r\n */\r\nexport function normalize(out: T, v: VectorArray): T {\r\n const d = len(v);\r\n if (d === 0) {\r\n out[0] = 0;\r\n out[1] = 0;\r\n }\r\n else {\r\n out[0] = v[0] / d;\r\n out[1] = v[1] / d;\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * 计算向量间距离\r\n */\r\nexport function distance(v1: VectorArray, v2: VectorArray): number {\r\n return Math.sqrt(\r\n (v1[0] - v2[0]) * (v1[0] - v2[0])\r\n + (v1[1] - v2[1]) * (v1[1] - v2[1])\r\n );\r\n}\r\nexport const dist = distance;\r\n\r\n/**\r\n * 向量距离平方\r\n */\r\nexport function distanceSquare(v1: VectorArray, v2: VectorArray): number {\r\n return (v1[0] - v2[0]) * (v1[0] - v2[0])\r\n + (v1[1] - v2[1]) * (v1[1] - v2[1]);\r\n}\r\nexport const distSquare = distanceSquare;\r\n\r\n/**\r\n * 求负向量\r\n */\r\nexport function negate(out: T, v: VectorArray): T {\r\n out[0] = -v[0];\r\n out[1] = -v[1];\r\n return out;\r\n}\r\n\r\n/**\r\n * 插值两个点\r\n */\r\nexport function lerp(out: T, v1: VectorArray, v2: VectorArray, t: number): T {\r\n out[0] = v1[0] + t * (v2[0] - v1[0]);\r\n out[1] = v1[1] + t * (v2[1] - v1[1]);\r\n return out;\r\n}\r\n\r\n/**\r\n * 矩阵左乘向量\r\n */\r\nexport function applyTransform(out: T, v: VectorArray, m: MatrixArray): T {\r\n const x = v[0];\r\n const y = v[1];\r\n out[0] = m[0] * x + m[2] * y + m[4];\r\n out[1] = m[1] * x + m[3] * y + m[5];\r\n return out;\r\n}\r\n\r\n/**\r\n * 求两个向量最小值\r\n */\r\nexport function min(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = Math.min(v1[0], v2[0]);\r\n out[1] = Math.min(v1[1], v2[1]);\r\n return out;\r\n}\r\n\r\n/**\r\n * 求两个向量最大值\r\n */\r\nexport function max(out: T, v1: VectorArray, v2: VectorArray): T {\r\n out[0] = Math.max(v1[0], v2[0]);\r\n out[1] = Math.max(v1[1], v2[1]);\r\n return out;\r\n}\r\n","import Handler from '../Handler';\r\nimport Element, { ElementEvent } from '../Element';\r\nimport Displayable from '../graphic/Displayable';\r\n\r\nclass Param {\r\n\r\n target: Element\r\n topTarget: Element\r\n\r\n constructor(target: Element, e?: ElementEvent) {\r\n this.target = target;\r\n this.topTarget = e && e.topTarget;\r\n }\r\n}\r\n\r\n// FIXME Draggable on element which has parent rotation or scale\r\nexport default class Draggable {\r\n\r\n handler: Handler\r\n\r\n _draggingTarget: Element\r\n _dropTarget: Element\r\n\r\n _x: number\r\n _y: number\r\n\r\n constructor(handler: Handler) {\r\n this.handler = handler;\r\n\r\n handler.on('mousedown', this._dragStart, this);\r\n handler.on('mousemove', this._drag, this);\r\n handler.on('mouseup', this._dragEnd, this);\r\n // `mosuemove` and `mouseup` can be continue to fire when dragging.\r\n // See [DRAG_OUTSIDE] in `Handler.js`. So we do not need to trigger\r\n // `_dragEnd` when globalout. That would brings better user experience.\r\n // this.on('globalout', this._dragEnd, this);\r\n\r\n // this._dropTarget = null;\r\n // this._draggingTarget = null;\r\n\r\n // this._x = 0;\r\n // this._y = 0;\r\n }\r\n\r\n _dragStart(e: ElementEvent) {\r\n let draggingTarget = e.target;\r\n // Find if there is draggable in the ancestor\r\n while (draggingTarget && !draggingTarget.draggable) {\r\n draggingTarget = draggingTarget.parent || draggingTarget.__hostTarget;\r\n }\r\n if (draggingTarget) {\r\n this._draggingTarget = draggingTarget;\r\n draggingTarget.dragging = true;\r\n this._x = e.offsetX;\r\n this._y = e.offsetY;\r\n\r\n this.handler.dispatchToElement(\r\n new Param(draggingTarget, e), 'dragstart', e.event\r\n );\r\n }\r\n }\r\n\r\n _drag(e: ElementEvent) {\r\n const draggingTarget = this._draggingTarget;\r\n if (draggingTarget) {\r\n\r\n const x = e.offsetX;\r\n const y = e.offsetY;\r\n\r\n const dx = x - this._x;\r\n const dy = y - this._y;\r\n this._x = x;\r\n this._y = y;\r\n\r\n draggingTarget.drift(dx, dy, e);\r\n this.handler.dispatchToElement(\r\n new Param(draggingTarget, e), 'drag', e.event\r\n );\r\n\r\n const dropTarget = this.handler.findHover(\r\n x, y, draggingTarget as Displayable // PENDING\r\n ).target;\r\n const lastDropTarget = this._dropTarget;\r\n this._dropTarget = dropTarget;\r\n\r\n if (draggingTarget !== dropTarget) {\r\n if (lastDropTarget && dropTarget !== lastDropTarget) {\r\n this.handler.dispatchToElement(\r\n new Param(lastDropTarget, e), 'dragleave', e.event\r\n );\r\n }\r\n if (dropTarget && dropTarget !== lastDropTarget) {\r\n this.handler.dispatchToElement(\r\n new Param(dropTarget, e), 'dragenter', e.event\r\n );\r\n }\r\n }\r\n }\r\n }\r\n\r\n _dragEnd(e: ElementEvent) {\r\n const draggingTarget = this._draggingTarget;\r\n\r\n if (draggingTarget) {\r\n draggingTarget.dragging = false;\r\n }\r\n\r\n this.handler.dispatchToElement(new Param(draggingTarget, e), 'dragend', e.event);\r\n\r\n if (this._dropTarget) {\r\n this.handler.dispatchToElement(new Param(this._dropTarget, e), 'drop', e.event);\r\n }\r\n\r\n this._draggingTarget = null;\r\n this._dropTarget = null;\r\n }\r\n\r\n}","import { Dictionary, WithThisType } from './types';\r\n\r\n// Return true to cancel bubble\r\nexport type EventCallbackSingleParam = EvtParam extends any\r\n ? (params: EvtParam) => boolean | void\r\n : never\r\n\r\nexport type EventCallback = EvtParams extends any[]\r\n ? (...args: EvtParams) => boolean | void\r\n : never\r\nexport type EventQuery = string | Object\r\n\r\ntype CbThis = unknown extends Ctx ? Impl : Ctx;\r\n\r\ntype EventHandler = {\r\n h: EventCallback\r\n ctx: CbThis\r\n query: EventQuery\r\n\r\n callAtLast: boolean\r\n}\r\n\r\ntype DefaultEventDefinition = Dictionary>;\r\n\r\nexport interface EventProcessor {\r\n normalizeQuery?: (query: EventQuery) => EventQuery\r\n filter?: (eventType: keyof EvtDef, query: EventQuery) => boolean\r\n afterTrigger?: (eventType: keyof EvtDef) => void\r\n}\r\n\r\n/**\r\n * Event dispatcher.\r\n *\r\n * Event can be defined in EvtDef to enable type check. For example:\r\n * ```ts\r\n * interface FooEvents {\r\n * // key: event name, value: the first event param in `trigger` and `callback`.\r\n * myevent: {\r\n * aa: string;\r\n * bb: number;\r\n * };\r\n * }\r\n * class Foo extends Eventful {\r\n * fn() {\r\n * // Type check of event name and the first event param is enabled here.\r\n * this.trigger('myevent', {aa: 'xx', bb: 3});\r\n * }\r\n * }\r\n * let foo = new Foo();\r\n * // Type check of event name and the first event param is enabled here.\r\n * foo.on('myevent', (eventParam) => { ... });\r\n * ```\r\n *\r\n * @param eventProcessor The object eventProcessor is the scope when\r\n * `eventProcessor.xxx` called.\r\n * @param eventProcessor.normalizeQuery\r\n * param: {string|Object} Raw query.\r\n * return: {string|Object} Normalized query.\r\n * @param eventProcessor.filter Event will be dispatched only\r\n * if it returns `true`.\r\n * param: {string} eventType\r\n * param: {string|Object} query\r\n * return: {boolean}\r\n * @param eventProcessor.afterTrigger Called after all handlers called.\r\n * param: {string} eventType\r\n */\r\nexport default class Eventful {\r\n\r\n private _$handlers: Dictionary[]>\r\n\r\n protected _$eventProcessor: EventProcessor\r\n\r\n constructor(eventProcessors?: EventProcessor) {\r\n if (eventProcessors) {\r\n this._$eventProcessor = eventProcessors;\r\n }\r\n }\r\n\r\n on(\r\n event: EvtNm,\r\n handler: WithThisType>,\r\n context?: Ctx\r\n ): this\r\n on(\r\n event: EvtNm,\r\n query: EventQuery,\r\n handler: WithThisType>,\r\n context?: Ctx\r\n ): this\r\n /**\r\n * Bind a handler.\r\n *\r\n * @param event The event name.\r\n * @param Condition used on event filter.\r\n * @param handler The event handler.\r\n * @param context\r\n */\r\n on(\r\n event: EvtNm,\r\n query: EventQuery | WithThisType, CbThis>,\r\n handler?: WithThisType, CbThis> | Ctx,\r\n context?: Ctx\r\n ): this {\r\n if (!this._$handlers) {\r\n this._$handlers = {};\r\n }\r\n\r\n const _h = this._$handlers;\r\n\r\n if (typeof query === 'function') {\r\n context = handler as Ctx;\r\n handler = query as (...args: any) => any;\r\n query = null;\r\n }\r\n\r\n if (!handler || !event) {\r\n return this;\r\n }\r\n\r\n const eventProcessor = this._$eventProcessor;\r\n if (query != null && eventProcessor && eventProcessor.normalizeQuery) {\r\n query = eventProcessor.normalizeQuery(query);\r\n }\r\n\r\n if (!_h[event as string]) {\r\n _h[event as string] = [];\r\n }\r\n\r\n for (let i = 0; i < _h[event as string].length; i++) {\r\n if (_h[event as string][i].h === handler) {\r\n return this;\r\n }\r\n }\r\n\r\n const wrap: EventHandler = {\r\n h: handler as EventCallback,\r\n query: query,\r\n ctx: (context || this) as CbThis,\r\n // FIXME\r\n // Do not publish this feature util it is proved that it makes sense.\r\n callAtLast: (handler as any).zrEventfulCallAtLast\r\n };\r\n\r\n const lastIndex = _h[event as string].length - 1;\r\n const lastWrap = _h[event as string][lastIndex];\r\n (lastWrap && lastWrap.callAtLast)\r\n ? _h[event as string].splice(lastIndex, 0, wrap)\r\n : _h[event as string].push(wrap);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Whether any handler has bound.\r\n */\r\n isSilent(eventName: keyof EvtDef): boolean {\r\n const _h = this._$handlers;\r\n return !_h || !_h[eventName as string] || !_h[eventName as string].length;\r\n }\r\n\r\n /**\r\n * Unbind a event.\r\n *\r\n * @param eventType The event name.\r\n * If no `event` input, \"off\" all listeners.\r\n * @param handler The event handler.\r\n * If no `handler` input, \"off\" all listeners of the `event`.\r\n */\r\n off(eventType?: keyof EvtDef, handler?: Function): this {\r\n const _h = this._$handlers;\r\n\r\n if (!_h) {\r\n return this;\r\n }\r\n\r\n if (!eventType) {\r\n this._$handlers = {};\r\n return this;\r\n }\r\n\r\n if (handler) {\r\n if (_h[eventType as string]) {\r\n const newList = [];\r\n for (let i = 0, l = _h[eventType as string].length; i < l; i++) {\r\n if (_h[eventType as string][i].h !== handler) {\r\n newList.push(_h[eventType as string][i]);\r\n }\r\n }\r\n _h[eventType as string] = newList;\r\n }\r\n\r\n if (_h[eventType as string] && _h[eventType as string].length === 0) {\r\n delete _h[eventType as string];\r\n }\r\n }\r\n else {\r\n delete _h[eventType as string];\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispatch a event.\r\n *\r\n * @param {string} eventType The event name.\r\n */\r\n trigger(\r\n eventType: EvtNm,\r\n ...args: Parameters\r\n ): this {\r\n if (!this._$handlers) {\r\n return this;\r\n }\r\n\r\n const _h = this._$handlers[eventType as string];\r\n const eventProcessor = this._$eventProcessor;\r\n\r\n if (_h) {\r\n const argLen = args.length;\r\n\r\n const len = _h.length;\r\n for (let i = 0; i < len; i++) {\r\n const hItem = _h[i];\r\n if (eventProcessor\r\n && eventProcessor.filter\r\n && hItem.query != null\r\n && !eventProcessor.filter(eventType, hItem.query)\r\n ) {\r\n continue;\r\n }\r\n\r\n // Optimize advise from backbone\r\n switch (argLen) {\r\n case 0:\r\n hItem.h.call(hItem.ctx);\r\n break;\r\n case 1:\r\n hItem.h.call(hItem.ctx, args[0]);\r\n break;\r\n case 2:\r\n hItem.h.call(hItem.ctx, args[0], args[1]);\r\n break;\r\n default:\r\n // have more than 2 given arguments\r\n hItem.h.apply(hItem.ctx, args);\r\n break;\r\n }\r\n }\r\n }\r\n\r\n eventProcessor && eventProcessor.afterTrigger\r\n && eventProcessor.afterTrigger(eventType);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Dispatch a event with context, which is specified at the last parameter.\r\n *\r\n * @param {string} type The event name.\r\n */\r\n triggerWithContext(type: keyof EvtDef, ...args: any[]): this {\r\n if (!this._$handlers) {\r\n return this;\r\n }\r\n\r\n const _h = this._$handlers[type as string];\r\n const eventProcessor = this._$eventProcessor;\r\n\r\n if (_h) {\r\n const argLen = args.length;\r\n const ctx = args[argLen - 1];\r\n\r\n const len = _h.length;\r\n for (let i = 0; i < len; i++) {\r\n const hItem = _h[i];\r\n if (eventProcessor\r\n && eventProcessor.filter\r\n && hItem.query != null\r\n && !eventProcessor.filter(type, hItem.query)\r\n ) {\r\n continue;\r\n }\r\n\r\n // Optimize advise from backbone\r\n switch (argLen) {\r\n case 0:\r\n hItem.h.call(ctx);\r\n break;\r\n case 1:\r\n hItem.h.call(ctx, args[0]);\r\n break;\r\n case 2:\r\n hItem.h.call(ctx, args[0], args[1]);\r\n break;\r\n default:\r\n // have more than 2 given arguments\r\n hItem.h.apply(ctx, args.slice(1, argLen - 1));\r\n break;\r\n }\r\n }\r\n }\r\n\r\n eventProcessor && eventProcessor.afterTrigger\r\n && eventProcessor.afterTrigger(type);\r\n\r\n return this;\r\n }\r\n\r\n}\r\n","/**\r\n * The algoritm is learnt from\r\n * https://franklinta.com/2014/09/08/computing-css-matrix3d-transforms/\r\n * And we made some optimization for matrix inversion.\r\n * Other similar approaches:\r\n * \"cv::getPerspectiveTransform\", \"Direct Linear Transformation\".\r\n */\r\n\r\nconst LN2 = Math.log(2);\r\n\r\nfunction determinant(\r\n rows: number[][],\r\n rank: number,\r\n rowStart: number,\r\n rowMask: number,\r\n colMask: number,\r\n detCache: {[key: string]: number}\r\n) {\r\n const cacheKey = rowMask + '-' + colMask;\r\n const fullRank = rows.length;\r\n\r\n if (detCache.hasOwnProperty(cacheKey)) {\r\n return detCache[cacheKey];\r\n }\r\n\r\n if (rank === 1) {\r\n // In this case the colMask must be like: `11101111`. We can find the place of `0`.\r\n const colStart = Math.round(Math.log(((1 << fullRank) - 1) & ~colMask) / LN2);\r\n return rows[rowStart][colStart];\r\n }\r\n\r\n const subRowMask = rowMask | (1 << rowStart);\r\n let subRowStart = rowStart + 1;\r\n while (rowMask & (1 << subRowStart)) {\r\n subRowStart++;\r\n }\r\n\r\n let sum = 0;\r\n for (let j = 0, colLocalIdx = 0; j < fullRank; j++) {\r\n const colTag = 1 << j;\r\n if (!(colTag & colMask)) {\r\n sum += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j]\r\n // det(subMatrix(0, j))\r\n * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);\r\n colLocalIdx++;\r\n }\r\n }\r\n\r\n detCache[cacheKey] = sum;\r\n\r\n return sum;\r\n}\r\n\r\n/**\r\n * Usage:\r\n * ```js\r\n * const transformer = buildTransformer(\r\n * [10, 44, 100, 44, 100, 300, 10, 300],\r\n * [50, 54, 130, 14, 140, 330, 14, 220]\r\n * );\r\n * const out = [];\r\n * transformer && transformer([11, 33], out);\r\n * ```\r\n *\r\n * Notice: `buildTransformer` may take more than 10ms in some Android device.\r\n *\r\n * @param src source four points, [x0, y0, x1, y1, x2, y2, x3, y3]\r\n * @param dest destination four points, [x0, y0, x1, y1, x2, y2, x3, y3]\r\n * @return transformer If fail, return null/undefined.\r\n */\r\nexport function buildTransformer(src: number[], dest: number[]) {\r\n const mA = [\r\n [src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]],\r\n [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]],\r\n [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]],\r\n [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]],\r\n [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]],\r\n [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]],\r\n [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]],\r\n [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]\r\n ];\r\n\r\n const detCache = {};\r\n const det = determinant(mA, 8, 0, 0, 0, detCache);\r\n if (det === 0) {\r\n // can not make transformer when and only when\r\n // any three of the markers are collinear.\r\n return;\r\n }\r\n\r\n // `invert(mA) * dest`, that is, `adj(mA) / det * dest`.\r\n const vh: number[] = [];\r\n for (let i = 0; i < 8; i++) {\r\n for (let j = 0; j < 8; j++) {\r\n vh[j] == null && (vh[j] = 0);\r\n vh[j] += ((i + j) % 2 ? -1 : 1)\r\n // det(subMatrix(i, j))\r\n * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache)\r\n / det * dest[i];\r\n }\r\n }\r\n\r\n return function (out: number[], srcPointX: number, srcPointY: number) {\r\n const pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;\r\n out[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;\r\n out[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;\r\n };\r\n}\r\n","\r\nimport env from './env';\r\nimport {buildTransformer} from './fourPointsTransform';\r\nimport {Dictionary} from './types';\r\n\r\nconst EVENT_SAVED_PROP = '___zrEVENTSAVED';\r\nconst _calcOut: number[] = [];\r\n\r\ntype SavedInfo = {\r\n markers?: HTMLDivElement[]\r\n trans?: ReturnType\r\n invTrans?: ReturnType\r\n srcCoords?: number[]\r\n}\r\n\r\n/**\r\n * Transform \"local coord\" from `elFrom` to `elTarget`.\r\n * \"local coord\": the coord based on the input `el`. The origin point is at\r\n * the position of \"left: 0; top: 0;\" in the `el`.\r\n *\r\n * Support when CSS transform is used.\r\n *\r\n * Having the `out` (that is, `[outX, outY]`), we can create an DOM element\r\n * and set the CSS style as \"left: outX; top: outY;\" and append it to `elTarge`\r\n * to locate the element.\r\n *\r\n * For example, this code below positions a child of `document.body` on the event\r\n * point, no matter whether `body` has `margin`/`paddin`/`transfrom`/... :\r\n * ```js\r\n * transformLocalCoord(out, container, document.body, event.offsetX, event.offsetY);\r\n * if (!eqNaN(out[0])) {\r\n * // Then locate the tip element on the event point.\r\n * var tipEl = document.createElement('div');\r\n * tipEl.style.cssText = 'position: absolute; left:' + out[0] + ';top:' + out[1] + ';';\r\n * document.body.appendChild(tipEl);\r\n * }\r\n * ```\r\n *\r\n * Notice: In some env this method is not supported. If called, `out` will be `[NaN, NaN]`.\r\n *\r\n * @param {Array.} out [inX: number, inY: number] The output..\r\n * If can not transform, `out` will not be modified but return `false`.\r\n * @param {HTMLElement} elFrom The `[inX, inY]` is based on elFrom.\r\n * @param {HTMLElement} elTarget The `out` is based on elTarget.\r\n * @param {number} inX\r\n * @param {number} inY\r\n * @return {boolean} Whether transform successfully.\r\n */\r\nexport function transformLocalCoord(\r\n out: number[],\r\n elFrom: HTMLElement,\r\n elTarget: HTMLElement,\r\n inX: number,\r\n inY: number\r\n) {\r\n return transformCoordWithViewport(_calcOut, elFrom, inX, inY, true)\r\n && transformCoordWithViewport(out, elTarget, _calcOut[0], _calcOut[1]);\r\n}\r\n\r\n/**\r\n * Transform between a \"viewport coord\" and a \"local coord\".\r\n * \"viewport coord\": the coord based on the left-top corner of the viewport\r\n * of the browser.\r\n * \"local coord\": the coord based on the input `el`. The origin point is at\r\n * the position of \"left: 0; top: 0;\" in the `el`.\r\n *\r\n * Support the case when CSS transform is used on el.\r\n *\r\n * @param out [inX: number, inY: number] The output. If `inverse: false`,\r\n * it represents \"local coord\", otherwise \"vireport coord\".\r\n * If can not transform, `out` will not be modified but return `false`.\r\n * @param el The \"local coord\" is based on the `el`, see comment above.\r\n * @param inX If `inverse: false`,\r\n * it represents \"vireport coord\", otherwise \"local coord\".\r\n * @param inY If `inverse: false`,\r\n * it represents \"vireport coord\", otherwise \"local coord\".\r\n * @param inverse\r\n * `true`: from \"viewport coord\" to \"local coord\".\r\n * `false`: from \"local coord\" to \"viewport coord\".\r\n * @return {boolean} Whether transform successfully.\r\n */\r\nexport function transformCoordWithViewport(\r\n out: number[],\r\n el: HTMLElement,\r\n inX: number,\r\n inY: number,\r\n inverse?: boolean\r\n) {\r\n if (el.getBoundingClientRect && env.domSupported && !isCanvasEl(el)) {\r\n const saved = (el as any)[EVENT_SAVED_PROP] || ((el as any)[EVENT_SAVED_PROP] = {});\r\n const markers = prepareCoordMarkers(el, saved);\r\n const transformer = preparePointerTransformer(markers, saved, inverse);\r\n if (transformer) {\r\n transformer(out, inX, inY);\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction prepareCoordMarkers(el: HTMLElement, saved: SavedInfo) {\r\n let markers = saved.markers;\r\n if (markers) {\r\n return markers;\r\n }\r\n\r\n markers = saved.markers = [];\r\n const propLR = ['left', 'right'];\r\n const propTB = ['top', 'bottom'];\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const marker = document.createElement('div');\r\n const stl = marker.style;\r\n const idxLR = i % 2;\r\n const idxTB = (i >> 1) % 2;\r\n stl.cssText = [\r\n 'position: absolute',\r\n 'visibility: hidden',\r\n 'padding: 0',\r\n 'margin: 0',\r\n 'border-width: 0',\r\n 'user-select: none',\r\n 'width:0',\r\n 'height:0',\r\n // 'width: 5px',\r\n // 'height: 5px',\r\n propLR[idxLR] + ':0',\r\n propTB[idxTB] + ':0',\r\n propLR[1 - idxLR] + ':auto',\r\n propTB[1 - idxTB] + ':auto',\r\n ''\r\n ].join('!important;');\r\n el.appendChild(marker);\r\n markers.push(marker);\r\n }\r\n\r\n return markers;\r\n}\r\n\r\nfunction preparePointerTransformer(markers: HTMLDivElement[], saved: SavedInfo, inverse?: boolean) {\r\n const transformerName: 'invTrans' | 'trans' = inverse ? 'invTrans' : 'trans';\r\n const transformer = saved[transformerName];\r\n const oldSrcCoords = saved.srcCoords;\r\n const srcCoords = [];\r\n const destCoords = [];\r\n let oldCoordTheSame = true;\r\n\r\n for (let i = 0; i < 4; i++) {\r\n const rect = markers[i].getBoundingClientRect();\r\n const ii = 2 * i;\r\n const x = rect.left;\r\n const y = rect.top;\r\n srcCoords.push(x, y);\r\n oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];\r\n destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);\r\n }\r\n // Cache to avoid time consuming of `buildTransformer`.\r\n return (oldCoordTheSame && transformer)\r\n ? transformer\r\n : (\r\n saved.srcCoords = srcCoords,\r\n saved[transformerName] = inverse\r\n ? buildTransformer(destCoords, srcCoords)\r\n : buildTransformer(srcCoords, destCoords)\r\n );\r\n}\r\n\r\nexport function isCanvasEl(el: HTMLElement): el is HTMLCanvasElement {\r\n return el.nodeName.toUpperCase() === 'CANVAS';\r\n}\r\n\r\nconst replaceReg = /([&<>\"'])/g;\r\nconst replaceMap: Dictionary = {\r\n '&': '&',\r\n '<': '<',\r\n '>': '>',\r\n '\"': '"',\r\n '\\'': '''\r\n};\r\n\r\nexport function encodeHTML(source: string): string {\r\n return source == null\r\n ? ''\r\n : (source + '').replace(replaceReg, function (str, c) {\r\n return replaceMap[c];\r\n });\r\n}\r\n","/**\n * Utilities for mouse or touch events.\n */\n\nimport Eventful from './Eventful';\nimport env from './env';\nimport { ZRRawEvent } from './types';\nimport {isCanvasEl, transformCoordWithViewport} from './dom';\n\nconst MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;\nconst _calcOut: number[] = [];\nconst firefoxNotSupportOffsetXY = env.browser.firefox\n // use offsetX/offsetY for Firefox >= 39\n // PENDING: consider Firefox for Android and Firefox OS? >= 43\n && +(env.browser.version as string).split('.')[0] < 39;\n\ntype FirefoxMouseEvent = {\n layerX: number\n layerY: number\n}\n\n\n/**\n * Get the `zrX` and `zrY`, which are relative to the top-left of\n * the input `el`.\n * CSS transform (2D & 3D) is supported.\n *\n * The strategy to fetch the coords:\n * + If `calculate` is not set as `true`, users of this method should\n * ensure that `el` is the same or the same size & location as `e.target`.\n * Otherwise the result coords are probably not expected. Because we\n * firstly try to get coords from e.offsetX/e.offsetY.\n * + If `calculate` is set as `true`, the input `el` can be any element\n * and we force to calculate the coords based on `el`.\n * + The input `el` should be positionable (not position:static).\n *\n * The force `calculate` can be used in case like:\n * When mousemove event triggered on ec tooltip, `e.target` is not `el`(zr painter.dom).\n *\n * @param el DOM element.\n * @param e Mouse event or touch event.\n * @param out Get `out.zrX` and `out.zrY` as the result.\n * @param calculate Whether to force calculate\n * the coordinates but not use ones provided by browser.\n */\nexport function clientToLocal(\n el: HTMLElement,\n e: ZRRawEvent | FirefoxMouseEvent | Touch,\n out: {zrX?: number, zrY?: number},\n calculate?: boolean\n) {\n out = out || {};\n\n // According to the W3C Working Draft, offsetX and offsetY should be relative\n // to the padding edge of the target element. The only browser using this convention\n // is IE. Webkit uses the border edge, Opera uses the content edge, and FireFox does\n // not support the properties.\n // (see http://www.jacklmoore.com/notes/mouse-position/)\n // In zr painter.dom, padding edge equals to border edge.\n if (calculate) {\n calculateZrXY(el, e as ZRRawEvent, out);\n }\n // Caution: In FireFox, layerX/layerY Mouse position relative to the closest positioned\n // ancestor element, so we should make sure el is positioned (e.g., not position:static).\n // BTW1, Webkit don't return the same results as FF in non-simple cases (like add\n // zoom-factor, overflow / opacity layers, transforms ...)\n // BTW2, (ev.offsetY || ev.pageY - $(ev.target).offset().top) is not correct in preserve-3d.\n // \n // BTW3, In ff, offsetX/offsetY is always 0.\n else if (firefoxNotSupportOffsetXY\n && (e as FirefoxMouseEvent).layerX != null\n && (e as FirefoxMouseEvent).layerX !== (e as MouseEvent).offsetX\n ) {\n out.zrX = (e as FirefoxMouseEvent).layerX;\n out.zrY = (e as FirefoxMouseEvent).layerY;\n }\n // For IE6+, chrome, safari, opera, firefox >= 39\n else if ((e as MouseEvent).offsetX != null) {\n out.zrX = (e as MouseEvent).offsetX;\n out.zrY = (e as MouseEvent).offsetY;\n }\n // For some other device, e.g., IOS safari.\n else {\n calculateZrXY(el, e as ZRRawEvent, out);\n }\n\n return out;\n}\n\nfunction calculateZrXY(\n el: HTMLElement,\n e: ZRRawEvent,\n out: {zrX?: number, zrY?: number}\n) {\n // BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect.\n if (env.domSupported && el.getBoundingClientRect) {\n const ex = (e as MouseEvent).clientX;\n const ey = (e as MouseEvent).clientY;\n\n if (isCanvasEl(el)) {\n // Original approach, which do not support CSS transform.\n // marker can not be locationed in a canvas container\n // (getBoundingClientRect is always 0). We do not support\n // that input a pre-created canvas to zr while using css\n // transform in iOS.\n const box = el.getBoundingClientRect();\n out.zrX = ex - box.left;\n out.zrY = ey - box.top;\n return;\n }\n else {\n if (transformCoordWithViewport(_calcOut, el, ex, ey)) {\n out.zrX = _calcOut[0];\n out.zrY = _calcOut[1];\n return;\n }\n }\n }\n out.zrX = out.zrY = 0;\n}\n\n/**\n * Find native event compat for legency IE.\n * Should be called at the begining of a native event listener.\n *\n * @param e Mouse event or touch event or pointer event.\n * For lagency IE, we use `window.event` is used.\n * @return The native event.\n */\nexport function getNativeEvent(e: ZRRawEvent): ZRRawEvent {\n return e\n || (window.event as any); // For IE\n}\n\n/**\n * Normalize the coordinates of the input event.\n *\n * Get the `e.zrX` and `e.zrY`, which are relative to the top-left of\n * the input `el`.\n * Get `e.zrDelta` if using mouse wheel.\n * Get `e.which`, see the comment inside this function.\n *\n * Do not calculate repeatly if `zrX` and `zrY` already exist.\n *\n * Notice: see comments in `clientToLocal`. check the relationship\n * between the result coords and the parameters `el` and `calculate`.\n *\n * @param el DOM element.\n * @param e See `getNativeEvent`.\n * @param calculate Whether to force calculate\n * the coordinates but not use ones provided by browser.\n * @return The normalized native UIEvent.\n */\nexport function normalizeEvent(\n el: HTMLElement,\n e: ZRRawEvent,\n calculate?: boolean\n) {\n\n e = getNativeEvent(e);\n\n if (e.zrX != null) {\n return e;\n }\n\n const eventType = e.type;\n const isTouch = eventType && eventType.indexOf('touch') >= 0;\n\n if (!isTouch) {\n clientToLocal(el, e, e, calculate);\n const wheelDelta = getWheelDeltaMayPolyfill(e);\n // FIXME: IE8- has \"wheelDeta\" in event \"mousewheel\" but hat different value (120 times)\n // with Chrome and Safari. It's not correct for zrender event but we left it as it was.\n e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;\n }\n else {\n const touch = eventType !== 'touchend'\n ? (e).targetTouches[0]\n : (e).changedTouches[0];\n touch && clientToLocal(el, touch, e, calculate);\n }\n\n // Add which for click: 1 === left; 2 === middle; 3 === right; otherwise: 0;\n // See jQuery: https://github.com/jquery/jquery/blob/master/src/event.js\n // If e.which has been defined, it may be readonly,\n // see: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which\n const button = (e).button;\n if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {\n (e as any).which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));\n }\n // [Caution]: `e.which` from browser is not always reliable. For example,\n // when press left button and `mousemove (pointermove)` in Edge, the `e.which`\n // is 65536 and the `e.button` is -1. But the `mouseup (pointerup)` and\n // `mousedown (pointerdown)` is the same as Chrome does.\n\n return e;\n}\n\n// TODO: also provide prop \"deltaX\" \"deltaY\" in zrender \"mousewheel\" event.\nfunction getWheelDeltaMayPolyfill(e: ZRRawEvent): number {\n // Although event \"wheel\" do not has the prop \"wheelDelta\" in spec,\n // agent like Chrome and Safari still provide \"wheelDelta\" like\n // event \"mousewheel\" did (perhaps for backward compat).\n // Since zrender has been using \"wheelDeta\" in zrender event \"mousewheel\".\n // we currently do not break it.\n // But event \"wheel\" in firefox do not has \"wheelDelta\", so we calculate\n // \"wheelDeta\" from \"deltaX\", \"deltaY\" (which is the props in spec).\n const rawWheelDelta = (e as any).wheelDelta;\n // Theroetically `e.wheelDelta` won't be 0 unless some day it has been deprecated\n // by agent like Chrome or Safari. So we also calculate it if rawWheelDelta is 0.\n if (rawWheelDelta) {\n return rawWheelDelta;\n }\n\n const deltaX = (e as any).deltaX;\n const deltaY = (e as any).deltaY;\n if (deltaX == null || deltaY == null) {\n return rawWheelDelta;\n }\n\n // Test in Chrome and Safari (MacOS):\n // The sign is corrent.\n // The abs value is 99% corrent (inconsist case only like 62~63, 125~126 ...)\n const delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);\n const sign = deltaY > 0 ? -1\n : deltaY < 0 ? 1\n : deltaX > 0 ? -1\n : 1;\n return 3 * delta * sign;\n}\n\n\ntype AddEventListenerParams = Parameters\ntype RemoveEventListenerParams = Parameters\n/**\n * @param el\n * @param name\n * @param handler\n * @param opt If boolean, means `opt.capture`\n * @param opt.capture\n * @param opt.passive\n */\nexport function addEventListener(\n el: HTMLElement | HTMLDocument,\n name: AddEventListenerParams[0],\n handler: AddEventListenerParams[1],\n opt?: AddEventListenerParams[2]\n) {\n // Reproduct the console warning:\n // [Violation] Added non-passive event listener to a scroll-blocking event.\n // Consider marking event handler as 'passive' to make the page more responsive.\n // Just set console log level: verbose in chrome dev tool.\n // then the warning log will be printed when addEventListener called.\n // See https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n // We have not yet found a neat way to using passive. Because in zrender the dom event\n // listener delegate all of the upper events of element. Some of those events need\n // to prevent default. For example, the feature `preventDefaultMouseMove` of echarts.\n // Before passive can be adopted, these issues should be considered:\n // (1) Whether and how a zrender user specifies an event listener passive. And by default,\n // passive or not.\n // (2) How to tread that some zrender event listener is passive, and some is not. If\n // we use other way but not preventDefault of mousewheel and touchmove, browser\n // compatibility should be handled.\n\n // const opts = (env.passiveSupported && name === 'mousewheel')\n // ? {passive: true}\n // // By default, the third param of el.addEventListener is `capture: false`.\n // : void 0;\n // el.addEventListener(name, handler /* , opts */);\n el.addEventListener(name, handler, opt);\n}\n\n/**\n * Parameter are the same as `addEventListener`.\n *\n * Notice that if a listener is registered twice, one with capture and one without,\n * remove each one separately. Removal of a capturing listener does not affect a\n * non-capturing version of the same listener, and vice versa.\n */\nexport function removeEventListener(\n el: HTMLElement | HTMLDocument,\n name: RemoveEventListenerParams[0],\n handler: RemoveEventListenerParams[1],\n opt: RemoveEventListenerParams[2]\n) {\n el.removeEventListener(name, handler, opt);\n}\n\n/**\n * preventDefault and stopPropagation.\n * Notice: do not use this method in zrender. It can only be\n * used by upper applications if necessary.\n *\n * @param {Event} e A mouse or touch event.\n */\nexport const stop = function (e: MouseEvent | TouchEvent | PointerEvent) {\n e.preventDefault();\n e.stopPropagation();\n e.cancelBubble = true;\n};\n\n/**\n * This method only works for mouseup and mousedown. The functionality is restricted\n * for fault tolerance, See the `e.which` compatibility above.\n *\n * params can be MouseEvent or ElementEvent\n */\nexport function isMiddleOrRightButtonOnMouseUpDown(e: { which: number }) {\n return e.which === 2 || e.which === 3;\n}\n\n// For backward compatibility\nexport {Eventful as Dispatcher};\n","/**\n * Only implements needed gestures for mobile.\n */\n\nimport * as eventUtil from './event';\nimport { ZRRawTouchEvent, ZRPinchEvent, Dictionary } from './types';\nimport Displayable from '../graphic/Displayable';\n\ninterface TrackItem {\n points: number[][]\n touches: Touch[]\n target: Displayable,\n event: ZRRawTouchEvent\n}\n\nexport class GestureMgr {\n\n private _track: TrackItem[] = []\n\n constructor() {}\n\n recognize(event: ZRRawTouchEvent, target: Displayable, root: HTMLElement) {\n this._doTrack(event, target, root);\n return this._recognize(event);\n }\n\n clear() {\n this._track.length = 0;\n return this;\n }\n\n _doTrack(event: ZRRawTouchEvent, target: Displayable, root: HTMLElement) {\n const touches = event.touches;\n\n if (!touches) {\n return;\n }\n\n const trackItem: TrackItem = {\n points: [],\n touches: [],\n target: target,\n event: event\n };\n\n for (let i = 0, len = touches.length; i < len; i++) {\n const touch = touches[i];\n const pos = eventUtil.clientToLocal(root, touch, {});\n trackItem.points.push([pos.zrX, pos.zrY]);\n trackItem.touches.push(touch);\n }\n\n this._track.push(trackItem);\n }\n\n _recognize(event: ZRRawTouchEvent) {\n for (let eventName in recognizers) {\n if (recognizers.hasOwnProperty(eventName)) {\n const gestureInfo = recognizers[eventName](this._track, event);\n if (gestureInfo) {\n return gestureInfo;\n }\n }\n }\n }\n}\n\nfunction dist(pointPair: number[][]): number {\n const dx = pointPair[1][0] - pointPair[0][0];\n const dy = pointPair[1][1] - pointPair[0][1];\n\n return Math.sqrt(dx * dx + dy * dy);\n}\n\nfunction center(pointPair: number[][]): number[] {\n return [\n (pointPair[0][0] + pointPair[1][0]) / 2,\n (pointPair[0][1] + pointPair[1][1]) / 2\n ];\n}\n\ntype Recognizer = (tracks: TrackItem[], event: ZRRawTouchEvent) => {\n type: string\n target: Displayable\n event: ZRRawTouchEvent\n}\n\nconst recognizers: Dictionary = {\n\n pinch: function (tracks: TrackItem[], event: ZRRawTouchEvent) {\n const trackLen = tracks.length;\n\n if (!trackLen) {\n return;\n }\n\n const pinchEnd = (tracks[trackLen - 1] || {}).points;\n const pinchPre = (tracks[trackLen - 2] || {}).points || pinchEnd;\n\n if (pinchPre\n && pinchPre.length > 1\n && pinchEnd\n && pinchEnd.length > 1\n ) {\n let pinchScale = dist(pinchEnd) / dist(pinchPre);\n !isFinite(pinchScale) && (pinchScale = 1);\n\n (event as ZRPinchEvent).pinchScale = pinchScale;\n\n const pinchCenter = center(pinchEnd);\n (event as ZRPinchEvent).pinchX = pinchCenter[0];\n (event as ZRPinchEvent).pinchY = pinchCenter[1];\n\n return {\n type: 'pinch',\n target: tracks[0].target,\n event: event\n };\n }\n }\n\n // Only pinch currently.\n};","/**\n * 3x2矩阵操作类\n * @exports zrender/tool/matrix\n */\n\n/* global Float32Array */\n\nimport {VectorArray} from './vector';\n\nexport type MatrixArray = number[]\n/**\n * Create a identity matrix.\n */\nexport function create(): MatrixArray {\n return [1, 0, 0, 1, 0, 0];\n}\n\n/**\n * 设置矩阵为单位矩阵\n */\nexport function identity(out: MatrixArray): MatrixArray {\n out[0] = 1;\n out[1] = 0;\n out[2] = 0;\n out[3] = 1;\n out[4] = 0;\n out[5] = 0;\n return out;\n}\n\n/**\n * 复制矩阵\n */\nexport function copy(out: MatrixArray, m: MatrixArray): MatrixArray {\n out[0] = m[0];\n out[1] = m[1];\n out[2] = m[2];\n out[3] = m[3];\n out[4] = m[4];\n out[5] = m[5];\n return out;\n}\n\n/**\n * 矩阵相乘\n */\nexport function mul(out: MatrixArray, m1: MatrixArray, m2: MatrixArray): MatrixArray {\n // Consider matrix.mul(m, m2, m);\n // where out is the same as m2.\n // So use temp constiable to escape error.\n const out0 = m1[0] * m2[0] + m1[2] * m2[1];\n const out1 = m1[1] * m2[0] + m1[3] * m2[1];\n const out2 = m1[0] * m2[2] + m1[2] * m2[3];\n const out3 = m1[1] * m2[2] + m1[3] * m2[3];\n const out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];\n const out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];\n out[0] = out0;\n out[1] = out1;\n out[2] = out2;\n out[3] = out3;\n out[4] = out4;\n out[5] = out5;\n return out;\n}\n\n/**\n * 平移变换\n */\nexport function translate(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n out[4] = a[4] + v[0];\n out[5] = a[5] + v[1];\n return out;\n}\n\n/**\n * 旋转变换\n */\nexport function rotate(\n out: MatrixArray,\n a: MatrixArray,\n rad: number,\n pivot: VectorArray = [0, 0]\n): MatrixArray {\n const aa = a[0];\n const ac = a[2];\n const atx = a[4];\n const ab = a[1];\n const ad = a[3];\n const aty = a[5];\n const st = Math.sin(rad);\n const ct = Math.cos(rad);\n\n out[0] = aa * ct + ab * st;\n out[1] = -aa * st + ab * ct;\n out[2] = ac * ct + ad * st;\n out[3] = -ac * st + ct * ad;\n out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];\n out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];\n return out;\n}\n\n/**\n * 缩放变换\n */\nexport function scale(out: MatrixArray, a: MatrixArray, v: VectorArray): MatrixArray {\n const vx = v[0];\n const vy = v[1];\n out[0] = a[0] * vx;\n out[1] = a[1] * vy;\n out[2] = a[2] * vx;\n out[3] = a[3] * vy;\n out[4] = a[4] * vx;\n out[5] = a[5] * vy;\n return out;\n}\n\n/**\n * 求逆矩阵\n */\nexport function invert(out: MatrixArray, a: MatrixArray): MatrixArray | null {\n\n const aa = a[0];\n const ac = a[2];\n const atx = a[4];\n const ab = a[1];\n const ad = a[3];\n const aty = a[5];\n\n let det = aa * ad - ab * ac;\n if (!det) {\n return null;\n }\n det = 1.0 / det;\n\n out[0] = ad * det;\n out[1] = -ab * det;\n out[2] = -ac * det;\n out[3] = aa * det;\n out[4] = (ac * aty - ad * atx) * det;\n out[5] = (ab * atx - aa * aty) * det;\n return out;\n}\n\n/**\n * Clone a new matrix.\n */\nexport function clone(a: MatrixArray): MatrixArray {\n const b = create();\n copy(b, a);\n return b;\n}\n","import { MatrixArray } from './matrix';\r\n\r\nexport interface PointLike {\r\n x: number\r\n y: number\r\n}\r\nexport default class Point {\r\n\r\n x: number\r\n\r\n y: number\r\n\r\n constructor(x?: number, y?: number) {\r\n this.x = x || 0;\r\n this.y = y || 0;\r\n }\r\n\r\n /**\r\n * Copy from another point\r\n */\r\n copy(other: PointLike) {\r\n this.x = other.x;\r\n this.y = other.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Clone a point\r\n */\r\n clone() {\r\n return new Point(this.x, this.y);\r\n }\r\n\r\n /**\r\n * Set x and y\r\n */\r\n set(x: number, y: number) {\r\n this.x = x;\r\n this.y = y;\r\n return this;\r\n }\r\n\r\n /**\r\n * If equal to another point\r\n */\r\n equal(other: PointLike) {\r\n return other.x === this.x && other.y === this.y;\r\n }\r\n\r\n /**\r\n * Add another point\r\n */\r\n add(other: PointLike) {\r\n this.x += other.x;\r\n this.y += other.y;\r\n return this;\r\n }\r\n\r\n scale(scalar: number) {\r\n this.x *= scalar;\r\n this.y *= scalar;\r\n }\r\n\r\n scaleAndAdd(other: PointLike, scalar: number) {\r\n this.x += other.x * scalar;\r\n this.y += other.y * scalar;\r\n }\r\n\r\n /**\r\n * Sub another point\r\n */\r\n sub(other: PointLike) {\r\n this.x -= other.x;\r\n this.y -= other.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Dot product with other point\r\n */\r\n dot(other: PointLike) {\r\n return this.x * other.x + this.y * other.y;\r\n }\r\n\r\n /**\r\n * Get length of point\r\n */\r\n len() {\r\n return Math.sqrt(this.x * this.x + this.y * this.y);\r\n }\r\n\r\n /**\r\n * Get squared length\r\n */\r\n lenSquare() {\r\n return this.x * this.x + this.y * this.y;\r\n }\r\n\r\n /**\r\n * Normalize\r\n */\r\n normalize() {\r\n const len = this.len();\r\n this.x /= len;\r\n this.y /= len;\r\n return this;\r\n }\r\n\r\n /**\r\n * Distance to another point\r\n */\r\n distance(other: PointLike) {\r\n const dx = this.x - other.x;\r\n const dy = this.y - other.y;\r\n return Math.sqrt(dx * dx + dy * dy);\r\n }\r\n\r\n /**\r\n * Square distance to another point\r\n */\r\n distanceSquare(other: Point) {\r\n const dx = this.x - other.x;\r\n const dy = this.y - other.y;\r\n return dx * dx + dy * dy;\r\n }\r\n\r\n /**\r\n * Negate\r\n */\r\n negate() {\r\n this.x = -this.x;\r\n this.y = -this.y;\r\n return this;\r\n }\r\n\r\n /**\r\n * Apply a transform matrix array.\r\n */\r\n transform(m: MatrixArray) {\r\n if (!m) {\r\n return;\r\n }\r\n const x = this.x;\r\n const y = this.y;\r\n this.x = m[0] * x + m[2] * y + m[4];\r\n this.y = m[1] * x + m[3] * y + m[5];\r\n return this;\r\n }\r\n\r\n toArray(out: number[]) {\r\n out[0] = this.x;\r\n out[1] = this.y;\r\n return out;\r\n }\r\n\r\n fromArray(input: number[]) {\r\n this.x = input[0];\r\n this.y = input[1];\r\n }\r\n\r\n static set(p: PointLike, x: number, y: number) {\r\n p.x = x;\r\n p.y = y;\r\n }\r\n\r\n static copy(p: PointLike, p2: PointLike) {\r\n p.x = p2.x;\r\n p.y = p2.y;\r\n }\r\n\r\n static len(p: PointLike) {\r\n return Math.sqrt(p.x * p.x + p.y * p.y);\r\n }\r\n\r\n static lenSquare(p: PointLike) {\r\n return p.x * p.x + p.y * p.y;\r\n }\r\n\r\n static dot(p0: PointLike, p1: PointLike) {\r\n return p0.x * p1.x + p0.y * p1.y;\r\n }\r\n\r\n static add(out: PointLike, p0: PointLike, p1: PointLike) {\r\n out.x = p0.x + p1.x;\r\n out.y = p0.y + p1.y;\r\n }\r\n\r\n static sub(out: PointLike, p0: PointLike, p1: PointLike) {\r\n out.x = p0.x - p1.x;\r\n out.y = p0.y - p1.y;\r\n }\r\n\r\n static scale(out: PointLike, p0: PointLike, scalar: number) {\r\n out.x = p0.x * scalar;\r\n out.y = p0.y * scalar;\r\n }\r\n\r\n static scaleAndAdd(out: PointLike, p0: PointLike, p1: PointLike, scalar: number) {\r\n out.x = p0.x + p1.x * scalar;\r\n out.y = p0.y + p1.y * scalar;\r\n }\r\n\r\n static lerp(out: PointLike, p0: PointLike, p1: PointLike, t: number) {\r\n const onet = 1 - t;\r\n out.x = onet * p0.x + t * p1.x;\r\n out.y = onet * p0.y + t * p1.y;\r\n }\r\n}","/**\r\n * @module echarts/core/BoundingRect\r\n */\r\n\r\nimport * as matrix from './matrix';\r\nimport Point, { PointLike } from './Point';\r\n\r\nconst mathMin = Math.min;\r\nconst mathMax = Math.max;\r\n\r\nconst lt = new Point();\r\nconst rb = new Point();\r\nconst lb = new Point();\r\nconst rt = new Point();\r\n\r\nconst minTv = new Point();\r\nconst maxTv = new Point();\r\n\r\nclass BoundingRect {\r\n\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n\r\n constructor(x: number, y: number, width: number, height: number) {\r\n if (width < 0) {\r\n x = x + width;\r\n width = -width;\r\n }\r\n if (height < 0) {\r\n y = y + height;\r\n height = -height;\r\n }\r\n\r\n this.x = x;\r\n this.y = y;\r\n this.width = width;\r\n this.height = height;\r\n }\r\n\r\n union(other: BoundingRect) {\r\n const x = mathMin(other.x, this.x);\r\n const y = mathMin(other.y, this.y);\r\n\r\n // If x is -Infinity and width is Infinity (like in the case of\r\n // IncrementalDisplayble), x + width would be NaN\r\n if (isFinite(this.x) && isFinite(this.width)) {\r\n this.width = mathMax(\r\n other.x + other.width,\r\n this.x + this.width\r\n ) - x;\r\n }\r\n else {\r\n this.width = other.width;\r\n }\r\n\r\n if (isFinite(this.y) && isFinite(this.height)) {\r\n this.height = mathMax(\r\n other.y + other.height,\r\n this.y + this.height\r\n ) - y;\r\n }\r\n else {\r\n this.height = other.height;\r\n }\r\n\r\n this.x = x;\r\n this.y = y;\r\n }\r\n\r\n applyTransform(m: matrix.MatrixArray) {\r\n BoundingRect.applyTransform(this, this, m);\r\n }\r\n\r\n calculateTransform(b: RectLike): matrix.MatrixArray {\r\n const a = this;\r\n const sx = b.width / a.width;\r\n const sy = b.height / a.height;\r\n\r\n const m = matrix.create();\r\n\r\n // 矩阵右乘\r\n matrix.translate(m, m, [-a.x, -a.y]);\r\n matrix.scale(m, m, [sx, sy]);\r\n matrix.translate(m, m, [b.x, b.y]);\r\n\r\n return m;\r\n }\r\n\r\n intersect(b: RectLike, mtv?: PointLike): boolean {\r\n if (!b) {\r\n return false;\r\n }\r\n\r\n if (!(b instanceof BoundingRect)) {\r\n // Normalize negative width/height.\r\n b = BoundingRect.create(b);\r\n }\r\n\r\n const a = this;\r\n const ax0 = a.x;\r\n const ax1 = a.x + a.width;\r\n const ay0 = a.y;\r\n const ay1 = a.y + a.height;\r\n\r\n const bx0 = b.x;\r\n const bx1 = b.x + b.width;\r\n const by0 = b.y;\r\n const by1 = b.y + b.height;\r\n\r\n let overlap = !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0);\r\n if (mtv) {\r\n let dMin = Infinity;\r\n let dMax = 0;\r\n const d0 = Math.abs(ax1 - bx0);\r\n const d1 = Math.abs(bx1 - ax0);\r\n const d2 = Math.abs(ay1 - by0);\r\n const d3 = Math.abs(by1 - ay0);\r\n const dx = Math.min(d0, d1);\r\n const dy = Math.min(d2, d3);\r\n // On x axis\r\n if (ax1 < bx0 || bx1 < ax0) {\r\n if (dx > dMax) {\r\n dMax = dx;\r\n if (d0 < d1) {\r\n Point.set(maxTv, -d0, 0); // b is on the right\r\n }\r\n else {\r\n Point.set(maxTv, d1, 0); // b is on the left\r\n }\r\n }\r\n }\r\n else {\r\n if (dx < dMin) {\r\n dMin = dx;\r\n if (d0 < d1) {\r\n Point.set(minTv, d0, 0); // b is on the right\r\n }\r\n else {\r\n Point.set(minTv, -d1, 0); // b is on the left\r\n }\r\n }\r\n }\r\n\r\n // On y axis\r\n if (ay1 < by0 || by1 < ay0) {\r\n if (dy > dMax) {\r\n dMax = dy;\r\n if (d2 < d3) {\r\n Point.set(maxTv, 0, -d2); // b is on the bottom(larger y)\r\n }\r\n else {\r\n Point.set(maxTv, 0, d3); // b is on the top(smaller y)\r\n }\r\n }\r\n }\r\n else {\r\n if (dx < dMin) {\r\n dMin = dx;\r\n if (d2 < d3) {\r\n Point.set(minTv, 0, d2); // b is on the bottom\r\n }\r\n else {\r\n Point.set(minTv, 0, -d3); // b is on the top\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (mtv) {\r\n Point.copy(mtv, overlap ? minTv : maxTv);\r\n }\r\n return overlap;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const rect = this;\r\n return x >= rect.x\r\n && x <= (rect.x + rect.width)\r\n && y >= rect.y\r\n && y <= (rect.y + rect.height);\r\n }\r\n\r\n clone() {\r\n return new BoundingRect(this.x, this.y, this.width, this.height);\r\n }\r\n\r\n /**\r\n * Copy from another rect\r\n */\r\n copy(other: RectLike) {\r\n BoundingRect.copy(this, other);\r\n }\r\n\r\n plain(): RectLike {\r\n return {\r\n x: this.x,\r\n y: this.y,\r\n width: this.width,\r\n height: this.height\r\n };\r\n }\r\n\r\n /**\r\n * If not having NaN or Infinity with attributes\r\n */\r\n isFinite(): boolean {\r\n return isFinite(this.x)\r\n && isFinite(this.y)\r\n && isFinite(this.width)\r\n && isFinite(this.height);\r\n }\r\n\r\n isZero(): boolean {\r\n return this.width === 0 || this.height === 0;\r\n }\r\n\r\n static create(rect: RectLike): BoundingRect {\r\n return new BoundingRect(rect.x, rect.y, rect.width, rect.height);\r\n }\r\n\r\n static copy(target: RectLike, source: RectLike) {\r\n target.x = source.x;\r\n target.y = source.y;\r\n target.width = source.width;\r\n target.height = source.height;\r\n }\r\n\r\n static applyTransform(target: RectLike, source: RectLike, m: matrix.MatrixArray) {\r\n // In case usage like this\r\n // el.getBoundingRect().applyTransform(el.transform)\r\n // And element has no transform\r\n if (!m) {\r\n if (target !== source) {\r\n BoundingRect.copy(target, source);\r\n }\r\n return;\r\n }\r\n // Fast path when there is no rotation in matrix.\r\n if (m[1] < 1e-5 && m[1] > -1e-5 && m[2] < 1e-5 && m[2] > -1e-5) {\r\n const sx = m[0];\r\n const sy = m[3];\r\n const tx = m[4];\r\n const ty = m[5];\r\n target.x = source.x * sx + tx;\r\n target.y = source.y * sy + ty;\r\n target.width = source.width * sx;\r\n target.height = source.height * sy;\r\n if (target.width < 0) {\r\n target.x += target.width;\r\n target.width = -target.width;\r\n }\r\n if (target.height < 0) {\r\n target.y += target.height;\r\n target.height = -target.height;\r\n }\r\n return;\r\n }\r\n\r\n // source and target can be same instance.\r\n lt.x = lb.x = source.x;\r\n lt.y = rt.y = source.y;\r\n rb.x = rt.x = source.x + source.width;\r\n rb.y = lb.y = source.y + source.height;\r\n\r\n lt.transform(m);\r\n rt.transform(m);\r\n rb.transform(m);\r\n lb.transform(m);\r\n\r\n target.x = mathMin(lt.x, rb.x, lb.x, rt.x);\r\n target.y = mathMin(lt.y, rb.y, lb.y, rt.y);\r\n const maxX = mathMax(lt.x, rb.x, lb.x, rt.x);\r\n const maxY = mathMax(lt.y, rb.y, lb.y, rt.y);\r\n target.width = maxX - target.x;\r\n target.height = maxY - target.y;\r\n }\r\n}\r\n\r\n\r\nexport type RectLike = {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n}\r\n\r\nexport default BoundingRect;","import * as util from './core/util';\nimport * as vec2 from './core/vector';\nimport Draggable from './mixin/Draggable';\nimport Eventful from './core/Eventful';\nimport * as eventTool from './core/event';\nimport {GestureMgr} from './core/GestureMgr';\nimport Displayable from './graphic/Displayable';\nimport {PainterBase} from './PainterBase';\nimport HandlerDomProxy, { HandlerProxyInterface } from './dom/HandlerProxy';\nimport { ZRRawEvent, ZRPinchEvent, ElementEventName, ElementEventNameWithOn, ZRRawTouchEvent } from './core/types';\nimport Storage from './Storage';\nimport Element, {ElementEvent} from './Element';\nimport CanvasPainter from './canvas/Painter';\nimport BoundingRect from './core/BoundingRect';\n\n/**\n * [The interface between `Handler` and `HandlerProxy`]:\n *\n * The default `HandlerProxy` only support the common standard web environment\n * (e.g., standalone browser, headless browser, embed browser in mobild APP, ...).\n * But `HandlerProxy` can be replaced to support more non-standard environment\n * (e.g., mini app), or to support more feature that the default `HandlerProxy`\n * not provided (like echarts-gl did).\n * So the interface between `Handler` and `HandlerProxy` should be stable. Do not\n * make break changes util inevitable. The interface include the public methods\n * of `Handler` and the events listed in `handlerNames` below, by which `HandlerProxy`\n * drives `Handler`.\n */\n\n/**\n * [DRAG_OUTSIDE]:\n *\n * That is, triggering `mousemove` and `mouseup` event when the pointer is out of the\n * zrender area when dragging. That is important for the improvement of the user experience\n * when dragging something near the boundary without being terminated unexpectedly.\n *\n * We originally consider to introduce new events like `pagemovemove` and `pagemouseup`\n * to resolve this issue. But some drawbacks of it is described in\n * https://github.com/ecomfe/zrender/pull/536#issuecomment-560286899\n *\n * Instead, we referenced the specifications:\n * https://www.w3.org/TR/touch-events/#the-touchmove-event\n * https://www.w3.org/TR/2014/WD-DOM-Level-3-Events-20140925/#event-type-mousemove\n * where the the mousemove/touchmove can be continue to fire if the user began a drag\n * operation and the pointer has left the boundary. (for the mouse event, browsers\n * only do it on `document` and when the pointer has left the boundary of the browser.)\n *\n * So the default `HandlerProxy` supports this feature similarly: if it is in the dragging\n * state (see `pointerCapture` in `HandlerProxy`), the `mousemove` and `mouseup` continue\n * to fire until release the pointer. That is implemented by listen to those event on\n * `document`.\n * If we implement some other `HandlerProxy` only for touch device, that would be easier.\n * The touch event support this feature by default.\n * The term \"pointer capture\" is from the spec:\n * https://www.w3.org/TR/pointerevents2/#idl-def-element-setpointercapture-pointerid\n *\n * Note:\n * There might be some cases that the mouse event can not be received on `document`.\n * For example,\n * (A) When `useCapture` is not supported and some user defined event listeners on the ancestor\n * of zr dom throw Error.\n * (B) When `useCapture` is not supported and some user defined event listeners on the ancestor of\n * zr dom call `stopPropagation`.\n * In these cases, the `mousemove` event might be keep triggering event when the mouse is released.\n * We try to reduce the side-effect in those cases, that is, use `isOutsideBoundary` to prevent\n * it from do anything (especially, `findHover`).\n * (`useCapture` mean, `addEvnetListener(listener, {capture: true})`, althought it may not be\n * suppported in some environments.)\n *\n * Note:\n * If `HandlerProxy` listens to `document` with `useCapture`, `HandlerProxy` needs to\n * prevent user-registered-handler from calling `stopPropagation` and `preventDefault`\n * when the `event.target` is not a zrender dom element. Otherwise the user-registered-handler\n * may be able to prevent other elements (that not relevant to zrender) in the web page from receiving\n * dom events.\n */\n\nconst SILENT = 'silent';\n\nfunction makeEventPacket(eveType: ElementEventName, targetInfo: {\n target?: Element\n topTarget?: Element\n}, event: ZRRawEvent): ElementEvent {\n return {\n type: eveType,\n event: event,\n // target can only be an element that is not silent.\n target: targetInfo.target,\n // topTarget can be a silent element.\n topTarget: targetInfo.topTarget,\n cancelBubble: false,\n offsetX: event.zrX,\n offsetY: event.zrY,\n gestureEvent: (event as ZRPinchEvent).gestureEvent,\n pinchX: (event as ZRPinchEvent).pinchX,\n pinchY: (event as ZRPinchEvent).pinchY,\n pinchScale: (event as ZRPinchEvent).pinchScale,\n wheelDelta: event.zrDelta,\n zrByTouch: event.zrByTouch,\n which: event.which,\n stop: stopEvent\n };\n}\n\nfunction stopEvent(this: ElementEvent) {\n eventTool.stop(this.event);\n}\n\nclass EmptyProxy extends Eventful {\n handler: Handler = null\n dispose() {}\n setCursor() {}\n}\n\nclass HoveredResult {\n x: number\n y: number\n target: Displayable\n topTarget: Displayable\n constructor(x?: number, y?: number) {\n this.x = x;\n this.y = y;\n }\n}\n\nconst handlerNames = [\n 'click', 'dblclick', 'mousewheel', 'mouseout',\n 'mouseup', 'mousedown', 'mousemove', 'contextmenu'\n];\n\ntype HandlerName = 'click' |'dblclick' |'mousewheel' |'mouseout' |\n 'mouseup' |'mousedown' |'mousemove' |'contextmenu';\n\nconst tmpRect = new BoundingRect(0, 0, 0, 0);\n\n// TODO draggable\nclass Handler extends Eventful {\n\n storage: Storage\n painter: PainterBase\n painterRoot: HTMLElement\n\n proxy: HandlerProxyInterface\n\n private _hovered = new HoveredResult(0, 0)\n\n private _gestureMgr: GestureMgr\n\n private _draggingMgr: Draggable\n\n private _pointerSize: number\n\n _downEl: Element\n _upEl: Element\n _downPoint: [number, number]\n\n constructor(\n storage: Storage,\n painter: PainterBase,\n proxy: HandlerProxyInterface,\n painterRoot: HTMLElement,\n pointerSize: number\n ) {\n super();\n\n this.storage = storage;\n\n this.painter = painter;\n\n this.painterRoot = painterRoot;\n\n this._pointerSize = pointerSize;\n\n proxy = proxy || new EmptyProxy();\n\n /**\n * Proxy of event. can be Dom, WebGLSurface, etc.\n */\n this.proxy = null;\n\n this.setHandlerProxy(proxy);\n\n this._draggingMgr = new Draggable(this);\n }\n\n setHandlerProxy(proxy: HandlerProxyInterface) {\n if (this.proxy) {\n this.proxy.dispose();\n }\n\n if (proxy) {\n util.each(handlerNames, function (name) {\n proxy.on && proxy.on(name, this[name as HandlerName], this);\n }, this);\n // Attach handler\n proxy.handler = this;\n }\n this.proxy = proxy;\n }\n\n mousemove(event: ZRRawEvent) {\n const x = event.zrX;\n const y = event.zrY;\n\n const isOutside = isOutsideBoundary(this, x, y);\n\n let lastHovered = this._hovered;\n let lastHoveredTarget = lastHovered.target;\n\n // If lastHoveredTarget is removed from zr (detected by '__zr') by some API call\n // (like 'setOption' or 'dispatchAction') in event handlers, we should find\n // lastHovered again here. Otherwise 'mouseout' can not be triggered normally.\n // See #6198.\n if (lastHoveredTarget && !lastHoveredTarget.__zr) {\n lastHovered = this.findHover(lastHovered.x, lastHovered.y);\n lastHoveredTarget = lastHovered.target;\n }\n\n const hovered = this._hovered = isOutside ? new HoveredResult(x, y) : this.findHover(x, y);\n const hoveredTarget = hovered.target;\n\n const proxy = this.proxy;\n proxy.setCursor && proxy.setCursor(hoveredTarget ? hoveredTarget.cursor : 'default');\n\n // Mouse out on previous hovered element\n if (lastHoveredTarget && hoveredTarget !== lastHoveredTarget) {\n this.dispatchToElement(lastHovered, 'mouseout', event);\n }\n\n // Mouse moving on one element\n this.dispatchToElement(hovered, 'mousemove', event);\n\n // Mouse over on a new element\n if (hoveredTarget && hoveredTarget !== lastHoveredTarget) {\n this.dispatchToElement(hovered, 'mouseover', event);\n }\n }\n\n mouseout(event: ZRRawEvent) {\n const eventControl = event.zrEventControl;\n\n if (eventControl !== 'only_globalout') {\n this.dispatchToElement(this._hovered, 'mouseout', event);\n }\n\n if (eventControl !== 'no_globalout') {\n // FIXME: if the pointer moving from the extra doms to realy \"outside\",\n // the `globalout` should have been triggered. But currently not.\n this.trigger('globalout', {type: 'globalout', event: event});\n }\n }\n\n /**\n * Resize\n */\n resize() {\n this._hovered = new HoveredResult(0, 0);\n }\n\n /**\n * Dispatch event\n */\n dispatch(eventName: HandlerName, eventArgs?: any) {\n const handler = this[eventName];\n handler && handler.call(this, eventArgs);\n }\n\n /**\n * Dispose\n */\n dispose() {\n\n this.proxy.dispose();\n\n this.storage = null;\n this.proxy = null;\n this.painter = null;\n }\n\n /**\n * 设置默认的cursor style\n * @param cursorStyle 例如 crosshair,默认为 'default'\n */\n setCursorStyle(cursorStyle: string) {\n const proxy = this.proxy;\n proxy.setCursor && proxy.setCursor(cursorStyle);\n }\n\n /**\n * 事件分发代理\n *\n * @private\n * @param {Object} targetInfo {target, topTarget} 目标图形元素\n * @param {string} eventName 事件名称\n * @param {Object} event 事件对象\n */\n dispatchToElement(targetInfo: {\n target?: Element\n topTarget?: Element\n }, eventName: ElementEventName, event: ZRRawEvent) {\n\n targetInfo = targetInfo || {};\n\n let el = targetInfo.target as Element;\n if (el && el.silent) {\n return;\n }\n const eventKey = ('on' + eventName) as ElementEventNameWithOn;\n const eventPacket = makeEventPacket(eventName, targetInfo, event);\n\n while (el) {\n el[eventKey]\n && (eventPacket.cancelBubble = !!el[eventKey].call(el, eventPacket));\n\n el.trigger(eventName, eventPacket);\n\n // Bubble to the host if on the textContent.\n // PENDING\n el = el.__hostTarget ? el.__hostTarget : el.parent;\n\n if (eventPacket.cancelBubble) {\n break;\n }\n }\n\n if (!eventPacket.cancelBubble) {\n // 冒泡到顶级 zrender 对象\n this.trigger(eventName, eventPacket);\n // 分发事件到用户自定义层\n // 用户有可能在全局 click 事件中 dispose,所以需要判断下 painter 是否存在\n if (this.painter && (this.painter as CanvasPainter).eachOtherLayer) {\n (this.painter as CanvasPainter).eachOtherLayer(function (layer) {\n if (typeof (layer[eventKey]) === 'function') {\n layer[eventKey].call(layer, eventPacket);\n }\n if (layer.trigger) {\n layer.trigger(eventName, eventPacket);\n }\n });\n }\n }\n }\n\n findHover(x: number, y: number, exclude?: Displayable): HoveredResult {\n const list = this.storage.getDisplayList();\n const out = new HoveredResult(x, y);\n setHoverTarget(list, out, x, y, exclude);\n\n if (this._pointerSize && !out.target) {\n /**\n * If no element at pointer position, check intersection with\n * elements with pointer enlarged by target size.\n */\n const candidates: Displayable[] = [];\n const pointerSize = this._pointerSize;\n const targetSizeHalf = pointerSize / 2;\n const pointerRect = new BoundingRect(x - targetSizeHalf, y - targetSizeHalf, pointerSize, pointerSize);\n\n for (let i = list.length - 1; i >= 0; i--) {\n const el = list[i];\n if (el !== exclude\n && !el.ignore\n && !el.ignoreCoarsePointer\n // If an element ignores, its textContent should also ignore.\n // TSpan's parent is not a Group but a ZRText.\n // See Text.js _getOrCreateChild\n && (!el.parent || !(el.parent as any).ignoreCoarsePointer)\n ) {\n tmpRect.copy(el.getBoundingRect());\n if (el.transform) {\n tmpRect.applyTransform(el.transform);\n }\n if (tmpRect.intersect(pointerRect)) {\n candidates.push(el);\n }\n }\n }\n\n /**\n * If there are elements whose bounding boxes are near the pointer,\n * use the most top one that intersects with the enlarged pointer.\n */\n if (candidates.length) {\n const rStep = 4;\n const thetaStep = Math.PI / 12;\n const PI2 = Math.PI * 2;\n for (let r = 0; r < targetSizeHalf; r += rStep) {\n for (let theta = 0; theta < PI2; theta += thetaStep) {\n const x1 = x + r * Math.cos(theta);\n const y1 = y + r * Math.sin(theta);\n setHoverTarget(candidates, out, x1, y1, exclude);\n if (out.target) {\n return out;\n }\n }\n }\n }\n }\n\n return out;\n }\n\n processGesture(event: ZRRawEvent, stage?: 'start' | 'end' | 'change') {\n if (!this._gestureMgr) {\n this._gestureMgr = new GestureMgr();\n }\n const gestureMgr = this._gestureMgr;\n\n stage === 'start' && gestureMgr.clear();\n\n const gestureInfo = gestureMgr.recognize(\n event as ZRRawTouchEvent,\n this.findHover(event.zrX, event.zrY, null).target,\n (this.proxy as HandlerDomProxy).dom\n );\n\n stage === 'end' && gestureMgr.clear();\n\n // Do not do any preventDefault here. Upper application do that if necessary.\n if (gestureInfo) {\n const type = gestureInfo.type;\n (event as ZRPinchEvent).gestureEvent = type;\n\n let res = new HoveredResult();\n res.target = gestureInfo.target;\n this.dispatchToElement(res, type as ElementEventName, gestureInfo.event as ZRRawEvent);\n }\n }\n\n click: (event: ZRRawEvent) => void\n mousedown: (event: ZRRawEvent) => void\n mouseup: (event: ZRRawEvent) => void\n mousewheel: (event: ZRRawEvent) => void\n dblclick: (event: ZRRawEvent) => void\n contextmenu: (event: ZRRawEvent) => void\n}\n\n// Common handlers\nutil.each(['click', 'mousedown', 'mouseup', 'mousewheel', 'dblclick', 'contextmenu'], function (name: HandlerName) {\n Handler.prototype[name] = function (event) {\n const x = event.zrX;\n const y = event.zrY;\n const isOutside = isOutsideBoundary(this, x, y);\n\n let hovered;\n let hoveredTarget;\n\n if (name !== 'mouseup' || !isOutside) {\n // Find hover again to avoid click event is dispatched manually. Or click is triggered without mouseover\n hovered = this.findHover(x, y);\n hoveredTarget = hovered.target;\n }\n\n if (name === 'mousedown') {\n this._downEl = hoveredTarget;\n this._downPoint = [event.zrX, event.zrY];\n // In case click triggered before mouseup\n this._upEl = hoveredTarget;\n }\n else if (name === 'mouseup') {\n this._upEl = hoveredTarget;\n }\n else if (name === 'click') {\n if (this._downEl !== this._upEl\n // Original click event is triggered on the whole canvas element,\n // including the case that `mousedown` - `mousemove` - `mouseup`,\n // which should be filtered, otherwise it will bring trouble to\n // pan and zoom.\n || !this._downPoint\n // Arbitrary value\n || vec2.dist(this._downPoint, [event.zrX, event.zrY]) > 4\n ) {\n return;\n }\n this._downPoint = null;\n }\n\n this.dispatchToElement(hovered, name, event);\n };\n});\n\nfunction isHover(displayable: Displayable, x: number, y: number) {\n if (displayable[displayable.rectHover ? 'rectContain' : 'contain'](x, y)) {\n let el: Element = displayable;\n let isSilent;\n let ignoreClip = false;\n while (el) {\n // Ignore clip on any ancestors.\n if (el.ignoreClip) {\n ignoreClip = true;\n }\n if (!ignoreClip) {\n let clipPath = el.getClipPath();\n // If clipped by ancestor.\n // FIXME: If clipPath has neither stroke nor fill,\n // el.clipPath.contain(x, y) will always return false.\n if (clipPath && !clipPath.contain(x, y)) {\n return false;\n }\n }\n if (el.silent) {\n isSilent = true;\n }\n // Consider when el is textContent, also need to be silent\n // if any of its host el and its ancestors is silent.\n const hostEl = el.__hostTarget;\n el = hostEl ? hostEl : el.parent;\n }\n return isSilent ? SILENT : true;\n }\n\n return false;\n}\n\nfunction setHoverTarget(\n list: Displayable[],\n out: HoveredResult,\n x: number,\n y: number,\n exclude: Displayable\n) {\n for (let i = list.length - 1; i >= 0; i--) {\n const el = list[i];\n let hoverCheckResult;\n if (el !== exclude\n // getDisplayList may include ignored item in VML mode\n && !el.ignore\n && (hoverCheckResult = isHover(el, x, y))\n ) {\n !out.topTarget && (out.topTarget = el);\n if (hoverCheckResult !== SILENT) {\n out.target = el;\n break;\n }\n }\n }\n}\n\n/**\n * See [DRAG_OUTSIDE].\n */\nfunction isOutsideBoundary(handlerInstance: Handler, x: number, y: number) {\n const painter = handlerInstance.painter;\n return x < 0 || x > painter.getWidth() || y < 0 || y > painter.getHeight();\n}\n\nexport default Handler;\n","// https://github.com/mziccard/node-timsort\nconst DEFAULT_MIN_MERGE = 32;\n\nconst DEFAULT_MIN_GALLOPING = 7;\n\ntype CompareFunc =(a: T, b: T) => number\n\nfunction minRunLength(n: number): number {\n var r = 0;\n\n while (n >= DEFAULT_MIN_MERGE) {\n r |= n & 1;\n n >>= 1;\n }\n\n return n + r;\n}\n\nfunction makeAscendingRun(array: T[], lo: number, hi: number, compare: CompareFunc) {\n var runHi = lo + 1;\n\n if (runHi === hi) {\n return 1;\n }\n\n if (compare(array[runHi++], array[lo]) < 0) {\n while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) {\n runHi++;\n }\n\n reverseRun(array, lo, runHi);\n }\n else {\n while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) {\n runHi++;\n }\n }\n\n return runHi - lo;\n}\n\nfunction reverseRun(array: T[], lo: number, hi: number) {\n hi--;\n\n while (lo < hi) {\n var t = array[lo];\n array[lo++] = array[hi];\n array[hi--] = t;\n }\n}\n\nfunction binaryInsertionSort(array: T[], lo: number, hi: number, start: number, compare: CompareFunc) {\n if (start === lo) {\n start++;\n }\n\n for (; start < hi; start++) {\n var pivot = array[start];\n\n var left = lo;\n var right = start;\n var mid;\n\n while (left < right) {\n mid = left + right >>> 1;\n\n if (compare(pivot, array[mid]) < 0) {\n right = mid;\n }\n else {\n left = mid + 1;\n }\n }\n\n var n = start - left;\n\n switch (n) {\n case 3:\n array[left + 3] = array[left + 2];\n\n case 2:\n array[left + 2] = array[left + 1];\n\n case 1:\n array[left + 1] = array[left];\n break;\n default:\n while (n > 0) {\n array[left + n] = array[left + n - 1];\n n--;\n }\n }\n\n array[left] = pivot;\n }\n}\n\nfunction gallopLeft(value: T, array: T[], start: number, length: number, hint: number, compare: CompareFunc) {\n var lastOffset = 0;\n var maxOffset = 0;\n var offset = 1;\n\n if (compare(value, array[start + hint]) > 0) {\n maxOffset = length - hint;\n\n while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n lastOffset += hint;\n offset += hint;\n }\n else {\n maxOffset = hint + 1;\n while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n var tmp = lastOffset;\n lastOffset = hint - offset;\n offset = hint - tmp;\n }\n\n lastOffset++;\n while (lastOffset < offset) {\n var m = lastOffset + (offset - lastOffset >>> 1);\n\n if (compare(value, array[start + m]) > 0) {\n lastOffset = m + 1;\n }\n else {\n offset = m;\n }\n }\n return offset;\n}\n\nfunction gallopRight(value: T, array: T[], start: number, length: number, hint: number, compare: CompareFunc) {\n var lastOffset = 0;\n var maxOffset = 0;\n var offset = 1;\n\n if (compare(value, array[start + hint]) < 0) {\n maxOffset = hint + 1;\n\n while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n var tmp = lastOffset;\n lastOffset = hint - offset;\n offset = hint - tmp;\n }\n else {\n maxOffset = length - hint;\n\n while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {\n lastOffset = offset;\n offset = (offset << 1) + 1;\n\n if (offset <= 0) {\n offset = maxOffset;\n }\n }\n\n if (offset > maxOffset) {\n offset = maxOffset;\n }\n\n lastOffset += hint;\n offset += hint;\n }\n\n lastOffset++;\n\n while (lastOffset < offset) {\n var m = lastOffset + (offset - lastOffset >>> 1);\n\n if (compare(value, array[start + m]) < 0) {\n offset = m;\n }\n else {\n lastOffset = m + 1;\n }\n }\n\n return offset;\n}\n\nfunction TimSort(array: T[], compare: CompareFunc) {\n let minGallop = DEFAULT_MIN_GALLOPING;\n let runStart: number[];\n let runLength: number[];\n let stackSize = 0;\n\n var tmp: T[] = [];\n\n runStart = [];\n runLength = [];\n\n function pushRun(_runStart: number, _runLength: number) {\n runStart[stackSize] = _runStart;\n runLength[stackSize] = _runLength;\n stackSize += 1;\n }\n\n function mergeRuns() {\n while (stackSize > 1) {\n var n = stackSize - 2;\n\n if (\n (n >= 1 && runLength[n - 1] <= runLength[n] + runLength[n + 1])\n || (n >= 2 && runLength[n - 2] <= runLength[n] + runLength[n - 1])\n ) {\n if (runLength[n - 1] < runLength[n + 1]) {\n n--;\n }\n }\n else if (runLength[n] > runLength[n + 1]) {\n break;\n }\n mergeAt(n);\n }\n }\n\n function forceMergeRuns() {\n while (stackSize > 1) {\n var n = stackSize - 2;\n\n if (n > 0 && runLength[n - 1] < runLength[n + 1]) {\n n--;\n }\n\n mergeAt(n);\n }\n }\n\n function mergeAt(i: number) {\n var start1 = runStart[i];\n var length1 = runLength[i];\n var start2 = runStart[i + 1];\n var length2 = runLength[i + 1];\n\n runLength[i] = length1 + length2;\n\n if (i === stackSize - 3) {\n runStart[i + 1] = runStart[i + 2];\n runLength[i + 1] = runLength[i + 2];\n }\n\n stackSize--;\n\n var k = gallopRight(array[start2], array, start1, length1, 0, compare);\n start1 += k;\n length1 -= k;\n\n if (length1 === 0) {\n return;\n }\n\n length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);\n\n if (length2 === 0) {\n return;\n }\n\n if (length1 <= length2) {\n mergeLow(start1, length1, start2, length2);\n }\n else {\n mergeHigh(start1, length1, start2, length2);\n }\n }\n\n function mergeLow(start1: number, length1: number, start2: number, length2: number) {\n var i = 0;\n\n for (i = 0; i < length1; i++) {\n tmp[i] = array[start1 + i];\n }\n\n var cursor1 = 0;\n var cursor2 = start2;\n var dest = start1;\n\n array[dest++] = array[cursor2++];\n\n if (--length2 === 0) {\n for (i = 0; i < length1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n return;\n }\n\n if (length1 === 1) {\n for (i = 0; i < length2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n array[dest + length2] = tmp[cursor1];\n return;\n }\n\n var _minGallop = minGallop;\n var count1;\n var count2;\n var exit;\n\n while (1) {\n count1 = 0;\n count2 = 0;\n exit = false;\n\n do {\n if (compare(array[cursor2], tmp[cursor1]) < 0) {\n array[dest++] = array[cursor2++];\n count2++;\n count1 = 0;\n\n if (--length2 === 0) {\n exit = true;\n break;\n }\n }\n else {\n array[dest++] = tmp[cursor1++];\n count1++;\n count2 = 0;\n if (--length1 === 1) {\n exit = true;\n break;\n }\n }\n } while ((count1 | count2) < _minGallop);\n\n if (exit) {\n break;\n }\n\n do {\n count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);\n\n if (count1 !== 0) {\n for (i = 0; i < count1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n\n dest += count1;\n cursor1 += count1;\n length1 -= count1;\n if (length1 <= 1) {\n exit = true;\n break;\n }\n }\n\n array[dest++] = array[cursor2++];\n\n if (--length2 === 0) {\n exit = true;\n break;\n }\n\n count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);\n\n if (count2 !== 0) {\n for (i = 0; i < count2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n\n dest += count2;\n cursor2 += count2;\n length2 -= count2;\n\n if (length2 === 0) {\n exit = true;\n break;\n }\n }\n array[dest++] = tmp[cursor1++];\n\n if (--length1 === 1) {\n exit = true;\n break;\n }\n\n _minGallop--;\n } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);\n\n if (exit) {\n break;\n }\n\n if (_minGallop < 0) {\n _minGallop = 0;\n }\n\n _minGallop += 2;\n }\n\n minGallop = _minGallop;\n\n minGallop < 1 && (minGallop = 1);\n\n if (length1 === 1) {\n for (i = 0; i < length2; i++) {\n array[dest + i] = array[cursor2 + i];\n }\n array[dest + length2] = tmp[cursor1];\n }\n else if (length1 === 0) {\n throw new Error();\n }\n else {\n for (i = 0; i < length1; i++) {\n array[dest + i] = tmp[cursor1 + i];\n }\n }\n }\n\n function mergeHigh(start1: number, length1: number, start2: number, length2: number) {\n var i = 0;\n\n for (i = 0; i < length2; i++) {\n tmp[i] = array[start2 + i];\n }\n\n var cursor1 = start1 + length1 - 1;\n var cursor2 = length2 - 1;\n var dest = start2 + length2 - 1;\n var customCursor = 0;\n var customDest = 0;\n\n array[dest--] = array[cursor1--];\n\n if (--length1 === 0) {\n customCursor = dest - (length2 - 1);\n\n for (i = 0; i < length2; i++) {\n array[customCursor + i] = tmp[i];\n }\n\n return;\n }\n\n if (length2 === 1) {\n dest -= length1;\n cursor1 -= length1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = length1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n array[dest] = tmp[cursor2];\n return;\n }\n\n var _minGallop = minGallop;\n\n while (true) {\n var count1 = 0;\n var count2 = 0;\n var exit = false;\n\n do {\n if (compare(tmp[cursor2], array[cursor1]) < 0) {\n array[dest--] = array[cursor1--];\n count1++;\n count2 = 0;\n if (--length1 === 0) {\n exit = true;\n break;\n }\n }\n else {\n array[dest--] = tmp[cursor2--];\n count2++;\n count1 = 0;\n if (--length2 === 1) {\n exit = true;\n break;\n }\n }\n } while ((count1 | count2) < _minGallop);\n\n if (exit) {\n break;\n }\n\n do {\n count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);\n\n if (count1 !== 0) {\n dest -= count1;\n cursor1 -= count1;\n length1 -= count1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = count1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n if (length1 === 0) {\n exit = true;\n break;\n }\n }\n\n array[dest--] = tmp[cursor2--];\n\n if (--length2 === 1) {\n exit = true;\n break;\n }\n\n count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);\n\n if (count2 !== 0) {\n dest -= count2;\n cursor2 -= count2;\n length2 -= count2;\n customDest = dest + 1;\n customCursor = cursor2 + 1;\n\n for (i = 0; i < count2; i++) {\n array[customDest + i] = tmp[customCursor + i];\n }\n\n if (length2 <= 1) {\n exit = true;\n break;\n }\n }\n\n array[dest--] = array[cursor1--];\n\n if (--length1 === 0) {\n exit = true;\n break;\n }\n\n _minGallop--;\n } while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);\n\n if (exit) {\n break;\n }\n\n if (_minGallop < 0) {\n _minGallop = 0;\n }\n\n _minGallop += 2;\n }\n\n minGallop = _minGallop;\n\n if (minGallop < 1) {\n minGallop = 1;\n }\n\n if (length2 === 1) {\n dest -= length1;\n cursor1 -= length1;\n customDest = dest + 1;\n customCursor = cursor1 + 1;\n\n for (i = length1 - 1; i >= 0; i--) {\n array[customDest + i] = array[customCursor + i];\n }\n\n array[dest] = tmp[cursor2];\n }\n else if (length2 === 0) {\n throw new Error();\n // throw new Error('mergeHigh preconditions were not respected');\n }\n else {\n customCursor = dest - (length2 - 1);\n for (i = 0; i < length2; i++) {\n array[customCursor + i] = tmp[i];\n }\n }\n }\n\n return {\n mergeRuns,\n forceMergeRuns,\n pushRun\n };\n}\n\nexport default function sort(\n array: T[],\n compare: CompareFunc,\n lo?: number, hi?: number\n) {\n if (!lo) {\n lo = 0;\n }\n if (!hi) {\n hi = array.length;\n }\n\n var remaining = hi - lo;\n\n if (remaining < 2) {\n return;\n }\n\n var runLength = 0;\n\n if (remaining < DEFAULT_MIN_MERGE) {\n runLength = makeAscendingRun(array, lo, hi, compare);\n binaryInsertionSort(array, lo, hi, lo + runLength, compare);\n return;\n }\n\n var ts = TimSort(array, compare);\n\n var minRun = minRunLength(remaining);\n\n do {\n runLength = makeAscendingRun(array, lo, hi, compare);\n if (runLength < minRun) {\n var force = remaining;\n if (force > minRun) {\n force = minRun;\n }\n\n binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);\n runLength = force;\n }\n\n ts.pushRun(lo, runLength);\n ts.mergeRuns();\n\n remaining -= runLength;\n lo += runLength;\n } while (remaining !== 0);\n\n ts.forceMergeRuns();\n}\n","// Bit masks to check which parts of element needs to be updated.\r\nexport const REDRAW_BIT = 1;\r\nexport const STYLE_CHANGED_BIT = 2;\r\nexport const SHAPE_CHANGED_BIT = 4;\r\n","import * as util from './core/util';\r\nimport Group, { GroupLike } from './graphic/Group';\r\nimport Element from './Element';\r\n\r\n// Use timsort because in most case elements are partially sorted\r\n// https://jsfiddle.net/pissang/jr4x7mdm/8/\r\nimport timsort from './core/timsort';\r\nimport Displayable from './graphic/Displayable';\r\nimport Path from './graphic/Path';\r\nimport { REDRAW_BIT } from './graphic/constants';\r\n\r\nlet invalidZErrorLogged = false;\r\nfunction logInvalidZError() {\r\n if (invalidZErrorLogged) {\r\n return;\r\n }\r\n invalidZErrorLogged = true;\r\n console.warn('z / z2 / zlevel of displayable is invalid, which may cause unexpected errors');\r\n}\r\n\r\nfunction shapeCompareFunc(a: Displayable, b: Displayable) {\r\n if (a.zlevel === b.zlevel) {\r\n if (a.z === b.z) {\r\n return a.z2 - b.z2;\r\n }\r\n return a.z - b.z;\r\n }\r\n return a.zlevel - b.zlevel;\r\n}\r\n\r\nexport default class Storage {\r\n\r\n private _roots: Element[] = []\r\n\r\n private _displayList: Displayable[] = []\r\n\r\n private _displayListLen = 0\r\n\r\n traverse(\r\n cb: (this: T, el: Element) => void,\r\n context?: T\r\n ) {\r\n for (let i = 0; i < this._roots.length; i++) {\r\n this._roots[i].traverse(cb, context);\r\n }\r\n }\r\n\r\n /**\r\n * get a list of elements to be rendered\r\n *\r\n * @param {boolean} update whether to update elements before return\r\n * @param {DisplayParams} params options\r\n * @return {Displayable[]} a list of elements\r\n */\r\n getDisplayList(update?: boolean, includeIgnore?: boolean): Displayable[] {\r\n includeIgnore = includeIgnore || false;\r\n const displayList = this._displayList;\r\n // If displaylist is not created yet. Update force\r\n if (update || !displayList.length) {\r\n this.updateDisplayList(includeIgnore);\r\n }\r\n return displayList;\r\n }\r\n\r\n /**\r\n * 更新图形的绘制队列。\r\n * 每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,\r\n * 最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列\r\n */\r\n updateDisplayList(includeIgnore?: boolean) {\r\n this._displayListLen = 0;\r\n\r\n const roots = this._roots;\r\n const displayList = this._displayList;\r\n for (let i = 0, len = roots.length; i < len; i++) {\r\n this._updateAndAddDisplayable(roots[i], null, includeIgnore);\r\n }\r\n\r\n displayList.length = this._displayListLen;\r\n\r\n timsort(displayList, shapeCompareFunc);\r\n }\r\n\r\n private _updateAndAddDisplayable(\r\n el: Element,\r\n clipPaths: Path[],\r\n includeIgnore?: boolean\r\n ) {\r\n if (el.ignore && !includeIgnore) {\r\n return;\r\n }\r\n\r\n el.beforeUpdate();\r\n el.update();\r\n el.afterUpdate();\r\n\r\n const userSetClipPath = el.getClipPath();\r\n\r\n if (el.ignoreClip) {\r\n clipPaths = null;\r\n }\r\n else if (userSetClipPath) {\r\n\r\n // FIXME 效率影响\r\n if (clipPaths) {\r\n clipPaths = clipPaths.slice();\r\n }\r\n else {\r\n clipPaths = [];\r\n }\r\n\r\n let currentClipPath = userSetClipPath;\r\n let parentClipPath = el;\r\n // Recursively add clip path\r\n while (currentClipPath) {\r\n // clipPath 的变换是基于使用这个 clipPath 的元素\r\n // TODO: parent should be group type.\r\n currentClipPath.parent = parentClipPath as Group;\r\n currentClipPath.updateTransform();\r\n\r\n clipPaths.push(currentClipPath);\r\n\r\n parentClipPath = currentClipPath;\r\n currentClipPath = currentClipPath.getClipPath();\r\n }\r\n }\r\n\r\n // ZRText and Group and combining morphing Path may use children\r\n if ((el as GroupLike).childrenRef) {\r\n const children = (el as GroupLike).childrenRef();\r\n\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n\r\n // Force to mark as dirty if group is dirty\r\n if (el.__dirty) {\r\n child.__dirty |= REDRAW_BIT;\r\n }\r\n\r\n this._updateAndAddDisplayable(child, clipPaths, includeIgnore);\r\n }\r\n\r\n // Mark group clean here\r\n el.__dirty = 0;\r\n\r\n }\r\n else {\r\n const disp = el as Displayable;\r\n // Element is displayable\r\n if (clipPaths && clipPaths.length) {\r\n disp.__clipPaths = clipPaths;\r\n }\r\n else if (disp.__clipPaths && disp.__clipPaths.length > 0) {\r\n disp.__clipPaths = [];\r\n }\r\n\r\n // Avoid invalid z, z2, zlevel cause sorting error.\r\n if (isNaN(disp.z)) {\r\n logInvalidZError();\r\n disp.z = 0;\r\n }\r\n if (isNaN(disp.z2)) {\r\n logInvalidZError();\r\n disp.z2 = 0;\r\n }\r\n if (isNaN(disp.zlevel)) {\r\n logInvalidZError();\r\n disp.zlevel = 0;\r\n }\r\n\r\n this._displayList[this._displayListLen++] = disp;\r\n }\r\n\r\n // Add decal\r\n const decalEl = (el as Path).getDecalElement && (el as Path).getDecalElement();\r\n if (decalEl) {\r\n this._updateAndAddDisplayable(decalEl, clipPaths, includeIgnore);\r\n }\r\n\r\n // Add attached text element and guide line.\r\n const textGuide = el.getTextGuideLine();\r\n if (textGuide) {\r\n this._updateAndAddDisplayable(textGuide, clipPaths, includeIgnore);\r\n }\r\n\r\n const textEl = el.getTextContent();\r\n if (textEl) {\r\n this._updateAndAddDisplayable(textEl, clipPaths, includeIgnore);\r\n }\r\n }\r\n\r\n /**\r\n * 添加图形(Displayable)或者组(Group)到根节点\r\n */\r\n addRoot(el: Element) {\r\n if (el.__zr && el.__zr.storage === this) {\r\n return;\r\n }\r\n\r\n this._roots.push(el);\r\n }\r\n\r\n /**\r\n * 删除指定的图形(Displayable)或者组(Group)\r\n * @param el\r\n */\r\n delRoot(el: Element | Element[]) {\r\n\r\n if (el instanceof Array) {\r\n for (let i = 0, l = el.length; i < l; i++) {\r\n this.delRoot(el[i]);\r\n }\r\n return;\r\n }\r\n\r\n const idx = util.indexOf(this._roots, el);\r\n if (idx >= 0) {\r\n this._roots.splice(idx, 1);\r\n }\r\n }\r\n\r\n delAllRoots() {\r\n this._roots = [];\r\n this._displayList = [];\r\n this._displayListLen = 0;\r\n\r\n return;\r\n }\r\n\r\n getRoots() {\r\n return this._roots;\r\n }\r\n\r\n /**\r\n * 清空并且释放Storage\r\n */\r\n dispose() {\r\n this._displayList = null;\r\n this._roots = null;\r\n }\r\n\r\n displayableSortFunc = shapeCompareFunc\r\n}","import env from '../core/env';\r\n\r\ntype RequestAnimationFrameType = typeof window.requestAnimationFrame\r\n\r\nlet requestAnimationFrame: RequestAnimationFrameType;\r\n\r\nrequestAnimationFrame = (\r\n\tenv.hasGlobalWindow\r\n\t\t&& (\r\n\t\t\t(window.requestAnimationFrame && window.requestAnimationFrame.bind(window))\r\n\t\t\t// https://github.com/ecomfe/zrender/issues/189#issuecomment-224919809\r\n\t\t\t|| ((window as any).msRequestAnimationFrame && (window as any).msRequestAnimationFrame.bind(window))\r\n\t\t\t|| (window as any).mozRequestAnimationFrame\r\n\t\t\t// @ts-ignore\r\n\t\t\t|| window.webkitRequestAnimationFrame\r\n\t\t)\r\n) || function (func: Parameters[0]): number {\r\n\treturn setTimeout(func, 16) as any;\r\n};\r\n\r\nexport default requestAnimationFrame;\r\n","/**\r\n * 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js\r\n * @see http://sole.github.io/tween.js/examples/03_graphs.html\r\n * @exports zrender/animation/easing\r\n */\r\n\r\ntype easingFunc = (percent: number) => number;\r\n\r\nexport type AnimationEasing = keyof typeof easingFuncs | easingFunc;\r\n\r\nconst easingFuncs = {\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n linear(k: number) {\r\n return k;\r\n },\r\n\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticIn(k: number) {\r\n return k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticOut(k: number) {\r\n return k * (2 - k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quadraticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k;\r\n }\r\n return -0.5 * (--k * (k - 2) - 1);\r\n },\r\n\r\n // 三次方的缓动(t^3)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicIn(k: number) {\r\n return k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicOut(k: number) {\r\n return --k * k * k + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n cubicInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k;\r\n }\r\n return 0.5 * ((k -= 2) * k * k + 2);\r\n },\r\n\r\n // 四次方的缓动(t^4)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticIn(k: number) {\r\n return k * k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticOut(k: number) {\r\n return 1 - (--k * k * k * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quarticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k * k;\r\n }\r\n return -0.5 * ((k -= 2) * k * k * k - 2);\r\n },\r\n\r\n // 五次方的缓动(t^5)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticIn(k: number) {\r\n return k * k * k * k * k;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticOut(k: number) {\r\n return --k * k * k * k * k + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n quinticInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return 0.5 * k * k * k * k * k;\r\n }\r\n return 0.5 * ((k -= 2) * k * k * k * k + 2);\r\n },\r\n\r\n // 正弦曲线的缓动(sin(t))\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalIn(k: number) {\r\n return 1 - Math.cos(k * Math.PI / 2);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalOut(k: number) {\r\n return Math.sin(k * Math.PI / 2);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n sinusoidalInOut(k: number) {\r\n return 0.5 * (1 - Math.cos(Math.PI * k));\r\n },\r\n\r\n // 指数曲线的缓动(2^t)\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialIn(k: number) {\r\n return k === 0 ? 0 : Math.pow(1024, k - 1);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialOut(k: number) {\r\n return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n exponentialInOut(k: number) {\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if ((k *= 2) < 1) {\r\n return 0.5 * Math.pow(1024, k - 1);\r\n }\r\n return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);\r\n },\r\n\r\n // 圆形曲线的缓动(sqrt(1-t^2))\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularIn(k: number) {\r\n return 1 - Math.sqrt(1 - k * k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularOut(k: number) {\r\n return Math.sqrt(1 - (--k * k));\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n circularInOut(k: number) {\r\n if ((k *= 2) < 1) {\r\n return -0.5 * (Math.sqrt(1 - k * k) - 1);\r\n }\r\n return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);\r\n },\r\n\r\n // 创建类似于弹簧在停止前来回振荡的动画\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticIn(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n return -(a * Math.pow(2, 10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p));\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticOut(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n return (a * Math.pow(2, -10 * k)\r\n * Math.sin((k - s) * (2 * Math.PI) / p) + 1);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n elasticInOut(k: number) {\r\n let s;\r\n let a = 0.1;\r\n let p = 0.4;\r\n if (k === 0) {\r\n return 0;\r\n }\r\n if (k === 1) {\r\n return 1;\r\n }\r\n if (!a || a < 1) {\r\n a = 1;\r\n s = p / 4;\r\n }\r\n else {\r\n s = p * Math.asin(1 / a) / (2 * Math.PI);\r\n }\r\n if ((k *= 2) < 1) {\r\n return -0.5 * (a * Math.pow(2, 10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p));\r\n }\r\n return a * Math.pow(2, -10 * (k -= 1))\r\n * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;\r\n\r\n },\r\n\r\n // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backIn(k: number) {\r\n let s = 1.70158;\r\n return k * k * ((s + 1) * k - s);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backOut(k: number) {\r\n let s = 1.70158;\r\n return --k * k * ((s + 1) * k + s) + 1;\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n backInOut(k: number) {\r\n let s = 1.70158 * 1.525;\r\n if ((k *= 2) < 1) {\r\n return 0.5 * (k * k * ((s + 1) * k - s));\r\n }\r\n return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);\r\n },\r\n\r\n // 创建弹跳效果\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceIn(k: number) {\r\n return 1 - easingFuncs.bounceOut(1 - k);\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceOut(k: number) {\r\n if (k < (1 / 2.75)) {\r\n return 7.5625 * k * k;\r\n }\r\n else if (k < (2 / 2.75)) {\r\n return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;\r\n }\r\n else if (k < (2.5 / 2.75)) {\r\n return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;\r\n }\r\n else {\r\n return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;\r\n }\r\n },\r\n /**\r\n * @param {number} k\r\n * @return {number}\r\n */\r\n bounceInOut(k: number) {\r\n if (k < 0.5) {\r\n return easingFuncs.bounceIn(k * 2) * 0.5;\r\n }\r\n return easingFuncs.bounceOut(k * 2 - 1) * 0.5 + 0.5;\r\n }\r\n};\r\n\r\n\r\nexport default easingFuncs;","/**\r\n * 曲线辅助模块\r\n */\r\n\r\nimport {\r\n create as v2Create,\r\n distSquare as v2DistSquare,\r\n VectorArray\r\n} from './vector';\r\n\r\nconst mathPow = Math.pow;\r\nconst mathSqrt = Math.sqrt;\r\n\r\nconst EPSILON = 1e-8;\r\nconst EPSILON_NUMERIC = 1e-4;\r\n\r\nconst THREE_SQRT = mathSqrt(3);\r\nconst ONE_THIRD = 1 / 3;\r\n\r\n// 临时变量\r\nconst _v0 = v2Create();\r\nconst _v1 = v2Create();\r\nconst _v2 = v2Create();\r\n\r\nfunction isAroundZero(val: number) {\r\n return val > -EPSILON && val < EPSILON;\r\n}\r\nfunction isNotAroundZero(val: number) {\r\n return val > EPSILON || val < -EPSILON;\r\n}\r\n/**\r\n * 计算三次贝塞尔值\r\n */\r\nexport function cubicAt(p0: number, p1: number, p2: number, p3: number, t: number): number {\r\n const onet = 1 - t;\r\n return onet * onet * (onet * p0 + 3 * t * p1)\r\n + t * t * (t * p3 + 3 * onet * p2);\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔导数值\r\n */\r\nexport function cubicDerivativeAt(p0: number, p1: number, p2: number, p3: number, t: number): number {\r\n const onet = 1 - t;\r\n return 3 * (\r\n ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet\r\n + (p3 - p2) * t * t\r\n );\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔方程根,使用盛金公式\r\n */\r\nexport function cubicRootAt(p0: number, p1: number, p2: number, p3: number, val: number, roots: number[]): number {\r\n // Evaluate roots of cubic functions\r\n const a = p3 + 3 * (p1 - p2) - p0;\r\n const b = 3 * (p2 - p1 * 2 + p0);\r\n const c = 3 * (p1 - p0);\r\n const d = p0 - val;\r\n\r\n const A = b * b - 3 * a * c;\r\n const B = b * c - 9 * a * d;\r\n const C = c * c - 3 * b * d;\r\n\r\n let n = 0;\r\n\r\n if (isAroundZero(A) && isAroundZero(B)) {\r\n if (isAroundZero(b)) {\r\n roots[0] = 0;\r\n }\r\n else {\r\n const t1 = -c / b; //t1, t2, t3, b is not zero\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = B * B - 4 * A * C;\r\n\r\n if (isAroundZero(disc)) {\r\n const K = B / A;\r\n const t1 = -b / a + K; // t1, a is not zero\r\n const t2 = -K / 2; // t2, t3\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n let Y1 = A * b + 1.5 * a * (-B + discSqrt);\r\n let Y2 = A * b + 1.5 * a * (-B - discSqrt);\r\n if (Y1 < 0) {\r\n Y1 = -mathPow(-Y1, ONE_THIRD);\r\n }\r\n else {\r\n Y1 = mathPow(Y1, ONE_THIRD);\r\n }\r\n if (Y2 < 0) {\r\n Y2 = -mathPow(-Y2, ONE_THIRD);\r\n }\r\n else {\r\n Y2 = mathPow(Y2, ONE_THIRD);\r\n }\r\n const t1 = (-b - (Y1 + Y2)) / (3 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n else {\r\n const T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));\r\n const theta = Math.acos(T) / 3;\r\n const ASqrt = mathSqrt(A);\r\n const tmp = Math.cos(theta);\r\n\r\n const t1 = (-b - 2 * ASqrt * tmp) / (3 * a);\r\n const t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);\r\n const t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n if (t3 >= 0 && t3 <= 1) {\r\n roots[n++] = t3;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔方程极限值的位置\r\n * @return 有效数目\r\n */\r\nexport function cubicExtrema(p0: number, p1: number, p2: number, p3: number, extrema: number[]): number {\r\n const b = 6 * p2 - 12 * p1 + 6 * p0;\r\n const a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;\r\n const c = 3 * p1 - 3 * p0;\r\n\r\n let n = 0;\r\n if (isAroundZero(a)) {\r\n if (isNotAroundZero(b)) {\r\n const t1 = -c / b;\r\n if (t1 >= 0 && t1 <= 1) {\r\n extrema[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = b * b - 4 * a * c;\r\n if (isAroundZero(disc)) {\r\n extrema[0] = -b / (2 * a);\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n const t1 = (-b + discSqrt) / (2 * a);\r\n const t2 = (-b - discSqrt) / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n extrema[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n extrema[n++] = t2;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 细分三次贝塞尔曲线\r\n */\r\nexport function cubicSubdivide(p0: number, p1: number, p2: number, p3: number, t: number, out: number[]) {\r\n const p01 = (p1 - p0) * t + p0;\r\n const p12 = (p2 - p1) * t + p1;\r\n const p23 = (p3 - p2) * t + p2;\r\n\r\n const p012 = (p12 - p01) * t + p01;\r\n const p123 = (p23 - p12) * t + p12;\r\n\r\n const p0123 = (p123 - p012) * t + p012;\r\n // Seg0\r\n out[0] = p0;\r\n out[1] = p01;\r\n out[2] = p012;\r\n out[3] = p0123;\r\n // Seg1\r\n out[4] = p0123;\r\n out[5] = p123;\r\n out[6] = p23;\r\n out[7] = p3;\r\n}\r\n\r\n/**\r\n * 投射点到三次贝塞尔曲线上,返回投射距离。\r\n * 投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。\r\n */\r\nexport function cubicProjectPoint(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n x: number, y: number, out: VectorArray\r\n): number {\r\n // http://pomax.github.io/bezierinfo/#projections\r\n let t;\r\n let interval = 0.005;\r\n let d = Infinity;\r\n let prev;\r\n let next;\r\n let d1;\r\n let d2;\r\n\r\n _v0[0] = x;\r\n _v0[1] = y;\r\n\r\n // 先粗略估计一下可能的最小距离的 t 值\r\n // PENDING\r\n for (let _t = 0; _t < 1; _t += 0.05) {\r\n _v1[0] = cubicAt(x0, x1, x2, x3, _t);\r\n _v1[1] = cubicAt(y0, y1, y2, y3, _t);\r\n d1 = v2DistSquare(_v0, _v1);\r\n if (d1 < d) {\r\n t = _t;\r\n d = d1;\r\n }\r\n }\r\n d = Infinity;\r\n\r\n // At most 32 iteration\r\n for (let i = 0; i < 32; i++) {\r\n if (interval < EPSILON_NUMERIC) {\r\n break;\r\n }\r\n prev = t - interval;\r\n next = t + interval;\r\n // t - interval\r\n _v1[0] = cubicAt(x0, x1, x2, x3, prev);\r\n _v1[1] = cubicAt(y0, y1, y2, y3, prev);\r\n\r\n d1 = v2DistSquare(_v1, _v0);\r\n\r\n if (prev >= 0 && d1 < d) {\r\n t = prev;\r\n d = d1;\r\n }\r\n else {\r\n // t + interval\r\n _v2[0] = cubicAt(x0, x1, x2, x3, next);\r\n _v2[1] = cubicAt(y0, y1, y2, y3, next);\r\n d2 = v2DistSquare(_v2, _v0);\r\n\r\n if (next <= 1 && d2 < d) {\r\n t = next;\r\n d = d2;\r\n }\r\n else {\r\n interval *= 0.5;\r\n }\r\n }\r\n }\r\n // t\r\n if (out) {\r\n out[0] = cubicAt(x0, x1, x2, x3, t);\r\n out[1] = cubicAt(y0, y1, y2, y3, t);\r\n }\r\n // console.log(interval, i);\r\n return mathSqrt(d);\r\n}\r\n\r\n/**\r\n * 计算三次贝塞尔曲线长度\r\n */\r\nexport function cubicLength(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n iteration: number\r\n) {\r\n let px = x0;\r\n let py = y0;\r\n\r\n let d = 0;\r\n\r\n const step = 1 / iteration;\r\n\r\n for (let i = 1; i <= iteration; i++) {\r\n let t = i * step;\r\n const x = cubicAt(x0, x1, x2, x3, t);\r\n const y = cubicAt(y0, y1, y2, y3, t);\r\n\r\n const dx = x - px;\r\n const dy = y - py;\r\n\r\n d += Math.sqrt(dx * dx + dy * dy);\r\n\r\n px = x;\r\n py = y;\r\n }\r\n\r\n return d;\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔值\r\n */\r\nexport function quadraticAt(p0: number, p1: number, p2: number, t: number): number {\r\n const onet = 1 - t;\r\n return onet * (onet * p0 + 2 * t * p1) + t * t * p2;\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔导数值\r\n */\r\nexport function quadraticDerivativeAt(p0: number, p1: number, p2: number, t: number): number {\r\n return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));\r\n}\r\n\r\n/**\r\n * 计算二次方贝塞尔方程根\r\n * @return 有效根数目\r\n */\r\nexport function quadraticRootAt(p0: number, p1: number, p2: number, val: number, roots: number[]): number {\r\n const a = p0 - 2 * p1 + p2;\r\n const b = 2 * (p1 - p0);\r\n const c = p0 - val;\r\n\r\n let n = 0;\r\n if (isAroundZero(a)) {\r\n if (isNotAroundZero(b)) {\r\n const t1 = -c / b;\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n }\r\n else {\r\n const disc = b * b - 4 * a * c;\r\n if (isAroundZero(disc)) {\r\n const t1 = -b / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n }\r\n else if (disc > 0) {\r\n const discSqrt = mathSqrt(disc);\r\n const t1 = (-b + discSqrt) / (2 * a);\r\n const t2 = (-b - discSqrt) / (2 * a);\r\n if (t1 >= 0 && t1 <= 1) {\r\n roots[n++] = t1;\r\n }\r\n if (t2 >= 0 && t2 <= 1) {\r\n roots[n++] = t2;\r\n }\r\n }\r\n }\r\n return n;\r\n}\r\n\r\n/**\r\n * 计算二次贝塞尔方程极限值\r\n */\r\nexport function quadraticExtremum(p0: number, p1: number, p2: number): number {\r\n const divider = p0 + p2 - 2 * p1;\r\n if (divider === 0) {\r\n // p1 is center of p0 and p2\r\n return 0.5;\r\n }\r\n else {\r\n return (p0 - p1) / divider;\r\n }\r\n}\r\n\r\n/**\r\n * 细分二次贝塞尔曲线\r\n */\r\nexport function quadraticSubdivide(p0: number, p1: number, p2: number, t: number, out: number[]) {\r\n const p01 = (p1 - p0) * t + p0;\r\n const p12 = (p2 - p1) * t + p1;\r\n const p012 = (p12 - p01) * t + p01;\r\n\r\n // Seg0\r\n out[0] = p0;\r\n out[1] = p01;\r\n out[2] = p012;\r\n\r\n // Seg1\r\n out[3] = p012;\r\n out[4] = p12;\r\n out[5] = p2;\r\n}\r\n\r\n/**\r\n * 投射点到二次贝塞尔曲线上,返回投射距离。\r\n * 投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。\r\n * @param {number} x0\r\n * @param {number} y0\r\n * @param {number} x1\r\n * @param {number} y1\r\n * @param {number} x2\r\n * @param {number} y2\r\n * @param {number} x\r\n * @param {number} y\r\n * @param {Array.} out 投射点\r\n * @return {number}\r\n */\r\nexport function quadraticProjectPoint(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n x: number, y: number, out: VectorArray\r\n): number {\r\n // http://pomax.github.io/bezierinfo/#projections\r\n let t: number;\r\n let interval = 0.005;\r\n let d = Infinity;\r\n\r\n _v0[0] = x;\r\n _v0[1] = y;\r\n\r\n // 先粗略估计一下可能的最小距离的 t 值\r\n // PENDING\r\n for (let _t = 0; _t < 1; _t += 0.05) {\r\n _v1[0] = quadraticAt(x0, x1, x2, _t);\r\n _v1[1] = quadraticAt(y0, y1, y2, _t);\r\n const d1 = v2DistSquare(_v0, _v1);\r\n if (d1 < d) {\r\n t = _t;\r\n d = d1;\r\n }\r\n }\r\n d = Infinity;\r\n\r\n // At most 32 iteration\r\n for (let i = 0; i < 32; i++) {\r\n if (interval < EPSILON_NUMERIC) {\r\n break;\r\n }\r\n const prev = t - interval;\r\n const next = t + interval;\r\n // t - interval\r\n _v1[0] = quadraticAt(x0, x1, x2, prev);\r\n _v1[1] = quadraticAt(y0, y1, y2, prev);\r\n\r\n const d1 = v2DistSquare(_v1, _v0);\r\n\r\n if (prev >= 0 && d1 < d) {\r\n t = prev;\r\n d = d1;\r\n }\r\n else {\r\n // t + interval\r\n _v2[0] = quadraticAt(x0, x1, x2, next);\r\n _v2[1] = quadraticAt(y0, y1, y2, next);\r\n const d2 = v2DistSquare(_v2, _v0);\r\n if (next <= 1 && d2 < d) {\r\n t = next;\r\n d = d2;\r\n }\r\n else {\r\n interval *= 0.5;\r\n }\r\n }\r\n }\r\n // t\r\n if (out) {\r\n out[0] = quadraticAt(x0, x1, x2, t);\r\n out[1] = quadraticAt(y0, y1, y2, t);\r\n }\r\n // console.log(interval, i);\r\n return mathSqrt(d);\r\n}\r\n\r\n/**\r\n * 计算二次贝塞尔曲线长度\r\n */\r\nexport function quadraticLength(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n iteration: number\r\n) {\r\n let px = x0;\r\n let py = y0;\r\n\r\n let d = 0;\r\n\r\n const step = 1 / iteration;\r\n\r\n for (let i = 1; i <= iteration; i++) {\r\n let t = i * step;\r\n const x = quadraticAt(x0, x1, x2, t);\r\n const y = quadraticAt(y0, y1, y2, t);\r\n\r\n const dx = x - px;\r\n const dy = y - py;\r\n\r\n d += Math.sqrt(dx * dx + dy * dy);\r\n\r\n px = x;\r\n py = y;\r\n }\r\n\r\n return d;\r\n}\r\n","import { cubicAt, cubicRootAt } from '../core/curve';\r\nimport { trim } from '../core/util';\r\n\r\nconst regexp = /cubic-bezier\\(([0-9,\\.e ]+)\\)/;\r\n\r\nexport function createCubicEasingFunc(cubicEasingStr: string) {\r\n const cubic = cubicEasingStr && regexp.exec(cubicEasingStr);\r\n if (cubic) {\r\n const points = cubic[1].split(',');\r\n const a = +trim(points[0]);\r\n const b = +trim(points[1]);\r\n const c = +trim(points[2]);\r\n const d = +trim(points[3]);\r\n\r\n if (isNaN(a + b + c + d)) {\r\n return;\r\n }\r\n\r\n const roots: number[] = [];\r\n return (p: number) => {\r\n return p <= 0\r\n ? 0 : p >= 1\r\n ? 1\r\n : cubicRootAt(0, a, c, 1, p, roots) && cubicAt(0, b, d, 1, roots[0]);\r\n };\r\n }\r\n}","/**\r\n * 动画主控制器\r\n * @config target 动画对象,可以是数组,如果是数组的话会批量分发onframe等事件\r\n * @config life(1000) 动画时长\r\n * @config delay(0) 动画延迟时间\r\n * @config loop(true)\r\n * @config onframe\r\n * @config easing(optional)\r\n * @config ondestroy(optional)\r\n * @config onrestart(optional)\r\n *\r\n * TODO pause\r\n */\r\n\r\nimport easingFuncs, {AnimationEasing} from './easing';\r\nimport type Animation from './Animation';\r\nimport { isFunction, noop } from '../core/util';\r\nimport { createCubicEasingFunc } from './cubicEasing';\r\n\r\ntype OnframeCallback = (percent: number) => void;\r\ntype ondestroyCallback = () => void\r\ntype onrestartCallback = () => void\r\n\r\nexport type DeferredEventTypes = 'destroy' | 'restart'\r\n// type DeferredEventKeys = 'ondestroy' | 'onrestart'\r\n\r\nexport interface ClipProps {\r\n life?: number\r\n delay?: number\r\n loop?: boolean\r\n easing?: AnimationEasing\r\n\r\n onframe?: OnframeCallback\r\n ondestroy?: ondestroyCallback\r\n onrestart?: onrestartCallback\r\n}\r\n\r\nexport default class Clip {\r\n\r\n private _life: number\r\n private _delay: number\r\n\r\n private _inited: boolean = false\r\n private _startTime = 0 // 开始时间单位毫秒\r\n\r\n private _pausedTime = 0\r\n private _paused = false\r\n\r\n animation: Animation\r\n\r\n loop: boolean\r\n\r\n easing: AnimationEasing\r\n easingFunc: (p: number) => number\r\n\r\n // For linked list. Readonly\r\n next: Clip\r\n prev: Clip\r\n\r\n onframe: OnframeCallback\r\n ondestroy: ondestroyCallback\r\n onrestart: onrestartCallback\r\n\r\n constructor(opts: ClipProps) {\r\n\r\n this._life = opts.life || 1000;\r\n this._delay = opts.delay || 0;\r\n\r\n this.loop = opts.loop || false;\r\n\r\n this.onframe = opts.onframe || noop;\r\n this.ondestroy = opts.ondestroy || noop;\r\n this.onrestart = opts.onrestart || noop;\r\n\r\n opts.easing && this.setEasing(opts.easing);\r\n }\r\n\r\n step(globalTime: number, deltaTime: number): boolean {\r\n // Set startTime on first step, or _startTime may has milleseconds different between clips\r\n // PENDING\r\n if (!this._inited) {\r\n this._startTime = globalTime + this._delay;\r\n this._inited = true;\r\n }\r\n\r\n if (this._paused) {\r\n this._pausedTime += deltaTime;\r\n return;\r\n }\r\n\r\n const life = this._life;\r\n let elapsedTime = globalTime - this._startTime - this._pausedTime;\r\n let percent = elapsedTime / life;\r\n\r\n // PENDING: Not begin yet. Still run the loop.\r\n // In the case callback needs to be invoked.\r\n // Or want to update to the begin state at next frame when `setToFinal` and `delay` are both used.\r\n // To avoid the unexpected blink.\r\n if (percent < 0) {\r\n percent = 0;\r\n }\r\n\r\n percent = Math.min(percent, 1);\r\n\r\n const easingFunc = this.easingFunc;\r\n const schedule = easingFunc ? easingFunc(percent) : percent;\r\n\r\n this.onframe(schedule);\r\n\r\n // 结束\r\n if (percent === 1) {\r\n if (this.loop) {\r\n // Restart\r\n const remainder = elapsedTime % life;\r\n this._startTime = globalTime - remainder;\r\n this._pausedTime = 0;\r\n\r\n this.onrestart();\r\n }\r\n else {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }\r\n\r\n pause() {\r\n this._paused = true;\r\n }\r\n\r\n resume() {\r\n this._paused = false;\r\n }\r\n\r\n setEasing(easing: AnimationEasing) {\r\n this.easing = easing;\r\n this.easingFunc = isFunction(easing)\r\n ? easing\r\n : easingFuncs[easing] || createCubicEasingFunc(easing);\r\n }\r\n}","import { Dictionary } from './types';\r\n\r\n// Simple LRU cache use doubly linked list\r\n// @module zrender/core/LRU\r\n\r\nexport class Entry {\r\n\r\n value: T\r\n\r\n key: string | number\r\n\r\n next: Entry\r\n\r\n prev: Entry\r\n\r\n constructor(val: T) {\r\n this.value = val;\r\n }\r\n}\r\n/**\r\n * Simple double linked list. Compared with array, it has O(1) remove operation.\r\n * @constructor\r\n */\r\nexport class LinkedList {\r\n\r\n head: Entry\r\n tail: Entry\r\n\r\n private _len = 0\r\n\r\n /**\r\n * Insert a new value at the tail\r\n */\r\n insert(val: T): Entry {\r\n const entry = new Entry(val);\r\n this.insertEntry(entry);\r\n return entry;\r\n }\r\n\r\n /**\r\n * Insert an entry at the tail\r\n */\r\n insertEntry(entry: Entry) {\r\n if (!this.head) {\r\n this.head = this.tail = entry;\r\n }\r\n else {\r\n this.tail.next = entry;\r\n entry.prev = this.tail;\r\n entry.next = null;\r\n this.tail = entry;\r\n }\r\n this._len++;\r\n }\r\n\r\n /**\r\n * Remove entry.\r\n */\r\n remove(entry: Entry) {\r\n const prev = entry.prev;\r\n const next = entry.next;\r\n if (prev) {\r\n prev.next = next;\r\n }\r\n else {\r\n // Is head\r\n this.head = next;\r\n }\r\n if (next) {\r\n next.prev = prev;\r\n }\r\n else {\r\n // Is tail\r\n this.tail = prev;\r\n }\r\n entry.next = entry.prev = null;\r\n this._len--;\r\n }\r\n\r\n /**\r\n * Get length\r\n */\r\n len(): number {\r\n return this._len;\r\n }\r\n\r\n /**\r\n * Clear list\r\n */\r\n clear() {\r\n this.head = this.tail = null;\r\n this._len = 0;\r\n }\r\n\r\n}\r\n\r\n/**\r\n * LRU Cache\r\n */\r\nexport default class LRU {\r\n\r\n private _list = new LinkedList()\r\n\r\n private _maxSize = 10\r\n\r\n private _lastRemovedEntry: Entry\r\n\r\n private _map: Dictionary> = {}\r\n\r\n constructor(maxSize: number) {\r\n this._maxSize = maxSize;\r\n }\r\n\r\n /**\r\n * @return Removed value\r\n */\r\n put(key: string | number, value: T): T {\r\n const list = this._list;\r\n const map = this._map;\r\n let removed = null;\r\n if (map[key] == null) {\r\n const len = list.len();\r\n // Reuse last removed entry\r\n let entry = this._lastRemovedEntry;\r\n\r\n if (len >= this._maxSize && len > 0) {\r\n // Remove the least recently used\r\n const leastUsedEntry = list.head;\r\n list.remove(leastUsedEntry);\r\n delete map[leastUsedEntry.key];\r\n\r\n removed = leastUsedEntry.value;\r\n this._lastRemovedEntry = leastUsedEntry;\r\n }\r\n\r\n if (entry) {\r\n entry.value = value;\r\n }\r\n else {\r\n entry = new Entry(value);\r\n }\r\n entry.key = key;\r\n list.insertEntry(entry);\r\n map[key] = entry;\r\n }\r\n\r\n return removed;\r\n }\r\n\r\n get(key: string | number): T {\r\n const entry = this._map[key];\r\n const list = this._list;\r\n if (entry != null) {\r\n // Put the latest used entry in the tail\r\n if (entry !== list.tail) {\r\n list.remove(entry);\r\n list.insertEntry(entry);\r\n }\r\n\r\n return entry.value;\r\n }\r\n }\r\n\r\n /**\r\n * Clear the cache\r\n */\r\n clear() {\r\n this._list.clear();\r\n this._map = {};\r\n }\r\n\r\n len() {\r\n return this._list.len();\r\n }\r\n}","import LRU from '../core/LRU';\nimport { extend, isGradientObject, isString, map } from '../core/util';\nimport { GradientObject } from '../graphic/Gradient';\n\nconst kCSSColorTable = {\n 'transparent': [0, 0, 0, 0], 'aliceblue': [240, 248, 255, 1],\n 'antiquewhite': [250, 235, 215, 1], 'aqua': [0, 255, 255, 1],\n 'aquamarine': [127, 255, 212, 1], 'azure': [240, 255, 255, 1],\n 'beige': [245, 245, 220, 1], 'bisque': [255, 228, 196, 1],\n 'black': [0, 0, 0, 1], 'blanchedalmond': [255, 235, 205, 1],\n 'blue': [0, 0, 255, 1], 'blueviolet': [138, 43, 226, 1],\n 'brown': [165, 42, 42, 1], 'burlywood': [222, 184, 135, 1],\n 'cadetblue': [95, 158, 160, 1], 'chartreuse': [127, 255, 0, 1],\n 'chocolate': [210, 105, 30, 1], 'coral': [255, 127, 80, 1],\n 'cornflowerblue': [100, 149, 237, 1], 'cornsilk': [255, 248, 220, 1],\n 'crimson': [220, 20, 60, 1], 'cyan': [0, 255, 255, 1],\n 'darkblue': [0, 0, 139, 1], 'darkcyan': [0, 139, 139, 1],\n 'darkgoldenrod': [184, 134, 11, 1], 'darkgray': [169, 169, 169, 1],\n 'darkgreen': [0, 100, 0, 1], 'darkgrey': [169, 169, 169, 1],\n 'darkkhaki': [189, 183, 107, 1], 'darkmagenta': [139, 0, 139, 1],\n 'darkolivegreen': [85, 107, 47, 1], 'darkorange': [255, 140, 0, 1],\n 'darkorchid': [153, 50, 204, 1], 'darkred': [139, 0, 0, 1],\n 'darksalmon': [233, 150, 122, 1], 'darkseagreen': [143, 188, 143, 1],\n 'darkslateblue': [72, 61, 139, 1], 'darkslategray': [47, 79, 79, 1],\n 'darkslategrey': [47, 79, 79, 1], 'darkturquoise': [0, 206, 209, 1],\n 'darkviolet': [148, 0, 211, 1], 'deeppink': [255, 20, 147, 1],\n 'deepskyblue': [0, 191, 255, 1], 'dimgray': [105, 105, 105, 1],\n 'dimgrey': [105, 105, 105, 1], 'dodgerblue': [30, 144, 255, 1],\n 'firebrick': [178, 34, 34, 1], 'floralwhite': [255, 250, 240, 1],\n 'forestgreen': [34, 139, 34, 1], 'fuchsia': [255, 0, 255, 1],\n 'gainsboro': [220, 220, 220, 1], 'ghostwhite': [248, 248, 255, 1],\n 'gold': [255, 215, 0, 1], 'goldenrod': [218, 165, 32, 1],\n 'gray': [128, 128, 128, 1], 'green': [0, 128, 0, 1],\n 'greenyellow': [173, 255, 47, 1], 'grey': [128, 128, 128, 1],\n 'honeydew': [240, 255, 240, 1], 'hotpink': [255, 105, 180, 1],\n 'indianred': [205, 92, 92, 1], 'indigo': [75, 0, 130, 1],\n 'ivory': [255, 255, 240, 1], 'khaki': [240, 230, 140, 1],\n 'lavender': [230, 230, 250, 1], 'lavenderblush': [255, 240, 245, 1],\n 'lawngreen': [124, 252, 0, 1], 'lemonchiffon': [255, 250, 205, 1],\n 'lightblue': [173, 216, 230, 1], 'lightcoral': [240, 128, 128, 1],\n 'lightcyan': [224, 255, 255, 1], 'lightgoldenrodyellow': [250, 250, 210, 1],\n 'lightgray': [211, 211, 211, 1], 'lightgreen': [144, 238, 144, 1],\n 'lightgrey': [211, 211, 211, 1], 'lightpink': [255, 182, 193, 1],\n 'lightsalmon': [255, 160, 122, 1], 'lightseagreen': [32, 178, 170, 1],\n 'lightskyblue': [135, 206, 250, 1], 'lightslategray': [119, 136, 153, 1],\n 'lightslategrey': [119, 136, 153, 1], 'lightsteelblue': [176, 196, 222, 1],\n 'lightyellow': [255, 255, 224, 1], 'lime': [0, 255, 0, 1],\n 'limegreen': [50, 205, 50, 1], 'linen': [250, 240, 230, 1],\n 'magenta': [255, 0, 255, 1], 'maroon': [128, 0, 0, 1],\n 'mediumaquamarine': [102, 205, 170, 1], 'mediumblue': [0, 0, 205, 1],\n 'mediumorchid': [186, 85, 211, 1], 'mediumpurple': [147, 112, 219, 1],\n 'mediumseagreen': [60, 179, 113, 1], 'mediumslateblue': [123, 104, 238, 1],\n 'mediumspringgreen': [0, 250, 154, 1], 'mediumturquoise': [72, 209, 204, 1],\n 'mediumvioletred': [199, 21, 133, 1], 'midnightblue': [25, 25, 112, 1],\n 'mintcream': [245, 255, 250, 1], 'mistyrose': [255, 228, 225, 1],\n 'moccasin': [255, 228, 181, 1], 'navajowhite': [255, 222, 173, 1],\n 'navy': [0, 0, 128, 1], 'oldlace': [253, 245, 230, 1],\n 'olive': [128, 128, 0, 1], 'olivedrab': [107, 142, 35, 1],\n 'orange': [255, 165, 0, 1], 'orangered': [255, 69, 0, 1],\n 'orchid': [218, 112, 214, 1], 'palegoldenrod': [238, 232, 170, 1],\n 'palegreen': [152, 251, 152, 1], 'paleturquoise': [175, 238, 238, 1],\n 'palevioletred': [219, 112, 147, 1], 'papayawhip': [255, 239, 213, 1],\n 'peachpuff': [255, 218, 185, 1], 'peru': [205, 133, 63, 1],\n 'pink': [255, 192, 203, 1], 'plum': [221, 160, 221, 1],\n 'powderblue': [176, 224, 230, 1], 'purple': [128, 0, 128, 1],\n 'red': [255, 0, 0, 1], 'rosybrown': [188, 143, 143, 1],\n 'royalblue': [65, 105, 225, 1], 'saddlebrown': [139, 69, 19, 1],\n 'salmon': [250, 128, 114, 1], 'sandybrown': [244, 164, 96, 1],\n 'seagreen': [46, 139, 87, 1], 'seashell': [255, 245, 238, 1],\n 'sienna': [160, 82, 45, 1], 'silver': [192, 192, 192, 1],\n 'skyblue': [135, 206, 235, 1], 'slateblue': [106, 90, 205, 1],\n 'slategray': [112, 128, 144, 1], 'slategrey': [112, 128, 144, 1],\n 'snow': [255, 250, 250, 1], 'springgreen': [0, 255, 127, 1],\n 'steelblue': [70, 130, 180, 1], 'tan': [210, 180, 140, 1],\n 'teal': [0, 128, 128, 1], 'thistle': [216, 191, 216, 1],\n 'tomato': [255, 99, 71, 1], 'turquoise': [64, 224, 208, 1],\n 'violet': [238, 130, 238, 1], 'wheat': [245, 222, 179, 1],\n 'white': [255, 255, 255, 1], 'whitesmoke': [245, 245, 245, 1],\n 'yellow': [255, 255, 0, 1], 'yellowgreen': [154, 205, 50, 1]\n};\n\nfunction clampCssByte(i: number): number { // Clamp to integer 0 .. 255.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 255 ? 255 : i;\n}\n\nfunction clampCssAngle(i: number): number { // Clamp to integer 0 .. 360.\n i = Math.round(i); // Seems to be what Chrome does (vs truncation).\n return i < 0 ? 0 : i > 360 ? 360 : i;\n}\n\nfunction clampCssFloat(f: number): number { // Clamp to float 0.0 .. 1.0.\n return f < 0 ? 0 : f > 1 ? 1 : f;\n}\n\nfunction parseCssInt(val: string | number): number { // int or percentage.\n let str = val as string;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssByte(parseFloat(str) / 100 * 255);\n }\n return clampCssByte(parseInt(str, 10));\n}\n\nfunction parseCssFloat(val: string | number): number { // float or percentage.\n let str = val as string;\n if (str.length && str.charAt(str.length - 1) === '%') {\n return clampCssFloat(parseFloat(str) / 100);\n }\n return clampCssFloat(parseFloat(str));\n}\n\nfunction cssHueToRgb(m1: number, m2: number, h: number): number {\n if (h < 0) {\n h += 1;\n }\n else if (h > 1) {\n h -= 1;\n }\n\n if (h * 6 < 1) {\n return m1 + (m2 - m1) * h * 6;\n }\n if (h * 2 < 1) {\n return m2;\n }\n if (h * 3 < 2) {\n return m1 + (m2 - m1) * (2 / 3 - h) * 6;\n }\n return m1;\n}\n\nfunction lerpNumber(a: number, b: number, p: number): number {\n return a + (b - a) * p;\n}\n\nfunction setRgba(out: number[], r: number, g: number, b: number, a: number): number[] {\n out[0] = r;\n out[1] = g;\n out[2] = b;\n out[3] = a;\n return out;\n}\nfunction copyRgba(out: number[], a: number[]) {\n out[0] = a[0];\n out[1] = a[1];\n out[2] = a[2];\n out[3] = a[3];\n return out;\n}\n\nconst colorCache = new LRU(20);\nlet lastRemovedArr: number[] = null;\n\nfunction putToCache(colorStr: string, rgbaArr: number[]) {\n // Reuse removed array\n if (lastRemovedArr) {\n copyRgba(lastRemovedArr, rgbaArr);\n }\n lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice()));\n}\n\nexport function parse(colorStr: string, rgbaArr?: number[]): number[] {\n if (!colorStr) {\n return;\n }\n rgbaArr = rgbaArr || [];\n\n let cached = colorCache.get(colorStr);\n if (cached) {\n return copyRgba(rgbaArr, cached);\n }\n\n // colorStr may be not string\n colorStr = colorStr + '';\n // Remove all whitespace, not compliant, but should just be more accepting.\n let str = colorStr.replace(/ /g, '').toLowerCase();\n\n // Color keywords (and transparent) lookup.\n if (str in kCSSColorTable) {\n copyRgba(rgbaArr, kCSSColorTable[str as keyof typeof kCSSColorTable]);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n // supports the forms #rgb, #rrggbb, #rgba, #rrggbbaa\n // #rrggbbaa(use the last pair of digits as alpha)\n // see https://drafts.csswg.org/css-color/#hex-notation\n const strLen = str.length;\n if (str.charAt(0) === '#') {\n if (strLen === 4 || strLen === 5) {\n const iv = parseInt(str.slice(1, 4), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xfff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n // interpret values of the form #rgb as #rrggbb and #rgba as #rrggbbaa\n setRgba(rgbaArr,\n ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8),\n (iv & 0xf0) | ((iv & 0xf0) >> 4),\n (iv & 0xf) | ((iv & 0xf) << 4),\n strLen === 5 ? parseInt(str.slice(4), 16) / 0xf : 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else if (strLen === 7 || strLen === 9) {\n const iv = parseInt(str.slice(1, 7), 16); // TODO(deanm): Stricter parsing.\n if (!(iv >= 0 && iv <= 0xffffff)) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return; // Covers NaN.\n }\n setRgba(rgbaArr,\n (iv & 0xff0000) >> 16,\n (iv & 0xff00) >> 8,\n iv & 0xff,\n strLen === 9 ? parseInt(str.slice(7), 16) / 0xff : 1\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n\n return;\n }\n let op = str.indexOf('(');\n let ep = str.indexOf(')');\n if (op !== -1 && ep + 1 === strLen) {\n let fname = str.substr(0, op);\n let params: (number | string)[] = str.substr(op + 1, ep - (op + 1)).split(',');\n let alpha = 1; // To allow case fallthrough.\n switch (fname) {\n case 'rgba':\n if (params.length !== 4) {\n return params.length === 3\n // to be compatible with rgb\n ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1)\n : setRgba(rgbaArr, 0, 0, 0, 1);\n }\n alpha = parseCssFloat(params.pop()); // jshint ignore:line\n // Fall through.\n case 'rgb':\n if (params.length >= 3) {\n setRgba(rgbaArr,\n parseCssInt(params[0]),\n parseCssInt(params[1]),\n parseCssInt(params[2]),\n params.length === 3 ? alpha : parseCssFloat(params[3])\n );\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n }\n else {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n case 'hsla':\n if (params.length !== 4) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n params[3] = parseCssFloat(params[3]);\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n case 'hsl':\n if (params.length !== 3) {\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n }\n hsla2rgba(params, rgbaArr);\n putToCache(colorStr, rgbaArr);\n return rgbaArr;\n default:\n return;\n }\n }\n\n setRgba(rgbaArr, 0, 0, 0, 1);\n return;\n}\n\nfunction hsla2rgba(hsla: (number | string) [], rgba?: number[]): number[] {\n const h = (((parseFloat(hsla[0] as string) % 360) + 360) % 360) / 360; // 0 .. 1\n // NOTE(deanm): According to the CSS spec s/l should only be\n // percentages, but we don't bother and let float or percentage.\n const s = parseCssFloat(hsla[1]);\n const l = parseCssFloat(hsla[2]);\n const m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s;\n const m1 = l * 2 - m2;\n\n rgba = rgba || [];\n setRgba(rgba,\n clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h) * 255),\n clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255),\n 1\n );\n\n if (hsla.length === 4) {\n rgba[3] = hsla[3] as number;\n }\n\n return rgba;\n}\n\nfunction rgba2hsla(rgba: number[]): number[] {\n if (!rgba) {\n return;\n }\n\n // RGB from 0 to 255\n const R = rgba[0] / 255;\n const G = rgba[1] / 255;\n const B = rgba[2] / 255;\n\n const vMin = Math.min(R, G, B); // Min. value of RGB\n const vMax = Math.max(R, G, B); // Max. value of RGB\n const delta = vMax - vMin; // Delta RGB value\n\n const L = (vMax + vMin) / 2;\n let H;\n let S;\n // HSL results from 0 to 1\n if (delta === 0) {\n H = 0;\n S = 0;\n }\n else {\n if (L < 0.5) {\n S = delta / (vMax + vMin);\n }\n else {\n S = delta / (2 - vMax - vMin);\n }\n\n const deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;\n const deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;\n const deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;\n\n if (R === vMax) {\n H = deltaB - deltaG;\n }\n else if (G === vMax) {\n H = (1 / 3) + deltaR - deltaB;\n }\n else if (B === vMax) {\n H = (2 / 3) + deltaG - deltaR;\n }\n\n if (H < 0) {\n H += 1;\n }\n\n if (H > 1) {\n H -= 1;\n }\n }\n\n const hsla = [H * 360, S, L];\n\n if (rgba[3] != null) {\n hsla.push(rgba[3]);\n }\n\n return hsla;\n}\n\nexport function lift(color: string, level: number) {\n const colorArr = parse(color);\n if (colorArr) {\n for (let i = 0; i < 3; i++) {\n if (level < 0) {\n colorArr[i] = colorArr[i] * (1 - level) | 0;\n }\n else {\n colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0;\n }\n if (colorArr[i] > 255) {\n colorArr[i] = 255;\n }\n else if (colorArr[i] < 0) {\n colorArr[i] = 0;\n }\n }\n return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb');\n }\n}\n\nexport function toHex(color: string): string {\n const colorArr = parse(color);\n if (colorArr) {\n return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1);\n }\n}\n\n/**\n * Map value to color. Faster than lerp methods because color is represented by rgba array.\n * @param normalizedValue A float between 0 and 1.\n * @param colors List of rgba color array\n * @param out Mapped gba color array\n * @return will be null/undefined if input illegal.\n */\nexport function fastLerp(\n normalizedValue: number,\n colors: number[][],\n out?: number[]\n): number[] {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n out = out || [];\n\n const value = normalizedValue * (colors.length - 1);\n const leftIndex = Math.floor(value);\n const rightIndex = Math.ceil(value);\n const leftColor = colors[leftIndex];\n const rightColor = colors[rightIndex];\n const dv = value - leftIndex;\n out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));\n out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));\n out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));\n out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));\n\n return out;\n}\n\n/**\n * @deprecated\n */\nexport const fastMapToColor = fastLerp;\n\ntype LerpFullOutput = {\n color: string\n leftIndex: number\n rightIndex: number\n value: number\n}\n/**\n * @param normalizedValue A float between 0 and 1.\n * @param colors Color list.\n * @param fullOutput Default false.\n * @return Result color. If fullOutput,\n return {color: ..., leftIndex: ..., rightIndex: ..., value: ...},\n */\nexport function lerp(\n normalizedValue: number,\n colors: string[],\n fullOutput: boolean\n): LerpFullOutput\nexport function lerp(\n normalizedValue: number,\n colors: string[]\n): string\nexport function lerp(\n normalizedValue: number,\n colors: string[],\n fullOutput?: boolean\n): string | LerpFullOutput {\n if (!(colors && colors.length)\n || !(normalizedValue >= 0 && normalizedValue <= 1)\n ) {\n return;\n }\n\n const value = normalizedValue * (colors.length - 1);\n const leftIndex = Math.floor(value);\n const rightIndex = Math.ceil(value);\n const leftColor = parse(colors[leftIndex]);\n const rightColor = parse(colors[rightIndex]);\n const dv = value - leftIndex;\n\n const color = stringify(\n [\n clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),\n clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),\n clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),\n clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))\n ],\n 'rgba'\n );\n\n return fullOutput\n ? {\n color: color,\n leftIndex: leftIndex,\n rightIndex: rightIndex,\n value: value\n }\n : color;\n}\n\n/**\n * @deprecated\n */\nexport const mapToColor = lerp;\n\n/**\n * @param color\n * @param h 0 ~ 360, ignore when null.\n * @param s 0 ~ 1, ignore when null.\n * @param l 0 ~ 1, ignore when null.\n * @return Color string in rgba format.\n * @memberOf module:zrender/util/color\n */\nexport function modifyHSL(color: string, h?: number, s?: number, l?: number): string {\n let colorArr = parse(color);\n\n if (color) {\n colorArr = rgba2hsla(colorArr);\n h != null && (colorArr[0] = clampCssAngle(h));\n s != null && (colorArr[1] = parseCssFloat(s));\n l != null && (colorArr[2] = parseCssFloat(l));\n\n return stringify(hsla2rgba(colorArr), 'rgba');\n }\n}\n\n/**\n * @param color\n * @param alpha 0 ~ 1\n * @return Color string in rgba format.\n * @memberOf module:zrender/util/color\n */\nexport function modifyAlpha(color: string, alpha?: number): string {\n const colorArr = parse(color);\n\n if (colorArr && alpha != null) {\n colorArr[3] = clampCssFloat(alpha);\n return stringify(colorArr, 'rgba');\n }\n}\n\n/**\n * @param arrColor like [12,33,44,0.4]\n * @param type 'rgba', 'hsva', ...\n * @return Result color. (If input illegal, return undefined).\n */\nexport function stringify(arrColor: number[], type: string): string {\n if (!arrColor || !arrColor.length) {\n return;\n }\n let colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];\n if (type === 'rgba' || type === 'hsva' || type === 'hsla') {\n colorStr += ',' + arrColor[3];\n }\n return type + '(' + colorStr + ')';\n}\n\n/**\n * Calculate luminance. It will include alpha.\n */\nexport function lum(color: string, backgroundLum: number) {\n const arr = parse(color);\n return arr\n ? (0.299 * arr[0] + 0.587 * arr[1] + 0.114 * arr[2]) * arr[3] / 255\n + (1 - arr[3]) * backgroundLum // Blending with assumed white background.\n : 0;\n}\n\n/**\n * Generate a random color\n */\nexport function random(): string {\n return stringify([\n Math.round(Math.random() * 255),\n Math.round(Math.random() * 255),\n Math.round(Math.random() * 255)\n ], 'rgb');\n}\n\nconst liftedColorCache = new LRU(100);\nexport function liftColor(color: GradientObject): GradientObject;\nexport function liftColor(color: string): string;\nexport function liftColor(color: string | GradientObject): string | GradientObject {\n if (isString(color)) {\n let liftedColor = liftedColorCache.get(color);\n if (!liftedColor) {\n liftedColor = lift(color, -0.1);\n liftedColorCache.put(color, liftedColor);\n }\n return liftedColor;\n }\n else if (isGradientObject(color)) {\n const ret = extend({}, color) as GradientObject;\n ret.colorStops = map(color.colorStops, stop => ({\n offset: stop.offset,\n color: lift(stop.color, -0.1)\n }));\n return ret;\n }\n // Change nothing.\n return color;\n}\n","// Shared methods of svg and svg-ssr\r\n\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Transformable, { TransformProp } from '../core/Transformable';\r\nimport { RADIAN_TO_DEGREE, retrieve2, logError, isFunction } from '../core/util';\r\nimport Displayable from '../graphic/Displayable';\r\nimport { GradientObject } from '../graphic/Gradient';\r\nimport { LinearGradientObject } from '../graphic/LinearGradient';\r\nimport Path from '../graphic/Path';\r\nimport { ImagePatternObject, PatternObject, SVGPatternObject } from '../graphic/Pattern';\r\nimport { RadialGradientObject } from '../graphic/RadialGradient';\r\nimport { parse } from '../tool/color';\r\nimport env from '../core/env';\r\n\r\nconst mathRound = Math.round;\r\n\r\nexport function normalizeColor(color: string): { color: string; opacity: number; } {\r\n let opacity;\r\n if (!color || color === 'transparent') {\r\n color = 'none';\r\n }\r\n else if (typeof color === 'string' && color.indexOf('rgba') > -1) {\r\n const arr = parse(color);\r\n if (arr) {\r\n // TODO use hex?\r\n color = 'rgb(' + arr[0] + ',' + arr[1] + ',' + arr[2] + ')';\r\n opacity = arr[3];\r\n }\r\n }\r\n return {\r\n color,\r\n opacity: opacity == null ? 1 : opacity\r\n };\r\n}\r\nconst EPSILON = 1e-4;\r\nexport function isAroundZero(transform: number) {\r\n return transform < EPSILON && transform > -EPSILON;\r\n}\r\n\r\nexport function round3(transform: number) {\r\n return mathRound(transform * 1e3) / 1e3;\r\n}\r\nexport function round4(transform: number) {\r\n return mathRound(transform * 1e4) / 1e4;\r\n}\r\nexport function round1(transform: number) {\r\n return mathRound(transform * 10) / 10;\r\n}\r\n\r\nexport function getMatrixStr(m: MatrixArray) {\r\n return 'matrix('\r\n // Avoid large string of matrix\r\n // PENDING If have precision issue when scaled\r\n + round3(m[0]) + ','\r\n + round3(m[1]) + ','\r\n + round3(m[2]) + ','\r\n + round3(m[3]) + ','\r\n + round4(m[4]) + ','\r\n + round4(m[5])\r\n + ')';\r\n}\r\n\r\nexport const TEXT_ALIGN_TO_ANCHOR = {\r\n left: 'start',\r\n right: 'end',\r\n center: 'middle',\r\n middle: 'middle'\r\n};\r\n\r\nexport function adjustTextY(y: number, lineHeight: number, textBaseline: CanvasTextBaseline): number {\r\n // TODO Other baselines.\r\n if (textBaseline === 'top') {\r\n y += lineHeight / 2;\r\n }\r\n else if (textBaseline === 'bottom') {\r\n y -= lineHeight / 2;\r\n }\r\n return y;\r\n}\r\n\r\n\r\nexport function hasShadow(style: Displayable['style']) {\r\n // TODO: textBoxShadowBlur is not supported yet\r\n return style\r\n && (style.shadowBlur || style.shadowOffsetX || style.shadowOffsetY);\r\n}\r\n\r\nexport function getShadowKey(displayable: Displayable) {\r\n const style = displayable.style;\r\n const globalScale = displayable.getGlobalScale();\r\n return [\r\n style.shadowColor,\r\n (style.shadowBlur || 0).toFixed(2), // Reduce the precision\r\n (style.shadowOffsetX || 0).toFixed(2),\r\n (style.shadowOffsetY || 0).toFixed(2),\r\n globalScale[0],\r\n globalScale[1]\r\n ].join(',');\r\n}\r\n\r\nexport function getClipPathsKey(clipPaths: Path[]) {\r\n let key: number[] = [];\r\n if (clipPaths) {\r\n for (let i = 0; i < clipPaths.length; i++) {\r\n const clipPath = clipPaths[i];\r\n key.push(clipPath.id);\r\n }\r\n }\r\n return key.join(',');\r\n}\r\n\r\nexport function isImagePattern(val: any): val is ImagePatternObject {\r\n return val && (!!(val as ImagePatternObject).image);\r\n}\r\nexport function isSVGPattern(val: any): val is SVGPatternObject {\r\n return val && (!!(val as SVGPatternObject).svgElement);\r\n}\r\nexport function isPattern(val: any): val is PatternObject {\r\n return isImagePattern(val) || isSVGPattern(val);\r\n}\r\n\r\nexport function isLinearGradient(val: GradientObject): val is LinearGradientObject {\r\n return val.type === 'linear';\r\n}\r\n\r\nexport function isRadialGradient(val: GradientObject): val is RadialGradientObject {\r\n return val.type === 'radial';\r\n}\r\n\r\nexport function isGradient(val: any): val is GradientObject {\r\n return val && (\r\n (val as GradientObject).type === 'linear'\r\n || (val as GradientObject).type === 'radial'\r\n );\r\n}\r\n\r\nexport function getIdURL(id: string) {\r\n return `url(#${id})`;\r\n}\r\n\r\nexport function getPathPrecision(el: Path) {\r\n const scale = el.getGlobalScale();\r\n const size = Math.max(scale[0], scale[1]);\r\n return Math.max(Math.ceil(Math.log(size) / Math.log(10)), 1);\r\n}\r\n\r\nexport function getSRTTransformString(\r\n transform: Partial>\r\n) {\r\n const x = transform.x || 0;\r\n const y = transform.y || 0;\r\n const rotation = (transform.rotation || 0) * RADIAN_TO_DEGREE;\r\n const scaleX = retrieve2(transform.scaleX, 1);\r\n const scaleY = retrieve2(transform.scaleY, 1);\r\n const skewX = transform.skewX || 0;\r\n const skewY = transform.skewY || 0;\r\n const res = [];\r\n if (x || y) {\r\n // TODO not using px unit?\r\n res.push(`translate(${x}px,${y}px)`);\r\n }\r\n if (rotation) {\r\n res.push(`rotate(${rotation})`);\r\n }\r\n if (scaleX !== 1 || scaleY !== 1) {\r\n res.push(`scale(${scaleX},${scaleY})`);\r\n }\r\n if (skewX || skewY) {\r\n res.push(`skew(${mathRound(skewX * RADIAN_TO_DEGREE)}deg, ${mathRound(skewY * RADIAN_TO_DEGREE)}deg)`);\r\n }\r\n\r\n return res.join(' ');\r\n}\r\n\r\nexport const encodeBase64 = (function () {\r\n if (env.hasGlobalWindow && isFunction(window.btoa)) {\r\n return function (str: string) {\r\n return window.btoa(unescape(encodeURIComponent(str)));\r\n };\r\n }\r\n if (typeof Buffer !== 'undefined') {\r\n return function (str: string) {\r\n return Buffer.from(str).toString('base64');\r\n };\r\n }\r\n return function (str: string): string {\r\n if (process.env.NODE_ENV !== 'production') {\r\n logError('Base64 isn\\'t natively supported in the current environment.');\r\n }\r\n return null;\r\n };\r\n})();","/**\r\n * @module echarts/animation/Animator\r\n */\r\n\r\nimport Clip from './Clip';\r\nimport * as color from '../tool/color';\r\nimport {\r\n eqNaN,\r\n extend,\r\n isArrayLike,\r\n isFunction,\r\n isGradientObject,\r\n isNumber,\r\n isString,\r\n keys,\r\n logError,\r\n map\r\n} from '../core/util';\r\nimport {ArrayLike, Dictionary} from '../core/types';\r\nimport easingFuncs, { AnimationEasing } from './easing';\r\nimport Animation from './Animation';\r\nimport { createCubicEasingFunc } from './cubicEasing';\r\nimport { isLinearGradient, isRadialGradient } from '../svg/helper';\r\n\r\ntype NumberArray = ArrayLike\r\ntype InterpolatableType = string | number | NumberArray | NumberArray[];\r\n\r\ninterface ParsedColorStop {\r\n color: number[],\r\n offset: number\r\n};\r\n\r\ninterface ParsedGradientObject {\r\n colorStops: ParsedColorStop[]\r\n x: number\r\n y: number\r\n global: boolean\r\n}\r\ninterface ParsedLinearGradientObject extends ParsedGradientObject {\r\n x2: number\r\n y2: number\r\n}\r\ninterface ParsedRadialGradientObject extends ParsedGradientObject {\r\n r: number\r\n}\r\n\r\nconst arraySlice = Array.prototype.slice;\r\n\r\nfunction interpolateNumber(p0: number, p1: number, percent: number): number {\r\n return (p1 - p0) * percent + p0;\r\n}\r\nfunction interpolate1DArray(\r\n out: NumberArray,\r\n p0: NumberArray,\r\n p1: NumberArray,\r\n percent: number\r\n) {\r\n // TODO Handling different length TypedArray\r\n const len = p0.length;\r\n for (let i = 0; i < len; i++) {\r\n out[i] = interpolateNumber(p0[i], p1[i], percent);\r\n }\r\n return out;\r\n}\r\n\r\nfunction interpolate2DArray(\r\n out: NumberArray[],\r\n p0: NumberArray[],\r\n p1: NumberArray[],\r\n percent: number\r\n) {\r\n const len = p0.length;\r\n // TODO differnt length on each item?\r\n const len2 = len && p0[0].length;\r\n for (let i = 0; i < len; i++) {\r\n if (!out[i]) {\r\n out[i] = [];\r\n }\r\n for (let j = 0; j < len2; j++) {\r\n out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction add1DArray(\r\n out: NumberArray,\r\n p0: NumberArray,\r\n p1: NumberArray,\r\n sign: 1 | -1\r\n) {\r\n const len = p0.length;\r\n for (let i = 0; i < len; i++) {\r\n out[i] = p0[i] + p1[i] * sign;\r\n }\r\n return out;\r\n}\r\n\r\nfunction add2DArray(\r\n out: NumberArray[],\r\n p0: NumberArray[],\r\n p1: NumberArray[],\r\n sign: 1 | -1\r\n) {\r\n const len = p0.length;\r\n const len2 = len && p0[0].length;\r\n for (let i = 0; i < len; i++) {\r\n if (!out[i]) {\r\n out[i] = [];\r\n }\r\n for (let j = 0; j < len2; j++) {\r\n out[i][j] = p0[i][j] + p1[i][j] * sign;\r\n }\r\n }\r\n return out;\r\n}\r\n\r\nfunction fillColorStops(val0: ParsedColorStop[], val1: ParsedColorStop[]) {\r\n const len0 = val0.length;\r\n const len1 = val1.length;\r\n\r\n const shorterArr = len0 > len1 ? val1 : val0;\r\n const shorterLen = Math.min(len0, len1);\r\n const last = shorterArr[shorterLen - 1] || { color: [0, 0, 0, 0], offset: 0 };\r\n for (let i = shorterLen; i < Math.max(len0, len1); i++) {\r\n // Use last color stop to fill the shorter array\r\n shorterArr.push({\r\n offset: last.offset,\r\n color: last.color.slice()\r\n });\r\n }\r\n}\r\n// arr0 is source array, arr1 is target array.\r\n// Do some preprocess to avoid error happened when interpolating from arr0 to arr1\r\nfunction fillArray(\r\n val0: NumberArray | NumberArray[],\r\n val1: NumberArray | NumberArray[],\r\n arrDim: 1 | 2\r\n) {\r\n // TODO Handling different length TypedArray\r\n let arr0 = val0 as (number | number[])[];\r\n let arr1 = val1 as (number | number[])[];\r\n if (!arr0.push || !arr1.push) {\r\n return;\r\n }\r\n const arr0Len = arr0.length;\r\n const arr1Len = arr1.length;\r\n if (arr0Len !== arr1Len) {\r\n // FIXME Not work for TypedArray\r\n const isPreviousLarger = arr0Len > arr1Len;\r\n if (isPreviousLarger) {\r\n // Cut the previous\r\n arr0.length = arr1Len;\r\n }\r\n else {\r\n // Fill the previous\r\n for (let i = arr0Len; i < arr1Len; i++) {\r\n arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));\r\n }\r\n }\r\n }\r\n // Handling NaN value\r\n const len2 = arr0[0] && (arr0[0] as number[]).length;\r\n for (let i = 0; i < arr0.length; i++) {\r\n if (arrDim === 1) {\r\n if (isNaN(arr0[i] as number)) {\r\n arr0[i] = arr1[i];\r\n }\r\n }\r\n else {\r\n for (let j = 0; j < len2; j++) {\r\n if (isNaN((arr0 as number[][])[i][j])) {\r\n (arr0 as number[][])[i][j] = (arr1 as number[][])[i][j];\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport function cloneValue(value: InterpolatableType) {\r\n if (isArrayLike(value)) {\r\n const len = value.length;\r\n if (isArrayLike(value[0])) {\r\n const ret = [];\r\n for (let i = 0; i < len; i++) {\r\n ret.push(arraySlice.call(value[i]));\r\n }\r\n return ret;\r\n }\r\n\r\n return arraySlice.call(value);\r\n }\r\n\r\n return value;\r\n}\r\n\r\nfunction rgba2String(rgba: number[]): string {\r\n rgba[0] = Math.floor(rgba[0]) || 0;\r\n rgba[1] = Math.floor(rgba[1]) || 0;\r\n rgba[2] = Math.floor(rgba[2]) || 0;\r\n rgba[3] = rgba[3] == null ? 1 : rgba[3];\r\n\r\n return 'rgba(' + rgba.join(',') + ')';\r\n}\r\n\r\nfunction guessArrayDim(value: ArrayLike): 1 | 2 {\r\n return isArrayLike(value && (value as ArrayLike)[0]) ? 2 : 1;\r\n}\r\n\r\nconst VALUE_TYPE_NUMBER = 0;\r\nconst VALUE_TYPE_1D_ARRAY = 1;\r\nconst VALUE_TYPE_2D_ARRAY = 2;\r\nconst VALUE_TYPE_COLOR = 3;\r\nconst VALUE_TYPE_LINEAR_GRADIENT = 4;\r\nconst VALUE_TYPE_RADIAL_GRADIENT = 5;\r\n// Other value type that can only use discrete animation.\r\nconst VALUE_TYPE_UNKOWN = 6;\r\n\r\ntype ValueType = 0 | 1 | 2 | 3 | 4 | 5 | 6;\r\n\r\ntype Keyframe = {\r\n time: number\r\n value: unknown\r\n percent: number\r\n // Raw value for discrete animation.\r\n rawValue: unknown\r\n\r\n easing?: AnimationEasing // Raw easing\r\n easingFunc?: (percent: number) => number\r\n additiveValue?: unknown\r\n}\r\n\r\n\r\nfunction isGradientValueType(valType: ValueType): valType is 4 | 5 {\r\n return valType === VALUE_TYPE_LINEAR_GRADIENT || valType === VALUE_TYPE_RADIAL_GRADIENT;\r\n}\r\nfunction isArrayValueType(valType: ValueType): valType is 1 | 2 {\r\n return valType === VALUE_TYPE_1D_ARRAY || valType === VALUE_TYPE_2D_ARRAY;\r\n}\r\n\r\n\r\nlet tmpRgba: number[] = [0, 0, 0, 0];\r\n\r\nclass Track {\r\n\r\n keyframes: Keyframe[] = []\r\n\r\n propName: string\r\n\r\n valType: ValueType\r\n\r\n discrete: boolean = false\r\n\r\n _invalid: boolean = false;\r\n\r\n private _finished: boolean\r\n\r\n private _needsSort: boolean = false\r\n\r\n private _additiveTrack: Track\r\n // Temporal storage for interpolated additive value.\r\n private _additiveValue: unknown\r\n\r\n // Info for run\r\n /**\r\n * Last frame\r\n */\r\n private _lastFr = 0\r\n /**\r\n * Percent of last frame.\r\n */\r\n private _lastFrP = 0\r\n\r\n constructor(propName: string) {\r\n this.propName = propName;\r\n }\r\n\r\n isFinished() {\r\n return this._finished;\r\n }\r\n\r\n setFinished() {\r\n this._finished = true;\r\n // Also set additive track to finished.\r\n // Make sure the final value stopped on the latest track\r\n if (this._additiveTrack) {\r\n this._additiveTrack.setFinished();\r\n }\r\n }\r\n\r\n needsAnimate() {\r\n return this.keyframes.length >= 1;\r\n }\r\n\r\n getAdditiveTrack() {\r\n return this._additiveTrack;\r\n }\r\n\r\n addKeyframe(time: number, rawValue: unknown, easing?: AnimationEasing) {\r\n this._needsSort = true;\r\n\r\n let keyframes = this.keyframes;\r\n let len = keyframes.length;\r\n\r\n let discrete = false;\r\n let valType: ValueType = VALUE_TYPE_UNKOWN;\r\n let value = rawValue;\r\n\r\n // Handling values only if it's possible to be interpolated.\r\n if (isArrayLike(rawValue)) {\r\n let arrayDim = guessArrayDim(rawValue);\r\n valType = arrayDim;\r\n // Not a number array.\r\n if (arrayDim === 1 && !isNumber(rawValue[0])\r\n || arrayDim === 2 && !isNumber(rawValue[0][0])) {\r\n discrete = true;\r\n }\r\n }\r\n else {\r\n if (isNumber(rawValue) && !eqNaN(rawValue)) {\r\n valType = VALUE_TYPE_NUMBER;\r\n }\r\n else if (isString(rawValue)) {\r\n if (!isNaN(+rawValue)) { // Can be string number like '2'\r\n valType = VALUE_TYPE_NUMBER;\r\n }\r\n else {\r\n const colorArray = color.parse(rawValue);\r\n if (colorArray) {\r\n value = colorArray;\r\n valType = VALUE_TYPE_COLOR;\r\n }\r\n }\r\n }\r\n else if (isGradientObject(rawValue)) {\r\n // TODO Color to gradient or gradient to color.\r\n const parsedGradient = extend({}, value) as unknown as ParsedGradientObject;\r\n parsedGradient.colorStops = map(rawValue.colorStops, colorStop => ({\r\n offset: colorStop.offset,\r\n color: color.parse(colorStop.color)\r\n }));\r\n if (isLinearGradient(rawValue)) {\r\n valType = VALUE_TYPE_LINEAR_GRADIENT;\r\n }\r\n else if (isRadialGradient(rawValue)) {\r\n valType = VALUE_TYPE_RADIAL_GRADIENT;\r\n }\r\n value = parsedGradient;\r\n }\r\n }\r\n\r\n if (len === 0) {\r\n // Inference type from the first keyframe.\r\n this.valType = valType;\r\n }\r\n // Not same value type or can't be interpolated.\r\n else if (valType !== this.valType || valType === VALUE_TYPE_UNKOWN) {\r\n discrete = true;\r\n }\r\n\r\n this.discrete = this.discrete || discrete;\r\n\r\n const kf: Keyframe = {\r\n time,\r\n value,\r\n rawValue,\r\n percent: 0\r\n };\r\n if (easing) {\r\n // Save the raw easing name to be used in css animation output\r\n kf.easing = easing;\r\n kf.easingFunc = isFunction(easing)\r\n ? easing\r\n : easingFuncs[easing] || createCubicEasingFunc(easing);\r\n }\r\n // Not check if value equal here.\r\n keyframes.push(kf);\r\n return kf;\r\n }\r\n\r\n prepare(maxTime: number, additiveTrack?: Track) {\r\n let kfs = this.keyframes;\r\n if (this._needsSort) {\r\n // Sort keyframe as ascending\r\n kfs.sort(function (a: Keyframe, b: Keyframe) {\r\n return a.time - b.time;\r\n });\r\n }\r\n\r\n const valType = this.valType;\r\n const kfsLen = kfs.length;\r\n const lastKf = kfs[kfsLen - 1];\r\n const isDiscrete = this.discrete;\r\n const isArr = isArrayValueType(valType);\r\n const isGradient = isGradientValueType(valType);\r\n\r\n for (let i = 0; i < kfsLen; i++) {\r\n const kf = kfs[i];\r\n const value = kf.value;\r\n const lastValue = lastKf.value;\r\n kf.percent = kf.time / maxTime;\r\n if (!isDiscrete) {\r\n if (isArr && i !== kfsLen - 1) {\r\n // Align array with target frame.\r\n fillArray(value as NumberArray, lastValue as NumberArray, valType);\r\n }\r\n else if (isGradient) {\r\n fillColorStops(\r\n (value as ParsedLinearGradientObject).colorStops,\r\n (lastValue as ParsedLinearGradientObject).colorStops\r\n );\r\n }\r\n }\r\n }\r\n\r\n // Only apply additive animaiton on INTERPOLABLE SAME TYPE values.\r\n if (\r\n !isDiscrete\r\n // TODO support gradient\r\n && valType !== VALUE_TYPE_RADIAL_GRADIENT\r\n && additiveTrack\r\n // If two track both will be animated and have same value format.\r\n && this.needsAnimate()\r\n && additiveTrack.needsAnimate()\r\n && valType === additiveTrack.valType\r\n && !additiveTrack._finished\r\n ) {\r\n this._additiveTrack = additiveTrack;\r\n\r\n const startValue = kfs[0].value;\r\n // Calculate difference\r\n for (let i = 0; i < kfsLen; i++) {\r\n if (valType === VALUE_TYPE_NUMBER) {\r\n kfs[i].additiveValue = kfs[i].value as number - (startValue as number);\r\n }\r\n else if (valType === VALUE_TYPE_COLOR) {\r\n kfs[i].additiveValue =\r\n add1DArray([], kfs[i].value as NumberArray, startValue as NumberArray, -1);\r\n }\r\n else if (isArrayValueType(valType)) {\r\n kfs[i].additiveValue = valType === VALUE_TYPE_1D_ARRAY\r\n ? add1DArray([], kfs[i].value as NumberArray, startValue as NumberArray, -1)\r\n : add2DArray([], kfs[i].value as NumberArray[], startValue as NumberArray[], -1);\r\n }\r\n }\r\n }\r\n }\r\n\r\n step(target: any, percent: number) {\r\n if (this._finished) { // Track may be set to finished.\r\n return;\r\n }\r\n\r\n if (this._additiveTrack && this._additiveTrack._finished) {\r\n // Remove additive track if it's finished.\r\n this._additiveTrack = null;\r\n }\r\n const isAdditive = this._additiveTrack != null;\r\n const valueKey = isAdditive ? 'additiveValue' : 'value';\r\n\r\n const valType = this.valType;\r\n const keyframes = this.keyframes;\r\n const kfsNum = keyframes.length;\r\n const propName = this.propName;\r\n const isValueColor = valType === VALUE_TYPE_COLOR;\r\n // Find the range keyframes\r\n // kf1-----kf2---------current--------kf3\r\n // find kf2 and kf3 and do interpolation\r\n let frameIdx;\r\n const lastFrame = this._lastFr;\r\n const mathMin = Math.min;\r\n let frame;\r\n let nextFrame;\r\n if (kfsNum === 1) {\r\n frame = nextFrame = keyframes[0];\r\n }\r\n else {\r\n // In the easing function like elasticOut, percent may less than 0\r\n if (percent < 0) {\r\n frameIdx = 0;\r\n }\r\n else if (percent < this._lastFrP) {\r\n // Start from next key\r\n // PENDING start from lastFrame ?\r\n const start = mathMin(lastFrame + 1, kfsNum - 1);\r\n for (frameIdx = start; frameIdx >= 0; frameIdx--) {\r\n if (keyframes[frameIdx].percent <= percent) {\r\n break;\r\n }\r\n }\r\n frameIdx = mathMin(frameIdx, kfsNum - 2);\r\n }\r\n else {\r\n for (frameIdx = lastFrame; frameIdx < kfsNum; frameIdx++) {\r\n if (keyframes[frameIdx].percent > percent) {\r\n break;\r\n }\r\n }\r\n frameIdx = mathMin(frameIdx - 1, kfsNum - 2);\r\n }\r\n\r\n nextFrame = keyframes[frameIdx + 1];\r\n frame = keyframes[frameIdx];\r\n }\r\n\r\n // Defensive coding.\r\n if (!(frame && nextFrame)) {\r\n return;\r\n }\r\n\r\n this._lastFr = frameIdx;\r\n this._lastFrP = percent;\r\n\r\n const interval = (nextFrame.percent - frame.percent);\r\n let w = interval === 0 ? 1 : mathMin((percent - frame.percent) / interval, 1);\r\n\r\n // Apply different easing of each keyframe.\r\n // Use easing specified in target frame.\r\n if (nextFrame.easingFunc) {\r\n w = nextFrame.easingFunc(w);\r\n }\r\n\r\n // If value is arr\r\n let targetArr = isAdditive ? this._additiveValue\r\n : (isValueColor ? tmpRgba : target[propName]);\r\n\r\n if ((isArrayValueType(valType) || isValueColor) && !targetArr) {\r\n targetArr = this._additiveValue = [];\r\n }\r\n\r\n if (this.discrete) {\r\n // use raw value without parse in discrete animation.\r\n target[propName] = w < 1 ? frame.rawValue : nextFrame.rawValue;\r\n }\r\n else if (isArrayValueType(valType)) {\r\n valType === VALUE_TYPE_1D_ARRAY\r\n ? interpolate1DArray(\r\n targetArr as NumberArray,\r\n frame[valueKey] as NumberArray,\r\n nextFrame[valueKey] as NumberArray,\r\n w\r\n )\r\n : interpolate2DArray(\r\n targetArr as NumberArray[],\r\n frame[valueKey] as NumberArray[],\r\n nextFrame[valueKey] as NumberArray[],\r\n w\r\n );\r\n }\r\n else if (isGradientValueType(valType)) {\r\n const val = frame[valueKey] as ParsedGradientObject;\r\n const nextVal = nextFrame[valueKey] as ParsedGradientObject;\r\n const isLinearGradient = valType === VALUE_TYPE_LINEAR_GRADIENT;\r\n target[propName] = {\r\n type: isLinearGradient ? 'linear' : 'radial',\r\n x: interpolateNumber(val.x, nextVal.x, w),\r\n y: interpolateNumber(val.y, nextVal.y, w),\r\n // TODO performance\r\n colorStops: map(val.colorStops, (colorStop, idx) => {\r\n const nextColorStop = nextVal.colorStops[idx];\r\n return {\r\n offset: interpolateNumber(colorStop.offset, nextColorStop.offset, w),\r\n color: rgba2String(interpolate1DArray(\r\n [] as number[], colorStop.color, nextColorStop.color, w\r\n ) as number[])\r\n };\r\n }),\r\n global: nextVal.global\r\n };\r\n if (isLinearGradient) {\r\n // Linear\r\n target[propName].x2 = interpolateNumber(\r\n (val as ParsedLinearGradientObject).x2, (nextVal as ParsedLinearGradientObject).x2, w\r\n );\r\n target[propName].y2 = interpolateNumber(\r\n (val as ParsedLinearGradientObject).y2, (nextVal as ParsedLinearGradientObject).y2, w\r\n );\r\n }\r\n else {\r\n // Radial\r\n target[propName].r = interpolateNumber(\r\n (val as ParsedRadialGradientObject).r, (nextVal as ParsedRadialGradientObject).r, w\r\n );\r\n }\r\n }\r\n else if (isValueColor) {\r\n interpolate1DArray(\r\n targetArr,\r\n frame[valueKey] as NumberArray,\r\n nextFrame[valueKey] as NumberArray,\r\n w\r\n );\r\n if (!isAdditive) { // Convert to string later:)\r\n target[propName] = rgba2String(targetArr);\r\n }\r\n }\r\n else {\r\n const value = interpolateNumber(frame[valueKey] as number, nextFrame[valueKey] as number, w);\r\n if (isAdditive) {\r\n this._additiveValue = value;\r\n }\r\n else {\r\n target[propName] = value;\r\n }\r\n }\r\n\r\n // Add additive to target\r\n if (isAdditive) {\r\n this._addToTarget(target);\r\n }\r\n }\r\n\r\n private _addToTarget(target: any) {\r\n const valType = this.valType;\r\n const propName = this.propName;\r\n const additiveValue = this._additiveValue;\r\n\r\n if (valType === VALUE_TYPE_NUMBER) {\r\n // Add a difference value based on the change of previous frame.\r\n target[propName] = target[propName] + additiveValue;\r\n }\r\n else if (valType === VALUE_TYPE_COLOR) {\r\n // TODO reduce unnecessary parse\r\n color.parse(target[propName], tmpRgba);\r\n add1DArray(tmpRgba, tmpRgba, additiveValue as NumberArray, 1);\r\n target[propName] = rgba2String(tmpRgba);\r\n }\r\n else if (valType === VALUE_TYPE_1D_ARRAY) {\r\n add1DArray(target[propName], target[propName], additiveValue as NumberArray, 1);\r\n }\r\n else if (valType === VALUE_TYPE_2D_ARRAY) {\r\n add2DArray(target[propName], target[propName], additiveValue as NumberArray[], 1);\r\n }\r\n }\r\n}\r\n\r\n\r\ntype DoneCallback = () => void;\r\ntype AbortCallback = () => void;\r\nexport type OnframeCallback = (target: T, percent: number) => void;\r\n\r\nexport type AnimationPropGetter = (target: T, key: string) => InterpolatableType;\r\nexport type AnimationPropSetter = (target: T, key: string, value: InterpolatableType) => void;\r\n\r\nexport default class Animator {\r\n\r\n animation?: Animation\r\n\r\n targetName?: string\r\n\r\n scope?: string\r\n\r\n __fromStateTransition?: string\r\n\r\n private _tracks: Dictionary = {}\r\n private _trackKeys: string[] = []\r\n\r\n private _target: T\r\n\r\n private _loop: boolean\r\n private _delay: number\r\n private _maxTime = 0\r\n\r\n /**\r\n * If force run regardless of empty tracks when duration is set.\r\n */\r\n private _force: boolean;\r\n\r\n /**\r\n * If animator is paused\r\n * @default false\r\n */\r\n private _paused: boolean\r\n // 0: Not started\r\n // 1: Invoked started\r\n // 2: Has been run for at least one frame.\r\n private _started = 0\r\n\r\n /**\r\n * If allow discrete animation\r\n * @default false\r\n */\r\n private _allowDiscrete: boolean\r\n\r\n private _additiveAnimators: Animator[]\r\n\r\n private _doneCbs: DoneCallback[]\r\n private _onframeCbs: OnframeCallback[]\r\n\r\n private _abortedCbs: AbortCallback[]\r\n\r\n private _clip: Clip = null\r\n\r\n constructor(\r\n target: T,\r\n loop: boolean,\r\n allowDiscreteAnimation?: boolean, // If doing discrete animation on the values can't be interpolated\r\n additiveTo?: Animator[]\r\n ) {\r\n this._target = target;\r\n this._loop = loop;\r\n if (loop && additiveTo) {\r\n logError('Can\\' use additive animation on looped animation.');\r\n return;\r\n }\r\n this._additiveAnimators = additiveTo;\r\n\r\n this._allowDiscrete = allowDiscreteAnimation;\r\n }\r\n\r\n getMaxTime() {\r\n return this._maxTime;\r\n }\r\n\r\n getDelay() {\r\n return this._delay;\r\n }\r\n\r\n getLoop() {\r\n return this._loop;\r\n }\r\n\r\n getTarget() {\r\n return this._target;\r\n }\r\n\r\n /**\r\n * Target can be changed during animation\r\n * For example if style is changed during state change.\r\n * We need to change target to the new style object.\r\n */\r\n changeTarget(target: T) {\r\n this._target = target;\r\n }\r\n\r\n /**\r\n * Set Animation keyframe\r\n * @param time time of keyframe in ms\r\n * @param props key-value props of keyframe.\r\n * @param easing\r\n */\r\n when(time: number, props: Dictionary, easing?: AnimationEasing) {\r\n return this.whenWithKeys(time, props, keys(props) as string[], easing);\r\n }\r\n\r\n\r\n // Fast path for add keyframes of aniamteTo\r\n whenWithKeys(time: number, props: Dictionary, propNames: string[], easing?: AnimationEasing) {\r\n const tracks = this._tracks;\r\n for (let i = 0; i < propNames.length; i++) {\r\n const propName = propNames[i];\r\n\r\n let track = tracks[propName];\r\n if (!track) {\r\n track = tracks[propName] = new Track(propName);\r\n\r\n let initialValue;\r\n const additiveTrack = this._getAdditiveTrack(propName);\r\n if (additiveTrack) {\r\n const addtiveTrackKfs = additiveTrack.keyframes;\r\n const lastFinalKf = addtiveTrackKfs[addtiveTrackKfs.length - 1];\r\n // Use the last state of additived animator.\r\n initialValue = lastFinalKf && lastFinalKf.value;\r\n if (additiveTrack.valType === VALUE_TYPE_COLOR && initialValue) {\r\n // Convert to rgba string\r\n initialValue = rgba2String(initialValue as number[]);\r\n }\r\n }\r\n else {\r\n initialValue = (this._target as any)[propName];\r\n }\r\n // Invalid value\r\n if (initialValue == null) {\r\n // zrLog('Invalid property ' + propName);\r\n continue;\r\n }\r\n // If time is <= 0\r\n // Then props is given initialize value\r\n // Note: initial percent can be negative, which means the initial value is before the animation start.\r\n // Else\r\n // Initialize value from current prop value\r\n if (time > 0) {\r\n track.addKeyframe(0, cloneValue(initialValue), easing);\r\n }\r\n\r\n this._trackKeys.push(propName);\r\n }\r\n track.addKeyframe(time, cloneValue(props[propName]), easing);\r\n }\r\n this._maxTime = Math.max(this._maxTime, time);\r\n return this;\r\n }\r\n\r\n pause() {\r\n this._clip.pause();\r\n this._paused = true;\r\n }\r\n\r\n resume() {\r\n this._clip.resume();\r\n this._paused = false;\r\n }\r\n\r\n isPaused(): boolean {\r\n return !!this._paused;\r\n }\r\n\r\n /**\r\n * Set duration of animator.\r\n * Will run this duration regardless the track max time or if trackes exits.\r\n * @param duration\r\n * @returns\r\n */\r\n duration(duration: number) {\r\n this._maxTime = duration;\r\n this._force = true;\r\n return this;\r\n }\r\n\r\n private _doneCallback() {\r\n this._setTracksFinished();\r\n // Clear clip\r\n this._clip = null;\r\n\r\n const doneList = this._doneCbs;\r\n if (doneList) {\r\n const len = doneList.length;\r\n for (let i = 0; i < len; i++) {\r\n doneList[i].call(this);\r\n }\r\n }\r\n }\r\n private _abortedCallback() {\r\n this._setTracksFinished();\r\n\r\n const animation = this.animation;\r\n const abortedList = this._abortedCbs;\r\n\r\n if (animation) {\r\n animation.removeClip(this._clip);\r\n }\r\n this._clip = null;\r\n\r\n if (abortedList) {\r\n for (let i = 0; i < abortedList.length; i++) {\r\n abortedList[i].call(this);\r\n }\r\n }\r\n }\r\n private _setTracksFinished() {\r\n const tracks = this._tracks;\r\n const tracksKeys = this._trackKeys;\r\n for (let i = 0; i < tracksKeys.length; i++) {\r\n tracks[tracksKeys[i]].setFinished();\r\n }\r\n }\r\n\r\n private _getAdditiveTrack(trackName: string): Track {\r\n let additiveTrack;\r\n const additiveAnimators = this._additiveAnimators;\r\n if (additiveAnimators) {\r\n for (let i = 0; i < additiveAnimators.length; i++) {\r\n const track = additiveAnimators[i].getTrack(trackName);\r\n if (track) {\r\n // Use the track of latest animator.\r\n additiveTrack = track;\r\n }\r\n }\r\n }\r\n return additiveTrack;\r\n }\r\n\r\n /**\r\n * Start the animation\r\n * @param easing\r\n * @return\r\n */\r\n start(easing?: AnimationEasing) {\r\n if (this._started > 0) {\r\n return;\r\n }\r\n this._started = 1;\r\n\r\n const self = this;\r\n\r\n const tracks: Track[] = [];\r\n const maxTime = this._maxTime || 0;\r\n for (let i = 0; i < this._trackKeys.length; i++) {\r\n const propName = this._trackKeys[i];\r\n const track = this._tracks[propName];\r\n const additiveTrack = this._getAdditiveTrack(propName);\r\n const kfs = track.keyframes;\r\n const kfsNum = kfs.length;\r\n track.prepare(maxTime, additiveTrack);\r\n if (track.needsAnimate()) {\r\n // Set value directly if discrete animation is not allowed.\r\n if (!this._allowDiscrete && track.discrete) {\r\n const lastKf = kfs[kfsNum - 1];\r\n // Set final value.\r\n if (lastKf) {\r\n // use raw value without parse.\r\n (self._target as any)[track.propName] = lastKf.rawValue;\r\n }\r\n track.setFinished();\r\n }\r\n else {\r\n tracks.push(track);\r\n }\r\n }\r\n }\r\n // Add during callback on the last clip\r\n if (tracks.length || this._force) {\r\n const clip = new Clip({\r\n life: maxTime,\r\n loop: this._loop,\r\n delay: this._delay || 0,\r\n onframe(percent: number) {\r\n self._started = 2;\r\n // Remove additived animator if it's finished.\r\n // For the purpose of memory effeciency.\r\n const additiveAnimators = self._additiveAnimators;\r\n if (additiveAnimators) {\r\n let stillHasAdditiveAnimator = false;\r\n for (let i = 0; i < additiveAnimators.length; i++) {\r\n if (additiveAnimators[i]._clip) {\r\n stillHasAdditiveAnimator = true;\r\n break;\r\n }\r\n }\r\n if (!stillHasAdditiveAnimator) {\r\n self._additiveAnimators = null;\r\n }\r\n }\r\n\r\n for (let i = 0; i < tracks.length; i++) {\r\n // NOTE: don't cache target outside.\r\n // Because target may be changed.\r\n tracks[i].step(self._target, percent);\r\n }\r\n\r\n const onframeList = self._onframeCbs;\r\n if (onframeList) {\r\n for (let i = 0; i < onframeList.length; i++) {\r\n onframeList[i](self._target, percent);\r\n }\r\n }\r\n },\r\n ondestroy() {\r\n self._doneCallback();\r\n }\r\n });\r\n this._clip = clip;\r\n\r\n if (this.animation) {\r\n this.animation.addClip(clip);\r\n }\r\n\r\n if (easing) {\r\n clip.setEasing(easing);\r\n }\r\n }\r\n else {\r\n // This optimization will help the case that in the upper application\r\n // the view may be refreshed frequently, where animation will be\r\n // called repeatly but nothing changed.\r\n this._doneCallback();\r\n }\r\n\r\n return this;\r\n }\r\n /**\r\n * Stop animation\r\n * @param {boolean} forwardToLast If move to last frame before stop\r\n */\r\n stop(forwardToLast?: boolean) {\r\n if (!this._clip) {\r\n return;\r\n }\r\n const clip = this._clip;\r\n if (forwardToLast) {\r\n // Move to last frame before stop\r\n clip.onframe(1);\r\n }\r\n\r\n this._abortedCallback();\r\n }\r\n /**\r\n * Set when animation delay starts\r\n * @param time 单位ms\r\n */\r\n delay(time: number) {\r\n this._delay = time;\r\n return this;\r\n }\r\n /**\r\n * 添加动画每一帧的回调函数\r\n * @param callback\r\n */\r\n during(cb: OnframeCallback) {\r\n if (cb) {\r\n if (!this._onframeCbs) {\r\n this._onframeCbs = [];\r\n }\r\n this._onframeCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n /**\r\n * Add callback for animation end\r\n * @param cb\r\n */\r\n done(cb: DoneCallback) {\r\n if (cb) {\r\n if (!this._doneCbs) {\r\n this._doneCbs = [];\r\n }\r\n this._doneCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n\r\n aborted(cb: AbortCallback) {\r\n if (cb) {\r\n if (!this._abortedCbs) {\r\n this._abortedCbs = [];\r\n }\r\n this._abortedCbs.push(cb);\r\n }\r\n return this;\r\n }\r\n\r\n getClip() {\r\n return this._clip;\r\n }\r\n\r\n getTrack(propName: string) {\r\n return this._tracks[propName];\r\n }\r\n\r\n getTracks() {\r\n return map(this._trackKeys, key => this._tracks[key]);\r\n }\r\n\r\n /**\r\n * Return true if animator is not available anymore.\r\n */\r\n stopTracks(propNames: string[], forwardToLast?: boolean): boolean {\r\n if (!propNames.length || !this._clip) {\r\n return true;\r\n }\r\n const tracks = this._tracks;\r\n const tracksKeys = this._trackKeys;\r\n\r\n for (let i = 0; i < propNames.length; i++) {\r\n const track = tracks[propNames[i]];\r\n if (track && !track.isFinished()) {\r\n if (forwardToLast) {\r\n track.step(this._target, 1);\r\n }\r\n // If the track has not been run for at least one frame.\r\n // The property may be stayed at the final state. when setToFinal is set true.\r\n // For example:\r\n // Animate x from 0 to 100, then animate to 150 immediately.\r\n // We want the x is translated from 0 to 150, not 100 to 150.\r\n else if (this._started === 1) {\r\n track.step(this._target, 0);\r\n }\r\n // Set track to finished\r\n track.setFinished();\r\n }\r\n }\r\n let allAborted = true;\r\n for (let i = 0; i < tracksKeys.length; i++) {\r\n if (!tracks[tracksKeys[i]].isFinished()) {\r\n allAborted = false;\r\n break;\r\n }\r\n }\r\n // Remove clip if all tracks has been aborted.\r\n if (allAborted) {\r\n this._abortedCallback();\r\n }\r\n\r\n return allAborted;\r\n }\r\n\r\n /**\r\n * Save values of final state to target.\r\n * It is mainly used in state mangement. When state is switching during animation.\r\n * We need to save final state of animation to the normal state. Not interpolated value.\r\n *\r\n * @param target\r\n * @param trackKeys\r\n * @param firstOrLast If save first frame or last frame\r\n */\r\n saveTo(\r\n target: T,\r\n trackKeys?: readonly string[],\r\n firstOrLast?: boolean\r\n ) {\r\n if (!target) { // DO nothing if target is not given.\r\n return;\r\n }\r\n\r\n trackKeys = trackKeys || this._trackKeys;\r\n\r\n for (let i = 0; i < trackKeys.length; i++) {\r\n const propName = trackKeys[i];\r\n const track = this._tracks[propName];\r\n if (!track || track.isFinished()) { // Ignore finished track.\r\n continue;\r\n }\r\n const kfs = track.keyframes;\r\n const kf = kfs[firstOrLast ? 0 : kfs.length - 1];\r\n if (kf) {\r\n // TODO CLONE?\r\n // Use raw value without parse.\r\n (target as any)[propName] = cloneValue(kf.rawValue as any);\r\n }\r\n }\r\n }\r\n\r\n // Change final value after animator has been started.\r\n // NOTE: Be careful to use it.\r\n __changeFinalValue(finalProps: Dictionary, trackKeys?: readonly string[]) {\r\n trackKeys = trackKeys || keys(finalProps);\r\n\r\n for (let i = 0; i < trackKeys.length; i++) {\r\n const propName = trackKeys[i];\r\n\r\n const track = this._tracks[propName];\r\n if (!track) {\r\n continue;\r\n }\r\n\r\n const kfs = track.keyframes;\r\n if (kfs.length > 1) {\r\n // Remove the original last kf and add again.\r\n const lastKf = kfs.pop();\r\n\r\n track.addKeyframe(lastKf.time, finalProps[propName]);\r\n // Prepare again.\r\n track.prepare(this._maxTime, track.getAdditiveTrack());\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport type AnimatorTrack = Track;","/**\r\n * Animation main class, dispatch and manage all animation controllers\r\n *\r\n */\r\n// TODO Additive animation\r\n// http://iosoteric.com/additive-animations-animatewithduration-in-ios-8/\r\n// https://developer.apple.com/videos/wwdc2014/#236\r\n\r\nimport Eventful from '../core/Eventful';\r\nimport requestAnimationFrame from './requestAnimationFrame';\r\nimport Animator from './Animator';\r\nimport Clip from './Clip';\r\n\r\nexport function getTime() {\r\n return new Date().getTime();\r\n}\r\n\r\ninterface Stage {\r\n update?: () => void\r\n}\r\n\r\ninterface AnimationOption {\r\n stage?: Stage\r\n}\r\n/**\r\n * @example\r\n * const animation = new Animation();\r\n * const obj = {\r\n * x: 100,\r\n * y: 100\r\n * };\r\n * animation.animate(node.position)\r\n * .when(1000, {\r\n * x: 500,\r\n * y: 500\r\n * })\r\n * .when(2000, {\r\n * x: 100,\r\n * y: 100\r\n * })\r\n * .start();\r\n */\r\n\r\nexport default class Animation extends Eventful {\r\n\r\n stage: Stage\r\n\r\n // Use linked list to store clip\r\n private _head: Clip\r\n private _tail: Clip\r\n\r\n private _running = false\r\n\r\n private _time = 0\r\n private _pausedTime = 0\r\n private _pauseStart = 0\r\n\r\n private _paused = false;\r\n\r\n constructor(opts?: AnimationOption) {\r\n super();\r\n\r\n opts = opts || {};\r\n\r\n this.stage = opts.stage || {};\r\n }\r\n\r\n /**\r\n * Add clip\r\n */\r\n addClip(clip: Clip) {\r\n if (clip.animation) {\r\n // Clip has been added\r\n this.removeClip(clip);\r\n }\r\n\r\n if (!this._head) {\r\n this._head = this._tail = clip;\r\n }\r\n else {\r\n this._tail.next = clip;\r\n clip.prev = this._tail;\r\n clip.next = null;\r\n this._tail = clip;\r\n }\r\n clip.animation = this;\r\n }\r\n /**\r\n * Add animator\r\n */\r\n addAnimator(animator: Animator) {\r\n animator.animation = this;\r\n const clip = animator.getClip();\r\n if (clip) {\r\n this.addClip(clip);\r\n }\r\n }\r\n /**\r\n * Delete animation clip\r\n */\r\n removeClip(clip: Clip) {\r\n if (!clip.animation) {\r\n return;\r\n }\r\n const prev = clip.prev;\r\n const next = clip.next;\r\n if (prev) {\r\n prev.next = next;\r\n }\r\n else {\r\n // Is head\r\n this._head = next;\r\n }\r\n if (next) {\r\n next.prev = prev;\r\n }\r\n else {\r\n // Is tail\r\n this._tail = prev;\r\n }\r\n clip.next = clip.prev = clip.animation = null;\r\n }\r\n\r\n /**\r\n * Delete animation clip\r\n */\r\n removeAnimator(animator: Animator) {\r\n const clip = animator.getClip();\r\n if (clip) {\r\n this.removeClip(clip);\r\n }\r\n animator.animation = null;\r\n }\r\n\r\n update(notTriggerFrameAndStageUpdate?: boolean) {\r\n const time = getTime() - this._pausedTime;\r\n const delta = time - this._time;\r\n let clip = this._head;\r\n\r\n while (clip) {\r\n // Save the nextClip before step.\r\n // So the loop will not been affected if the clip is removed in the callback\r\n const nextClip = clip.next;\r\n let finished = clip.step(time, delta);\r\n if (finished) {\r\n clip.ondestroy();\r\n this.removeClip(clip);\r\n clip = nextClip;\r\n }\r\n else {\r\n clip = nextClip;\r\n }\r\n }\r\n\r\n this._time = time;\r\n\r\n if (!notTriggerFrameAndStageUpdate) {\r\n\r\n // 'frame' should be triggered before stage, because upper application\r\n // depends on the sequence (e.g., echarts-stream and finish\r\n // event judge)\r\n this.trigger('frame', delta);\r\n\r\n this.stage.update && this.stage.update();\r\n }\r\n }\r\n\r\n _startLoop() {\r\n const self = this;\r\n\r\n this._running = true;\r\n\r\n function step() {\r\n if (self._running) {\r\n requestAnimationFrame(step);\r\n !self._paused && self.update();\r\n }\r\n }\r\n\r\n requestAnimationFrame(step);\r\n }\r\n\r\n /**\r\n * Start animation.\r\n */\r\n start() {\r\n if (this._running) {\r\n return;\r\n }\r\n\r\n this._time = getTime();\r\n this._pausedTime = 0;\r\n\r\n this._startLoop();\r\n }\r\n\r\n /**\r\n * Stop animation.\r\n */\r\n stop() {\r\n this._running = false;\r\n }\r\n\r\n /**\r\n * Pause animation.\r\n */\r\n pause() {\r\n if (!this._paused) {\r\n this._pauseStart = getTime();\r\n this._paused = true;\r\n }\r\n }\r\n\r\n /**\r\n * Resume animation.\r\n */\r\n resume() {\r\n if (this._paused) {\r\n this._pausedTime += getTime() - this._pauseStart;\r\n this._paused = false;\r\n }\r\n }\r\n\r\n /**\r\n * Clear animation.\r\n */\r\n clear() {\r\n let clip = this._head;\r\n\r\n while (clip) {\r\n let nextClip = clip.next;\r\n clip.prev = clip.next = clip.animation = null;\r\n clip = nextClip;\r\n }\r\n\r\n this._head = this._tail = null;\r\n }\r\n\r\n /**\r\n * Whether animation finished.\r\n */\r\n isFinished() {\r\n return this._head == null;\r\n }\r\n\r\n /**\r\n * Creat animator for a target, whose props can be animated.\r\n */\r\n // TODO Gap\r\n animate(target: T, options: {\r\n loop?: boolean // Whether loop animation\r\n }) {\r\n options = options || {};\r\n\r\n // Start animation loop\r\n this.start();\r\n\r\n const animator = new Animator(\r\n target,\r\n options.loop\r\n );\r\n\r\n this.addAnimator(animator);\r\n\r\n return animator;\r\n }\r\n}","\n/* global document */\n\nimport {\n addEventListener,\n removeEventListener,\n normalizeEvent,\n getNativeEvent\n} from '../core/event';\nimport * as zrUtil from '../core/util';\nimport Eventful from '../core/Eventful';\nimport env from '../core/env';\nimport { Dictionary, ZRRawEvent, ZRRawMouseEvent } from '../core/types';\nimport { VectorArray } from '../core/vector';\nimport Handler from '../Handler';\n\ntype DomHandlersMap = Dictionary<(this: HandlerDomProxy, event: ZRRawEvent) => void>\n\ntype DomExtended = Node & {\n domBelongToZr: boolean\n}\n\nconst TOUCH_CLICK_DELAY = 300;\n\nconst globalEventSupported = env.domSupported;\n\n\nconst localNativeListenerNames = (function () {\n const mouseHandlerNames = [\n 'click', 'dblclick', 'mousewheel', 'wheel', 'mouseout',\n 'mouseup', 'mousedown', 'mousemove', 'contextmenu'\n ];\n const touchHandlerNames = [\n 'touchstart', 'touchend', 'touchmove'\n ];\n const pointerEventNameMap = {\n pointerdown: 1, pointerup: 1, pointermove: 1, pointerout: 1\n };\n const pointerHandlerNames = zrUtil.map(mouseHandlerNames, function (name) {\n const nm = name.replace('mouse', 'pointer');\n return pointerEventNameMap.hasOwnProperty(nm) ? nm : name;\n });\n\n return {\n mouse: mouseHandlerNames,\n touch: touchHandlerNames,\n pointer: pointerHandlerNames\n };\n})();\n\nconst globalNativeListenerNames = {\n mouse: ['mousemove', 'mouseup'],\n pointer: ['pointermove', 'pointerup']\n};\n\nlet wheelEventSupported = false;\n\n\n// Although firfox has 'DOMMouseScroll' event and do not has 'mousewheel' event,\n// the 'DOMMouseScroll' event do not performe the same behavior on touch pad device\n// (like on Mac) ('DOMMouseScroll' will be triggered only if a big wheel delta).\n// So we should not use it.\n// function eventNameFix(name: string) {\n// return (name === 'mousewheel' && env.browser.firefox) ? 'DOMMouseScroll' : name;\n// }\n\nfunction isPointerFromTouch(event: ZRRawEvent) {\n const pointerType = (event as any).pointerType;\n return pointerType === 'pen' || pointerType === 'touch';\n}\n\n// function useMSGuesture(handlerProxy, event) {\n// return isPointerFromTouch(event) && !!handlerProxy._msGesture;\n// }\n\n// function onMSGestureChange(proxy, event) {\n// if (event.translationX || event.translationY) {\n// // mousemove is carried by MSGesture to reduce the sensitivity.\n// proxy.handler.dispatchToElement(event.target, 'mousemove', event);\n// }\n// if (event.scale !== 1) {\n// event.pinchX = event.offsetX;\n// event.pinchY = event.offsetY;\n// event.pinchScale = event.scale;\n// proxy.handler.dispatchToElement(event.target, 'pinch', event);\n// }\n// }\n\n/**\n * Prevent mouse event from being dispatched after Touch Events action\n * @see \n * 1. Mobile browsers dispatch mouse events 300ms after touchend.\n * 2. Chrome for Android dispatch mousedown for long-touch about 650ms\n * Result: Blocking Mouse Events for 700ms.\n *\n * @param {DOMHandlerScope} scope\n */\nfunction setTouchTimer(scope: DOMHandlerScope) {\n scope.touching = true;\n if (scope.touchTimer != null) {\n clearTimeout(scope.touchTimer);\n scope.touchTimer = null;\n }\n scope.touchTimer = setTimeout(function () {\n scope.touching = false;\n scope.touchTimer = null;\n }, 700);\n}\n\n// Mark touch, which is useful in distinguish touch and\n// mouse event in upper applicatoin.\nfunction markTouch(event: ZRRawEvent) {\n event && (event.zrByTouch = true);\n}\n\n\n// function markTriggeredFromLocal(event) {\n// event && (event.__zrIsFromLocal = true);\n// }\n\n// function isTriggeredFromLocal(instance, event) {\n// return !!(event && event.__zrIsFromLocal);\n// }\n\nfunction normalizeGlobalEvent(instance: HandlerDomProxy, event: ZRRawEvent) {\n // offsetX, offsetY still need to be calculated. They are necessary in the event\n // handlers of the upper applications. Set `true` to force calculate them.\n return normalizeEvent(\n instance.dom,\n // TODO ANY TYPE\n new FakeGlobalEvent(instance, event) as any as ZRRawEvent,\n true\n );\n}\n\n/**\n * Detect whether the given el is in `painterRoot`.\n */\nfunction isLocalEl(instance: HandlerDomProxy, el: Node) {\n let elTmp = el;\n let isLocal = false;\n while (elTmp && elTmp.nodeType !== 9\n && !(\n isLocal = (elTmp as DomExtended).domBelongToZr\n || (elTmp !== el && elTmp === instance.painterRoot)\n )\n ) {\n elTmp = elTmp.parentNode;\n }\n return isLocal;\n}\n\n/**\n * Make a fake event but not change the original event,\n * because the global event probably be used by other\n * listeners not belonging to zrender.\n * @class\n */\nclass FakeGlobalEvent {\n type: string\n target: HTMLElement\n currentTarget: HTMLElement\n\n pointerType: string\n clientX: number\n clientY: number\n\n constructor(instance: HandlerDomProxy, event: ZRRawEvent) {\n this.type = event.type;\n this.target = this.currentTarget = instance.dom;\n this.pointerType = (event as any).pointerType;\n // Necessray for the force calculation of zrX, zrY\n this.clientX = (event as ZRRawMouseEvent).clientX;\n this.clientY = (event as ZRRawMouseEvent).clientY;\n // Because we do not mount global listeners to touch events,\n // we do not copy `targetTouches` and `changedTouches` here.\n }\n\n // we make the default methods on the event do nothing,\n // otherwise it is dangerous. See more details in\n // [DRAG_OUTSIDE] in `Handler.js`.\n stopPropagation = zrUtil.noop\n stopImmediatePropagation = zrUtil.noop\n preventDefault = zrUtil.noop\n}\n\n\n/**\n * Local DOM Handlers\n * @this {HandlerProxy}\n */\nconst localDOMHandlers: DomHandlersMap = {\n\n mousedown(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n this.__mayPointerCapture = [event.zrX, event.zrY];\n\n this.trigger('mousedown', event);\n },\n\n mousemove(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n const downPoint = this.__mayPointerCapture;\n if (downPoint && (event.zrX !== downPoint[0] || event.zrY !== downPoint[1])) {\n this.__togglePointerCapture(true);\n }\n\n this.trigger('mousemove', event);\n },\n\n mouseup(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n this.__togglePointerCapture(false);\n\n this.trigger('mouseup', event);\n },\n\n mouseout(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n // There might be some doms created by upper layer application\n // at the same level of painter.getViewportRoot() (e.g., tooltip\n // dom created by echarts), where 'globalout' event should not\n // be triggered when mouse enters these doms. (But 'mouseout'\n // should be triggered at the original hovered element as usual).\n const element = (event as any).toElement || (event as ZRRawMouseEvent).relatedTarget;\n\n // For SVG rendering, there are SVG elements inside `this.dom`.\n // (especially in decal case). Should not to handle those \"mouseout\"..\n if (!isLocalEl(this, element)) {\n // Similarly to the browser did on `document` and touch event,\n // `globalout` will be delayed to final pointer cature release.\n if (this.__pointerCapturing) {\n event.zrEventControl = 'no_globalout';\n }\n\n this.trigger('mouseout', event);\n }\n },\n\n wheel(event: ZRRawEvent) {\n // Morden agent has supported event `wheel` instead of `mousewheel`.\n // About the polyfill of the props \"delta\", see \"arc/core/event.ts\".\n\n // Firefox only support `wheel` rather than `mousewheel`. Although firfox has been supporting\n // event `DOMMouseScroll`, it do not act the same behavior as `wheel` on touch pad device\n // like on Mac, where `DOMMouseScroll` will be triggered only if a big wheel delta occurs,\n // and it results in no chance to \"preventDefault\". So we should not use `DOMMouseScroll`.\n\n wheelEventSupported = true;\n event = normalizeEvent(this.dom, event);\n // Follow the definition of the previous version, the zrender event name is still 'mousewheel'.\n this.trigger('mousewheel', event);\n },\n\n mousewheel(event: ZRRawEvent) {\n // IE8- and some other lagacy agent do not support event `wheel`, so we still listen\n // to the legacy event `mouseevent`.\n // Typically if event `wheel` is supported and the handler has been mounted on a\n // DOM element, the legacy `mousewheel` event will not be triggered (Chrome and Safari).\n // But we still do this guard to avoid to duplicated handle.\n if (wheelEventSupported) {\n return;\n }\n event = normalizeEvent(this.dom, event);\n this.trigger('mousewheel', event);\n },\n\n touchstart(event: ZRRawEvent) {\n // Default mouse behaviour should not be disabled here.\n // For example, page may needs to be slided.\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.__lastTouchMoment = new Date();\n\n this.handler.processGesture(event, 'start');\n\n // For consistent event listener for both touch device and mouse device,\n // we simulate \"mouseover-->mousedown\" in touch device. So we trigger\n // `mousemove` here (to trigger `mouseover` inside), and then trigger\n // `mousedown`.\n localDOMHandlers.mousemove.call(this, event);\n localDOMHandlers.mousedown.call(this, event);\n },\n\n touchmove(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.handler.processGesture(event, 'change');\n\n // Mouse move should always be triggered no matter whether\n // there is gestrue event, because mouse move and pinch may\n // be used at the same time.\n localDOMHandlers.mousemove.call(this, event);\n },\n\n touchend(event: ZRRawEvent) {\n event = normalizeEvent(this.dom, event);\n\n markTouch(event);\n\n this.handler.processGesture(event, 'end');\n\n localDOMHandlers.mouseup.call(this, event);\n\n // Do not trigger `mouseout` here, in spite of `mousemove`(`mouseover`) is\n // triggered in `touchstart`. This seems to be illogical, but by this mechanism,\n // we can conveniently implement \"hover style\" in both PC and touch device just\n // by listening to `mouseover` to add \"hover style\" and listening to `mouseout`\n // to remove \"hover style\" on an element, without any additional code for\n // compatibility. (`mouseout` will not be triggered in `touchend`, so \"hover\n // style\" will remain for user view)\n\n // click event should always be triggered no matter whether\n // there is gestrue event. System click can not be prevented.\n if (+new Date() - (+this.__lastTouchMoment) < TOUCH_CLICK_DELAY) {\n localDOMHandlers.click.call(this, event);\n }\n },\n\n pointerdown(event: ZRRawEvent) {\n localDOMHandlers.mousedown.call(this, event);\n\n // if (useMSGuesture(this, event)) {\n // this._msGesture.addPointer(event.pointerId);\n // }\n },\n\n pointermove(event: ZRRawEvent) {\n // FIXME\n // pointermove is so sensitive that it always triggered when\n // tap(click) on touch screen, which affect some judgement in\n // upper application. So, we don't support mousemove on MS touch\n // device yet.\n if (!isPointerFromTouch(event)) {\n localDOMHandlers.mousemove.call(this, event);\n }\n },\n\n pointerup(event: ZRRawEvent) {\n localDOMHandlers.mouseup.call(this, event);\n },\n\n pointerout(event: ZRRawEvent) {\n // pointerout will be triggered when tap on touch screen\n // (IE11+/Edge on MS Surface) after click event triggered,\n // which is inconsistent with the mousout behavior we defined\n // in touchend. So we unify them.\n // (check localDOMHandlers.touchend for detailed explanation)\n if (!isPointerFromTouch(event)) {\n localDOMHandlers.mouseout.call(this, event);\n }\n }\n\n};\n\n/**\n * Othere DOM UI Event handlers for zr dom.\n * @this {HandlerProxy}\n */\nzrUtil.each(['click', 'dblclick', 'contextmenu'], function (name) {\n localDOMHandlers[name] = function (event) {\n event = normalizeEvent(this.dom, event);\n this.trigger(name, event);\n };\n});\n\n\n/**\n * DOM UI Event handlers for global page.\n *\n * [Caution]:\n * those handlers should both support in capture phase and bubble phase!\n */\nconst globalDOMHandlers: DomHandlersMap = {\n\n pointermove: function (event: ZRRawEvent) {\n // FIXME\n // pointermove is so sensitive that it always triggered when\n // tap(click) on touch screen, which affect some judgement in\n // upper application. So, we don't support mousemove on MS touch\n // device yet.\n if (!isPointerFromTouch(event)) {\n globalDOMHandlers.mousemove.call(this, event);\n }\n },\n\n pointerup: function (event: ZRRawEvent) {\n globalDOMHandlers.mouseup.call(this, event);\n },\n\n mousemove: function (event: ZRRawEvent) {\n this.trigger('mousemove', event);\n },\n\n mouseup: function (event: ZRRawEvent) {\n const pointerCaptureReleasing = this.__pointerCapturing;\n\n this.__togglePointerCapture(false);\n\n this.trigger('mouseup', event);\n\n if (pointerCaptureReleasing) {\n event.zrEventControl = 'only_globalout';\n this.trigger('mouseout', event);\n }\n }\n\n};\n\n\nfunction mountLocalDOMEventListeners(instance: HandlerDomProxy, scope: DOMHandlerScope) {\n const domHandlers = scope.domHandlers;\n\n if (env.pointerEventsSupported) { // Only IE11+/Edge\n // 1. On devices that both enable touch and mouse (e.g., MS Surface and lenovo X240),\n // IE11+/Edge do not trigger touch event, but trigger pointer event and mouse event\n // at the same time.\n // 2. On MS Surface, it probablely only trigger mousedown but no mouseup when tap on\n // screen, which do not occurs in pointer event.\n // So we use pointer event to both detect touch gesture and mouse behavior.\n zrUtil.each(localNativeListenerNames.pointer, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n });\n });\n\n // FIXME\n // Note: MS Gesture require CSS touch-action set. But touch-action is not reliable,\n // which does not prevent defuault behavior occasionally (which may cause view port\n // zoomed in but use can not zoom it back). And event.preventDefault() does not work.\n // So we have to not to use MSGesture and not to support touchmove and pinch on MS\n // touch screen. And we only support click behavior on MS touch screen now.\n\n // MS Gesture Event is only supported on IE11+/Edge and on Windows 8+.\n // We don't support touch on IE on win7.\n // See \n // if (typeof MSGesture === 'function') {\n // (this._msGesture = new MSGesture()).target = dom; // jshint ignore:line\n // dom.addEventListener('MSGestureChange', onMSGestureChange);\n // }\n }\n else {\n if (env.touchEventsSupported) {\n zrUtil.each(localNativeListenerNames.touch, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n setTouchTimer(scope);\n });\n });\n // Handler of 'mouseout' event is needed in touch mode, which will be mounted below.\n // addEventListener(root, 'mouseout', this._mouseoutHandler);\n }\n\n // 1. Considering some devices that both enable touch and mouse event (like on MS Surface\n // and lenovo X240, @see #2350), we make mouse event be always listened, otherwise\n // mouse event can not be handle in those devices.\n // 2. On MS Surface, Chrome will trigger both touch event and mouse event. How to prevent\n // mouseevent after touch event triggered, see `setTouchTimer`.\n zrUtil.each(localNativeListenerNames.mouse, function (nativeEventName) {\n mountSingleDOMEventListener(scope, nativeEventName, function (event: ZRRawEvent) {\n event = getNativeEvent(event);\n if (!scope.touching) {\n // markTriggeredFromLocal(event);\n domHandlers[nativeEventName].call(instance, event);\n }\n });\n });\n }\n}\n\nfunction mountGlobalDOMEventListeners(instance: HandlerDomProxy, scope: DOMHandlerScope) {\n // Only IE11+/Edge. See the comment in `mountLocalDOMEventListeners`.\n if (env.pointerEventsSupported) {\n zrUtil.each(globalNativeListenerNames.pointer, mount);\n }\n // Touch event has implemented \"drag outside\" so we do not mount global listener for touch event.\n // (see https://www.w3.org/TR/touch-events/#the-touchmove-event) (see also `DRAG_OUTSIDE`).\n // We do not consider \"both-support-touch-and-mouse device\" for this feature (see the comment of\n // `mountLocalDOMEventListeners`) to avoid bugs util some requirements come.\n else if (!env.touchEventsSupported) {\n zrUtil.each(globalNativeListenerNames.mouse, mount);\n }\n\n function mount(nativeEventName: string) {\n function nativeEventListener(event: ZRRawEvent) {\n event = getNativeEvent(event);\n // See the reason in [DRAG_OUTSIDE] in `Handler.js`\n // This checking supports both `useCapture` or not.\n // PENDING: if there is performance issue in some devices,\n // we probably can not use `useCapture` and change a easier\n // to judes whether local (mark).\n if (!isLocalEl(instance, event.target as Node)) {\n event = normalizeGlobalEvent(instance, event);\n scope.domHandlers[nativeEventName].call(instance, event);\n }\n }\n mountSingleDOMEventListener(\n scope, nativeEventName, nativeEventListener,\n {capture: true} // See [DRAG_OUTSIDE] in `Handler.js`\n );\n }\n}\n\nfunction mountSingleDOMEventListener(\n scope: DOMHandlerScope,\n nativeEventName: string,\n listener: EventListener,\n opt?: boolean | AddEventListenerOptions\n) {\n scope.mounted[nativeEventName] = listener;\n scope.listenerOpts[nativeEventName] = opt;\n addEventListener(scope.domTarget, nativeEventName, listener, opt);\n}\n\nfunction unmountDOMEventListeners(scope: DOMHandlerScope) {\n const mounted = scope.mounted;\n for (let nativeEventName in mounted) {\n if (mounted.hasOwnProperty(nativeEventName)) {\n removeEventListener(\n scope.domTarget, nativeEventName, mounted[nativeEventName],\n scope.listenerOpts[nativeEventName]\n );\n }\n }\n scope.mounted = {};\n}\n\n\nclass DOMHandlerScope {\n domTarget: HTMLElement | HTMLDocument\n domHandlers: DomHandlersMap\n\n // Key: eventName, value: mounted handler functions.\n // Used for unmount.\n mounted: Dictionary = {};\n\n listenerOpts: Dictionary = {};\n\n touchTimer: ReturnType;\n touching = false;\n\n constructor(\n domTarget: HTMLElement | HTMLDocument,\n domHandlers: DomHandlersMap\n ) {\n this.domTarget = domTarget;\n this.domHandlers = domHandlers;\n\n }\n}\n\n\nexport default class HandlerDomProxy extends Eventful {\n\n dom: HTMLElement\n painterRoot: HTMLElement\n\n handler: Handler\n\n private _localHandlerScope: DOMHandlerScope\n private _globalHandlerScope: DOMHandlerScope\n\n __lastTouchMoment: Date\n\n // See [DRAG_OUTSIDE] in `Handler.ts`.\n __pointerCapturing = false\n // [x, y]\n __mayPointerCapture: VectorArray\n\n\n constructor(dom: HTMLElement, painterRoot: HTMLElement) {\n super();\n\n this.dom = dom;\n this.painterRoot = painterRoot;\n\n this._localHandlerScope = new DOMHandlerScope(dom, localDOMHandlers);\n\n if (globalEventSupported) {\n this._globalHandlerScope = new DOMHandlerScope(document, globalDOMHandlers);\n }\n\n mountLocalDOMEventListeners(this, this._localHandlerScope);\n }\n\n dispose() {\n unmountDOMEventListeners(this._localHandlerScope);\n if (globalEventSupported) {\n unmountDOMEventListeners(this._globalHandlerScope);\n }\n }\n\n setCursor(cursorStyle: string) {\n this.dom.style && (this.dom.style.cursor = cursorStyle || 'default');\n }\n\n /**\n * See [DRAG_OUTSIDE] in `Handler.js`.\n * @implement\n * @param isPointerCapturing Should never be `null`/`undefined`.\n * `true`: start to capture pointer if it is not capturing.\n * `false`: end the capture if it is capturing.\n */\n __togglePointerCapture(isPointerCapturing?: boolean) {\n this.__mayPointerCapture = null;\n\n if (globalEventSupported\n && ((+this.__pointerCapturing) ^ (+isPointerCapturing))\n ) {\n this.__pointerCapturing = isPointerCapturing;\n\n const globalHandlerScope = this._globalHandlerScope;\n isPointerCapturing\n ? mountGlobalDOMEventListeners(this, globalHandlerScope)\n : unmountDOMEventListeners(globalHandlerScope);\n }\n }\n}\n\nexport interface HandlerProxyInterface extends Eventful {\n handler: Handler\n dispose: () => void\n setCursor: (cursorStyle?: string) => void\n}","import env from './core/env';\n\nlet dpr = 1;\n\n// If in browser environment\nif (env.hasGlobalWindow) {\n dpr = Math.max(\n window.devicePixelRatio\n || (window.screen && (window.screen as any).deviceXDPI / (window.screen as any).logicalXDPI)\n || 1, 1\n );\n}\n\n/**\n * Debug log mode:\n * 0: Do nothing, for release.\n * 1: console.error, for debug.\n */\nexport const debugMode = 0;\n\n// retina 屏幕优化\nexport const devicePixelRatio = dpr;\n\n\n/**\n * Determine when to turn on dark mode based on the luminance of backgroundColor\n */\nexport const DARK_MODE_THRESHOLD = 0.4;\n\n/**\n * Color of default dark label.\n */\nexport const DARK_LABEL_COLOR = '#333';\n\n/**\n * Color of default light label.\n */\nexport const LIGHT_LABEL_COLOR = '#ccc';\n\n/**\n * Color of default light label.\n */\nexport const LIGHTER_LABEL_COLOR = '#eee';\n","import * as matrix from './matrix';\nimport * as vector from './vector';\n\nconst mIdentity = matrix.identity;\n\nconst EPSILON = 5e-5;\n\nfunction isNotAroundZero(val: number) {\n return val > EPSILON || val < -EPSILON;\n}\n\nconst scaleTmp: vector.VectorArray = [];\nconst tmpTransform: matrix.MatrixArray = [];\nconst originTransform = matrix.create();\nconst abs = Math.abs;\n\nclass Transformable {\n\n parent: Transformable\n\n x: number\n y: number\n\n scaleX: number\n scaleY: number\n\n skewX: number\n skewY: number\n\n rotation: number\n\n /**\n * Will translated the element to the anchor position before applying other transforms.\n */\n anchorX: number\n anchorY: number\n /**\n * Origin of scale, rotation, skew\n */\n originX: number\n originY: number\n\n /**\n * Scale ratio\n */\n globalScaleRatio: number\n\n transform: matrix.MatrixArray\n invTransform: matrix.MatrixArray\n\n /**\n * Get computed local transform\n */\n getLocalTransform(m?: matrix.MatrixArray) {\n return Transformable.getLocalTransform(this, m);\n }\n\n /**\n * Set position from array\n */\n setPosition(arr: number[]) {\n this.x = arr[0];\n this.y = arr[1];\n }\n /**\n * Set scale from array\n */\n setScale(arr: number[]) {\n this.scaleX = arr[0];\n this.scaleY = arr[1];\n }\n\n /**\n * Set skew from array\n */\n setSkew(arr: number[]) {\n this.skewX = arr[0];\n this.skewY = arr[1];\n }\n\n /**\n * Set origin from array\n */\n setOrigin(arr: number[]) {\n this.originX = arr[0];\n this.originY = arr[1];\n }\n\n /**\n * If needs to compute transform\n */\n needLocalTransform(): boolean {\n return isNotAroundZero(this.rotation)\n || isNotAroundZero(this.x)\n || isNotAroundZero(this.y)\n || isNotAroundZero(this.scaleX - 1)\n || isNotAroundZero(this.scaleY - 1)\n || isNotAroundZero(this.skewX)\n || isNotAroundZero(this.skewY);\n }\n\n /**\n * Update global transform\n */\n updateTransform() {\n const parentTransform = this.parent && this.parent.transform;\n const needLocalTransform = this.needLocalTransform();\n\n let m = this.transform;\n if (!(needLocalTransform || parentTransform)) {\n if (m) {\n mIdentity(m);\n // reset invTransform\n this.invTransform = null;\n }\n return;\n }\n\n m = m || matrix.create();\n\n if (needLocalTransform) {\n this.getLocalTransform(m);\n }\n else {\n mIdentity(m);\n }\n\n // 应用父节点变换\n if (parentTransform) {\n if (needLocalTransform) {\n matrix.mul(m, parentTransform, m);\n }\n else {\n matrix.copy(m, parentTransform);\n }\n }\n // 保存这个变换矩阵\n this.transform = m;\n\n this._resolveGlobalScaleRatio(m);\n }\n\n private _resolveGlobalScaleRatio(m: matrix.MatrixArray) {\n const globalScaleRatio = this.globalScaleRatio;\n if (globalScaleRatio != null && globalScaleRatio !== 1) {\n this.getGlobalScale(scaleTmp);\n const relX = scaleTmp[0] < 0 ? -1 : 1;\n const relY = scaleTmp[1] < 0 ? -1 : 1;\n const sx = ((scaleTmp[0] - relX) * globalScaleRatio + relX) / scaleTmp[0] || 0;\n const sy = ((scaleTmp[1] - relY) * globalScaleRatio + relY) / scaleTmp[1] || 0;\n\n m[0] *= sx;\n m[1] *= sx;\n m[2] *= sy;\n m[3] *= sy;\n }\n\n this.invTransform = this.invTransform || matrix.create();\n matrix.invert(this.invTransform, m);\n }\n\n /**\n * Get computed global transform\n * NOTE: this method will force update transform on all ancestors.\n * Please be aware of the potential performance cost.\n */\n getComputedTransform() {\n let transformNode: Transformable = this;\n const ancestors: Transformable[] = [];\n while (transformNode) {\n ancestors.push(transformNode);\n transformNode = transformNode.parent;\n }\n\n // Update from topdown.\n while (transformNode = ancestors.pop()) {\n transformNode.updateTransform();\n }\n\n return this.transform;\n }\n\n setLocalTransform(m: vector.VectorArray) {\n if (!m) {\n // TODO return or set identity?\n return;\n }\n let sx = m[0] * m[0] + m[1] * m[1];\n let sy = m[2] * m[2] + m[3] * m[3];\n\n const rotation = Math.atan2(m[1], m[0]);\n\n const shearX = Math.PI / 2 + rotation - Math.atan2(m[3], m[2]);\n sy = Math.sqrt(sy) * Math.cos(shearX);\n sx = Math.sqrt(sx);\n\n this.skewX = shearX;\n this.skewY = 0;\n this.rotation = -rotation;\n\n this.x = +m[4];\n this.y = +m[5];\n this.scaleX = sx;\n this.scaleY = sy;\n\n this.originX = 0;\n this.originY = 0;\n }\n /**\n * 分解`transform`矩阵到`position`, `rotation`, `scale`\n */\n decomposeTransform() {\n if (!this.transform) {\n return;\n }\n const parent = this.parent;\n let m = this.transform;\n if (parent && parent.transform) {\n // Get local transform and decompose them to position, scale, rotation\n parent.invTransform = parent.invTransform || matrix.create();\n matrix.mul(tmpTransform, parent.invTransform, m);\n m = tmpTransform;\n }\n const ox = this.originX;\n const oy = this.originY;\n if (ox || oy) {\n originTransform[4] = ox;\n originTransform[5] = oy;\n matrix.mul(tmpTransform, m, originTransform);\n tmpTransform[4] -= ox;\n tmpTransform[5] -= oy;\n m = tmpTransform;\n }\n\n this.setLocalTransform(m);\n }\n\n /**\n * Get global scale\n */\n getGlobalScale(out?: vector.VectorArray): vector.VectorArray {\n const m = this.transform;\n out = out || [];\n if (!m) {\n out[0] = 1;\n out[1] = 1;\n return out;\n }\n out[0] = Math.sqrt(m[0] * m[0] + m[1] * m[1]);\n out[1] = Math.sqrt(m[2] * m[2] + m[3] * m[3]);\n if (m[0] < 0) {\n out[0] = -out[0];\n }\n if (m[3] < 0) {\n out[1] = -out[1];\n }\n return out;\n }\n /**\n * 变换坐标位置到 shape 的局部坐标空间\n */\n transformCoordToLocal(x: number, y: number): number[] {\n const v2 = [x, y];\n const invTransform = this.invTransform;\n if (invTransform) {\n vector.applyTransform(v2, v2, invTransform);\n }\n return v2;\n }\n\n /**\n * 变换局部坐标位置到全局坐标空间\n */\n transformCoordToGlobal(x: number, y: number): number[] {\n const v2 = [x, y];\n const transform = this.transform;\n if (transform) {\n vector.applyTransform(v2, v2, transform);\n }\n return v2;\n }\n\n\n getLineScale() {\n const m = this.transform;\n // Get the line scale.\n // Determinant of `m` means how much the area is enlarged by the\n // transformation. So its square root can be used as a scale factor\n // for width.\n return m && abs(m[0] - 1) > 1e-10 && abs(m[3] - 1) > 1e-10\n ? Math.sqrt(abs(m[0] * m[3] - m[2] * m[1]))\n : 1;\n }\n\n copyTransform(source: Transformable) {\n copyTransform(this, source);\n }\n\n\n static getLocalTransform(target: Transformable, m?: matrix.MatrixArray): matrix.MatrixArray {\n m = m || [];\n\n const ox = target.originX || 0;\n const oy = target.originY || 0;\n const sx = target.scaleX;\n const sy = target.scaleY;\n const ax = target.anchorX;\n const ay = target.anchorY;\n const rotation = target.rotation || 0;\n const x = target.x;\n const y = target.y;\n const skewX = target.skewX ? Math.tan(target.skewX) : 0;\n // TODO: zrender use different hand in coordinate system and y axis is inversed.\n const skewY = target.skewY ? Math.tan(-target.skewY) : 0;\n\n // The order of transform (-anchor * -origin * scale * skew * rotate * origin * translate).\n // We merge (-origin * scale * skew) into one. Also did identity in these operations.\n // origin\n if (ox || oy || ax || ay) {\n const dx = ox + ax;\n const dy = oy + ay;\n m[4] = -dx * sx - skewX * dy * sy;\n m[5] = -dy * sy - skewY * dx * sx;\n }\n else {\n m[4] = m[5] = 0;\n }\n // scale\n m[0] = sx;\n m[3] = sy;\n // skew\n m[1] = skewY * sx;\n m[2] = skewX * sy;\n\n // Apply rotation\n rotation && matrix.rotate(m, m, rotation);\n\n // Translate back from origin and apply translation\n m[4] += ox + x;\n m[5] += oy + y;\n\n return m;\n }\n\n private static initDefaultProps = (function () {\n const proto = Transformable.prototype;\n proto.scaleX =\n proto.scaleY =\n proto.globalScaleRatio = 1;\n proto.x =\n proto.y =\n proto.originX =\n proto.originY =\n proto.skewX =\n proto.skewY =\n proto.rotation =\n proto.anchorX =\n proto.anchorY = 0;\n })()\n};\n\nexport const TRANSFORMABLE_PROPS = [\n 'x', 'y', 'originX', 'originY', 'anchorX', 'anchorY', 'rotation', 'scaleX', 'scaleY', 'skewX', 'skewY'\n] as const;\n\nexport type TransformProp = (typeof TRANSFORMABLE_PROPS)[number]\n\nexport function copyTransform(\n target: Partial>,\n source: Pick\n) {\n for (let i = 0; i < TRANSFORMABLE_PROPS.length; i++) {\n const propName = TRANSFORMABLE_PROPS[i];\n target[propName] = source[propName];\n }\n}\n\nexport default Transformable;","import BoundingRect, { RectLike } from '../core/BoundingRect';\r\nimport { Dictionary, TextAlign, TextVerticalAlign, BuiltinTextPosition } from '../core/types';\r\nimport LRU from '../core/LRU';\r\nimport { DEFAULT_FONT, platformApi } from '../core/platform';\r\n\r\nlet textWidthCache: Dictionary> = {};\r\n\r\nexport function getWidth(text: string, font: string): number {\r\n font = font || DEFAULT_FONT;\r\n let cacheOfFont = textWidthCache[font];\r\n if (!cacheOfFont) {\r\n cacheOfFont = textWidthCache[font] = new LRU(500);\r\n }\r\n let width = cacheOfFont.get(text);\r\n if (width == null) {\r\n width = platformApi.measureText(text, font).width;\r\n cacheOfFont.put(text, width);\r\n }\r\n\r\n return width;\r\n}\r\n\r\n/**\r\n *\r\n * Get bounding rect for inner usage(TSpan)\r\n * Which not include text newline.\r\n */\r\nexport function innerGetBoundingRect(\r\n text: string,\r\n font: string,\r\n textAlign?: TextAlign,\r\n textBaseline?: TextVerticalAlign\r\n): BoundingRect {\r\n const width = getWidth(text, font);\r\n const height = getLineHeight(font);\r\n\r\n const x = adjustTextX(0, width, textAlign);\r\n const y = adjustTextY(0, height, textBaseline);\r\n\r\n const rect = new BoundingRect(x, y, width, height);\r\n\r\n return rect;\r\n}\r\n\r\n/**\r\n *\r\n * Get bounding rect for outer usage. Compatitable with old implementation\r\n * Which includes text newline.\r\n */\r\nexport function getBoundingRect(\r\n text: string,\r\n font: string,\r\n textAlign?: TextAlign,\r\n textBaseline?: TextVerticalAlign\r\n) {\r\n const textLines = ((text || '') + '').split('\\n');\r\n const len = textLines.length;\r\n if (len === 1) {\r\n return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);\r\n }\r\n else {\r\n const uniondRect = new BoundingRect(0, 0, 0, 0);\r\n for (let i = 0; i < textLines.length; i++) {\r\n const rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);\r\n i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);\r\n }\r\n return uniondRect;\r\n }\r\n}\r\n\r\nexport function adjustTextX(x: number, width: number, textAlign: TextAlign): number {\r\n // TODO Right to left language\r\n if (textAlign === 'right') {\r\n x -= width;\r\n }\r\n else if (textAlign === 'center') {\r\n x -= width / 2;\r\n }\r\n return x;\r\n}\r\n\r\nexport function adjustTextY(y: number, height: number, verticalAlign: TextVerticalAlign): number {\r\n if (verticalAlign === 'middle') {\r\n y -= height / 2;\r\n }\r\n else if (verticalAlign === 'bottom') {\r\n y -= height;\r\n }\r\n return y;\r\n}\r\n\r\n\r\nexport function getLineHeight(font?: string): number {\r\n // FIXME A rough approach.\r\n return getWidth('国', font);\r\n}\r\n\r\nexport function measureText(text: string, font?: string): {\r\n width: number\r\n} {\r\n return platformApi.measureText(text, font);\r\n}\r\n\r\n\r\nexport function parsePercent(value: number | string, maxValue: number): number {\r\n if (typeof value === 'string') {\r\n if (value.lastIndexOf('%') >= 0) {\r\n return parseFloat(value) / 100 * maxValue;\r\n }\r\n return parseFloat(value);\r\n }\r\n return value;\r\n}\r\n\r\nexport interface TextPositionCalculationResult {\r\n x: number\r\n y: number\r\n align: TextAlign\r\n verticalAlign: TextVerticalAlign\r\n}\r\n/**\r\n * Follow same interface to `Displayable.prototype.calculateTextPosition`.\r\n * @public\r\n * @param out Prepared out object. If not input, auto created in the method.\r\n * @param style where `textPosition` and `textDistance` are visited.\r\n * @param rect {x, y, width, height} Rect of the host elment, according to which the text positioned.\r\n * @return The input `out`. Set: {x, y, textAlign, textVerticalAlign}\r\n */\r\nexport function calculateTextPosition(\r\n out: TextPositionCalculationResult,\r\n opts: {\r\n position?: BuiltinTextPosition | (number | string)[]\r\n distance?: number // Default 5\r\n global?: boolean\r\n },\r\n rect: RectLike\r\n): TextPositionCalculationResult {\r\n const textPosition = opts.position || 'inside';\r\n const distance = opts.distance != null ? opts.distance : 5;\r\n\r\n const height = rect.height;\r\n const width = rect.width;\r\n const halfHeight = height / 2;\r\n\r\n let x = rect.x;\r\n let y = rect.y;\r\n\r\n let textAlign: TextAlign = 'left';\r\n let textVerticalAlign: TextVerticalAlign = 'top';\r\n\r\n if (textPosition instanceof Array) {\r\n x += parsePercent(textPosition[0], rect.width);\r\n y += parsePercent(textPosition[1], rect.height);\r\n // Not use textAlign / textVerticalAlign\r\n textAlign = null;\r\n textVerticalAlign = null;\r\n }\r\n else {\r\n switch (textPosition) {\r\n case 'left':\r\n x -= distance;\r\n y += halfHeight;\r\n textAlign = 'right';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'right':\r\n x += distance + width;\r\n y += halfHeight;\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'top':\r\n x += width / 2;\r\n y -= distance;\r\n textAlign = 'center';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'bottom':\r\n x += width / 2;\r\n y += height + distance;\r\n textAlign = 'center';\r\n break;\r\n case 'inside':\r\n x += width / 2;\r\n y += halfHeight;\r\n textAlign = 'center';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideLeft':\r\n x += distance;\r\n y += halfHeight;\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideRight':\r\n x += width - distance;\r\n y += halfHeight;\r\n textAlign = 'right';\r\n textVerticalAlign = 'middle';\r\n break;\r\n case 'insideTop':\r\n x += width / 2;\r\n y += distance;\r\n textAlign = 'center';\r\n break;\r\n case 'insideBottom':\r\n x += width / 2;\r\n y += height - distance;\r\n textAlign = 'center';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'insideTopLeft':\r\n x += distance;\r\n y += distance;\r\n break;\r\n case 'insideTopRight':\r\n x += width - distance;\r\n y += distance;\r\n textAlign = 'right';\r\n break;\r\n case 'insideBottomLeft':\r\n x += distance;\r\n y += height - distance;\r\n textVerticalAlign = 'bottom';\r\n break;\r\n case 'insideBottomRight':\r\n x += width - distance;\r\n y += height - distance;\r\n textAlign = 'right';\r\n textVerticalAlign = 'bottom';\r\n break;\r\n }\r\n }\r\n\r\n out = out || {} as TextPositionCalculationResult;\r\n out.x = x;\r\n out.y = y;\r\n out.align = textAlign;\r\n out.verticalAlign = textVerticalAlign;\r\n\r\n return out;\r\n}\r\n","import Transformable, {TRANSFORMABLE_PROPS, TransformProp} from './core/Transformable';\nimport { AnimationEasing } from './animation/easing';\nimport Animator, {cloneValue} from './animation/Animator';\nimport { ZRenderType } from './zrender';\nimport {\n Dictionary, ElementEventName, ZRRawEvent, BuiltinTextPosition, AllPropTypes,\n TextVerticalAlign, TextAlign, MapToType\n} from './core/types';\nimport Path from './graphic/Path';\nimport BoundingRect, { RectLike } from './core/BoundingRect';\nimport Eventful from './core/Eventful';\nimport ZRText, { DefaultTextStyle } from './graphic/Text';\nimport { calculateTextPosition, TextPositionCalculationResult, parsePercent } from './contain/text';\nimport {\n guid,\n isObject,\n keys,\n extend,\n indexOf,\n logError,\n mixin,\n isArrayLike,\n isTypedArray,\n isGradientObject,\n filter,\n reduce\n} from './core/util';\nimport Polyline from './graphic/shape/Polyline';\nimport Group from './graphic/Group';\nimport Point from './core/Point';\nimport { LIGHT_LABEL_COLOR, DARK_LABEL_COLOR } from './config';\nimport { parse, stringify } from './tool/color';\nimport { REDRAW_BIT } from './graphic/constants';\n\nexport interface ElementAnimateConfig {\n duration?: number\n delay?: number\n easing?: AnimationEasing\n during?: (percent: number) => void\n\n // `done` will be called when all of the animations of the target props are\n // \"done\" or \"aborted\", and at least one \"done\" happened.\n // Common cases: animations declared, but some of them are aborted (e.g., by state change).\n // The calling of `animationTo` done rather than aborted if at least one done happened.\n done?: Function\n // `aborted` will be called when all of the animations of the target props are \"aborted\".\n aborted?: Function\n\n scope?: string\n /**\n * If force animate\n * Prevent stop animation and callback\n * immediently when target values are the same as current values.\n */\n force?: boolean\n /**\n * If use additive animation.\n */\n additive?: boolean\n /**\n * If set to final state before animation started.\n * It can be useful if something you want to calcuate depends on the final state of element.\n * Like bounding rect for text layouting.\n *\n * Only available in animateTo\n */\n setToFinal?: boolean\n}\n\nexport interface ElementTextConfig {\n /**\n * Position relative to the element bounding rect\n * @default 'inside'\n */\n position?: BuiltinTextPosition | (number | string)[]\n\n /**\n * Rotation of the label.\n */\n rotation?: number\n\n /**\n * Rect that text will be positioned.\n * Default to be the rect of element.\n */\n layoutRect?: RectLike\n\n /**\n * Offset of the label.\n * The difference of offset and position is that it will be applied\n * in the rotation\n */\n offset?: number[]\n\n /**\n * Origin or rotation. Which is relative to the bounding box of the attached element.\n * Can be percent value. Relative to the bounding box.\n * If specified center. It will be center of the bounding box.\n *\n * Only available when position and rotation are both set.\n */\n origin?: (number | string)[] | 'center'\n\n /**\n * Distance to the rect\n * @default 5\n */\n distance?: number\n\n /**\n * If use local user space. Which will apply host's transform\n * @default false\n */\n local?: boolean\n\n /**\n * `insideFill` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `fill` will be picked by this priority:\n * `textContent.style.fill` > `textConfig.insideFill` > \"auto-calculated-fill\"\n * In most cases, \"auto-calculated-fill\" is white.\n */\n insideFill?: string\n\n /**\n * `insideStroke` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `stroke` will be picked by this priority:\n * `textContent.style.stroke` > `textConfig.insideStroke` > \"auto-calculated-stroke\"\n *\n * The rule of getting \"auto-calculated-stroke\":\n * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`)\n * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`)\n * \"auto-calculated-stroke\" will be null.\n * Otherwise, \"auto-calculated-stroke\" will be the same as `fill` of this element if possible, or null.\n *\n * The reason of (A) is not decisive:\n * 1. If users specify `fill` in style and still use \"auto-calculated-stroke\", the effect\n * is not good and unexpected in some cases. It not easy and seams uncessary to auto calculate\n * a proper `stroke` for the given `fill`, since they can specify `stroke` themselve.\n * 2. Backward compat.\n */\n insideStroke?: string\n\n /**\n * `outsideFill` is a color string or left empty.\n * If a `textContent` is \"inside\", its final `fill` will be picked by this priority:\n * `textContent.style.fill` > `textConfig.outsideFill` > #000\n */\n outsideFill?: string\n\n /**\n * `outsideStroke` is a color string or left empth.\n * If a `textContent` is not \"inside\", its final `stroke` will be picked by this priority:\n * `textContent.style.stroke` > `textConfig.outsideStroke` > \"auto-calculated-stroke\"\n *\n * The rule of getting \"auto-calculated-stroke\":\n * If (A) the `fill` is specified in style (either in `textContent.style` or `textContent.style.rich`)\n * or (B) needed to draw text background (either defined in `textContent.style` or `textContent.style.rich`)\n * \"auto-calculated-stroke\" will be null.\n * Otherwise, \"auto-calculated-stroke\" will be a neer white color to distinguish \"front end\"\n * label with messy background (like other text label, line or other graphic).\n */\n outsideStroke?: string\n\n /**\n * Tell zrender I can sure this text is inside or not.\n * In case position is not using builtin `inside` hints.\n */\n inside?: boolean\n}\nexport interface ElementTextGuideLineConfig {\n /**\n * Anchor for text guide line.\n * Notice: Won't work\n */\n anchor?: Point\n\n /**\n * If above the target element.\n */\n showAbove?: boolean\n\n /**\n * Candidates of connectors. Used when autoCalculate is true and anchor is not specified.\n */\n candidates?: ('left' | 'top' | 'right' | 'bottom')[]\n}\n\nexport interface ElementEvent {\n type: ElementEventName,\n event: ZRRawEvent,\n // target can only be an element that is not silent.\n target: Element,\n // topTarget can be a silent element.\n topTarget: Element,\n cancelBubble: boolean,\n offsetX: number,\n offsetY: number,\n gestureEvent: string,\n pinchX: number,\n pinchY: number,\n pinchScale: number,\n wheelDelta: number,\n zrByTouch: boolean,\n which: number,\n stop: (this: ElementEvent) => void\n}\n\nexport type ElementEventCallback = (\n this: CbThis, e: ElementEvent\n) => boolean | void\ntype CbThis = unknown extends Ctx ? Impl : Ctx;\n\ninterface ElementEventHandlerProps {\n // Events\n onclick: ElementEventCallback\n ondblclick: ElementEventCallback\n onmouseover: ElementEventCallback\n onmouseout: ElementEventCallback\n onmousemove: ElementEventCallback\n onmousewheel: ElementEventCallback\n onmousedown: ElementEventCallback\n onmouseup: ElementEventCallback\n oncontextmenu: ElementEventCallback\n\n ondrag: ElementEventCallback\n ondragstart: ElementEventCallback\n ondragend: ElementEventCallback\n ondragenter: ElementEventCallback\n ondragleave: ElementEventCallback\n ondragover: ElementEventCallback\n ondrop: ElementEventCallback\n}\n\nexport interface ElementProps extends Partial, Partial> {\n name?: string\n ignore?: boolean\n isGroup?: boolean\n draggable?: boolean | 'horizontal' | 'vertical'\n\n silent?: boolean\n\n ignoreClip?: boolean\n globalScaleRatio?: number\n\n textConfig?: ElementTextConfig\n textContent?: ZRText\n\n clipPath?: Path\n drift?: Element['drift']\n\n extra?: Dictionary\n\n // For echarts animation.\n anid?: string\n}\n\n// Properties can be used in state.\nexport const PRESERVED_NORMAL_STATE = '__zr_normal__';\n// export const PRESERVED_MERGED_STATE = '__zr_merged__';\n\nconst PRIMARY_STATES_KEYS = (TRANSFORMABLE_PROPS as any).concat(['ignore']) as [TransformProp, 'ignore'];\nconst DEFAULT_ANIMATABLE_MAP = reduce(TRANSFORMABLE_PROPS, (obj, key) => {\n obj[key] = true;\n return obj;\n}, {ignore: false} as Partial>);\n\nexport type ElementStatePropNames = (typeof PRIMARY_STATES_KEYS)[number] | 'textConfig';\nexport type ElementState = Pick & ElementCommonState\n\nexport type ElementCommonState = {\n hoverLayer?: boolean\n}\n\nexport type ElementCalculateTextPosition = (\n out: TextPositionCalculationResult,\n style: ElementTextConfig,\n rect: RectLike\n) => TextPositionCalculationResult;\n\nlet tmpTextPosCalcRes = {} as TextPositionCalculationResult;\nlet tmpBoundingRect = new BoundingRect(0, 0, 0, 0);\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ninterface Element extends Transformable,\n Eventful<{\n [key in ElementEventName]: (e: ElementEvent) => void | boolean\n } & {\n [key in string]: (...args: any) => void | boolean\n }>,\n ElementEventHandlerProps {\n}\n\nclass Element {\n\n id: number = guid()\n /**\n * Element type\n */\n type: string\n\n /**\n * Element name\n */\n name: string\n\n /**\n * If ignore drawing and events of the element object\n */\n ignore: boolean\n\n /**\n * Whether to respond to mouse events.\n */\n silent: boolean\n\n /**\n * 是否是 Group\n */\n isGroup: boolean\n\n /**\n * Whether it can be dragged.\n */\n draggable: boolean | 'horizontal' | 'vertical'\n\n /**\n * Whether is it dragging.\n */\n dragging: boolean\n\n parent: Group\n\n animators: Animator[] = []\n\n /**\n * If ignore clip from it's parent or hosts.\n * Applied on itself and all it's children.\n *\n * NOTE: It won't affect the clipPath set on the children.\n */\n ignoreClip: boolean\n\n /**\n * If element is used as a component of other element.\n */\n __hostTarget: Element\n\n /**\n * ZRender instance will be assigned when element is associated with zrender\n */\n __zr: ZRenderType\n\n /**\n * Dirty bits.\n * From which painter will determine if this displayable object needs brush.\n */\n __dirty: number\n\n /**\n * If element was painted on the screen\n */\n __isRendered: boolean;\n\n /**\n * If element has been moved to the hover layer.\n *\n * If so, dirty will only trigger the zrender refresh hover layer\n */\n __inHover: boolean\n\n /**\n * path to clip the elements and its children, if it is a group.\n * @see http://www.w3.org/TR/2dcontext/#clipping-region\n */\n private _clipPath?: Path\n\n /**\n * Attached text element.\n * `position`, `style.textAlign`, `style.textVerticalAlign`\n * of element will be ignored if textContent.position is set\n */\n private _textContent?: ZRText\n\n /**\n * Text guide line.\n */\n private _textGuide?: Polyline\n\n /**\n * Config of textContent. Inlcuding layout, color, ...etc.\n */\n textConfig?: ElementTextConfig\n\n /**\n * Config for guide line calculating.\n *\n * NOTE: This is just a property signature. READ and WRITE are all done in echarts.\n */\n textGuideLineConfig?: ElementTextGuideLineConfig\n\n // FOR ECHARTS\n /**\n * Id for mapping animation\n */\n anid: string\n\n extra: Dictionary\n\n currentStates?: string[] = []\n // prevStates is for storager in echarts.\n prevStates?: string[]\n /**\n * Store of element state.\n * '__normal__' key is preserved for default properties.\n */\n states: Dictionary = {}\n\n /**\n * Animation config applied on state switching.\n */\n stateTransition: ElementAnimateConfig\n\n /**\n * Proxy function for getting state with given stateName.\n * ZRender will first try to get with stateProxy. Then find from states if stateProxy returns nothing\n *\n * targetStates will be given in useStates\n */\n stateProxy?: (stateName: string, targetStates?: string[]) => ElementState\n\n protected _normalState: ElementState\n\n // Temporary storage for inside text color configuration.\n private _innerTextDefaultStyle: DefaultTextStyle\n\n constructor(props?: Props) {\n this._init(props);\n }\n\n protected _init(props?: Props) {\n // Init default properties\n this.attr(props);\n }\n\n /**\n * Drift element\n * @param {number} dx dx on the global space\n * @param {number} dy dy on the global space\n */\n drift(dx: number, dy: number, e?: ElementEvent) {\n switch (this.draggable) {\n case 'horizontal':\n dy = 0;\n break;\n case 'vertical':\n dx = 0;\n break;\n }\n\n let m = this.transform;\n if (!m) {\n m = this.transform = [1, 0, 0, 1, 0, 0];\n }\n m[4] += dx;\n m[5] += dy;\n\n this.decomposeTransform();\n this.markRedraw();\n }\n\n /**\n * Hook before update\n */\n beforeUpdate() {}\n /**\n * Hook after update\n */\n afterUpdate() {}\n /**\n * Update each frame\n */\n update() {\n this.updateTransform();\n\n if (this.__dirty) {\n this.updateInnerText();\n }\n }\n\n updateInnerText(forceUpdate?: boolean) {\n // Update textContent\n const textEl = this._textContent;\n if (textEl && (!textEl.ignore || forceUpdate)) {\n if (!this.textConfig) {\n this.textConfig = {};\n }\n const textConfig = this.textConfig;\n const isLocal = textConfig.local;\n const innerTransformable = textEl.innerTransformable;\n\n let textAlign: TextAlign;\n let textVerticalAlign: TextVerticalAlign;\n\n let textStyleChanged = false;\n\n // Apply host's transform.\n innerTransformable.parent = isLocal ? this as unknown as Group : null;\n\n let innerOrigin = false;\n\n // Reset x/y/rotation\n innerTransformable.copyTransform(textEl);\n\n // Force set attached text's position if `position` is in config.\n if (textConfig.position != null) {\n let layoutRect = tmpBoundingRect;\n if (textConfig.layoutRect) {\n layoutRect.copy(textConfig.layoutRect);\n }\n else {\n layoutRect.copy(this.getBoundingRect());\n }\n if (!isLocal) {\n layoutRect.applyTransform(this.transform);\n }\n\n if (this.calculateTextPosition) {\n this.calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n else {\n calculateTextPosition(tmpTextPosCalcRes, textConfig, layoutRect);\n }\n\n // TODO Should modify back if textConfig.position is set to null again.\n // Or textContent is detached.\n innerTransformable.x = tmpTextPosCalcRes.x;\n innerTransformable.y = tmpTextPosCalcRes.y;\n\n // User specified align/verticalAlign has higher priority, which is\n // useful in the case that attached text is rotated 90 degree.\n textAlign = tmpTextPosCalcRes.align;\n textVerticalAlign = tmpTextPosCalcRes.verticalAlign;\n\n const textOrigin = textConfig.origin;\n if (textOrigin && textConfig.rotation != null) {\n let relOriginX;\n let relOriginY;\n if (textOrigin === 'center') {\n relOriginX = layoutRect.width * 0.5;\n relOriginY = layoutRect.height * 0.5;\n }\n else {\n relOriginX = parsePercent(textOrigin[0], layoutRect.width);\n relOriginY = parsePercent(textOrigin[1], layoutRect.height);\n }\n\n innerOrigin = true;\n innerTransformable.originX = -innerTransformable.x + relOriginX + (isLocal ? 0 : layoutRect.x);\n innerTransformable.originY = -innerTransformable.y + relOriginY + (isLocal ? 0 : layoutRect.y);\n }\n }\n\n\n if (textConfig.rotation != null) {\n innerTransformable.rotation = textConfig.rotation;\n }\n\n // TODO\n const textOffset = textConfig.offset;\n if (textOffset) {\n innerTransformable.x += textOffset[0];\n innerTransformable.y += textOffset[1];\n\n // Not change the user set origin.\n if (!innerOrigin) {\n innerTransformable.originX = -textOffset[0];\n innerTransformable.originY = -textOffset[1];\n }\n }\n\n // Calculate text color\n const isInside = textConfig.inside == null // Force to be inside or not.\n ? (typeof textConfig.position === 'string' && textConfig.position.indexOf('inside') >= 0)\n : textConfig.inside;\n const innerTextDefaultStyle = this._innerTextDefaultStyle || (this._innerTextDefaultStyle = {});\n\n let textFill;\n let textStroke;\n let autoStroke;\n if (isInside && this.canBeInsideText()) {\n // In most cases `textContent` need this \"auto\" strategy.\n // So by default be 'auto'. Otherwise users need to literally\n // set `insideFill: 'auto', insideStroke: 'auto'` each time.\n textFill = textConfig.insideFill;\n textStroke = textConfig.insideStroke;\n\n if (textFill == null || textFill === 'auto') {\n textFill = this.getInsideTextFill();\n }\n if (textStroke == null || textStroke === 'auto') {\n textStroke = this.getInsideTextStroke(textFill);\n autoStroke = true;\n }\n }\n else {\n textFill = textConfig.outsideFill;\n textStroke = textConfig.outsideStroke;\n\n if (textFill == null || textFill === 'auto') {\n textFill = this.getOutsideFill();\n }\n // By default give a stroke to distinguish \"front end\" label with\n // messy background (like other text label, line or other graphic).\n // If textContent.style.fill specified, this auto stroke will not be used.\n if (textStroke == null || textStroke === 'auto') {\n // If some time need to customize the default stroke getter,\n // add some kind of override method.\n textStroke = this.getOutsideStroke(textFill);\n autoStroke = true;\n }\n }\n // Default `textFill` should must have a value to ensure text can be displayed.\n textFill = textFill || '#000';\n\n if (textFill !== innerTextDefaultStyle.fill\n || textStroke !== innerTextDefaultStyle.stroke\n || autoStroke !== innerTextDefaultStyle.autoStroke\n || textAlign !== innerTextDefaultStyle.align\n || textVerticalAlign !== innerTextDefaultStyle.verticalAlign\n ) {\n\n textStyleChanged = true;\n\n innerTextDefaultStyle.fill = textFill;\n innerTextDefaultStyle.stroke = textStroke;\n innerTextDefaultStyle.autoStroke = autoStroke;\n innerTextDefaultStyle.align = textAlign;\n innerTextDefaultStyle.verticalAlign = textVerticalAlign;\n\n textEl.setDefaultTextStyle(innerTextDefaultStyle);\n }\n\n // Mark textEl to update transform.\n // DON'T use markRedraw. It will cause Element itself to dirty again.\n textEl.__dirty |= REDRAW_BIT;\n\n if (textStyleChanged) {\n // Only mark style dirty if necessary. Update ZRText is costly.\n textEl.dirtyStyle(true);\n }\n }\n }\n\n protected canBeInsideText() {\n return true;\n }\n\n protected getInsideTextFill(): string | undefined {\n return '#fff';\n }\n\n protected getInsideTextStroke(textFill: string): string | undefined {\n return '#000';\n }\n\n protected getOutsideFill(): string | undefined {\n return this.__zr && this.__zr.isDarkMode() ? LIGHT_LABEL_COLOR : DARK_LABEL_COLOR;\n }\n\n protected getOutsideStroke(textFill: string): string {\n const backgroundColor = this.__zr && this.__zr.getBackgroundColor();\n let colorArr = typeof backgroundColor === 'string' && parse(backgroundColor as string);\n if (!colorArr) {\n colorArr = [255, 255, 255, 1];\n }\n // Assume blending on a white / black(dark) background.\n const alpha = colorArr[3];\n const isDark = this.__zr.isDarkMode();\n for (let i = 0; i < 3; i++) {\n colorArr[i] = colorArr[i] * alpha + (isDark ? 0 : 255) * (1 - alpha);\n }\n colorArr[3] = 1;\n return stringify(colorArr, 'rgba');\n }\n\n traverse(\n cb: (this: Context, el: Element) => void,\n context?: Context\n ) {}\n\n protected attrKV(key: string, value: unknown) {\n if (key === 'textConfig') {\n this.setTextConfig(value as ElementTextConfig);\n }\n else if (key === 'textContent') {\n this.setTextContent(value as ZRText);\n }\n else if (key === 'clipPath') {\n this.setClipPath(value as Path);\n }\n else if (key === 'extra') {\n this.extra = this.extra || {};\n extend(this.extra, value);\n }\n else {\n (this as any)[key] = value;\n }\n }\n\n /**\n * Hide the element\n */\n hide() {\n this.ignore = true;\n this.markRedraw();\n }\n\n /**\n * Show the element\n */\n show() {\n this.ignore = false;\n this.markRedraw();\n }\n\n attr(keyOrObj: Props): this\n attr(keyOrObj: T, value: Props[T]): this\n attr(keyOrObj: keyof Props | Props, value?: unknown): this {\n if (typeof keyOrObj === 'string') {\n this.attrKV(keyOrObj as keyof ElementProps, value as AllPropTypes);\n }\n else if (isObject(keyOrObj)) {\n let obj = keyOrObj as object;\n let keysArr = keys(obj);\n for (let i = 0; i < keysArr.length; i++) {\n let key = keysArr[i];\n this.attrKV(key as keyof ElementProps, keyOrObj[key]);\n }\n }\n this.markRedraw();\n return this;\n }\n\n // Save current state to normal\n saveCurrentToNormalState(toState: ElementState) {\n this._innerSaveToNormal(toState);\n\n // If we are switching from normal to other state during animation.\n // We need to save final value of animation to the normal state. Not interpolated value.\n const normalState = this._normalState;\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n const fromStateTransition = animator.__fromStateTransition;\n // Ignore animation from state transition(except normal).\n // Ignore loop animation.\n if (animator.getLoop() || fromStateTransition && fromStateTransition !== PRESERVED_NORMAL_STATE) {\n continue;\n }\n\n const targetName = animator.targetName;\n // Respecting the order of animation if multiple animator is\n // animating on the same property(If additive animation is used)\n const target = targetName\n ? (normalState as any)[targetName] : normalState;\n // Only save keys that are changed by the states.\n animator.saveTo(target);\n }\n }\n\n protected _innerSaveToNormal(toState: ElementState) {\n let normalState = this._normalState;\n if (!normalState) {\n // Clear previous stored normal states when switching from normalState to otherState.\n normalState = this._normalState = {};\n }\n if (toState.textConfig && !normalState.textConfig) {\n normalState.textConfig = this.textConfig;\n }\n\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\n }\n\n protected _savePrimaryToNormal(\n toState: Dictionary, normalState: Dictionary, primaryKeys: readonly string[]\n ) {\n for (let i = 0; i < primaryKeys.length; i++) {\n let key = primaryKeys[i];\n // Only save property that will be changed by toState\n // and has not been saved to normalState yet.\n if (toState[key] != null && !(key in normalState)) {\n (normalState as any)[key] = (this as any)[key];\n }\n }\n }\n\n /**\n * If has any state.\n */\n hasState() {\n return this.currentStates.length > 0;\n }\n\n /**\n * Get state object\n */\n getState(name: string) {\n return this.states[name];\n }\n\n\n /**\n * Ensure state exists. If not, will create one and return.\n */\n ensureState(name: string) {\n const states = this.states;\n if (!states[name]) {\n states[name] = {};\n }\n return states[name];\n }\n\n /**\n * Clear all states.\n */\n clearStates(noAnimation?: boolean) {\n this.useState(PRESERVED_NORMAL_STATE, false, noAnimation);\n // TODO set _normalState to null?\n }\n /**\n * Use state. State is a collection of properties.\n * Will return current state object if state exists and stateName has been changed.\n *\n * @param stateName State name to be switched to\n * @param keepCurrentState If keep current states.\n * If not, it will inherit from the normal state.\n */\n useState(stateName: string, keepCurrentStates?: boolean, noAnimation?: boolean, forceUseHoverLayer?: boolean) {\n // Use preserved word __normal__\n // TODO: Only restore changed properties when restore to normal???\n const toNormalState = stateName === PRESERVED_NORMAL_STATE;\n const hasStates = this.hasState();\n\n if (!hasStates && toNormalState) {\n // If switched from normal to normal.\n return;\n }\n\n const currentStates = this.currentStates;\n const animationCfg = this.stateTransition;\n\n // No need to change in following cases:\n // 1. Keep current states. and already being applied before.\n // 2. Don't keep current states. And new state is same with the only one exists state.\n if (indexOf(currentStates, stateName) >= 0 && (keepCurrentStates || currentStates.length === 1)) {\n return;\n }\n\n let state;\n if (this.stateProxy && !toNormalState) {\n state = this.stateProxy(stateName);\n }\n\n if (!state) {\n state = (this.states && this.states[stateName]);\n }\n\n if (!state && !toNormalState) {\n logError(`State ${stateName} not exists.`);\n return;\n }\n\n if (!toNormalState) {\n this.saveCurrentToNormalState(state);\n }\n\n const useHoverLayer = !!((state && state.hoverLayer) || forceUseHoverLayer);\n\n if (useHoverLayer) {\n // Enter hover layer before states update.\n this._toggleHoverLayerFlag(true);\n }\n\n this._applyStateObj(\n stateName,\n state,\n this._normalState,\n keepCurrentStates,\n !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0,\n animationCfg\n );\n\n // Also set text content.\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n // Force textContent use hover layer if self is using it.\n textContent.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useState(stateName, keepCurrentStates, noAnimation, useHoverLayer);\n }\n\n if (toNormalState) {\n // Clear state\n this.currentStates = [];\n // Reset normal state.\n this._normalState = {};\n }\n else {\n if (!keepCurrentStates) {\n this.currentStates = [stateName];\n }\n else {\n this.currentStates.push(stateName);\n }\n }\n\n // Update animating target to the new object after state changed.\n this._updateAnimationTargets();\n\n this.markRedraw();\n\n if (!useHoverLayer && this.__inHover) {\n // Leave hover layer after states update and markRedraw.\n this._toggleHoverLayerFlag(false);\n // NOTE: avoid unexpected refresh when moving out from hover layer!!\n // Only clear from hover layer.\n this.__dirty &= ~REDRAW_BIT;\n }\n\n // Return used state.\n return state;\n }\n\n /**\n * Apply multiple states.\n * @param states States list.\n */\n useStates(states: string[], noAnimation?: boolean, forceUseHoverLayer?: boolean) {\n if (!states.length) {\n this.clearStates();\n }\n else {\n const stateObjects: ElementState[] = [];\n const currentStates = this.currentStates;\n const len = states.length;\n let notChange = len === currentStates.length;\n if (notChange) {\n for (let i = 0; i < len; i++) {\n if (states[i] !== currentStates[i]) {\n notChange = false;\n break;\n }\n }\n }\n if (notChange) {\n return;\n }\n\n for (let i = 0; i < len; i++) {\n const stateName = states[i];\n let stateObj: ElementState;\n if (this.stateProxy) {\n stateObj = this.stateProxy(stateName, states);\n }\n if (!stateObj) {\n stateObj = this.states[stateName];\n }\n if (stateObj) {\n stateObjects.push(stateObj);\n }\n }\n\n const lastStateObj = stateObjects[len - 1];\n const useHoverLayer = !!((lastStateObj && lastStateObj.hoverLayer) || forceUseHoverLayer);\n if (useHoverLayer) {\n // Enter hover layer before states update.\n this._toggleHoverLayerFlag(true);\n }\n\n const mergedState = this._mergeStates(stateObjects);\n const animationCfg = this.stateTransition;\n\n this.saveCurrentToNormalState(mergedState);\n\n this._applyStateObj(\n states.join(','),\n mergedState,\n this._normalState,\n false,\n !noAnimation && !this.__inHover && animationCfg && animationCfg.duration > 0,\n animationCfg\n );\n\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n textContent.useStates(states, noAnimation, useHoverLayer);\n }\n if (textGuide) {\n textGuide.useStates(states, noAnimation, useHoverLayer);\n }\n\n this._updateAnimationTargets();\n\n // Create a copy\n this.currentStates = states.slice();\n this.markRedraw();\n\n if (!useHoverLayer && this.__inHover) {\n // Leave hover layer after states update and markRedraw.\n this._toggleHoverLayerFlag(false);\n // NOTE: avoid unexpected refresh when moving out from hover layer!!\n // Only clear from hover layer.\n this.__dirty &= ~REDRAW_BIT;\n }\n }\n }\n\n /**\n * Return if el.silent or any ancestor element has silent true.\n */\n isSilent() {\n let isSilent = this.silent;\n let ancestor = this.parent;\n while (!isSilent && ancestor) {\n if (ancestor.silent) {\n isSilent = true;\n break;\n }\n ancestor = ancestor.parent;\n }\n return isSilent;\n }\n\n /**\n * Update animation targets when reference is changed.\n */\n private _updateAnimationTargets() {\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n if (animator.targetName) {\n animator.changeTarget((this as any)[animator.targetName]);\n }\n }\n }\n\n /**\n * Remove state\n * @param state State to remove\n */\n removeState(state: string) {\n const idx = indexOf(this.currentStates, state);\n if (idx >= 0) {\n const currentStates = this.currentStates.slice();\n currentStates.splice(idx, 1);\n this.useStates(currentStates);\n }\n }\n\n /**\n * Replace exists state.\n * @param oldState\n * @param newState\n * @param forceAdd If still add when even if replaced target not exists.\n */\n replaceState(oldState: string, newState: string, forceAdd: boolean) {\n const currentStates = this.currentStates.slice();\n const idx = indexOf(currentStates, oldState);\n const newStateExists = indexOf(currentStates, newState) >= 0;\n if (idx >= 0) {\n if (!newStateExists) {\n // Replace the old with the new one.\n currentStates[idx] = newState;\n }\n else {\n // Only remove the old one.\n currentStates.splice(idx, 1);\n }\n }\n else if (forceAdd && !newStateExists) {\n currentStates.push(newState);\n }\n this.useStates(currentStates);\n }\n\n /**\n * Toogle state.\n */\n toggleState(state: string, enable: boolean) {\n if (enable) {\n this.useState(state, true);\n }\n else {\n this.removeState(state);\n }\n }\n\n protected _mergeStates(states: ElementState[]) {\n const mergedState: ElementState = {};\n let mergedTextConfig: ElementTextConfig;\n for (let i = 0; i < states.length; i++) {\n const state = states[i];\n extend(mergedState, state);\n\n if (state.textConfig) {\n mergedTextConfig = mergedTextConfig || {};\n extend(mergedTextConfig, state.textConfig);\n }\n }\n if (mergedTextConfig) {\n mergedState.textConfig = mergedTextConfig;\n }\n\n return mergedState;\n }\n\n protected _applyStateObj(\n stateName: string,\n state: ElementState,\n normalState: ElementState,\n keepCurrentStates: boolean,\n transition: boolean,\n animationCfg: ElementAnimateConfig\n ) {\n const needsRestoreToNormal = !(state && keepCurrentStates);\n\n // TODO: Save current state to normal?\n // TODO: Animation\n if (state && state.textConfig) {\n // Inherit from current state or normal state.\n this.textConfig = extend(\n {},\n keepCurrentStates ? this.textConfig : normalState.textConfig\n );\n extend(this.textConfig, state.textConfig);\n }\n else if (needsRestoreToNormal) {\n if (normalState.textConfig) { // Only restore if changed and saved.\n this.textConfig = normalState.textConfig;\n }\n }\n\n const transitionTarget: Dictionary = {};\n let hasTransition = false;\n\n for (let i = 0; i < PRIMARY_STATES_KEYS.length; i++) {\n const key = PRIMARY_STATES_KEYS[i];\n const propNeedsTransition = transition && DEFAULT_ANIMATABLE_MAP[key];\n\n if (state && state[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = state[key];\n }\n else {\n // Replace if it exist in target state\n (this as any)[key] = state[key];\n }\n }\n else if (needsRestoreToNormal) {\n if (normalState[key] != null) {\n if (propNeedsTransition) {\n hasTransition = true;\n transitionTarget[key] = normalState[key];\n }\n else {\n // Restore to normal state\n (this as any)[key] = normalState[key];\n }\n }\n }\n }\n\n if (!transition) {\n // Keep the running animation to the new values after states changed.\n // Not simply stop animation. Or it may have jump effect.\n for (let i = 0; i < this.animators.length; i++) {\n const animator = this.animators[i];\n const targetName = animator.targetName;\n // Ignore loop animation\n if (!animator.getLoop()) {\n animator.__changeFinalValue(targetName\n ? ((state || normalState) as any)[targetName]\n : (state || normalState)\n );\n }\n }\n }\n\n if (hasTransition) {\n this._transitionState(\n stateName,\n transitionTarget as Props,\n animationCfg\n );\n }\n }\n\n /**\n * Component is some elements attached on this element for specific purpose.\n * Like clipPath, textContent\n */\n private _attachComponent(componentEl: Element) {\n if (componentEl.__zr && !componentEl.__hostTarget) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Text element has been added to zrender.');\n }\n return;\n }\n\n if (componentEl === this) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Recursive component attachment.');\n }\n return;\n }\n\n const zr = this.__zr;\n if (zr) {\n // Needs to add self to zrender. For rerender triggering, or animation.\n componentEl.addSelfToZr(zr);\n }\n\n componentEl.__zr = zr;\n componentEl.__hostTarget = this as unknown as Element;\n }\n\n private _detachComponent(componentEl: Element) {\n if (componentEl.__zr) {\n componentEl.removeSelfFromZr(componentEl.__zr);\n }\n\n componentEl.__zr = null;\n componentEl.__hostTarget = null;\n }\n\n /**\n * Get clip path\n */\n getClipPath() {\n return this._clipPath;\n }\n\n /**\n * Set clip path\n *\n * clipPath can't be shared between two elements.\n */\n setClipPath(clipPath: Path) {\n // Remove previous clip path\n if (this._clipPath && this._clipPath !== clipPath) {\n this.removeClipPath();\n }\n\n this._attachComponent(clipPath);\n\n this._clipPath = clipPath;\n this.markRedraw();\n }\n\n /**\n * Remove clip path\n */\n removeClipPath() {\n const clipPath = this._clipPath;\n if (clipPath) {\n this._detachComponent(clipPath);\n this._clipPath = null;\n this.markRedraw();\n }\n }\n\n /**\n * Get attached text content.\n */\n getTextContent(): ZRText {\n return this._textContent;\n }\n\n /**\n * Attach text on element\n */\n setTextContent(textEl: ZRText) {\n const previousTextContent = this._textContent;\n if (previousTextContent === textEl) {\n return;\n }\n // Remove previous textContent\n if (previousTextContent && previousTextContent !== textEl) {\n this.removeTextContent();\n }\n if (process.env.NODE_ENV !== 'production') {\n if (textEl.__zr && !textEl.__hostTarget) {\n throw new Error('Text element has been added to zrender.');\n }\n }\n\n textEl.innerTransformable = new Transformable();\n\n this._attachComponent(textEl);\n\n this._textContent = textEl;\n\n this.markRedraw();\n }\n\n /**\n * Set layout of attached text. Will merge with the previous.\n */\n setTextConfig(cfg: ElementTextConfig) {\n // TODO hide cfg property?\n if (!this.textConfig) {\n this.textConfig = {};\n }\n extend(this.textConfig, cfg);\n this.markRedraw();\n }\n\n /**\n * Remove text config\n */\n removeTextConfig() {\n this.textConfig = null;\n this.markRedraw();\n }\n\n /**\n * Remove attached text element.\n */\n removeTextContent() {\n const textEl = this._textContent;\n if (textEl) {\n textEl.innerTransformable = null;\n this._detachComponent(textEl);\n this._textContent = null;\n this._innerTextDefaultStyle = null;\n this.markRedraw();\n }\n }\n\n getTextGuideLine(): Polyline {\n return this._textGuide;\n }\n\n setTextGuideLine(guideLine: Polyline) {\n // Remove previous clip path\n if (this._textGuide && this._textGuide !== guideLine) {\n this.removeTextGuideLine();\n }\n\n this._attachComponent(guideLine);\n\n this._textGuide = guideLine;\n\n this.markRedraw();\n }\n\n removeTextGuideLine() {\n const textGuide = this._textGuide;\n if (textGuide) {\n this._detachComponent(textGuide);\n this._textGuide = null;\n this.markRedraw();\n }\n }\n /**\n * Mark element needs to be repainted\n */\n markRedraw() {\n this.__dirty |= REDRAW_BIT;\n const zr = this.__zr;\n if (zr) {\n if (this.__inHover) {\n zr.refreshHover();\n }\n else {\n zr.refresh();\n }\n }\n\n // Used as a clipPath or textContent\n if (this.__hostTarget) {\n this.__hostTarget.markRedraw();\n }\n }\n\n /**\n * Besides marking elements to be refreshed.\n * It will also invalid all cache and doing recalculate next frame.\n */\n dirty() {\n this.markRedraw();\n }\n\n private _toggleHoverLayerFlag(inHover: boolean) {\n this.__inHover = inHover;\n const textContent = this._textContent;\n const textGuide = this._textGuide;\n if (textContent) {\n textContent.__inHover = inHover;\n }\n if (textGuide) {\n textGuide.__inHover = inHover;\n }\n }\n\n /**\n * Add self from zrender instance.\n * Not recursively because it will be invoked when element added to storage.\n */\n addSelfToZr(zr: ZRenderType) {\n if (this.__zr === zr) {\n return;\n }\n\n this.__zr = zr;\n // 添加动画\n const animators = this.animators;\n if (animators) {\n for (let i = 0; i < animators.length; i++) {\n zr.animation.addAnimator(animators[i]);\n }\n }\n\n if (this._clipPath) {\n this._clipPath.addSelfToZr(zr);\n }\n if (this._textContent) {\n this._textContent.addSelfToZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.addSelfToZr(zr);\n }\n }\n\n /**\n * Remove self from zrender instance.\n * Not recursively because it will be invoked when element added to storage.\n */\n removeSelfFromZr(zr: ZRenderType) {\n if (!this.__zr) {\n return;\n }\n\n this.__zr = null;\n // Remove animation\n const animators = this.animators;\n if (animators) {\n for (let i = 0; i < animators.length; i++) {\n zr.animation.removeAnimator(animators[i]);\n }\n }\n\n if (this._clipPath) {\n this._clipPath.removeSelfFromZr(zr);\n }\n if (this._textContent) {\n this._textContent.removeSelfFromZr(zr);\n }\n if (this._textGuide) {\n this._textGuide.removeSelfFromZr(zr);\n }\n }\n\n /**\n * 动画\n *\n * @param path The key to fetch value from object. Mostly style or shape.\n * @param loop Whether to loop animation.\n * @param allowDiscreteAnimation Whether to allow discrete animation\n * @example:\n * el.animate('style', false)\n * .when(1000, {x: 10} )\n * .done(function(){ // Animation done })\n * .start()\n */\n animate(key?: string, loop?: boolean, allowDiscreteAnimation?: boolean) {\n let target = key ? (this as any)[key] : this;\n\n if (process.env.NODE_ENV !== 'production') {\n if (!target) {\n logError(\n 'Property \"'\n + key\n + '\" is not existed in element '\n + this.id\n );\n return;\n }\n }\n\n const animator = new Animator(target, loop, allowDiscreteAnimation);\n key && (animator.targetName = key);\n this.addAnimator(animator, key);\n return animator;\n }\n\n addAnimator(animator: Animator, key: string): void {\n const zr = this.__zr;\n\n const el = this;\n\n animator.during(function () {\n el.updateDuringAnimation(key as string);\n }).done(function () {\n const animators = el.animators;\n // FIXME Animator will not be removed if use `Animator#stop` to stop animation\n const idx = indexOf(animators, animator);\n if (idx >= 0) {\n animators.splice(idx, 1);\n }\n });\n\n this.animators.push(animator);\n\n // If animate after added to the zrender\n if (zr) {\n zr.animation.addAnimator(animator);\n }\n\n // Wake up zrender to start the animation loop.\n zr && zr.wakeUp();\n }\n\n updateDuringAnimation(key: string) {\n this.markRedraw();\n }\n\n /**\n * 停止动画\n * @param {boolean} forwardToLast If move to last frame before stop\n */\n stopAnimation(scope?: string, forwardToLast?: boolean) {\n const animators = this.animators;\n const len = animators.length;\n const leftAnimators: Animator[] = [];\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n if (!scope || scope === animator.scope) {\n animator.stop(forwardToLast);\n }\n else {\n leftAnimators.push(animator);\n }\n }\n this.animators = leftAnimators;\n\n return this;\n }\n\n /**\n * @param animationProps A map to specify which property to animate. If not specified, will animate all.\n * @example\n * // Animate position\n * el.animateTo({\n * position: [10, 10]\n * }, { done: () => { // done } })\n *\n * // Animate shape, style and position in 100ms, delayed 100ms, with cubicOut easing\n * el.animateTo({\n * shape: {\n * width: 500\n * },\n * style: {\n * fill: 'red'\n * }\n * position: [10, 10]\n * }, {\n * duration: 100,\n * delay: 100,\n * easing: 'cubicOut',\n * done: () => { // done }\n * })\n */\n animateTo(target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType) {\n animateTo(this, target, cfg, animationProps);\n }\n\n /**\n * Animate from the target state to current state.\n * The params and the value are the same as `this.animateTo`.\n */\n\n // Overload definitions\n animateFrom(\n target: Props, cfg: ElementAnimateConfig, animationProps?: MapToType\n ) {\n animateTo(this, target, cfg, animationProps, true);\n }\n\n protected _transitionState(\n stateName: string, target: Props, cfg?: ElementAnimateConfig, animationProps?: MapToType\n ) {\n const animators = animateTo(this, target, cfg, animationProps);\n for (let i = 0; i < animators.length; i++) {\n animators[i].__fromStateTransition = stateName;\n }\n }\n\n /**\n * Interface of getting the minimum bounding box.\n */\n getBoundingRect(): BoundingRect {\n return null;\n }\n\n getPaintRect(): BoundingRect {\n return null;\n }\n\n /**\n * The string value of `textPosition` needs to be calculated to a real postion.\n * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]`\n * by default. See `contain/text.js#calculateTextPosition` for more details.\n * But some coutom shapes like \"pin\", \"flag\" have center that is not exactly\n * `[width/2, height/2]`. So we provide this hook to customize the calculation\n * for those shapes. It will be called if the `style.textPosition` is a string.\n * @param {Obejct} [out] Prepared out object. If not provided, this method should\n * be responsible for creating one.\n * @param {module:zrender/graphic/Style} style\n * @param {Object} rect {x, y, width, height}\n * @return {Obejct} out The same as the input out.\n * {\n * x: number. mandatory.\n * y: number. mandatory.\n * align: string. optional. use style.textAlign by default.\n * verticalAlign: string. optional. use style.textVerticalAlign by default.\n * }\n */\n calculateTextPosition: ElementCalculateTextPosition;\n\n protected static initDefaultProps = (function () {\n const elProto = Element.prototype;\n elProto.type = 'element';\n elProto.name = '';\n\n elProto.ignore =\n elProto.silent =\n elProto.isGroup =\n elProto.draggable =\n elProto.dragging =\n elProto.ignoreClip =\n elProto.__inHover = false;\n\n elProto.__dirty = REDRAW_BIT;\n\n\n const logs: Dictionary = {};\n function logDeprecatedError(key: string, xKey: string, yKey: string) {\n if (!logs[key + xKey + yKey]) {\n console.warn(`DEPRECATED: '${key}' has been deprecated. use '${xKey}', '${yKey}' instead`);\n logs[key + xKey + yKey] = true;\n }\n }\n // Legacy transform properties. position and scale\n function createLegacyProperty(\n key: string,\n privateKey: string,\n xKey: string,\n yKey: string\n ) {\n Object.defineProperty(elProto, key, {\n get() {\n if (process.env.NODE_ENV !== 'production') {\n logDeprecatedError(key, xKey, yKey);\n }\n if (!this[privateKey]) {\n const pos: number[] = this[privateKey] = [];\n enhanceArray(this, pos);\n }\n return this[privateKey];\n },\n set(pos: number[]) {\n if (process.env.NODE_ENV !== 'production') {\n logDeprecatedError(key, xKey, yKey);\n }\n this[xKey] = pos[0];\n this[yKey] = pos[1];\n this[privateKey] = pos;\n enhanceArray(this, pos);\n }\n });\n function enhanceArray(self: any, pos: number[]) {\n Object.defineProperty(pos, 0, {\n get() {\n return self[xKey];\n },\n set(val: number) {\n self[xKey] = val;\n }\n });\n Object.defineProperty(pos, 1, {\n get() {\n return self[yKey];\n },\n set(val: number) {\n self[yKey] = val;\n }\n });\n }\n }\n if (Object.defineProperty\n // Just don't support ie8\n // && (!(env as any).browser.ie || (env as any).browser.version > 8)\n ) {\n createLegacyProperty('position', '_legacyPos', 'x', 'y');\n createLegacyProperty('scale', '_legacyScale', 'scaleX', 'scaleY');\n createLegacyProperty('origin', '_legacyOrigin', 'originX', 'originY');\n }\n })()\n}\n\nmixin(Element, Eventful);\nmixin(Element, Transformable);\n\nfunction animateTo(\n animatable: Element,\n target: Dictionary,\n cfg: ElementAnimateConfig,\n animationProps: Dictionary,\n reverse?: boolean\n) {\n cfg = cfg || {};\n const animators: Animator[] = [];\n animateToShallow(\n animatable,\n '',\n animatable,\n target,\n cfg,\n animationProps,\n animators,\n reverse\n );\n\n let finishCount = animators.length;\n let doneHappened = false;\n const cfgDone = cfg.done;\n const cfgAborted = cfg.aborted;\n\n const doneCb = () => {\n doneHappened = true;\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n\n const abortedCb = () => {\n finishCount--;\n if (finishCount <= 0) {\n doneHappened\n ? (cfgDone && cfgDone())\n : (cfgAborted && cfgAborted());\n }\n };\n\n // No animators. This should be checked before animators[i].start(),\n // because 'done' may be executed immediately if no need to animate.\n if (!finishCount) {\n cfgDone && cfgDone();\n }\n\n // Adding during callback to the first animator\n if (animators.length > 0 && cfg.during) {\n // TODO If there are two animators in animateTo, and the first one is stopped by other animator.\n animators[0].during((target, percent) => {\n cfg.during(percent);\n });\n }\n\n // Start after all animators created\n // Incase any animator is done immediately when all animation properties are not changed\n for (let i = 0; i < animators.length; i++) {\n const animator = animators[i];\n if (doneCb) {\n animator.done(doneCb);\n }\n if (abortedCb) {\n animator.aborted(abortedCb);\n }\n if (cfg.force) {\n animator.duration(cfg.duration);\n }\n animator.start(cfg.easing);\n }\n\n return animators;\n}\n\nfunction copyArrShallow(source: number[], target: number[], len: number) {\n for (let i = 0; i < len; i++) {\n source[i] = target[i];\n }\n}\n\nfunction is2DArray(value: any[]): value is number[][] {\n return isArrayLike(value[0]);\n}\n\nfunction copyValue(target: Dictionary, source: Dictionary, key: string) {\n if (isArrayLike(source[key])) {\n if (!isArrayLike(target[key])) {\n target[key] = [];\n }\n\n if (isTypedArray(source[key])) {\n const len = source[key].length;\n if (target[key].length !== len) {\n target[key] = new (source[key].constructor)(len);\n copyArrShallow(target[key], source[key], len);\n }\n }\n else {\n const sourceArr = source[key] as any[];\n const targetArr = target[key] as any[];\n\n const len0 = sourceArr.length;\n if (is2DArray(sourceArr)) {\n // NOTE: each item should have same length\n const len1 = sourceArr[0].length;\n\n for (let i = 0; i < len0; i++) {\n if (!targetArr[i]) {\n targetArr[i] = Array.prototype.slice.call(sourceArr[i]);\n }\n else {\n copyArrShallow(targetArr[i], sourceArr[i], len1);\n }\n }\n }\n else {\n copyArrShallow(targetArr, sourceArr, len0);\n }\n\n targetArr.length = sourceArr.length;\n }\n }\n else {\n target[key] = source[key];\n }\n}\n\nfunction isValueSame(val1: any, val2: any) {\n return val1 === val2\n // Only check 1 dimension array\n || isArrayLike(val1) && isArrayLike(val2) && is1DArraySame(val1, val2);\n}\n\nfunction is1DArraySame(arr0: ArrayLike, arr1: ArrayLike) {\n const len = arr0.length;\n if (len !== arr1.length) {\n return false;\n }\n for (let i = 0; i < len; i++) {\n if (arr0[i] !== arr1[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction animateToShallow(\n animatable: Element,\n topKey: string,\n animateObj: Dictionary,\n target: Dictionary,\n cfg: ElementAnimateConfig,\n animationProps: Dictionary | true,\n animators: Animator[],\n reverse: boolean // If `true`, animate from the `target` to current state.\n) {\n const targetKeys = keys(target);\n const duration = cfg.duration;\n const delay = cfg.delay;\n const additive = cfg.additive;\n const setToFinal = cfg.setToFinal;\n const animateAll = !isObject(animationProps);\n // Find last animator animating same prop.\n const existsAnimators = animatable.animators;\n\n let animationKeys: string[] = [];\n for (let k = 0; k < targetKeys.length; k++) {\n const innerKey = targetKeys[k] as string;\n const targetVal = target[innerKey];\n\n if (\n targetVal != null && animateObj[innerKey] != null\n && (animateAll || (animationProps as Dictionary)[innerKey])\n ) {\n if (isObject(targetVal)\n && !isArrayLike(targetVal)\n && !isGradientObject(targetVal)\n ) {\n if (topKey) {\n // logError('Only support 1 depth nest object animation.');\n // Assign directly.\n // TODO richText?\n if (!reverse) {\n animateObj[innerKey] = targetVal;\n animatable.updateDuringAnimation(topKey);\n }\n continue;\n }\n animateToShallow(\n animatable,\n innerKey,\n animateObj[innerKey],\n targetVal,\n cfg,\n animationProps && (animationProps as Dictionary)[innerKey],\n animators,\n reverse\n );\n }\n else {\n animationKeys.push(innerKey);\n }\n }\n else if (!reverse) {\n // Assign target value directly.\n animateObj[innerKey] = targetVal;\n animatable.updateDuringAnimation(topKey);\n // Previous animation will be stopped on the changed keys.\n // So direct assign is also included.\n animationKeys.push(innerKey);\n }\n }\n\n let keyLen = animationKeys.length;\n // Stop previous animations on the same property.\n if (!additive && keyLen) {\n // Stop exists animation on specific tracks. Only one animator available for each property.\n // TODO Should invoke previous animation callback?\n for (let i = 0; i < existsAnimators.length; i++) {\n const animator = existsAnimators[i];\n if (animator.targetName === topKey) {\n const allAborted = animator.stopTracks(animationKeys);\n if (allAborted) { // This animator can't be used.\n const idx = indexOf(existsAnimators, animator);\n existsAnimators.splice(idx, 1);\n }\n }\n }\n }\n\n // Ignore values not changed.\n // NOTE: Must filter it after previous animation stopped\n // and make sure the value to compare is using initial frame if animation is not started yet when setToFinal is used.\n if (!cfg.force) {\n animationKeys = filter(animationKeys, key => !isValueSame(target[key], animateObj[key]));\n keyLen = animationKeys.length;\n }\n\n if (keyLen > 0\n // cfg.force is mainly for keep invoking onframe and ondone callback even if animation is not necessary.\n // So if there is already has animators. There is no need to create another animator if not necessary.\n // Or it will always add one more with empty target.\n || (cfg.force && !animators.length)\n ) {\n let revertedSource: Dictionary;\n let reversedTarget: Dictionary;\n let sourceClone: Dictionary;\n if (reverse) {\n reversedTarget = {};\n if (setToFinal) {\n revertedSource = {};\n }\n for (let i = 0; i < keyLen; i++) {\n const innerKey = animationKeys[i];\n reversedTarget[innerKey] = animateObj[innerKey];\n if (setToFinal) {\n revertedSource[innerKey] = target[innerKey];\n }\n else {\n // The usage of \"animateFrom\" expects that the element props has been updated dirctly to\n // \"final\" values outside, and input the \"from\" values here (i.e., in variable `target` here).\n // So here we assign the \"from\" values directly to element here (rather that in the next frame)\n // to prevent the \"final\" values from being read in any other places (like other running\n // animator during callbacks).\n // But if `setToFinal: true` this feature can not be satisfied.\n animateObj[innerKey] = target[innerKey];\n }\n }\n }\n else if (setToFinal) {\n sourceClone = {};\n for (let i = 0; i < keyLen; i++) {\n const innerKey = animationKeys[i];\n // NOTE: Must clone source after the stopTracks. The property may be modified in stopTracks.\n sourceClone[innerKey] = cloneValue(animateObj[innerKey]);\n // Use copy, not change the original reference\n // Copy from target to source.\n copyValue(animateObj, target, innerKey);\n }\n }\n\n const animator = new Animator(animateObj, false, false, additive ? filter(\n // Use key string instead object reference because ref may be changed.\n existsAnimators, animator => animator.targetName === topKey\n ) : null);\n\n animator.targetName = topKey;\n if (cfg.scope) {\n animator.scope = cfg.scope;\n }\n\n if (setToFinal && revertedSource) {\n animator.whenWithKeys(0, revertedSource, animationKeys);\n }\n if (sourceClone) {\n animator.whenWithKeys(0, sourceClone, animationKeys);\n }\n\n animator.whenWithKeys(\n duration == null ? 500 : duration,\n reverse ? reversedTarget : target,\n animationKeys\n ).delay(delay || 0);\n\n animatable.addAnimator(animator, topKey);\n animators.push(animator);\n }\n}\n\n\nexport default Element;\n","/**\r\n * Group是一个容器,可以插入子节点,Group的变换也会被应用到子节点上\r\n * @module zrender/graphic/Group\r\n * @example\r\n * const Group = require('zrender/graphic/Group');\r\n * const Circle = require('zrender/graphic/shape/Circle');\r\n * const g = new Group();\r\n * g.position[0] = 100;\r\n * g.position[1] = 100;\r\n * g.add(new Circle({\r\n * style: {\r\n * x: 100,\r\n * y: 100,\r\n * r: 20,\r\n * }\r\n * }));\r\n * zr.add(g);\r\n */\r\n\r\nimport * as zrUtil from '../core/util';\r\nimport Element, { ElementProps } from '../Element';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Displayable from './Displayable';\r\nimport { ZRenderType } from '../zrender';\r\n\r\nexport interface GroupProps extends ElementProps {\r\n}\r\n\r\nclass Group extends Element {\r\n\r\n readonly isGroup = true\r\n\r\n private _children: Element[] = []\r\n\r\n\r\n constructor(opts?: GroupProps) {\r\n super();\r\n\r\n this.attr(opts);\r\n }\r\n\r\n /**\r\n * Get children reference.\r\n */\r\n childrenRef() {\r\n return this._children;\r\n }\r\n\r\n /**\r\n * Get children copy.\r\n */\r\n children() {\r\n return this._children.slice();\r\n }\r\n\r\n /**\r\n * 获取指定 index 的儿子节点\r\n */\r\n childAt(idx: number): Element {\r\n return this._children[idx];\r\n }\r\n\r\n /**\r\n * 获取指定名字的儿子节点\r\n */\r\n childOfName(name: string): Element {\r\n const children = this._children;\r\n for (let i = 0; i < children.length; i++) {\r\n if (children[i].name === name) {\r\n return children[i];\r\n }\r\n }\r\n }\r\n\r\n childCount(): number {\r\n return this._children.length;\r\n }\r\n\r\n /**\r\n * 添加子节点到最后\r\n */\r\n add(child: Element): Group {\r\n if (child) {\r\n if (child !== this && child.parent !== this) {\r\n this._children.push(child);\r\n this._doAdd(child);\r\n }\r\n if (process.env.NODE_ENV !== 'production') {\r\n if (child.__hostTarget) {\r\n throw 'This elemenet has been used as an attachment';\r\n }\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * 添加子节点在 nextSibling 之前\r\n */\r\n addBefore(child: Element, nextSibling: Element) {\r\n if (child && child !== this && child.parent !== this\r\n && nextSibling && nextSibling.parent === this) {\r\n\r\n const children = this._children;\r\n const idx = children.indexOf(nextSibling);\r\n\r\n if (idx >= 0) {\r\n children.splice(idx, 0, child);\r\n this._doAdd(child);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n replace(oldChild: Element, newChild: Element) {\r\n const idx = zrUtil.indexOf(this._children, oldChild);\r\n if (idx >= 0) {\r\n this.replaceAt(newChild, idx);\r\n }\r\n return this;\r\n }\r\n\r\n replaceAt(child: Element, index: number) {\r\n const children = this._children;\r\n const old = children[index];\r\n\r\n if (child && child !== this && child.parent !== this && child !== old) {\r\n children[index] = child;\r\n\r\n old.parent = null;\r\n const zr = this.__zr;\r\n if (zr) {\r\n old.removeSelfFromZr(zr);\r\n }\r\n\r\n this._doAdd(child);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n _doAdd(child: Element) {\r\n if (child.parent) {\r\n // Parent must be a group\r\n (child.parent as Group).remove(child);\r\n }\r\n\r\n child.parent = this;\r\n\r\n const zr = this.__zr;\r\n if (zr && zr !== (child as Group).__zr) { // Only group has __storage\r\n\r\n child.addSelfToZr(zr);\r\n }\r\n\r\n zr && zr.refresh();\r\n }\r\n\r\n /**\r\n * Remove child\r\n * @param child\r\n */\r\n remove(child: Element) {\r\n const zr = this.__zr;\r\n const children = this._children;\r\n\r\n const idx = zrUtil.indexOf(children, child);\r\n if (idx < 0) {\r\n return this;\r\n }\r\n children.splice(idx, 1);\r\n\r\n child.parent = null;\r\n\r\n if (zr) {\r\n\r\n child.removeSelfFromZr(zr);\r\n }\r\n\r\n zr && zr.refresh();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Remove all children\r\n */\r\n removeAll() {\r\n const children = this._children;\r\n const zr = this.__zr;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n if (zr) {\r\n child.removeSelfFromZr(zr);\r\n }\r\n child.parent = null;\r\n }\r\n children.length = 0;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * 遍历所有子节点\r\n */\r\n eachChild(\r\n cb: (this: Context, el: Element, index?: number) => void,\r\n context?: Context\r\n ) {\r\n const children = this._children;\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n cb.call(context, child, i);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Visit all descendants.\r\n * Return false in callback to stop visit descendants of current node\r\n */\r\n // TODO Group itself should also invoke the callback.\r\n traverse(\r\n cb: (this: T, el: Element) => boolean | void,\r\n context?: T\r\n ) {\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n const stopped = cb.call(context, child);\r\n\r\n if (child.isGroup && !stopped) {\r\n child.traverse(cb, context);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n addSelfToZr(zr: ZRenderType) {\r\n super.addSelfToZr(zr);\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n child.addSelfToZr(zr);\r\n }\r\n }\r\n\r\n removeSelfFromZr(zr: ZRenderType) {\r\n super.removeSelfFromZr(zr);\r\n for (let i = 0; i < this._children.length; i++) {\r\n const child = this._children[i];\r\n child.removeSelfFromZr(zr);\r\n }\r\n }\r\n\r\n getBoundingRect(includeChildren?: Element[]): BoundingRect {\r\n // TODO Caching\r\n const tmpRect = new BoundingRect(0, 0, 0, 0);\r\n const children = includeChildren || this._children;\r\n const tmpMat: MatrixArray = [];\r\n let rect = null;\r\n\r\n for (let i = 0; i < children.length; i++) {\r\n const child = children[i];\r\n // TODO invisible?\r\n if (child.ignore || (child as Displayable).invisible) {\r\n continue;\r\n }\r\n\r\n const childRect = child.getBoundingRect();\r\n const transform = child.getLocalTransform(tmpMat);\r\n // TODO\r\n // The boundingRect cacluated by transforming original\r\n // rect may be bigger than the actual bundingRect when rotation\r\n // is used. (Consider a circle rotated aginst its center, where\r\n // the actual boundingRect should be the same as that not be\r\n // rotated.) But we can not find better approach to calculate\r\n // actual boundingRect yet, considering performance.\r\n if (transform) {\r\n BoundingRect.applyTransform(tmpRect, childRect, transform);\r\n rect = rect || tmpRect.clone();\r\n rect.union(tmpRect);\r\n }\r\n else {\r\n rect = rect || childRect.clone();\r\n rect.union(childRect);\r\n }\r\n }\r\n return rect || tmpRect;\r\n }\r\n}\r\n\r\nGroup.prototype.type = 'group';\r\n// Storage will use childrenRef to get children to render.\r\nexport interface GroupLike extends Element {\r\n childrenRef(): Element[]\r\n}\r\n\r\nexport default Group;","/*!\n* ZRender, a high performance 2d drawing library.\n*\n* Copyright (c) 2013, Baidu Inc.\n* All rights reserved.\n*\n* LICENSE\n* https://github.com/ecomfe/zrender/blob/master/LICENSE.txt\n*/\n\nimport env from './core/env';\nimport * as zrUtil from './core/util';\nimport Handler from './Handler';\nimport Storage from './Storage';\nimport {PainterBase} from './PainterBase';\nimport Animation, {getTime} from './animation/Animation';\nimport HandlerProxy from './dom/HandlerProxy';\nimport Element, { ElementEventCallback } from './Element';\nimport { Dictionary, ElementEventName, RenderedEvent, WithThisType } from './core/types';\nimport { LayerConfig } from './canvas/Layer';\nimport { GradientObject } from './graphic/Gradient';\nimport { PatternObject } from './graphic/Pattern';\nimport { EventCallback } from './core/Eventful';\nimport Displayable from './graphic/Displayable';\nimport { lum } from './tool/color';\nimport { DARK_MODE_THRESHOLD } from './config';\nimport Group from './graphic/Group';\n\n\ntype PainterBaseCtor = {\n new(dom: HTMLElement, storage: Storage, ...args: any[]): PainterBase\n}\n\nconst painterCtors: Dictionary = {};\n\nlet instances: { [key: number]: ZRender } = {};\n\nfunction delInstance(id: number) {\n delete instances[id];\n}\n\nfunction isDarkMode(backgroundColor: string | GradientObject | PatternObject): boolean {\n if (!backgroundColor) {\n return false;\n }\n if (typeof backgroundColor === 'string') {\n return lum(backgroundColor, 1) < DARK_MODE_THRESHOLD;\n }\n else if ((backgroundColor as GradientObject).colorStops) {\n const colorStops = (backgroundColor as GradientObject).colorStops;\n let totalLum = 0;\n const len = colorStops.length;\n // Simply do the math of average the color. Not consider the offset\n for (let i = 0; i < len; i++) {\n totalLum += lum(colorStops[i].color, 1);\n }\n totalLum /= len;\n\n return totalLum < DARK_MODE_THRESHOLD;\n }\n // Can't determine\n return false;\n}\n\nclass ZRender {\n /**\n * Not necessary if using SSR painter like svg-ssr\n */\n dom?: HTMLElement\n\n id: number\n\n storage: Storage\n painter: PainterBase\n handler: Handler\n animation: Animation\n\n private _sleepAfterStill = 10;\n\n private _stillFrameAccum = 0;\n\n private _needsRefresh = true\n private _needsRefreshHover = true\n private _disposed: boolean;\n /**\n * If theme is dark mode. It will determine the color strategy for labels.\n */\n private _darkMode = false;\n\n private _backgroundColor: string | GradientObject | PatternObject;\n\n constructor(id: number, dom?: HTMLElement, opts?: ZRenderInitOpt) {\n opts = opts || {};\n\n /**\n * @type {HTMLDomElement}\n */\n this.dom = dom;\n\n this.id = id;\n\n const storage = new Storage();\n\n let rendererType = opts.renderer || 'canvas';\n\n if (!painterCtors[rendererType]) {\n // Use the first registered renderer.\n rendererType = zrUtil.keys(painterCtors)[0];\n }\n if (process.env.NODE_ENV !== 'production') {\n if (!painterCtors[rendererType]) {\n throw new Error(`Renderer '${rendererType}' is not imported. Please import it first.`);\n }\n }\n\n opts.useDirtyRect = opts.useDirtyRect == null\n ? false\n : opts.useDirtyRect;\n\n const painter = new painterCtors[rendererType](dom, storage, opts, id);\n const ssrMode = opts.ssr || painter.ssrOnly;\n\n this.storage = storage;\n this.painter = painter;\n\n const handlerProxy = (!env.node && !env.worker && !ssrMode)\n ? new HandlerProxy(painter.getViewportRoot(), painter.root)\n : null;\n\n const useCoarsePointer = opts.useCoarsePointer;\n const usePointerSize = (useCoarsePointer == null || useCoarsePointer === 'auto')\n ? env.touchEventsSupported\n : !!useCoarsePointer;\n const defaultPointerSize = 44;\n let pointerSize;\n if (usePointerSize) {\n pointerSize = zrUtil.retrieve2(opts.pointerSize, defaultPointerSize);\n }\n\n this.handler = new Handler(storage, painter, handlerProxy, painter.root, pointerSize);\n\n this.animation = new Animation({\n stage: {\n update: ssrMode ? null : () => this._flush(true)\n }\n });\n\n if (!ssrMode) {\n this.animation.start();\n }\n }\n\n /**\n * 添加元素\n */\n add(el: Element) {\n if (this._disposed || !el) {\n return;\n }\n this.storage.addRoot(el);\n el.addSelfToZr(this);\n this.refresh();\n }\n\n /**\n * 删除元素\n */\n remove(el: Element) {\n if (this._disposed || !el) {\n return;\n }\n this.storage.delRoot(el);\n el.removeSelfFromZr(this);\n this.refresh();\n }\n\n /**\n * Change configuration of layer\n */\n configLayer(zLevel: number, config: LayerConfig) {\n if (this._disposed) {\n return;\n }\n if (this.painter.configLayer) {\n this.painter.configLayer(zLevel, config);\n }\n this.refresh();\n }\n\n /**\n * Set background color\n */\n setBackgroundColor(backgroundColor: string | GradientObject | PatternObject) {\n if (this._disposed) {\n return;\n }\n if (this.painter.setBackgroundColor) {\n this.painter.setBackgroundColor(backgroundColor);\n }\n this.refresh();\n this._backgroundColor = backgroundColor;\n this._darkMode = isDarkMode(backgroundColor);\n }\n\n getBackgroundColor() {\n return this._backgroundColor;\n }\n\n /**\n * Force to set dark mode\n */\n setDarkMode(darkMode: boolean) {\n this._darkMode = darkMode;\n }\n\n isDarkMode() {\n return this._darkMode;\n }\n\n /**\n * Repaint the canvas immediately\n */\n refreshImmediately(fromInside?: boolean) {\n if (this._disposed) {\n return;\n }\n // const start = new Date();\n if (!fromInside) {\n // Update animation if refreshImmediately is invoked from outside.\n // Not trigger stage update to call flush again. Which may refresh twice\n this.animation.update(true);\n }\n\n // Clear needsRefresh ahead to avoid something wrong happens in refresh\n // Or it will cause zrender refreshes again and again.\n this._needsRefresh = false;\n this.painter.refresh();\n // Avoid trigger zr.refresh in Element#beforeUpdate hook\n this._needsRefresh = false;\n }\n\n /**\n * Mark and repaint the canvas in the next frame of browser\n */\n refresh() {\n if (this._disposed) {\n return;\n }\n this._needsRefresh = true;\n // Active the animation again.\n this.animation.start();\n }\n\n /**\n * Perform all refresh\n */\n flush() {\n if (this._disposed) {\n return;\n }\n this._flush(false);\n }\n\n private _flush(fromInside?: boolean) {\n let triggerRendered;\n\n const start = getTime();\n if (this._needsRefresh) {\n triggerRendered = true;\n this.refreshImmediately(fromInside);\n }\n\n if (this._needsRefreshHover) {\n triggerRendered = true;\n this.refreshHoverImmediately();\n }\n const end = getTime();\n\n if (triggerRendered) {\n this._stillFrameAccum = 0;\n this.trigger('rendered', {\n elapsedTime: end - start\n } as RenderedEvent);\n }\n else if (this._sleepAfterStill > 0) {\n this._stillFrameAccum++;\n // Stop the animation after still for 10 frames.\n if (this._stillFrameAccum > this._sleepAfterStill) {\n this.animation.stop();\n }\n }\n }\n\n /**\n * Set sleep after still for frames.\n * Disable auto sleep when it's 0.\n */\n setSleepAfterStill(stillFramesCount: number) {\n this._sleepAfterStill = stillFramesCount;\n }\n\n /**\n * Wake up animation loop. But not render.\n */\n wakeUp() {\n if (this._disposed) {\n return;\n }\n this.animation.start();\n // Reset the frame count.\n this._stillFrameAccum = 0;\n }\n\n /**\n * Refresh hover in next frame\n */\n refreshHover() {\n this._needsRefreshHover = true;\n }\n\n /**\n * Refresh hover immediately\n */\n refreshHoverImmediately() {\n if (this._disposed) {\n return;\n }\n this._needsRefreshHover = false;\n if (this.painter.refreshHover && this.painter.getType() === 'canvas') {\n this.painter.refreshHover();\n }\n }\n\n /**\n * Resize the canvas.\n * Should be invoked when container size is changed\n */\n resize(opts?: {\n width?: number| string\n height?: number | string\n }) {\n if (this._disposed) {\n return;\n }\n opts = opts || {};\n this.painter.resize(opts.width, opts.height);\n this.handler.resize();\n }\n\n /**\n * Stop and clear all animation immediately\n */\n clearAnimation() {\n if (this._disposed) {\n return;\n }\n this.animation.clear();\n }\n\n /**\n * Get container width\n */\n getWidth(): number | undefined {\n if (this._disposed) {\n return;\n }\n return this.painter.getWidth();\n }\n\n /**\n * Get container height\n */\n getHeight(): number | undefined {\n if (this._disposed) {\n return;\n }\n return this.painter.getHeight();\n }\n\n /**\n * Set default cursor\n * @param cursorStyle='default' 例如 crosshair\n */\n setCursorStyle(cursorStyle: string) {\n if (this._disposed) {\n return;\n }\n this.handler.setCursorStyle(cursorStyle);\n }\n\n /**\n * Find hovered element\n * @param x\n * @param y\n * @return {target, topTarget}\n */\n findHover(x: number, y: number): {\n target: Displayable\n topTarget: Displayable\n } | undefined {\n if (this._disposed) {\n return;\n }\n return this.handler.findHover(x, y);\n }\n\n on(eventName: ElementEventName, eventHandler: ElementEventCallback, context?: Ctx): this\n // eslint-disable-next-line max-len\n on(eventName: string, eventHandler: WithThisType, unknown extends Ctx ? ZRenderType : Ctx>, context?: Ctx): this\n // eslint-disable-next-line max-len\n on(eventName: string, eventHandler: (...args: any) => any, context?: Ctx): this {\n if (!this._disposed) {\n this.handler.on(eventName, eventHandler, context);\n }\n return this;\n }\n\n /**\n * Unbind event\n * @param eventName Event name\n * @param eventHandler Handler function\n */\n // eslint-disable-next-line max-len\n off(eventName?: string, eventHandler?: EventCallback) {\n if (this._disposed) {\n return;\n }\n this.handler.off(eventName, eventHandler);\n }\n\n /**\n * Trigger event manually\n *\n * @param eventName Event name\n * @param event Event object\n */\n trigger(eventName: string, event?: unknown) {\n if (this._disposed) {\n return;\n }\n this.handler.trigger(eventName, event);\n }\n\n\n /**\n * Clear all objects and the canvas.\n */\n clear() {\n if (this._disposed) {\n return;\n }\n const roots = this.storage.getRoots();\n for (let i = 0; i < roots.length; i++) {\n if (roots[i] instanceof Group) {\n roots[i].removeSelfFromZr(this);\n }\n }\n this.storage.delAllRoots();\n this.painter.clear();\n }\n\n /**\n * Dispose self.\n */\n dispose() {\n if (this._disposed) {\n return;\n }\n\n this.animation.stop();\n\n this.clear();\n this.storage.dispose();\n this.painter.dispose();\n this.handler.dispose();\n\n this.animation =\n this.storage =\n this.painter =\n this.handler = null;\n\n this._disposed = true;\n\n delInstance(this.id);\n }\n}\n\n\nexport interface ZRenderInitOpt {\n renderer?: string // 'canvas' or 'svg\n devicePixelRatio?: number\n width?: number | string // 10, 10px, 'auto'\n height?: number | string\n useDirtyRect?: boolean\n useCoarsePointer?: 'auto' | boolean\n pointerSize?: number\n ssr?: boolean // If enable ssr mode.\n}\n\n/**\n * Initializing a zrender instance\n *\n * @param dom Not necessary if using SSR painter like svg-ssr\n */\nexport function init(dom?: HTMLElement | null, opts?: ZRenderInitOpt) {\n const zr = new ZRender(zrUtil.guid(), dom, opts);\n instances[zr.id] = zr;\n return zr;\n}\n\n/**\n * Dispose zrender instance\n */\nexport function dispose(zr: ZRender) {\n zr.dispose();\n}\n\n/**\n * Dispose all zrender instances\n */\nexport function disposeAll() {\n for (let key in instances) {\n if (instances.hasOwnProperty(key)) {\n instances[key].dispose();\n }\n }\n instances = {};\n}\n\n/**\n * Get zrender instance by id\n */\nexport function getInstance(id: number): ZRender {\n return instances[id];\n}\n\nexport function registerPainter(name: string, Ctor: PainterBaseCtor) {\n painterCtors[name] = Ctor;\n}\n\nexport type ElementSSRData = zrUtil.HashMap;\nexport type ElementSSRDataGetter = (el: Element) => zrUtil.HashMap;\n\nlet ssrDataGetter: ElementSSRDataGetter;\n\nexport function getElementSSRData(el: Element): ElementSSRData {\n if (typeof ssrDataGetter === 'function') {\n return ssrDataGetter(el);\n }\n}\n\nexport function registerSSRDataGetter(getter: ElementSSRDataGetter) {\n ssrDataGetter = getter;\n}\n\n/**\n * @type {string}\n */\nexport const version = '5.6.1';\n\n\nexport interface ZRenderType extends ZRender {};","/**\r\n * Base class of all displayable graphic objects\r\n */\r\n\r\nimport Element, {ElementProps, ElementStatePropNames, ElementAnimateConfig, ElementCommonState} from '../Element';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { PropType, Dictionary, MapToType } from '../core/types';\r\nimport Path from './Path';\r\nimport { keys, extend, createObject } from '../core/util';\r\nimport Animator from '../animation/Animator';\r\nimport { REDRAW_BIT, STYLE_CHANGED_BIT } from './constants';\r\n\r\n// type CalculateTextPositionResult = ReturnType\r\n\r\nconst STYLE_MAGIC_KEY = '__zr_style_' + Math.round((Math.random() * 10));\r\n\r\nexport interface CommonStyleProps {\r\n shadowBlur?: number\r\n shadowOffsetX?: number\r\n shadowOffsetY?: number\r\n shadowColor?: string\r\n\r\n opacity?: number\r\n /**\r\n * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation\r\n */\r\n blend?: string\r\n}\r\n\r\nexport const DEFAULT_COMMON_STYLE: CommonStyleProps = {\r\n shadowBlur: 0,\r\n shadowOffsetX: 0,\r\n shadowOffsetY: 0,\r\n shadowColor: '#000',\r\n opacity: 1,\r\n blend: 'source-over'\r\n};\r\n\r\nexport const DEFAULT_COMMON_ANIMATION_PROPS: MapToType = {\r\n style: {\r\n shadowBlur: true,\r\n shadowOffsetX: true,\r\n shadowOffsetY: true,\r\n shadowColor: true,\r\n opacity: true\r\n }\r\n };\r\n\r\n(DEFAULT_COMMON_STYLE as any)[STYLE_MAGIC_KEY] = true;\r\n\r\nexport interface DisplayableProps extends ElementProps {\r\n style?: Dictionary\r\n\r\n zlevel?: number\r\n z?: number\r\n z2?: number\r\n\r\n culling?: boolean\r\n\r\n // TODO list all cursors\r\n cursor?: string\r\n\r\n rectHover?: boolean\r\n\r\n progressive?: boolean\r\n\r\n incremental?: boolean\r\n\r\n ignoreCoarsePointer?: boolean\r\n\r\n batch?: boolean\r\n invisible?: boolean\r\n}\r\n\r\ntype DisplayableKey = keyof DisplayableProps\r\ntype DisplayablePropertyType = PropType\r\n\r\nexport type DisplayableStatePropNames = ElementStatePropNames | 'style' | 'z' | 'z2' | 'invisible';\r\nexport type DisplayableState = Pick & ElementCommonState;\r\n\r\nconst PRIMARY_STATES_KEYS = ['z', 'z2', 'invisible'] as const;\r\nconst PRIMARY_STATES_KEYS_IN_HOVER_LAYER = ['invisible'] as const;\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\ninterface Displayable {\r\n animate(key?: '', loop?: boolean): Animator\r\n animate(key: 'style', loop?: boolean): Animator\r\n\r\n getState(stateName: string): DisplayableState\r\n ensureState(stateName: string): DisplayableState\r\n\r\n states: Dictionary\r\n stateProxy: (stateName: string) => DisplayableState\r\n}\r\n\r\nclass Displayable extends Element {\r\n\r\n /**\r\n * Whether the displayable object is visible. when it is true, the displayable object\r\n * is not drawn, but the mouse event can still trigger the object.\r\n */\r\n invisible: boolean\r\n\r\n z: number\r\n\r\n z2: number\r\n\r\n /**\r\n * The z level determines the displayable object can be drawn in which layer canvas.\r\n */\r\n zlevel: number\r\n\r\n /**\r\n * If enable culling\r\n */\r\n culling: boolean\r\n\r\n /**\r\n * Mouse cursor when hovered\r\n */\r\n cursor: string\r\n\r\n /**\r\n * If hover area is bounding rect\r\n */\r\n rectHover: boolean\r\n /**\r\n * For increamental rendering\r\n */\r\n incremental: boolean\r\n\r\n /**\r\n * Never increase to target size\r\n */\r\n ignoreCoarsePointer?: boolean\r\n\r\n style: Dictionary\r\n\r\n protected _normalState: DisplayableState\r\n\r\n protected _rect: BoundingRect\r\n protected _paintRect: BoundingRect\r\n protected _prevPaintRect: BoundingRect\r\n\r\n dirtyRectTolerance: number\r\n\r\n /************* Properties will be inejected in other modules. *******************/\r\n\r\n // @deprecated.\r\n useHoverLayer?: boolean\r\n\r\n __hoverStyle?: CommonStyleProps\r\n\r\n // TODO use WeakMap?\r\n\r\n // Shapes for cascade clipping.\r\n // Can only be `null`/`undefined` or an non-empty array, MUST NOT be an empty array.\r\n // because it is easy to only using null to check whether clipPaths changed.\r\n __clipPaths?: Path[]\r\n\r\n // FOR CANVAS PAINTER\r\n __canvasFillGradient: CanvasGradient\r\n __canvasStrokeGradient: CanvasGradient\r\n __canvasFillPattern: CanvasPattern\r\n __canvasStrokePattern: CanvasPattern\r\n\r\n // FOR SVG PAINTER\r\n __svgEl: SVGElement\r\n\r\n constructor(props?: Props) {\r\n super(props);\r\n }\r\n\r\n protected _init(props?: Props) {\r\n // Init default properties\r\n const keysArr = keys(props);\r\n for (let i = 0; i < keysArr.length; i++) {\r\n const key = keysArr[i];\r\n if (key === 'style') {\r\n this.useStyle(props[key] as Props['style']);\r\n }\r\n else {\r\n super.attrKV(key as any, props[key]);\r\n }\r\n }\r\n // Give a empty style\r\n if (!this.style) {\r\n this.useStyle({});\r\n }\r\n }\r\n\r\n // Hook provided to developers.\r\n beforeBrush() {}\r\n afterBrush() {}\r\n\r\n // Hook provided to inherited classes.\r\n // Executed between beforeBrush / afterBrush\r\n innerBeforeBrush() {}\r\n innerAfterBrush() {}\r\n\r\n shouldBePainted(\r\n viewWidth: number,\r\n viewHeight: number,\r\n considerClipPath: boolean,\r\n considerAncestors: boolean\r\n ) {\r\n const m = this.transform;\r\n if (\r\n this.ignore\r\n // Ignore invisible element\r\n || this.invisible\r\n // Ignore transparent element\r\n || this.style.opacity === 0\r\n // Ignore culled element\r\n || (this.culling\r\n && isDisplayableCulled(this, viewWidth, viewHeight)\r\n )\r\n // Ignore scale 0 element, in some environment like node-canvas\r\n // Draw a scale 0 element can cause all following draw wrong\r\n // And setTransform with scale 0 will cause set back transform failed.\r\n || (m && !m[0] && !m[3])\r\n ) {\r\n return false;\r\n }\r\n\r\n if (considerClipPath && this.__clipPaths) {\r\n for (let i = 0; i < this.__clipPaths.length; ++i) {\r\n if (this.__clipPaths[i].isZeroArea()) {\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n if (considerAncestors && this.parent) {\r\n let parent = this.parent;\r\n while (parent) {\r\n if (parent.ignore) {\r\n return false;\r\n }\r\n parent = parent.parent;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * If displayable element contain coord x, y\r\n */\r\n contain(x: number, y: number) {\r\n return this.rectContain(x, y);\r\n }\r\n\r\n traverse(\r\n cb: (this: Context, el: this) => void,\r\n context?: Context\r\n ) {\r\n cb.call(context, this);\r\n }\r\n\r\n /**\r\n * If bounding rect of element contain coord x, y\r\n */\r\n rectContain(x: number, y: number) {\r\n const coord = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n return rect.contain(coord[0], coord[1]);\r\n }\r\n\r\n getPaintRect(): BoundingRect {\r\n let rect = this._paintRect;\r\n if (!this._paintRect || this.__dirty) {\r\n const transform = this.transform;\r\n const elRect = this.getBoundingRect();\r\n\r\n const style = this.style;\r\n const shadowSize = style.shadowBlur || 0;\r\n const shadowOffsetX = style.shadowOffsetX || 0;\r\n const shadowOffsetY = style.shadowOffsetY || 0;\r\n\r\n rect = this._paintRect || (this._paintRect = new BoundingRect(0, 0, 0, 0));\r\n if (transform) {\r\n BoundingRect.applyTransform(rect, elRect, transform);\r\n }\r\n else {\r\n rect.copy(elRect);\r\n }\r\n\r\n if (shadowSize || shadowOffsetX || shadowOffsetY) {\r\n rect.width += shadowSize * 2 + Math.abs(shadowOffsetX);\r\n rect.height += shadowSize * 2 + Math.abs(shadowOffsetY);\r\n rect.x = Math.min(rect.x, rect.x + shadowOffsetX - shadowSize);\r\n rect.y = Math.min(rect.y, rect.y + shadowOffsetY - shadowSize);\r\n\r\n }\r\n\r\n // For the accuracy tolerance of text height or line joint point\r\n const tolerance = this.dirtyRectTolerance;\r\n if (!rect.isZero()) {\r\n rect.x = Math.floor(rect.x - tolerance);\r\n rect.y = Math.floor(rect.y - tolerance);\r\n rect.width = Math.ceil(rect.width + 1 + tolerance * 2);\r\n rect.height = Math.ceil(rect.height + 1 + tolerance * 2);\r\n }\r\n }\r\n return rect;\r\n }\r\n\r\n setPrevPaintRect(paintRect: BoundingRect) {\r\n if (paintRect) {\r\n this._prevPaintRect = this._prevPaintRect || new BoundingRect(0, 0, 0, 0);\r\n this._prevPaintRect.copy(paintRect);\r\n }\r\n else {\r\n this._prevPaintRect = null;\r\n }\r\n }\r\n\r\n getPrevPaintRect(): BoundingRect {\r\n return this._prevPaintRect;\r\n }\r\n\r\n /**\r\n * Alias for animate('style')\r\n * @param loop\r\n */\r\n animateStyle(loop: boolean) {\r\n return this.animate('style', loop);\r\n }\r\n\r\n // Override updateDuringAnimation\r\n updateDuringAnimation(targetKey: string) {\r\n if (targetKey === 'style') {\r\n this.dirtyStyle();\r\n }\r\n else {\r\n this.markRedraw();\r\n }\r\n }\r\n\r\n attrKV(key: DisplayableKey, value: DisplayablePropertyType) {\r\n if (key !== 'style') {\r\n super.attrKV(key as keyof DisplayableProps, value);\r\n }\r\n else {\r\n if (!this.style) {\r\n this.useStyle(value as Dictionary);\r\n }\r\n else {\r\n this.setStyle(value as Dictionary);\r\n }\r\n }\r\n }\r\n\r\n setStyle(obj: Props['style']): this\r\n setStyle(obj: T, value: Props['style'][T]): this\r\n setStyle(keyOrObj: keyof Props['style'] | Props['style'], value?: unknown): this {\r\n if (typeof keyOrObj === 'string') {\r\n this.style[keyOrObj] = value;\r\n }\r\n else {\r\n extend(this.style, keyOrObj as Props['style']);\r\n }\r\n this.dirtyStyle();\r\n return this;\r\n }\r\n\r\n // getDefaultStyleValue(key: T): Props['style'][T] {\r\n // // Default value is on the prototype.\r\n // return this.style.prototype[key];\r\n // }\r\n\r\n dirtyStyle(notRedraw?: boolean) {\r\n if (!notRedraw) {\r\n this.markRedraw();\r\n }\r\n this.__dirty |= STYLE_CHANGED_BIT;\r\n // Clear bounding rect.\r\n if (this._rect) {\r\n this._rect = null;\r\n }\r\n }\r\n\r\n dirty() {\r\n this.dirtyStyle();\r\n }\r\n\r\n /**\r\n * Is style changed. Used with dirtyStyle.\r\n */\r\n styleChanged() {\r\n return !!(this.__dirty & STYLE_CHANGED_BIT);\r\n }\r\n\r\n /**\r\n * Mark style updated. Only useful when style is used for caching. Like in the text.\r\n */\r\n styleUpdated() {\r\n this.__dirty &= ~STYLE_CHANGED_BIT;\r\n }\r\n\r\n /**\r\n * Create a style object with default values in it's prototype.\r\n */\r\n createStyle(obj?: Props['style']) {\r\n return createObject(DEFAULT_COMMON_STYLE, obj);\r\n }\r\n\r\n /**\r\n * Replace style property.\r\n * It will create a new style if given obj is not a valid style object.\r\n */\r\n // PENDING should not createStyle if it's an style object.\r\n useStyle(obj: Props['style']) {\r\n if (!obj[STYLE_MAGIC_KEY]) {\r\n obj = this.createStyle(obj);\r\n }\r\n if (this.__inHover) {\r\n this.__hoverStyle = obj; // Not affect exists style.\r\n }\r\n else {\r\n this.style = obj;\r\n }\r\n this.dirtyStyle();\r\n }\r\n\r\n /**\r\n * Determine if an object is a valid style object.\r\n * Which means it is created by `createStyle.`\r\n *\r\n * A valid style object will have all default values in it's prototype.\r\n * To avoid get null/undefined values.\r\n */\r\n isStyleObject(obj: Props['style']) {\r\n return obj[STYLE_MAGIC_KEY];\r\n }\r\n\r\n protected _innerSaveToNormal(toState: DisplayableState) {\r\n super._innerSaveToNormal(toState);\r\n\r\n const normalState = this._normalState;\r\n if (toState.style && !normalState.style) {\r\n // Clone style object.\r\n // TODO: Only save changed style.\r\n normalState.style = this._mergeStyle(this.createStyle(), this.style);\r\n }\r\n\r\n this._savePrimaryToNormal(toState, normalState, PRIMARY_STATES_KEYS);\r\n }\r\n\r\n protected _applyStateObj(\r\n stateName: string,\r\n state: DisplayableState,\r\n normalState: DisplayableState,\r\n keepCurrentStates: boolean,\r\n transition: boolean,\r\n animationCfg: ElementAnimateConfig\r\n ) {\r\n super._applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg);\r\n\r\n const needsRestoreToNormal = !(state && keepCurrentStates);\r\n let targetStyle: Props['style'];\r\n if (state && state.style) {\r\n // Only animate changed properties.\r\n if (transition) {\r\n if (keepCurrentStates) {\r\n targetStyle = state.style;\r\n }\r\n else {\r\n targetStyle = this._mergeStyle(this.createStyle(), normalState.style);\r\n this._mergeStyle(targetStyle, state.style);\r\n }\r\n }\r\n else {\r\n targetStyle = this._mergeStyle(\r\n this.createStyle(),\r\n keepCurrentStates ? this.style : normalState.style\r\n );\r\n this._mergeStyle(targetStyle, state.style);\r\n }\r\n }\r\n else if (needsRestoreToNormal) {\r\n targetStyle = normalState.style;\r\n }\r\n\r\n if (targetStyle) {\r\n if (transition) {\r\n // Clone a new style. Not affect the original one.\r\n const sourceStyle = this.style;\r\n\r\n this.style = this.createStyle(needsRestoreToNormal ? {} : sourceStyle);\r\n // const sourceStyle = this.style = this.createStyle(this.style);\r\n\r\n if (needsRestoreToNormal) {\r\n const changedKeys = keys(sourceStyle);\r\n for (let i = 0; i < changedKeys.length; i++) {\r\n const key = changedKeys[i];\r\n if (key in targetStyle) { // Not use `key == null` because == null may means no stroke/fill.\r\n // Pick out from prototype. Or the property won't be animated.\r\n (targetStyle as any)[key] = targetStyle[key];\r\n // Omit the property has no default value.\r\n (this.style as any)[key] = sourceStyle[key];\r\n }\r\n }\r\n }\r\n\r\n // If states is switched twice in ONE FRAME, for example:\r\n // one property(for example shadowBlur) changed from default value to a specifed value,\r\n // then switched back in immediately. this.style may don't set this property yet when switching back.\r\n // It won't treat it as an changed property when switching back. And it won't be animated.\r\n // So here we make sure the properties will be animated from default value to a specifed value are set.\r\n const targetKeys = keys(targetStyle);\r\n for (let i = 0; i < targetKeys.length; i++) {\r\n const key = targetKeys[i];\r\n this.style[key] = this.style[key];\r\n }\r\n\r\n this._transitionState(stateName, {\r\n style: targetStyle\r\n } as Props, animationCfg, this.getAnimationStyleProps() as MapToType);\r\n }\r\n else {\r\n this.useStyle(targetStyle);\r\n }\r\n }\r\n\r\n // Don't change z, z2 for element moved into hover layer.\r\n // It's not necessary and will cause paint list order changed.\r\n const statesKeys = this.__inHover ? PRIMARY_STATES_KEYS_IN_HOVER_LAYER : PRIMARY_STATES_KEYS;\r\n for (let i = 0; i < statesKeys.length; i++) {\r\n let key = statesKeys[i];\r\n if (state && state[key] != null) {\r\n // Replace if it exist in target state\r\n (this as any)[key] = state[key];\r\n }\r\n else if (needsRestoreToNormal) {\r\n // Restore to normal state\r\n if (normalState[key] != null) {\r\n (this as any)[key] = normalState[key];\r\n }\r\n }\r\n }\r\n }\r\n\r\n protected _mergeStates(states: DisplayableState[]) {\r\n const mergedState = super._mergeStates(states) as DisplayableState;\r\n let mergedStyle: Props['style'];\r\n for (let i = 0; i < states.length; i++) {\r\n const state = states[i];\r\n if (state.style) {\r\n mergedStyle = mergedStyle || {};\r\n this._mergeStyle(mergedStyle, state.style);\r\n }\r\n }\r\n if (mergedStyle) {\r\n mergedState.style = mergedStyle;\r\n }\r\n return mergedState;\r\n }\r\n\r\n protected _mergeStyle(\r\n targetStyle: CommonStyleProps,\r\n sourceStyle: CommonStyleProps\r\n ) {\r\n extend(targetStyle, sourceStyle);\r\n return targetStyle;\r\n }\r\n\r\n getAnimationStyleProps() {\r\n return DEFAULT_COMMON_ANIMATION_PROPS;\r\n }\r\n\r\n /**\r\n * The string value of `textPosition` needs to be calculated to a real postion.\r\n * For example, `'inside'` is calculated to `[rect.width/2, rect.height/2]`\r\n * by default. See `contain/text.js#calculateTextPosition` for more details.\r\n * But some coutom shapes like \"pin\", \"flag\" have center that is not exactly\r\n * `[width/2, height/2]`. So we provide this hook to customize the calculation\r\n * for those shapes. It will be called if the `style.textPosition` is a string.\r\n * @param out Prepared out object. If not provided, this method should\r\n * be responsible for creating one.\r\n * @param style\r\n * @param rect {x, y, width, height}\r\n * @return out The same as the input out.\r\n * {\r\n * x: number. mandatory.\r\n * y: number. mandatory.\r\n * textAlign: string. optional. use style.textAlign by default.\r\n * textVerticalAlign: string. optional. use style.textVerticalAlign by default.\r\n * }\r\n */\r\n // calculateTextPosition: (out: CalculateTextPositionResult, style: Dictionary, rect: RectLike) => CalculateTextPositionResult\r\n\r\n protected static initDefaultProps = (function () {\r\n const dispProto = Displayable.prototype;\r\n dispProto.type = 'displayable';\r\n dispProto.invisible = false;\r\n dispProto.z = 0;\r\n dispProto.z2 = 0;\r\n dispProto.zlevel = 0;\r\n dispProto.culling = false;\r\n dispProto.cursor = 'pointer';\r\n dispProto.rectHover = false;\r\n dispProto.incremental = false;\r\n dispProto._rect = null;\r\n dispProto.dirtyRectTolerance = 0;\r\n\r\n dispProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT;\r\n })()\r\n}\r\n\r\nconst tmpRect = new BoundingRect(0, 0, 0, 0);\r\nconst viewRect = new BoundingRect(0, 0, 0, 0);\r\nfunction isDisplayableCulled(el: Displayable, width: number, height: number) {\r\n tmpRect.copy(el.getBoundingRect());\r\n if (el.transform) {\r\n tmpRect.applyTransform(el.transform);\r\n }\r\n viewRect.width = width;\r\n viewRect.height = height;\r\n return !tmpRect.intersect(viewRect);\r\n}\r\n\r\nexport default Displayable;","/**\r\n * @author Yi Shen(https://github.com/pissang)\r\n */\r\n\r\nimport * as vec2 from './vector';\r\nimport * as curve from './curve';\r\n\r\nconst mathMin = Math.min;\r\nconst mathMax = Math.max;\r\nconst mathSin = Math.sin;\r\nconst mathCos = Math.cos;\r\nconst PI2 = Math.PI * 2;\r\n\r\nconst start = vec2.create();\r\nconst end = vec2.create();\r\nconst extremity = vec2.create();\r\n\r\n/**\r\n * 从顶点数组中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromPoints(points: ArrayLike[], min: vec2.VectorArray, max: vec2.VectorArray) {\r\n if (points.length === 0) {\r\n return;\r\n }\r\n let p = points[0];\r\n let left = p[0];\r\n let right = p[0];\r\n let top = p[1];\r\n let bottom = p[1];\r\n\r\n for (let i = 1; i < points.length; i++) {\r\n p = points[i];\r\n left = mathMin(left, p[0]);\r\n right = mathMax(right, p[0]);\r\n top = mathMin(top, p[1]);\r\n bottom = mathMax(bottom, p[1]);\r\n }\r\n\r\n min[0] = left;\r\n min[1] = top;\r\n max[0] = right;\r\n max[1] = bottom;\r\n}\r\n\r\nexport function fromLine(\r\n x0: number, y0: number, x1: number, y1: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n min[0] = mathMin(x0, x1);\r\n min[1] = mathMin(y0, y1);\r\n max[0] = mathMax(x0, x1);\r\n max[1] = mathMax(y0, y1);\r\n}\r\n\r\nconst xDim: number[] = [];\r\nconst yDim: number[] = [];\r\n/**\r\n * 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromCubic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const cubicExtrema = curve.cubicExtrema;\r\n const cubicAt = curve.cubicAt;\r\n let n = cubicExtrema(x0, x1, x2, x3, xDim);\r\n min[0] = Infinity;\r\n min[1] = Infinity;\r\n max[0] = -Infinity;\r\n max[1] = -Infinity;\r\n\r\n for (let i = 0; i < n; i++) {\r\n const x = cubicAt(x0, x1, x2, x3, xDim[i]);\r\n min[0] = mathMin(x, min[0]);\r\n max[0] = mathMax(x, max[0]);\r\n }\r\n n = cubicExtrema(y0, y1, y2, y3, yDim);\r\n for (let i = 0; i < n; i++) {\r\n const y = cubicAt(y0, y1, y2, y3, yDim[i]);\r\n min[1] = mathMin(y, min[1]);\r\n max[1] = mathMax(y, max[1]);\r\n }\r\n\r\n min[0] = mathMin(x0, min[0]);\r\n max[0] = mathMax(x0, max[0]);\r\n min[0] = mathMin(x3, min[0]);\r\n max[0] = mathMax(x3, max[0]);\r\n\r\n min[1] = mathMin(y0, min[1]);\r\n max[1] = mathMax(y0, max[1]);\r\n min[1] = mathMin(y3, min[1]);\r\n max[1] = mathMax(y3, max[1]);\r\n}\r\n\r\n/**\r\n * 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromQuadratic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const quadraticExtremum = curve.quadraticExtremum;\r\n const quadraticAt = curve.quadraticAt;\r\n // Find extremities, where derivative in x dim or y dim is zero\r\n const tx =\r\n mathMax(\r\n mathMin(quadraticExtremum(x0, x1, x2), 1), 0\r\n );\r\n const ty =\r\n mathMax(\r\n mathMin(quadraticExtremum(y0, y1, y2), 1), 0\r\n );\r\n\r\n const x = quadraticAt(x0, x1, x2, tx);\r\n const y = quadraticAt(y0, y1, y2, ty);\r\n\r\n min[0] = mathMin(x0, x2, x);\r\n min[1] = mathMin(y0, y2, y);\r\n max[0] = mathMax(x0, x2, x);\r\n max[1] = mathMax(y0, y2, y);\r\n}\r\n\r\n/**\r\n * 从圆弧中计算出最小包围盒,写入`min`和`max`中\r\n */\r\nexport function fromArc(\r\n x: number, y: number, rx: number, ry: number, startAngle: number, endAngle: number, anticlockwise: boolean,\r\n min: vec2.VectorArray, max: vec2.VectorArray\r\n) {\r\n const vec2Min = vec2.min;\r\n const vec2Max = vec2.max;\r\n\r\n const diff = Math.abs(startAngle - endAngle);\r\n\r\n\r\n if (diff % PI2 < 1e-4 && diff > 1e-4) {\r\n // Is a circle\r\n min[0] = x - rx;\r\n min[1] = y - ry;\r\n max[0] = x + rx;\r\n max[1] = y + ry;\r\n return;\r\n }\r\n\r\n start[0] = mathCos(startAngle) * rx + x;\r\n start[1] = mathSin(startAngle) * ry + y;\r\n\r\n end[0] = mathCos(endAngle) * rx + x;\r\n end[1] = mathSin(endAngle) * ry + y;\r\n\r\n vec2Min(min, start, end);\r\n vec2Max(max, start, end);\r\n\r\n // Thresh to [0, Math.PI * 2]\r\n startAngle = startAngle % (PI2);\r\n if (startAngle < 0) {\r\n startAngle = startAngle + PI2;\r\n }\r\n endAngle = endAngle % (PI2);\r\n if (endAngle < 0) {\r\n endAngle = endAngle + PI2;\r\n }\r\n\r\n if (startAngle > endAngle && !anticlockwise) {\r\n endAngle += PI2;\r\n }\r\n else if (startAngle < endAngle && anticlockwise) {\r\n startAngle += PI2;\r\n }\r\n if (anticlockwise) {\r\n const tmp = endAngle;\r\n endAngle = startAngle;\r\n startAngle = tmp;\r\n }\r\n\r\n // const number = 0;\r\n // const step = (anticlockwise ? -Math.PI : Math.PI) / 2;\r\n for (let angle = 0; angle < endAngle; angle += Math.PI / 2) {\r\n if (angle > startAngle) {\r\n extremity[0] = mathCos(angle) * rx + x;\r\n extremity[1] = mathSin(angle) * ry + y;\r\n\r\n vec2Min(min, extremity, min);\r\n vec2Max(max, extremity, max);\r\n }\r\n }\r\n}\r\n","/**\n * Path 代理,可以在`buildPath`中用于替代`ctx`, 会保存每个path操作的命令到pathCommands属性中\n * 可以用于 isInsidePath 判断以及获取boundingRect\n */\n\n// TODO getTotalLength, getPointAtLength, arcTo\n\n/* global Float32Array */\n\nimport * as vec2 from './vector';\nimport BoundingRect from './BoundingRect';\nimport {devicePixelRatio as dpr} from '../config';\nimport { fromLine, fromCubic, fromQuadratic, fromArc } from './bbox';\nimport { cubicLength, cubicSubdivide, quadraticLength, quadraticSubdivide } from './curve';\n\nconst CMD = {\n M: 1,\n L: 2,\n C: 3,\n Q: 4,\n A: 5,\n Z: 6,\n // Rect\n R: 7\n};\n\n// const CMD_MEM_SIZE = {\n// M: 3,\n// L: 3,\n// C: 7,\n// Q: 5,\n// A: 9,\n// R: 5,\n// Z: 1\n// };\n\ninterface ExtendedCanvasRenderingContext2D extends CanvasRenderingContext2D {\n dpr?: number\n}\n\nconst tmpOutX: number[] = [];\nconst tmpOutY: number[] = [];\n\nconst min: number[] = [];\nconst max: number[] = [];\nconst min2: number[] = [];\nconst max2: number[] = [];\nconst mathMin = Math.min;\nconst mathMax = Math.max;\nconst mathCos = Math.cos;\nconst mathSin = Math.sin;\nconst mathAbs = Math.abs;\n\nconst PI = Math.PI;\nconst PI2 = PI * 2;\n\nconst hasTypedArray = typeof Float32Array !== 'undefined';\n\nconst tmpAngles: number[] = [];\n\nfunction modPI2(radian: number) {\n // It's much more stable to mod N instedof PI\n const n = Math.round(radian / PI * 1e8) / 1e8;\n return (n % 2) * PI;\n}\n/**\n * Normalize start and end angles.\n * startAngle will be normalized to 0 ~ PI*2\n * sweepAngle(endAngle - startAngle) will be normalized to 0 ~ PI*2 if clockwise.\n * -PI*2 ~ 0 if anticlockwise.\n */\nexport function normalizeArcAngles(angles: number[], anticlockwise: boolean): void {\n let newStartAngle = modPI2(angles[0]);\n if (newStartAngle < 0) {\n // Normlize to 0 - PI2\n newStartAngle += PI2;\n }\n\n let delta = newStartAngle - angles[0];\n let newEndAngle = angles[1];\n newEndAngle += delta;\n\n // https://github.com/chromium/chromium/blob/c20d681c9c067c4e15bb1408f17114b9e8cba294/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc#L184\n // Is circle\n if (!anticlockwise && newEndAngle - newStartAngle >= PI2) {\n newEndAngle = newStartAngle + PI2;\n }\n else if (anticlockwise && newStartAngle - newEndAngle >= PI2) {\n newEndAngle = newStartAngle - PI2;\n }\n // Make startAngle < endAngle when clockwise, otherwise endAngle < startAngle.\n // The sweep angle can never been larger than P2.\n else if (!anticlockwise && newStartAngle > newEndAngle) {\n newEndAngle = newStartAngle + (PI2 - modPI2(newStartAngle - newEndAngle));\n }\n else if (anticlockwise && newStartAngle < newEndAngle) {\n newEndAngle = newStartAngle - (PI2 - modPI2(newEndAngle - newStartAngle));\n }\n\n angles[0] = newStartAngle;\n angles[1] = newEndAngle;\n}\n\n\nexport default class PathProxy {\n\n dpr = 1\n\n data: number[] | Float32Array\n\n /**\n * Version is for tracking if the path has been changed.\n */\n private _version: number\n\n /**\n * If save path data.\n */\n private _saveData: boolean\n\n /**\n * If the line segment is too small to draw. It will be added to the pending pt.\n * It will be added if the subpath needs to be finished before stroke, fill, or starting a new subpath.\n */\n private _pendingPtX: number;\n private _pendingPtY: number;\n // Distance of pending pt to previous point.\n // 0 if there is no pending point.\n // Only update the pending pt when distance is larger.\n private _pendingPtDist: number;\n\n private _ctx: ExtendedCanvasRenderingContext2D\n\n private _xi = 0\n private _yi = 0\n\n private _x0 = 0\n private _y0 = 0\n\n private _len = 0\n\n // Calculating path len and seg len.\n private _pathSegLen: number[]\n private _pathLen: number\n // Unit x, Unit y. Provide for avoiding drawing that too short line segment\n private _ux: number\n private _uy: number\n\n static CMD = CMD\n\n constructor(notSaveData?: boolean) {\n if (notSaveData) {\n this._saveData = false;\n }\n\n if (this._saveData) {\n this.data = [];\n }\n }\n\n increaseVersion() {\n this._version++;\n }\n\n /**\n * Version can be used outside for compare if the path is changed.\n * For example to determine if need to update svg d str in svg renderer.\n */\n getVersion() {\n return this._version;\n }\n\n /**\n * @readOnly\n */\n setScale(sx: number, sy: number, segmentIgnoreThreshold?: number) {\n // Compat. Previously there is no segmentIgnoreThreshold.\n segmentIgnoreThreshold = segmentIgnoreThreshold || 0;\n if (segmentIgnoreThreshold > 0) {\n this._ux = mathAbs(segmentIgnoreThreshold / dpr / sx) || 0;\n this._uy = mathAbs(segmentIgnoreThreshold / dpr / sy) || 0;\n }\n }\n\n setDPR(dpr: number) {\n this.dpr = dpr;\n }\n\n setContext(ctx: ExtendedCanvasRenderingContext2D) {\n this._ctx = ctx;\n }\n\n getContext(): ExtendedCanvasRenderingContext2D {\n return this._ctx;\n }\n\n beginPath() {\n this._ctx && this._ctx.beginPath();\n this.reset();\n return this;\n }\n\n /**\n * Reset path data.\n */\n reset() {\n // Reset\n if (this._saveData) {\n this._len = 0;\n }\n\n if (this._pathSegLen) {\n this._pathSegLen = null;\n this._pathLen = 0;\n }\n\n // Update version\n this._version++;\n }\n\n moveTo(x: number, y: number) {\n // Add pending point for previous path.\n this._drawPendingPt();\n\n this.addData(CMD.M, x, y);\n this._ctx && this._ctx.moveTo(x, y);\n\n // x0, y0, xi, yi 是记录在 _dashedXXXXTo 方法中使用\n // xi, yi 记录当前点, x0, y0 在 closePath 的时候回到起始点。\n // 有可能在 beginPath 之后直接调用 lineTo,这时候 x0, y0 需要\n // 在 lineTo 方法中记录,这里先不考虑这种情况,dashed line 也只在 IE10- 中不支持\n this._x0 = x;\n this._y0 = y;\n\n this._xi = x;\n this._yi = y;\n\n return this;\n }\n\n lineTo(x: number, y: number) {\n const dx = mathAbs(x - this._xi);\n const dy = mathAbs(y - this._yi);\n const exceedUnit = dx > this._ux || dy > this._uy;\n\n this.addData(CMD.L, x, y);\n\n if (this._ctx && exceedUnit) {\n this._ctx.lineTo(x, y);\n }\n if (exceedUnit) {\n this._xi = x;\n this._yi = y;\n this._pendingPtDist = 0;\n }\n else {\n const d2 = dx * dx + dy * dy;\n // Only use the farthest pending point.\n if (d2 > this._pendingPtDist) {\n this._pendingPtX = x;\n this._pendingPtY = y;\n this._pendingPtDist = d2;\n }\n }\n\n return this;\n }\n\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number) {\n this._drawPendingPt();\n\n this.addData(CMD.C, x1, y1, x2, y2, x3, y3);\n if (this._ctx) {\n this._ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n }\n this._xi = x3;\n this._yi = y3;\n return this;\n }\n\n quadraticCurveTo(x1: number, y1: number, x2: number, y2: number) {\n this._drawPendingPt();\n\n this.addData(CMD.Q, x1, y1, x2, y2);\n if (this._ctx) {\n this._ctx.quadraticCurveTo(x1, y1, x2, y2);\n }\n this._xi = x2;\n this._yi = y2;\n return this;\n }\n\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise?: boolean) {\n this._drawPendingPt();\n\n tmpAngles[0] = startAngle;\n tmpAngles[1] = endAngle;\n normalizeArcAngles(tmpAngles, anticlockwise);\n\n startAngle = tmpAngles[0];\n endAngle = tmpAngles[1];\n\n let delta = endAngle - startAngle;\n\n this.addData(\n CMD.A, cx, cy, r, r, startAngle, delta, 0, anticlockwise ? 0 : 1\n );\n\n this._ctx && this._ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n\n this._xi = mathCos(endAngle) * r + cx;\n this._yi = mathSin(endAngle) * r + cy;\n return this;\n }\n\n // TODO\n arcTo(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this._drawPendingPt();\n\n if (this._ctx) {\n this._ctx.arcTo(x1, y1, x2, y2, radius);\n }\n return this;\n }\n\n // TODO\n rect(x: number, y: number, w: number, h: number) {\n this._drawPendingPt();\n\n this._ctx && this._ctx.rect(x, y, w, h);\n this.addData(CMD.R, x, y, w, h);\n return this;\n }\n\n closePath() {\n // Add pending point for previous path.\n this._drawPendingPt();\n\n this.addData(CMD.Z);\n\n const ctx = this._ctx;\n const x0 = this._x0;\n const y0 = this._y0;\n if (ctx) {\n ctx.closePath();\n }\n\n this._xi = x0;\n this._yi = y0;\n return this;\n }\n\n fill(ctx: CanvasRenderingContext2D) {\n ctx && ctx.fill();\n this.toStatic();\n }\n\n stroke(ctx: CanvasRenderingContext2D) {\n ctx && ctx.stroke();\n this.toStatic();\n }\n\n len() {\n return this._len;\n }\n\n setData(data: Float32Array | number[]) {\n\n const len = data.length;\n\n if (!(this.data && this.data.length === len) && hasTypedArray) {\n this.data = new Float32Array(len);\n }\n\n for (let i = 0; i < len; i++) {\n this.data[i] = data[i];\n }\n\n this._len = len;\n }\n\n appendPath(path: PathProxy | PathProxy[]) {\n if (!(path instanceof Array)) {\n path = [path];\n }\n const len = path.length;\n let appendSize = 0;\n let offset = this._len;\n for (let i = 0; i < len; i++) {\n appendSize += path[i].len();\n }\n if (hasTypedArray && (this.data instanceof Float32Array)) {\n this.data = new Float32Array(offset + appendSize);\n }\n for (let i = 0; i < len; i++) {\n const appendPathData = path[i].data;\n for (let k = 0; k < appendPathData.length; k++) {\n this.data[offset++] = appendPathData[k];\n }\n }\n this._len = offset;\n }\n\n /**\n * 填充 Path 数据。\n * 尽量复用而不申明新的数组。大部分图形重绘的指令数据长度都是不变的。\n */\n addData(\n cmd: number,\n a?: number,\n b?: number,\n c?: number,\n d?: number,\n e?: number,\n f?: number,\n g?: number,\n h?: number\n ) {\n if (!this._saveData) {\n return;\n }\n\n let data = this.data;\n if (this._len + arguments.length > data.length) {\n // 因为之前的数组已经转换成静态的 Float32Array\n // 所以不够用时需要扩展一个新的动态数组\n this._expandData();\n data = this.data;\n }\n for (let i = 0; i < arguments.length; i++) {\n data[this._len++] = arguments[i];\n }\n }\n\n private _drawPendingPt() {\n if (this._pendingPtDist > 0) {\n this._ctx && this._ctx.lineTo(this._pendingPtX, this._pendingPtY);\n this._pendingPtDist = 0;\n }\n }\n\n private _expandData() {\n // Only if data is Float32Array\n if (!(this.data instanceof Array)) {\n const newData = [];\n for (let i = 0; i < this._len; i++) {\n newData[i] = this.data[i];\n }\n this.data = newData;\n }\n }\n\n /**\n * Convert dynamic array to static Float32Array\n *\n * It will still use a normal array if command buffer length is less than 10\n * Because Float32Array itself may take more memory than a normal array.\n *\n * 10 length will make sure at least one M command and one A(arc) command.\n */\n toStatic() {\n if (!this._saveData) {\n return;\n }\n\n this._drawPendingPt();\n\n const data = this.data;\n if (data instanceof Array) {\n data.length = this._len;\n if (hasTypedArray && this._len > 11) {\n this.data = new Float32Array(data);\n }\n }\n }\n\n\n getBoundingRect() {\n min[0] = min[1] = min2[0] = min2[1] = Number.MAX_VALUE;\n max[0] = max[1] = max2[0] = max2[1] = -Number.MAX_VALUE;\n\n const data = this.data;\n let xi = 0;\n let yi = 0;\n let x0 = 0;\n let y0 = 0;\n\n let i;\n for (i = 0; i < this._len;) {\n const cmd = data[i++] as number;\n\n const isFirst = i === 1;\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = data[i];\n yi = data[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n\n switch (cmd) {\n case CMD.M:\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\n // 在 closePath 的时候使用\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n min2[0] = x0;\n min2[1] = y0;\n max2[0] = x0;\n max2[1] = y0;\n break;\n case CMD.L:\n fromLine(xi, yi, data[i], data[i + 1], min2, max2);\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.C:\n fromCubic(\n xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\n min2, max2\n );\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.Q:\n fromQuadratic(\n xi, yi, data[i++], data[i++], data[i], data[i + 1],\n min2, max2\n );\n xi = data[i++];\n yi = data[i++];\n break;\n case CMD.A:\n const cx = data[i++];\n const cy = data[i++];\n const rx = data[i++];\n const ry = data[i++];\n const startAngle = data[i++];\n const endAngle = data[i++] + startAngle;\n // TODO Arc 旋转\n i += 1;\n const anticlockwise = !data[i++];\n\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n\n fromArc(\n cx, cy, rx, ry, startAngle, endAngle,\n anticlockwise, min2, max2\n );\n\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n const width = data[i++];\n const height = data[i++];\n // Use fromLine\n fromLine(x0, y0, x0 + width, y0 + height, min2, max2);\n break;\n case CMD.Z:\n xi = x0;\n yi = y0;\n break;\n }\n\n // Union\n vec2.min(min, min, min2);\n vec2.max(max, max, max2);\n }\n\n // No data\n if (i === 0) {\n min[0] = min[1] = max[0] = max[1] = 0;\n }\n\n return new BoundingRect(\n min[0], min[1], max[0] - min[0], max[1] - min[1]\n );\n }\n\n private _calculateLength(): number {\n const data = this.data;\n const len = this._len;\n const ux = this._ux;\n const uy = this._uy;\n let xi = 0;\n let yi = 0;\n let x0 = 0;\n let y0 = 0;\n\n if (!this._pathSegLen) {\n this._pathSegLen = [];\n }\n const pathSegLen = this._pathSegLen;\n let pathTotalLen = 0;\n let segCount = 0;\n\n for (let i = 0; i < len;) {\n const cmd = data[i++] as number;\n const isFirst = i === 1;\n\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = data[i];\n yi = data[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n\n let l = -1;\n\n switch (cmd) {\n case CMD.M:\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\n // 在 closePath 的时候使用\n xi = x0 = data[i++];\n yi = y0 = data[i++];\n break;\n case CMD.L: {\n const x2 = data[i++];\n const y2 = data[i++];\n const dx = x2 - xi;\n const dy = y2 - yi;\n if (mathAbs(dx) > ux || mathAbs(dy) > uy || i === len - 1) {\n l = Math.sqrt(dx * dx + dy * dy);\n xi = x2;\n yi = y2;\n }\n break;\n }\n case CMD.C: {\n const x1 = data[i++];\n const y1 = data[i++];\n const x2 = data[i++];\n const y2 = data[i++];\n const x3 = data[i++];\n const y3 = data[i++];\n // TODO adaptive iteration\n l = cubicLength(xi, yi, x1, y1, x2, y2, x3, y3, 10);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n const x1 = data[i++];\n const y1 = data[i++];\n const x2 = data[i++];\n const y2 = data[i++];\n l = quadraticLength(xi, yi, x1, y1, x2, y2, 10);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n // TODO Arc 判断的开销比较大\n const cx = data[i++];\n const cy = data[i++];\n const rx = data[i++];\n const ry = data[i++];\n const startAngle = data[i++];\n let delta = data[i++];\n const endAngle = delta + startAngle;\n // TODO Arc 旋转\n i += 1;\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n\n // TODO Ellipse\n l = mathMax(rx, ry) * mathMin(PI2, Math.abs(delta));\n\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R: {\n x0 = xi = data[i++];\n y0 = yi = data[i++];\n const width = data[i++];\n const height = data[i++];\n l = width * 2 + height * 2;\n break;\n }\n case CMD.Z: {\n const dx = x0 - xi;\n const dy = y0 - yi;\n l = Math.sqrt(dx * dx + dy * dy);\n\n xi = x0;\n yi = y0;\n break;\n }\n }\n\n if (l >= 0) {\n pathSegLen[segCount++] = l;\n pathTotalLen += l;\n }\n }\n\n // TODO Optimize memory cost.\n this._pathLen = pathTotalLen;\n\n return pathTotalLen;\n }\n /**\n * Rebuild path from current data\n * Rebuild path will not consider javascript implemented line dash.\n * @param {CanvasRenderingContext2D} ctx\n */\n rebuildPath(ctx: PathRebuilder, percent: number) {\n const d = this.data;\n const ux = this._ux;\n const uy = this._uy;\n const len = this._len;\n let x0;\n let y0;\n let xi;\n let yi;\n let x;\n let y;\n\n const drawPart = percent < 1;\n let pathSegLen;\n let pathTotalLen;\n let accumLength = 0;\n let segCount = 0;\n let displayedLength;\n\n let pendingPtDist = 0;\n let pendingPtX: number;\n let pendingPtY: number;\n\n\n if (drawPart) {\n if (!this._pathSegLen) {\n this._calculateLength();\n }\n pathSegLen = this._pathSegLen;\n pathTotalLen = this._pathLen;\n displayedLength = percent * pathTotalLen;\n\n if (!displayedLength) {\n return;\n }\n }\n\n lo: for (let i = 0; i < len;) {\n const cmd = d[i++];\n const isFirst = i === 1;\n\n if (isFirst) {\n // 如果第一个命令是 L, C, Q\n // 则 previous point 同绘制命令的第一个 point\n // 第一个命令为 Arc 的情况下会在后面特殊处理\n xi = d[i];\n yi = d[i + 1];\n\n x0 = xi;\n y0 = yi;\n }\n // Only lineTo support ignoring small segments.\n // Otherwise if the pending point should always been flushed.\n if (cmd !== CMD.L && pendingPtDist > 0) {\n ctx.lineTo(pendingPtX, pendingPtY);\n pendingPtDist = 0;\n }\n switch (cmd) {\n case CMD.M:\n x0 = xi = d[i++];\n y0 = yi = d[i++];\n ctx.moveTo(xi, yi);\n break;\n case CMD.L: {\n x = d[i++];\n y = d[i++];\n const dx = mathAbs(x - xi);\n const dy = mathAbs(y - yi);\n // Not draw too small seg between\n if (dx > ux || dy > uy) {\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x * t, yi * (1 - t) + y * t);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.lineTo(x, y);\n xi = x;\n yi = y;\n pendingPtDist = 0;\n }\n else {\n const d2 = dx * dx + dy * dy;\n // Only use the farthest pending point.\n if (d2 > pendingPtDist) {\n pendingPtX = x;\n pendingPtY = y;\n pendingPtDist = d2;\n }\n }\n break;\n }\n case CMD.C: {\n const x1 = d[i++];\n const y1 = d[i++];\n const x2 = d[i++];\n const y2 = d[i++];\n const x3 = d[i++];\n const y3 = d[i++];\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n cubicSubdivide(xi, x1, x2, x3, t, tmpOutX);\n cubicSubdivide(yi, y1, y2, y3, t, tmpOutY);\n ctx.bezierCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2], tmpOutX[3], tmpOutY[3]);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.bezierCurveTo(x1, y1, x2, y2, x3, y3);\n xi = x3;\n yi = y3;\n break;\n }\n case CMD.Q: {\n const x1 = d[i++];\n const y1 = d[i++];\n const x2 = d[i++];\n const y2 = d[i++];\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n quadraticSubdivide(xi, x1, x2, t, tmpOutX);\n quadraticSubdivide(yi, y1, y2, t, tmpOutY);\n ctx.quadraticCurveTo(tmpOutX[1], tmpOutY[1], tmpOutX[2], tmpOutY[2]);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.quadraticCurveTo(x1, y1, x2, y2);\n xi = x2;\n yi = y2;\n break;\n }\n case CMD.A:\n const cx = d[i++];\n const cy = d[i++];\n const rx = d[i++];\n const ry = d[i++];\n let startAngle = d[i++];\n let delta = d[i++];\n const psi = d[i++];\n const anticlockwise = !d[i++];\n const r = (rx > ry) ? rx : ry;\n // const scaleX = (rx > ry) ? 1 : rx / ry;\n // const scaleY = (rx > ry) ? ry / rx : 1;\n const isEllipse = mathAbs(rx - ry) > 1e-3;\n let endAngle = startAngle + delta;\n let breakBuild = false;\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n endAngle = startAngle + delta * (displayedLength - accumLength) / l;\n breakBuild = true;\n }\n accumLength += l;\n }\n if (isEllipse && ctx.ellipse) {\n ctx.ellipse(cx, cy, rx, ry, psi, startAngle, endAngle, anticlockwise);\n }\n else {\n ctx.arc(cx, cy, r, startAngle, endAngle, anticlockwise);\n }\n\n if (breakBuild) {\n break lo;\n }\n\n if (isFirst) {\n // 直接使用 arc 命令\n // 第一个命令起点还未定义\n x0 = mathCos(startAngle) * rx + cx;\n y0 = mathSin(startAngle) * ry + cy;\n }\n xi = mathCos(endAngle) * rx + cx;\n yi = mathSin(endAngle) * ry + cy;\n break;\n case CMD.R:\n x0 = xi = d[i];\n y0 = yi = d[i + 1];\n\n x = d[i++];\n y = d[i++];\n const width = d[i++];\n const height = d[i++];\n\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n let d = displayedLength - accumLength;\n ctx.moveTo(x, y);\n ctx.lineTo(x + mathMin(d, width), y);\n d -= width;\n if (d > 0) {\n ctx.lineTo(x + width, y + mathMin(d, height));\n }\n d -= height;\n if (d > 0) {\n ctx.lineTo(x + mathMax(width - d, 0), y + height);\n }\n d -= width;\n if (d > 0) {\n ctx.lineTo(x, y + mathMax(height - d, 0));\n }\n break lo;\n }\n accumLength += l;\n }\n ctx.rect(x, y, width, height);\n break;\n case CMD.Z:\n if (drawPart) {\n const l = pathSegLen[segCount++];\n if (accumLength + l > displayedLength) {\n const t = (displayedLength - accumLength) / l;\n ctx.lineTo(xi * (1 - t) + x0 * t, yi * (1 - t) + y0 * t);\n break lo;\n }\n accumLength += l;\n }\n\n ctx.closePath();\n xi = x0;\n yi = y0;\n }\n }\n }\n\n clone() {\n const newProxy = new PathProxy();\n const data = this.data;\n newProxy.data = data.slice ? data.slice()\n : Array.prototype.slice.call(data);\n newProxy._len = this._len;\n return newProxy;\n }\n\n private static initDefaultProps = (function () {\n const proto = PathProxy.prototype;\n proto._saveData = true;\n proto._ux = 0;\n proto._uy = 0;\n proto._pendingPtDist = 0;\n proto._version = 0;\n })()\n}\n\n\nexport interface PathRebuilder {\n moveTo(x: number, y: number): void\n lineTo(x: number, y: number): void\n bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number): void\n quadraticCurveTo(x: number, y: number, x2: number, y2: number): void\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean): void\n // eslint-disable-next-line max-len\n ellipse(cx: number, cy: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise: boolean): void\n rect(x: number, y: number, width: number, height: number): void\n closePath(): void\n}","\r\n/**\r\n * 线段包含判断\r\n * @param {number} x0\r\n * @param {number} y0\r\n * @param {number} x1\r\n * @param {number} y1\r\n * @param {number} lineWidth\r\n * @param {number} x\r\n * @param {number} y\r\n * @return {boolean}\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n let _a = 0;\r\n let _b = x0;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l)\r\n || (y < y0 - _l && y < y1 - _l)\r\n || (x > x0 + _l && x > x1 + _l)\r\n || (x < x0 - _l && x < x1 - _l)\r\n ) {\r\n return false;\r\n }\r\n\r\n if (x0 !== x1) {\r\n _a = (y0 - y1) / (x0 - x1);\r\n _b = (x0 * y1 - x1 * y0) / (x0 - x1);\r\n }\r\n else {\r\n return Math.abs(x - x0) <= _l / 2;\r\n }\r\n const tmp = _a * x - y + _b;\r\n const _s = tmp * tmp / (_a * _a + 1);\r\n return _s <= _l / 2 * _l / 2;\r\n}","\r\nimport * as curve from '../core/curve';\r\n\r\n/**\r\n * 三次贝塞尔曲线描边包含判断\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number,\r\n x2: number, y2: number, x3: number, y3: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)\r\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)\r\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)\r\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)\r\n ) {\r\n return false;\r\n }\r\n const d = curve.cubicProjectPoint(\r\n x0, y0, x1, y1, x2, y2, x3, y3,\r\n x, y, null\r\n );\r\n return d <= _l / 2;\r\n}","import {quadraticProjectPoint} from '../core/curve';\r\n\r\n/**\r\n * 二次贝塞尔曲线描边包含判断\r\n */\r\nexport function containStroke(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n // Quick reject\r\n if (\r\n (y > y0 + _l && y > y1 + _l && y > y2 + _l)\r\n || (y < y0 - _l && y < y1 - _l && y < y2 - _l)\r\n || (x > x0 + _l && x > x1 + _l && x > x2 + _l)\r\n || (x < x0 - _l && x < x1 - _l && x < x2 - _l)\r\n ) {\r\n return false;\r\n }\r\n const d = quadraticProjectPoint(\r\n x0, y0, x1, y1, x2, y2,\r\n x, y, null\r\n );\r\n return d <= _l / 2;\r\n}\r\n","\r\nconst PI2 = Math.PI * 2;\r\n\r\nexport function normalizeRadian(angle: number): number {\r\n angle %= PI2;\r\n if (angle < 0) {\r\n angle += PI2;\r\n }\r\n return angle;\r\n}","\r\nimport {normalizeRadian} from './util';\r\n\r\nconst PI2 = Math.PI * 2;\r\n\r\n/**\r\n * 圆弧描边包含判断\r\n */\r\nexport function containStroke(\r\n cx: number, cy: number, r: number, startAngle: number, endAngle: number,\r\n anticlockwise: boolean,\r\n lineWidth: number, x: number, y: number\r\n): boolean {\r\n\r\n if (lineWidth === 0) {\r\n return false;\r\n }\r\n const _l = lineWidth;\r\n\r\n x -= cx;\r\n y -= cy;\r\n const d = Math.sqrt(x * x + y * y);\r\n\r\n if ((d - _l > r) || (d + _l < r)) {\r\n return false;\r\n }\r\n // TODO\r\n if (Math.abs(startAngle - endAngle) % PI2 < 1e-4) {\r\n // Is a circle\r\n return true;\r\n }\r\n if (anticlockwise) {\r\n const tmp = startAngle;\r\n startAngle = normalizeRadian(endAngle);\r\n endAngle = normalizeRadian(tmp);\r\n }\r\n else {\r\n startAngle = normalizeRadian(startAngle);\r\n endAngle = normalizeRadian(endAngle);\r\n }\r\n if (startAngle > endAngle) {\r\n endAngle += PI2;\r\n }\r\n\r\n let angle = Math.atan2(y, x);\r\n if (angle < 0) {\r\n angle += PI2;\r\n }\r\n return (angle >= startAngle && angle <= endAngle)\r\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);\r\n}","\r\nexport default function windingLine(\r\n x0: number, y0: number, x1: number, y1: number, x: number, y: number\r\n): number {\r\n if ((y > y0 && y > y1) || (y < y0 && y < y1)) {\r\n return 0;\r\n }\r\n // Ignore horizontal line\r\n if (y1 === y0) {\r\n return 0;\r\n }\r\n const t = (y - y0) / (y1 - y0);\r\n\r\n let dir = y1 < y0 ? 1 : -1;\r\n // Avoid winding error when intersection point is the connect point of two line of polygon\r\n if (t === 1 || t === 0) {\r\n dir = y1 < y0 ? 0.5 : -0.5;\r\n }\r\n\r\n const x_ = t * (x1 - x0) + x0;\r\n\r\n // If (x, y) on the line, considered as \"contain\".\r\n return x_ === x ? Infinity : x_ > x ? dir : 0;\r\n}","import PathProxy from '../core/PathProxy';\r\nimport * as line from './line';\r\nimport * as cubic from './cubic';\r\nimport * as quadratic from './quadratic';\r\nimport * as arc from './arc';\r\nimport * as curve from '../core/curve';\r\nimport windingLine from './windingLine';\r\n\r\nconst CMD = PathProxy.CMD;\r\nconst PI2 = Math.PI * 2;\r\n\r\nconst EPSILON = 1e-4;\r\n\r\nfunction isAroundEqual(a: number, b: number) {\r\n return Math.abs(a - b) < EPSILON;\r\n}\r\n\r\n// 临时数组\r\nconst roots = [-1, -1, -1];\r\nconst extrema = [-1, -1];\r\n\r\nfunction swapExtrema() {\r\n const tmp = extrema[0];\r\n extrema[0] = extrema[1];\r\n extrema[1] = tmp;\r\n}\r\n\r\nfunction windingCubic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n x: number, y: number\r\n): number {\r\n // Quick reject\r\n if (\r\n (y > y0 && y > y1 && y > y2 && y > y3)\r\n || (y < y0 && y < y1 && y < y2 && y < y3)\r\n ) {\r\n return 0;\r\n }\r\n const nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);\r\n if (nRoots === 0) {\r\n return 0;\r\n }\r\n else {\r\n let w = 0;\r\n let nExtrema = -1;\r\n let y0_;\r\n let y1_;\r\n for (let i = 0; i < nRoots; i++) {\r\n let t = roots[i];\r\n\r\n // Avoid winding error when intersection point is the connect point of two line of polygon\r\n let unit = (t === 0 || t === 1) ? 0.5 : 1;\r\n\r\n let x_ = curve.cubicAt(x0, x1, x2, x3, t);\r\n if (x_ < x) { // Quick reject\r\n continue;\r\n }\r\n if (nExtrema < 0) {\r\n nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);\r\n if (extrema[1] < extrema[0] && nExtrema > 1) {\r\n swapExtrema();\r\n }\r\n y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);\r\n if (nExtrema > 1) {\r\n y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);\r\n }\r\n }\r\n if (nExtrema === 2) {\r\n // 分成三段单调函数\r\n if (t < extrema[0]) {\r\n w += y0_ < y0 ? unit : -unit;\r\n }\r\n else if (t < extrema[1]) {\r\n w += y1_ < y0_ ? unit : -unit;\r\n }\r\n else {\r\n w += y3 < y1_ ? unit : -unit;\r\n }\r\n }\r\n else {\r\n // 分成两段单调函数\r\n if (t < extrema[0]) {\r\n w += y0_ < y0 ? unit : -unit;\r\n }\r\n else {\r\n w += y3 < y0_ ? unit : -unit;\r\n }\r\n }\r\n }\r\n return w;\r\n }\r\n}\r\n\r\nfunction windingQuadratic(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number,\r\n x: number, y: number\r\n): number {\r\n // Quick reject\r\n if (\r\n (y > y0 && y > y1 && y > y2)\r\n || (y < y0 && y < y1 && y < y2)\r\n ) {\r\n return 0;\r\n }\r\n const nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);\r\n if (nRoots === 0) {\r\n return 0;\r\n }\r\n else {\r\n const t = curve.quadraticExtremum(y0, y1, y2);\r\n if (t >= 0 && t <= 1) {\r\n let w = 0;\r\n let y_ = curve.quadraticAt(y0, y1, y2, t);\r\n for (let i = 0; i < nRoots; i++) {\r\n // Remove one endpoint.\r\n let unit = (roots[i] === 0 || roots[i] === 1) ? 0.5 : 1;\r\n\r\n let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);\r\n if (x_ < x) { // Quick reject\r\n continue;\r\n }\r\n if (roots[i] < t) {\r\n w += y_ < y0 ? unit : -unit;\r\n }\r\n else {\r\n w += y2 < y_ ? unit : -unit;\r\n }\r\n }\r\n return w;\r\n }\r\n else {\r\n // Remove one endpoint.\r\n const unit = (roots[0] === 0 || roots[0] === 1) ? 0.5 : 1;\r\n\r\n const x_ = curve.quadraticAt(x0, x1, x2, roots[0]);\r\n if (x_ < x) { // Quick reject\r\n return 0;\r\n }\r\n return y2 < y0 ? unit : -unit;\r\n }\r\n }\r\n}\r\n// TODO\r\n// Arc 旋转\r\n// startAngle, endAngle has been normalized by normalizeArcAngles\r\nfunction windingArc(\r\n cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean,\r\n x: number, y: number\r\n) {\r\n y -= cy;\r\n if (y > r || y < -r) {\r\n return 0;\r\n }\r\n const tmp = Math.sqrt(r * r - y * y);\r\n roots[0] = -tmp;\r\n roots[1] = tmp;\r\n\r\n const dTheta = Math.abs(startAngle - endAngle);\r\n if (dTheta < 1e-4) {\r\n return 0;\r\n }\r\n if (dTheta >= PI2 - 1e-4) {\r\n // Is a circle\r\n startAngle = 0;\r\n endAngle = PI2;\r\n const dir = anticlockwise ? 1 : -1;\r\n if (x >= roots[0] + cx && x <= roots[1] + cx) {\r\n return dir;\r\n }\r\n else {\r\n return 0;\r\n }\r\n }\r\n\r\n if (startAngle > endAngle) {\r\n // Swap, make sure startAngle is smaller than endAngle.\r\n const tmp = startAngle;\r\n startAngle = endAngle;\r\n endAngle = tmp;\r\n }\r\n // endAngle - startAngle is normalized to 0 - 2*PI.\r\n // So following will normalize them to 0 - 4*PI\r\n if (startAngle < 0) {\r\n startAngle += PI2;\r\n endAngle += PI2;\r\n }\r\n\r\n let w = 0;\r\n for (let i = 0; i < 2; i++) {\r\n const x_ = roots[i];\r\n if (x_ + cx > x) {\r\n let angle = Math.atan2(y, x_);\r\n let dir = anticlockwise ? 1 : -1;\r\n if (angle < 0) {\r\n angle = PI2 + angle;\r\n }\r\n if (\r\n (angle >= startAngle && angle <= endAngle)\r\n || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)\r\n ) {\r\n if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {\r\n dir = -dir;\r\n }\r\n w += dir;\r\n }\r\n }\r\n }\r\n return w;\r\n}\r\n\r\n\r\nfunction containPath(\r\n path: PathProxy, lineWidth: number, isStroke: boolean, x: number, y: number\r\n): boolean {\r\n const data = path.data;\r\n const len = path.len();\r\n let w = 0;\r\n let xi = 0;\r\n let yi = 0;\r\n let x0 = 0;\r\n let y0 = 0;\r\n let x1;\r\n let y1;\r\n\r\n for (let i = 0; i < len;) {\r\n const cmd = data[i++];\r\n const isFirst = i === 1;\r\n // Begin a new subpath\r\n if (cmd === CMD.M && i > 1) {\r\n // Close previous subpath\r\n if (!isStroke) {\r\n w += windingLine(xi, yi, x0, y0, x, y);\r\n }\r\n // 如果被任何一个 subpath 包含\r\n // if (w !== 0) {\r\n // return true;\r\n // }\r\n }\r\n\r\n if (isFirst) {\r\n // 如果第一个命令是 L, C, Q\r\n // 则 previous point 同绘制命令的第一个 point\r\n //\r\n // 第一个命令为 Arc 的情况下会在后面特殊处理\r\n xi = data[i];\r\n yi = data[i + 1];\r\n\r\n x0 = xi;\r\n y0 = yi;\r\n }\r\n\r\n switch (cmd) {\r\n case CMD.M:\r\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\r\n // 在 closePath 的时候使用\r\n x0 = data[i++];\r\n y0 = data[i++];\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n case CMD.L:\r\n if (isStroke) {\r\n if (line.containStroke(xi, yi, data[i], data[i + 1], lineWidth, x, y)) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // NOTE 在第一个命令为 L, C, Q 的时候会计算出 NaN\r\n w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.C:\r\n if (isStroke) {\r\n if (cubic.containStroke(xi, yi,\r\n data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\r\n lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingCubic(\r\n xi, yi,\r\n data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1],\r\n x, y\r\n ) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.Q:\r\n if (isStroke) {\r\n if (quadratic.containStroke(xi, yi,\r\n data[i++], data[i++], data[i], data[i + 1],\r\n lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingQuadratic(\r\n xi, yi,\r\n data[i++], data[i++], data[i], data[i + 1],\r\n x, y\r\n ) || 0;\r\n }\r\n xi = data[i++];\r\n yi = data[i++];\r\n break;\r\n case CMD.A:\r\n // TODO Arc 判断的开销比较大\r\n const cx = data[i++];\r\n const cy = data[i++];\r\n const rx = data[i++];\r\n const ry = data[i++];\r\n const theta = data[i++];\r\n const dTheta = data[i++];\r\n // TODO Arc 旋转\r\n i += 1;\r\n const anticlockwise = !!(1 - data[i++]);\r\n x1 = Math.cos(theta) * rx + cx;\r\n y1 = Math.sin(theta) * ry + cy;\r\n // 不是直接使用 arc 命令\r\n if (!isFirst) {\r\n w += windingLine(xi, yi, x1, y1, x, y);\r\n }\r\n else {\r\n // 第一个命令起点还未定义\r\n x0 = x1;\r\n y0 = y1;\r\n }\r\n // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放\r\n const _x = (x - cx) * ry / rx + cx;\r\n if (isStroke) {\r\n if (arc.containStroke(\r\n cx, cy, ry, theta, theta + dTheta, anticlockwise,\r\n lineWidth, _x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n w += windingArc(\r\n cx, cy, ry, theta, theta + dTheta, anticlockwise,\r\n _x, y\r\n );\r\n }\r\n xi = Math.cos(theta + dTheta) * rx + cx;\r\n yi = Math.sin(theta + dTheta) * ry + cy;\r\n break;\r\n case CMD.R:\r\n x0 = xi = data[i++];\r\n y0 = yi = data[i++];\r\n const width = data[i++];\r\n const height = data[i++];\r\n x1 = x0 + width;\r\n y1 = y0 + height;\r\n if (isStroke) {\r\n if (line.containStroke(x0, y0, x1, y0, lineWidth, x, y)\r\n || line.containStroke(x1, y0, x1, y1, lineWidth, x, y)\r\n || line.containStroke(x1, y1, x0, y1, lineWidth, x, y)\r\n || line.containStroke(x0, y1, x0, y0, lineWidth, x, y)\r\n ) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // FIXME Clockwise ?\r\n w += windingLine(x1, y0, x1, y1, x, y);\r\n w += windingLine(x0, y1, x0, y0, x, y);\r\n }\r\n break;\r\n case CMD.Z:\r\n if (isStroke) {\r\n if (line.containStroke(\r\n xi, yi, x0, y0, lineWidth, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n else {\r\n // Close a subpath\r\n w += windingLine(xi, yi, x0, y0, x, y);\r\n // 如果被任何一个 subpath 包含\r\n // FIXME subpaths may overlap\r\n // if (w !== 0) {\r\n // return true;\r\n // }\r\n }\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n }\r\n }\r\n if (!isStroke && !isAroundEqual(yi, y0)) {\r\n w += windingLine(xi, yi, x0, y0, x, y) || 0;\r\n }\r\n return w !== 0;\r\n}\r\n\r\nexport function contain(pathProxy: PathProxy, x: number, y: number): boolean {\r\n return containPath(pathProxy, 0, false, x, y);\r\n}\r\n\r\nexport function containStroke(pathProxy: PathProxy, lineWidth: number, x: number, y: number): boolean {\r\n return containPath(pathProxy, lineWidth, true, x, y);\r\n}","import Displayable, { DisplayableProps,\r\n CommonStyleProps,\r\n DEFAULT_COMMON_STYLE,\r\n DisplayableStatePropNames,\r\n DEFAULT_COMMON_ANIMATION_PROPS\r\n} from './Displayable';\r\nimport Element, { ElementAnimateConfig } from '../Element';\r\nimport PathProxy from '../core/PathProxy';\r\nimport * as pathContain from '../contain/path';\r\nimport { PatternObject } from './Pattern';\r\nimport { Dictionary, PropType, MapToType } from '../core/types';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { LinearGradientObject } from './LinearGradient';\r\nimport { RadialGradientObject } from './RadialGradient';\r\nimport { defaults, keys, extend, clone, isString, createObject } from '../core/util';\r\nimport Animator from '../animation/Animator';\r\nimport { lum } from '../tool/color';\r\nimport { DARK_LABEL_COLOR, LIGHT_LABEL_COLOR, DARK_MODE_THRESHOLD, LIGHTER_LABEL_COLOR } from '../config';\r\nimport { REDRAW_BIT, SHAPE_CHANGED_BIT, STYLE_CHANGED_BIT } from './constants';\r\nimport { TRANSFORMABLE_PROPS } from '../core/Transformable';\r\n\r\n\r\nexport interface PathStyleProps extends CommonStyleProps {\r\n fill?: string | PatternObject | LinearGradientObject | RadialGradientObject\r\n stroke?: string | PatternObject | LinearGradientObject | RadialGradientObject\r\n decal?: PatternObject\r\n\r\n /**\r\n * Still experimental, not works weel on arc with edge cases(large angle).\r\n */\r\n strokePercent?: number\r\n strokeNoScale?: boolean\r\n fillOpacity?: number\r\n strokeOpacity?: number\r\n\r\n /**\r\n * `true` is not supported.\r\n * `false`/`null`/`undefined` are the same.\r\n * `false` is used to remove lineDash in some\r\n * case that `null`/`undefined` can not be set.\r\n * (e.g., emphasis.lineStyle in echarts)\r\n */\r\n lineDash?: false | number[] | 'solid' | 'dashed' | 'dotted'\r\n lineDashOffset?: number\r\n\r\n lineWidth?: number\r\n lineCap?: CanvasLineCap\r\n lineJoin?: CanvasLineJoin\r\n\r\n miterLimit?: number\r\n /**\r\n * Paint order, if do stroke first. Similar to SVG paint-order\r\n * https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/paint-order\r\n */\r\n strokeFirst?: boolean\r\n}\r\n\r\nexport const DEFAULT_PATH_STYLE: PathStyleProps = defaults({\r\n fill: '#000',\r\n stroke: null,\r\n strokePercent: 1,\r\n fillOpacity: 1,\r\n strokeOpacity: 1,\r\n\r\n lineDashOffset: 0,\r\n lineWidth: 1,\r\n lineCap: 'butt',\r\n miterLimit: 10,\r\n\r\n strokeNoScale: false,\r\n strokeFirst: false\r\n} as PathStyleProps, DEFAULT_COMMON_STYLE);\r\n\r\n\r\nexport const DEFAULT_PATH_ANIMATION_PROPS: MapToType = {\r\n style: defaults, MapToType>({\r\n fill: true,\r\n stroke: true,\r\n strokePercent: true,\r\n fillOpacity: true,\r\n strokeOpacity: true,\r\n lineDashOffset: true,\r\n lineWidth: true,\r\n miterLimit: true\r\n } as MapToType, DEFAULT_COMMON_ANIMATION_PROPS.style)\r\n };\r\n\r\nexport interface PathProps extends DisplayableProps {\r\n strokeContainThreshold?: number\r\n segmentIgnoreThreshold?: number\r\n subPixelOptimize?: boolean\r\n\r\n style?: PathStyleProps\r\n shape?: Dictionary\r\n\r\n autoBatch?: boolean\r\n\r\n __value?: (string | number)[] | (string | number)\r\n\r\n buildPath?: (\r\n ctx: PathProxy | CanvasRenderingContext2D,\r\n shapeCfg: Dictionary,\r\n inBatch?: boolean\r\n ) => void\r\n}\r\n\r\n\r\ntype PathKey = keyof PathProps\r\ntype PathPropertyType = PropType\r\n\r\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\r\ninterface Path {\r\n animate(key?: '', loop?: boolean): Animator\r\n animate(key: 'style', loop?: boolean): Animator\r\n animate(key: 'shape', loop?: boolean): Animator\r\n\r\n getState(stateName: string): PathState\r\n ensureState(stateName: string): PathState\r\n\r\n states: Dictionary\r\n stateProxy: (stateName: string) => PathState\r\n}\r\n\r\nexport type PathStatePropNames = DisplayableStatePropNames | 'shape';\r\nexport type PathState = Pick & {\r\n hoverLayer?: boolean\r\n}\r\n\r\nconst pathCopyParams = (TRANSFORMABLE_PROPS as readonly string[]).concat(['invisible',\r\n 'culling', 'z', 'z2', 'zlevel', 'parent'\r\n]) as (keyof Path)[];\r\n\r\nclass Path extends Displayable {\r\n\r\n path: PathProxy\r\n\r\n strokeContainThreshold: number\r\n\r\n // This item default to be false. But in map series in echarts,\r\n // in order to improve performance, it should be set to true,\r\n // so the shorty segment won't draw.\r\n segmentIgnoreThreshold: number\r\n\r\n subPixelOptimize: boolean\r\n\r\n style: PathStyleProps\r\n /**\r\n * If element can be batched automatically\r\n */\r\n autoBatch: boolean\r\n\r\n private _rectStroke: BoundingRect\r\n\r\n protected _normalState: PathState\r\n\r\n protected _decalEl: Path\r\n\r\n // Must have an initial value on shape.\r\n // It will be assigned by default value.\r\n shape: Dictionary\r\n\r\n constructor(opts?: Props) {\r\n super(opts);\r\n }\r\n\r\n update() {\r\n super.update();\r\n\r\n const style = this.style;\r\n if (style.decal) {\r\n const decalEl: Path = this._decalEl = this._decalEl || new Path();\r\n if (decalEl.buildPath === Path.prototype.buildPath) {\r\n decalEl.buildPath = ctx => {\r\n this.buildPath(ctx, this.shape);\r\n };\r\n }\r\n\r\n decalEl.silent = true;\r\n\r\n const decalElStyle = decalEl.style;\r\n\r\n for (let key in style) {\r\n if ((decalElStyle as any)[key] !== (style as any)[key]) {\r\n (decalElStyle as any)[key] = (style as any)[key];\r\n }\r\n }\r\n decalElStyle.fill = style.fill ? style.decal : null;\r\n decalElStyle.decal = null;\r\n decalElStyle.shadowColor = null;\r\n style.strokeFirst && (decalElStyle.stroke = null);\r\n\r\n for (let i = 0; i < pathCopyParams.length; ++i) {\r\n (decalEl as any)[pathCopyParams[i]] = this[pathCopyParams[i]];\r\n }\r\n\r\n decalEl.__dirty |= REDRAW_BIT;\r\n }\r\n else if (this._decalEl) {\r\n this._decalEl = null;\r\n }\r\n }\r\n\r\n getDecalElement() {\r\n return this._decalEl;\r\n }\r\n\r\n protected _init(props?: Props) {\r\n // Init default properties\r\n const keysArr = keys(props);\r\n\r\n this.shape = this.getDefaultShape();\r\n const defaultStyle = this.getDefaultStyle();\r\n if (defaultStyle) {\r\n this.useStyle(defaultStyle);\r\n }\r\n\r\n for (let i = 0; i < keysArr.length; i++) {\r\n const key = keysArr[i];\r\n const value = props[key];\r\n if (key === 'style') {\r\n if (!this.style) {\r\n // PENDING Reuse style object if possible?\r\n this.useStyle(value as Props['style']);\r\n }\r\n else {\r\n extend(this.style, value as Props['style']);\r\n }\r\n }\r\n else if (key === 'shape') {\r\n // this.shape = value;\r\n extend(this.shape, value as Props['shape']);\r\n }\r\n else {\r\n super.attrKV(key as any, value);\r\n }\r\n }\r\n\r\n // Create an empty one if no style object exists.\r\n if (!this.style) {\r\n this.useStyle({});\r\n }\r\n // const defaultShape = this.getDefaultShape();\r\n // if (!this.shape) {\r\n // this.shape = defaultShape;\r\n // }\r\n // else {\r\n // defaults(this.shape, defaultShape);\r\n // }\r\n }\r\n\r\n protected getDefaultStyle(): Props['style'] {\r\n return null;\r\n }\r\n\r\n // Needs to override\r\n protected getDefaultShape() {\r\n return {};\r\n }\r\n\r\n protected canBeInsideText() {\r\n return this.hasFill();\r\n }\r\n\r\n protected getInsideTextFill() {\r\n const pathFill = this.style.fill;\r\n if (pathFill !== 'none') {\r\n if (isString(pathFill)) {\r\n const fillLum = lum(pathFill, 0);\r\n // Determin text color based on the lum of path fill.\r\n // TODO use (1 - DARK_MODE_THRESHOLD)?\r\n if (fillLum > 0.5) { // TODO Consider background lum?\r\n return DARK_LABEL_COLOR;\r\n }\r\n else if (fillLum > 0.2) {\r\n return LIGHTER_LABEL_COLOR;\r\n }\r\n return LIGHT_LABEL_COLOR;\r\n }\r\n else if (pathFill) {\r\n return LIGHT_LABEL_COLOR;\r\n }\r\n\r\n }\r\n return DARK_LABEL_COLOR;\r\n }\r\n\r\n protected getInsideTextStroke(textFill?: string) {\r\n const pathFill = this.style.fill;\r\n // Not stroke on none fill object or gradient object\r\n if (isString(pathFill)) {\r\n const zr = this.__zr;\r\n const isDarkMode = !!(zr && zr.isDarkMode());\r\n const isDarkLabel = lum(textFill, 0) < DARK_MODE_THRESHOLD;\r\n // All dark or all light.\r\n if (isDarkMode === isDarkLabel) {\r\n return pathFill;\r\n }\r\n }\r\n }\r\n\r\n // When bundling path, some shape may decide if use moveTo to begin a new subpath or closePath\r\n // Like in circle\r\n buildPath(\r\n ctx: PathProxy | CanvasRenderingContext2D,\r\n shapeCfg: Dictionary,\r\n inBatch?: boolean\r\n ) {}\r\n\r\n pathUpdated() {\r\n this.__dirty &= ~SHAPE_CHANGED_BIT;\r\n }\r\n\r\n getUpdatedPathProxy(inBatch?: boolean) {\r\n // Update path proxy data to latest.\r\n !this.path && this.createPathProxy();\r\n this.path.beginPath();\r\n this.buildPath(this.path, this.shape, inBatch);\r\n return this.path;\r\n }\r\n\r\n createPathProxy() {\r\n this.path = new PathProxy(false);\r\n }\r\n\r\n hasStroke() {\r\n const style = this.style;\r\n const stroke = style.stroke;\r\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\r\n }\r\n\r\n hasFill() {\r\n const style = this.style;\r\n const fill = style.fill;\r\n return fill != null && fill !== 'none';\r\n }\r\n\r\n getBoundingRect(): BoundingRect {\r\n let rect = this._rect;\r\n const style = this.style;\r\n const needsUpdateRect = !rect;\r\n if (needsUpdateRect) {\r\n let firstInvoke = false;\r\n if (!this.path) {\r\n firstInvoke = true;\r\n // Create path on demand.\r\n this.createPathProxy();\r\n }\r\n let path = this.path;\r\n if (firstInvoke || (this.__dirty & SHAPE_CHANGED_BIT)) {\r\n path.beginPath();\r\n this.buildPath(path, this.shape, false);\r\n this.pathUpdated();\r\n }\r\n rect = path.getBoundingRect();\r\n }\r\n this._rect = rect;\r\n\r\n if (this.hasStroke() && this.path && this.path.len() > 0) {\r\n // Needs update rect with stroke lineWidth when\r\n // 1. Element changes scale or lineWidth\r\n // 2. Shape is changed\r\n const rectStroke = this._rectStroke || (this._rectStroke = rect.clone());\r\n if (this.__dirty || needsUpdateRect) {\r\n rectStroke.copy(rect);\r\n // PENDING, Min line width is needed when line is horizontal or vertical\r\n const lineScale = style.strokeNoScale ? this.getLineScale() : 1;\r\n // FIXME Must after updateTransform\r\n let w = style.lineWidth;\r\n\r\n // Only add extra hover lineWidth when there are no fill\r\n if (!this.hasFill()) {\r\n const strokeContainThreshold = this.strokeContainThreshold;\r\n w = Math.max(w, strokeContainThreshold == null ? 4 : strokeContainThreshold);\r\n }\r\n // Consider line width\r\n // Line scale can't be 0;\r\n if (lineScale > 1e-10) {\r\n rectStroke.width += w / lineScale;\r\n rectStroke.height += w / lineScale;\r\n rectStroke.x -= w / lineScale / 2;\r\n rectStroke.y -= w / lineScale / 2;\r\n }\r\n }\r\n\r\n // Return rect with stroke\r\n return rectStroke;\r\n }\r\n\r\n return rect;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const localPos = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n const style = this.style;\r\n x = localPos[0];\r\n y = localPos[1];\r\n\r\n if (rect.contain(x, y)) {\r\n const pathProxy = this.path;\r\n if (this.hasStroke()) {\r\n let lineWidth = style.lineWidth;\r\n let lineScale = style.strokeNoScale ? this.getLineScale() : 1;\r\n // Line scale can't be 0;\r\n if (lineScale > 1e-10) {\r\n // Only add extra hover lineWidth when there are no fill\r\n if (!this.hasFill()) {\r\n lineWidth = Math.max(lineWidth, this.strokeContainThreshold);\r\n }\r\n if (pathContain.containStroke(\r\n pathProxy, lineWidth / lineScale, x, y\r\n )) {\r\n return true;\r\n }\r\n }\r\n }\r\n if (this.hasFill()) {\r\n return pathContain.contain(pathProxy, x, y);\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Shape changed\r\n */\r\n dirtyShape() {\r\n this.__dirty |= SHAPE_CHANGED_BIT;\r\n if (this._rect) {\r\n this._rect = null;\r\n }\r\n if (this._decalEl) {\r\n this._decalEl.dirtyShape();\r\n }\r\n this.markRedraw();\r\n }\r\n\r\n dirty() {\r\n this.dirtyStyle();\r\n this.dirtyShape();\r\n }\r\n\r\n /**\r\n * Alias for animate('shape')\r\n * @param {boolean} loop\r\n */\r\n animateShape(loop: boolean) {\r\n return this.animate('shape', loop);\r\n }\r\n\r\n // Override updateDuringAnimation\r\n updateDuringAnimation(targetKey: string) {\r\n if (targetKey === 'style') {\r\n this.dirtyStyle();\r\n }\r\n else if (targetKey === 'shape') {\r\n this.dirtyShape();\r\n }\r\n else {\r\n this.markRedraw();\r\n }\r\n }\r\n\r\n // Overwrite attrKV\r\n attrKV(key: PathKey, value: PathPropertyType) {\r\n // FIXME\r\n if (key === 'shape') {\r\n this.setShape(value as Props['shape']);\r\n }\r\n else {\r\n super.attrKV(key as keyof DisplayableProps, value);\r\n }\r\n }\r\n\r\n setShape(obj: Props['shape']): this\r\n setShape(obj: T, value: Props['shape'][T]): this\r\n setShape(keyOrObj: keyof Props['shape'] | Props['shape'], value?: unknown): this {\r\n let shape = this.shape;\r\n if (!shape) {\r\n shape = this.shape = {};\r\n }\r\n // Path from string may not have shape\r\n if (typeof keyOrObj === 'string') {\r\n shape[keyOrObj] = value;\r\n }\r\n else {\r\n extend(shape, keyOrObj as Props['shape']);\r\n }\r\n this.dirtyShape();\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * If shape changed. used with dirtyShape\r\n */\r\n shapeChanged() {\r\n return !!(this.__dirty & SHAPE_CHANGED_BIT);\r\n }\r\n\r\n /**\r\n * Create a path style object with default values in it's prototype.\r\n * @override\r\n */\r\n createStyle(obj?: Props['style']) {\r\n return createObject(DEFAULT_PATH_STYLE, obj);\r\n }\r\n\r\n protected _innerSaveToNormal(toState: PathState) {\r\n super._innerSaveToNormal(toState);\r\n\r\n const normalState = this._normalState;\r\n // Clone a new one. DON'T share object reference between states and current using.\r\n // TODO: Clone array in shape?.\r\n // TODO: Only save changed shape.\r\n if (toState.shape && !normalState.shape) {\r\n normalState.shape = extend({}, this.shape);\r\n }\r\n }\r\n\r\n protected _applyStateObj(\r\n stateName: string,\r\n state: PathState,\r\n normalState: PathState,\r\n keepCurrentStates: boolean,\r\n transition: boolean,\r\n animationCfg: ElementAnimateConfig\r\n ) {\r\n super._applyStateObj(stateName, state, normalState, keepCurrentStates, transition, animationCfg);\r\n const needsRestoreToNormal = !(state && keepCurrentStates);\r\n let targetShape: Props['shape'];\r\n if (state && state.shape) {\r\n // Only animate changed properties.\r\n if (transition) {\r\n if (keepCurrentStates) {\r\n targetShape = state.shape;\r\n }\r\n else {\r\n // Inherits from normal state.\r\n targetShape = extend({}, normalState.shape);\r\n extend(targetShape, state.shape);\r\n }\r\n }\r\n else {\r\n // Because the shape will be replaced. So inherits from current shape.\r\n targetShape = extend({}, keepCurrentStates ? this.shape : normalState.shape);\r\n extend(targetShape, state.shape);\r\n }\r\n }\r\n else if (needsRestoreToNormal) {\r\n targetShape = normalState.shape;\r\n }\r\n\r\n if (targetShape) {\r\n if (transition) {\r\n // Clone a new shape.\r\n this.shape = extend({}, this.shape);\r\n // Only supports transition on primary props. Because shape is not deep cloned.\r\n const targetShapePrimaryProps: Props['shape'] = {};\r\n const shapeKeys = keys(targetShape);\r\n for (let i = 0; i < shapeKeys.length; i++) {\r\n const key = shapeKeys[i];\r\n if (typeof targetShape[key] === 'object') {\r\n (this.shape as Props['shape'])[key] = targetShape[key];\r\n }\r\n else {\r\n targetShapePrimaryProps[key] = targetShape[key];\r\n }\r\n }\r\n this._transitionState(stateName, {\r\n shape: targetShapePrimaryProps\r\n } as Props, animationCfg);\r\n }\r\n else {\r\n this.shape = targetShape;\r\n this.dirtyShape();\r\n }\r\n }\r\n }\r\n\r\n protected _mergeStates(states: PathState[]) {\r\n const mergedState = super._mergeStates(states) as PathState;\r\n let mergedShape: Props['shape'];\r\n for (let i = 0; i < states.length; i++) {\r\n const state = states[i];\r\n if (state.shape) {\r\n mergedShape = mergedShape || {};\r\n this._mergeStyle(mergedShape, state.shape);\r\n }\r\n }\r\n if (mergedShape) {\r\n mergedState.shape = mergedShape;\r\n }\r\n return mergedState;\r\n }\r\n\r\n getAnimationStyleProps() {\r\n return DEFAULT_PATH_ANIMATION_PROPS;\r\n }\r\n /**\r\n * If path shape is zero area\r\n */\r\n isZeroArea(): boolean {\r\n return false;\r\n }\r\n /**\r\n * 扩展一个 Path element, 比如星形,圆等。\r\n * Extend a path element\r\n * @DEPRECATED Use class extends\r\n * @param props\r\n * @param props.type Path type\r\n * @param props.init Initialize\r\n * @param props.buildPath Overwrite buildPath method\r\n * @param props.style Extended default style config\r\n * @param props.shape Extended default shape config\r\n */\r\n static extend>(defaultProps: {\r\n type?: string\r\n shape?: Shape\r\n style?: PathStyleProps\r\n beforeBrush?: Displayable['beforeBrush']\r\n afterBrush?: Displayable['afterBrush']\r\n getBoundingRect?: Displayable['getBoundingRect']\r\n\r\n calculateTextPosition?: Element['calculateTextPosition']\r\n buildPath(this: Path, ctx: CanvasRenderingContext2D | PathProxy, shape: Shape, inBatch?: boolean): void\r\n init?(this: Path, opts: PathProps): void // TODO Should be SubPathOption\r\n }): {\r\n new(opts?: PathProps & {shape: Shape}): Path\r\n } {\r\n interface SubPathOption extends PathProps {\r\n shape: Shape\r\n }\r\n\r\n class Sub extends Path {\r\n\r\n shape: Shape\r\n\r\n getDefaultStyle() {\r\n return clone(defaultProps.style);\r\n }\r\n\r\n getDefaultShape() {\r\n return clone(defaultProps.shape);\r\n }\r\n\r\n constructor(opts?: SubPathOption) {\r\n super(opts);\r\n defaultProps.init && defaultProps.init.call(this as any, opts);\r\n }\r\n }\r\n\r\n // TODO Legacy usage. Extend functions\r\n for (let key in defaultProps) {\r\n if (typeof (defaultProps as any)[key] === 'function') {\r\n (Sub.prototype as any)[key] = (defaultProps as any)[key];\r\n }\r\n }\r\n // Sub.prototype.buildPath = defaultProps.buildPath;\r\n // Sub.prototype.beforeBrush = defaultProps.beforeBrush;\r\n // Sub.prototype.afterBrush = defaultProps.afterBrush;\r\n\r\n return Sub as any;\r\n }\r\n\r\n protected static initDefaultProps = (function () {\r\n const pathProto = Path.prototype;\r\n pathProto.type = 'path';\r\n pathProto.strokeContainThreshold = 5;\r\n pathProto.segmentIgnoreThreshold = 0;\r\n pathProto.subPixelOptimize = false;\r\n pathProto.autoBatch = false;\r\n pathProto.__dirty = REDRAW_BIT | STYLE_CHANGED_BIT | SHAPE_CHANGED_BIT;\r\n })()\r\n}\r\n\r\nexport default Path;","import PathProxy from '../core/PathProxy';\r\nimport {applyTransform as v2ApplyTransform, VectorArray} from '../core/vector';\r\nimport { MatrixArray } from '../core/matrix';\r\n\r\nconst CMD = PathProxy.CMD;\r\n\r\nconst points: VectorArray[] = [[], [], []];\r\nconst mathSqrt = Math.sqrt;\r\nconst mathAtan2 = Math.atan2;\r\n\r\nexport default function transformPath(path: PathProxy, m: MatrixArray) {\r\n if (!m) {\r\n return;\r\n }\r\n\r\n let data = path.data;\r\n const len = path.len();\r\n let cmd;\r\n let nPoint: number;\r\n let i: number;\r\n let j: number;\r\n let k: number;\r\n let p: VectorArray;\r\n\r\n const M = CMD.M;\r\n const C = CMD.C;\r\n const L = CMD.L;\r\n const R = CMD.R;\r\n const A = CMD.A;\r\n const Q = CMD.Q;\r\n\r\n for (i = 0, j = 0; i < len;) {\r\n cmd = data[i++];\r\n j = i;\r\n nPoint = 0;\r\n\r\n switch (cmd) {\r\n case M:\r\n nPoint = 1;\r\n break;\r\n case L:\r\n nPoint = 1;\r\n break;\r\n case C:\r\n nPoint = 3;\r\n break;\r\n case Q:\r\n nPoint = 2;\r\n break;\r\n case A:\r\n const x = m[4];\r\n const y = m[5];\r\n const sx = mathSqrt(m[0] * m[0] + m[1] * m[1]);\r\n const sy = mathSqrt(m[2] * m[2] + m[3] * m[3]);\r\n const angle = mathAtan2(-m[1] / sy, m[0] / sx);\r\n // cx\r\n data[i] *= sx;\r\n data[i++] += x;\r\n // cy\r\n data[i] *= sy;\r\n data[i++] += y;\r\n // Scale rx and ry\r\n // FIXME Assume psi is 0 here\r\n data[i++] *= sx;\r\n data[i++] *= sy;\r\n\r\n // Start angle\r\n data[i++] += angle;\r\n // end angle\r\n data[i++] += angle;\r\n // FIXME psi\r\n i += 2;\r\n j = i;\r\n break;\r\n case R:\r\n // x0, y0\r\n p[0] = data[i++];\r\n p[1] = data[i++];\r\n v2ApplyTransform(p, p, m);\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n // x1, y1\r\n p[0] += data[i++];\r\n p[1] += data[i++];\r\n v2ApplyTransform(p, p, m);\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n }\r\n\r\n for (k = 0; k < nPoint; k++) {\r\n let p = points[k];\r\n p[0] = data[i++];\r\n p[1] = data[i++];\r\n\r\n v2ApplyTransform(p, p, m);\r\n // Write back\r\n data[j++] = p[0];\r\n data[j++] = p[1];\r\n }\r\n }\r\n\r\n path.increaseVersion();\r\n}\r\n","import Path, { PathProps } from '../graphic/Path';\nimport PathProxy from '../core/PathProxy';\nimport transformPath from './transformPath';\nimport { VectorArray } from '../core/vector';\nimport { MatrixArray } from '../core/matrix';\nimport { extend } from '../core/util';\n\n// command chars\n// const cc = [\n// 'm', 'M', 'l', 'L', 'v', 'V', 'h', 'H', 'z', 'Z',\n// 'c', 'C', 'q', 'Q', 't', 'T', 's', 'S', 'a', 'A'\n// ];\n\nconst mathSqrt = Math.sqrt;\nconst mathSin = Math.sin;\nconst mathCos = Math.cos;\nconst PI = Math.PI;\n\nfunction vMag(v: VectorArray): number {\n return Math.sqrt(v[0] * v[0] + v[1] * v[1]);\n};\nfunction vRatio(u: VectorArray, v: VectorArray): number {\n return (u[0] * v[0] + u[1] * v[1]) / (vMag(u) * vMag(v));\n};\nfunction vAngle(u: VectorArray, v: VectorArray): number {\n return (u[0] * v[1] < u[1] * v[0] ? -1 : 1)\n * Math.acos(vRatio(u, v));\n};\n\nfunction processArc(\n x1: number, y1: number, x2: number, y2: number, fa: number, fs: number,\n rx: number, ry: number, psiDeg: number, cmd: number, path: PathProxy\n) {\n // https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const psi = psiDeg * (PI / 180.0);\n const xp = mathCos(psi) * (x1 - x2) / 2.0\n + mathSin(psi) * (y1 - y2) / 2.0;\n const yp = -1 * mathSin(psi) * (x1 - x2) / 2.0\n + mathCos(psi) * (y1 - y2) / 2.0;\n\n const lambda = (xp * xp) / (rx * rx) + (yp * yp) / (ry * ry);\n\n if (lambda > 1) {\n rx *= mathSqrt(lambda);\n ry *= mathSqrt(lambda);\n }\n\n const f = (fa === fs ? -1 : 1)\n * mathSqrt((((rx * rx) * (ry * ry))\n - ((rx * rx) * (yp * yp))\n - ((ry * ry) * (xp * xp))) / ((rx * rx) * (yp * yp)\n + (ry * ry) * (xp * xp))\n ) || 0;\n\n const cxp = f * rx * yp / ry;\n const cyp = f * -ry * xp / rx;\n\n const cx = (x1 + x2) / 2.0\n + mathCos(psi) * cxp\n - mathSin(psi) * cyp;\n const cy = (y1 + y2) / 2.0\n + mathSin(psi) * cxp\n + mathCos(psi) * cyp;\n\n const theta = vAngle([ 1, 0 ], [ (xp - cxp) / rx, (yp - cyp) / ry ]);\n const u = [ (xp - cxp) / rx, (yp - cyp) / ry ];\n const v = [ (-1 * xp - cxp) / rx, (-1 * yp - cyp) / ry ];\n let dTheta = vAngle(u, v);\n\n if (vRatio(u, v) <= -1) {\n dTheta = PI;\n }\n if (vRatio(u, v) >= 1) {\n dTheta = 0;\n }\n\n if (dTheta < 0) {\n const n = Math.round(dTheta / PI * 1e6) / 1e6;\n // Convert to positive\n dTheta = PI * 2 + (n % 2) * PI;\n }\n\n path.addData(cmd, cx, cy, rx, ry, theta, dTheta, psi, fs);\n}\n\n\nconst commandReg = /([mlvhzcqtsa])([^mlvhzcqtsa]*)/ig;\n// Consider case:\n// (1) delimiter can be comma or space, where continuous commas\n// or spaces should be seen as one comma.\n// (2) value can be like:\n// '2e-4', 'l.5.9' (ignore 0), 'M-10-10', 'l-2.43e-1,34.9983',\n// 'l-.5E1,54', '121-23-44-11' (no delimiter)\nconst numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\n// const valueSplitReg = /[\\s,]+/;\n\nfunction createPathProxyFromString(data: string) {\n const path = new PathProxy();\n\n if (!data) {\n return path;\n }\n\n // const data = data.replace(/-/g, ' -')\n // .replace(/ /g, ' ')\n // .replace(/ /g, ',')\n // .replace(/,,/g, ',');\n\n // const n;\n // create pipes so that we can split the data\n // for (n = 0; n < cc.length; n++) {\n // cs = cs.replace(new RegExp(cc[n], 'g'), '|' + cc[n]);\n // }\n\n // data = data.replace(/-/g, ',-');\n\n // create array\n // const arr = cs.split('|');\n // init context point\n let cpx = 0;\n let cpy = 0;\n let subpathX = cpx;\n let subpathY = cpy;\n let prevCmd;\n\n const CMD = PathProxy.CMD;\n\n // commandReg.lastIndex = 0;\n // const cmdResult;\n // while ((cmdResult = commandReg.exec(data)) != null) {\n // const cmdStr = cmdResult[1];\n // const cmdContent = cmdResult[2];\n\n const cmdList = data.match(commandReg);\n if (!cmdList) {\n // Invalid svg path.\n return path;\n }\n\n for (let l = 0; l < cmdList.length; l++) {\n const cmdText = cmdList[l];\n let cmdStr = cmdText.charAt(0);\n\n let cmd;\n\n // String#split is faster a little bit than String#replace or RegExp#exec.\n // const p = cmdContent.split(valueSplitReg);\n // const pLen = 0;\n // for (let i = 0; i < p.length; i++) {\n // // '' and other invalid str => NaN\n // const val = parseFloat(p[i]);\n // !isNaN(val) && (p[pLen++] = val);\n // }\n\n\n // Following code will convert string to number. So convert type to number here\n const p = cmdText.match(numberReg) as any[] as number[] || [];\n const pLen = p.length;\n for (let i = 0; i < pLen; i++) {\n p[i] = parseFloat(p[i] as any as string);\n }\n\n let off = 0;\n while (off < pLen) {\n let ctlPtx;\n let ctlPty;\n\n let rx;\n let ry;\n let psi;\n let fa;\n let fs;\n\n let x1 = cpx;\n let y1 = cpy;\n\n let len: number;\n let pathData: number[] | Float32Array;\n // convert l, H, h, V, and v to L\n switch (cmdStr) {\n case 'l':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'L':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'm':\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'l';\n break;\n case 'M':\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.M;\n path.addData(cmd, cpx, cpy);\n subpathX = cpx;\n subpathY = cpy;\n cmdStr = 'L';\n break;\n case 'h':\n cpx += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'H':\n cpx = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'v':\n cpy += p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'V':\n cpy = p[off++];\n cmd = CMD.L;\n path.addData(cmd, cpx, cpy);\n break;\n case 'C':\n cmd = CMD.C;\n path.addData(\n cmd, p[off++], p[off++], p[off++], p[off++], p[off++], p[off++]\n );\n cpx = p[off - 2];\n cpy = p[off - 1];\n break;\n case 'c':\n cmd = CMD.C;\n path.addData(\n cmd,\n p[off++] + cpx, p[off++] + cpy,\n p[off++] + cpx, p[off++] + cpy,\n p[off++] + cpx, p[off++] + cpy\n );\n cpx += p[off - 2];\n cpy += p[off - 1];\n break;\n case 'S':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 's':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.C) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cmd = CMD.C;\n x1 = cpx + p[off++];\n y1 = cpy + p[off++];\n cpx += p[off++];\n cpy += p[off++];\n path.addData(cmd, ctlPtx, ctlPty, x1, y1, cpx, cpy);\n break;\n case 'Q':\n x1 = p[off++];\n y1 = p[off++];\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'q':\n x1 = p[off++] + cpx;\n y1 = p[off++] + cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, x1, y1, cpx, cpy);\n break;\n case 'T':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 't':\n ctlPtx = cpx;\n ctlPty = cpy;\n len = path.len();\n pathData = path.data;\n if (prevCmd === CMD.Q) {\n ctlPtx += cpx - pathData[len - 4];\n ctlPty += cpy - pathData[len - 3];\n }\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.Q;\n path.addData(cmd, ctlPtx, ctlPty, cpx, cpy);\n break;\n case 'A':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n\n x1 = cpx, y1 = cpy;\n cpx = p[off++];\n cpy = p[off++];\n cmd = CMD.A;\n processArc(\n x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path\n );\n break;\n case 'a':\n rx = p[off++];\n ry = p[off++];\n psi = p[off++];\n fa = p[off++];\n fs = p[off++];\n\n x1 = cpx, y1 = cpy;\n cpx += p[off++];\n cpy += p[off++];\n cmd = CMD.A;\n processArc(\n x1, y1, cpx, cpy, fa, fs, rx, ry, psi, cmd, path\n );\n break;\n }\n }\n\n if (cmdStr === 'z' || cmdStr === 'Z') {\n cmd = CMD.Z;\n path.addData(cmd);\n // z may be in the middle of the path.\n cpx = subpathX;\n cpy = subpathY;\n }\n\n prevCmd = cmd;\n }\n\n path.toStatic();\n\n return path;\n}\n\ntype SVGPathOption = Omit\ninterface InnerSVGPathOption extends PathProps {\n applyTransform?: (m: MatrixArray) => void\n}\nclass SVGPath extends Path {\n applyTransform(m: MatrixArray) {}\n}\n\nfunction isPathProxy(path: PathProxy | CanvasRenderingContext2D): path is PathProxy {\n return (path as PathProxy).setData != null;\n}\n// TODO Optimize double memory cost problem\nfunction createPathOptions(str: string, opts: SVGPathOption): InnerSVGPathOption {\n const pathProxy = createPathProxyFromString(str);\n const innerOpts: InnerSVGPathOption = extend({}, opts);\n innerOpts.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {\n if (isPathProxy(path)) {\n path.setData(pathProxy.data);\n // Svg and vml renderer don't have context\n const ctx = path.getContext();\n if (ctx) {\n path.rebuildPath(ctx, 1);\n }\n }\n else {\n const ctx = path;\n pathProxy.rebuildPath(ctx, 1);\n }\n };\n\n innerOpts.applyTransform = function (this: SVGPath, m: MatrixArray) {\n transformPath(pathProxy, m);\n this.dirtyShape();\n };\n\n return innerOpts;\n}\n\n/**\n * Create a Path object from path string data\n * http://www.w3.org/TR/SVG/paths.html#PathData\n * @param opts Other options\n */\nexport function createFromString(str: string, opts?: SVGPathOption): SVGPath {\n // PENDING\n return new SVGPath(createPathOptions(str, opts));\n}\n\n/**\n * Create a Path class from path string data\n * @param str\n * @param opts Other options\n */\nexport function extendFromString(str: string, defaultOpts?: SVGPathOption): typeof SVGPath {\n const innerOpts = createPathOptions(str, defaultOpts);\n class Sub extends SVGPath {\n constructor(opts: InnerSVGPathOption) {\n super(opts);\n this.applyTransform = innerOpts.applyTransform;\n this.buildPath = innerOpts.buildPath;\n }\n }\n return Sub;\n}\n\n/**\n * Merge multiple paths\n */\n// TODO Apply transform\n// TODO stroke dash\n// TODO Optimize double memory cost problem\nexport function mergePath(pathEls: Path[], opts: PathProps) {\n const pathList: PathProxy[] = [];\n const len = pathEls.length;\n for (let i = 0; i < len; i++) {\n const pathEl = pathEls[i];\n pathList.push(pathEl.getUpdatedPathProxy(true));\n }\n\n const pathBundle = new Path(opts);\n // Need path proxy.\n pathBundle.createPathProxy();\n pathBundle.buildPath = function (path: PathProxy | CanvasRenderingContext2D) {\n if (isPathProxy(path)) {\n path.appendPath(pathList);\n // Svg and vml renderer don't have context\n const ctx = path.getContext();\n if (ctx) {\n // Path bundle not support percent draw.\n path.rebuildPath(ctx, 1);\n }\n }\n };\n\n return pathBundle;\n}\n\n/**\n * Clone a path.\n */\nexport function clonePath(sourcePath: Path, opts?: {\n /**\n * If bake global transform to path.\n */\n bakeTransform?: boolean\n /**\n * Convert global transform to local.\n */\n toLocal?: boolean\n}) {\n opts = opts || {};\n const path = new Path();\n if (sourcePath.shape) {\n path.setShape(sourcePath.shape);\n }\n path.setStyle(sourcePath.style);\n\n if (opts.bakeTransform) {\n transformPath(path.path, sourcePath.getComputedTransform());\n }\n else {\n // TODO Copy getLocalTransform, updateTransform since they can be changed.\n if (opts.toLocal) {\n path.setLocalTransform(sourcePath.getComputedTransform());\n }\n else {\n path.copyTransform(sourcePath);\n }\n }\n\n // These methods may be overridden\n path.buildPath = sourcePath.buildPath;\n (path as SVGPath).applyTransform = (path as SVGPath).applyTransform;\n\n path.z = sourcePath.z;\n path.z2 = sourcePath.z2;\n path.zlevel = sourcePath.zlevel;\n\n return path;\n}\n","import Displayable, { DisplayableProps,\n CommonStyleProps,\n DEFAULT_COMMON_STYLE,\n DisplayableStatePropNames,\n DEFAULT_COMMON_ANIMATION_PROPS\n} from './Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { ImageLike, MapToType } from '../core/types';\nimport { defaults, createObject } from '../core/util';\nimport { ElementCommonState } from '../Element';\n\nexport interface ImageStyleProps extends CommonStyleProps {\n image?: string | ImageLike\n x?: number\n y?: number\n width?: number\n height?: number\n sx?: number\n sy?: number\n sWidth?: number\n sHeight?: number\n}\n\nexport const DEFAULT_IMAGE_STYLE: CommonStyleProps = defaults({\n x: 0,\n y: 0\n}, DEFAULT_COMMON_STYLE);\n\nexport const DEFAULT_IMAGE_ANIMATION_PROPS: MapToType = {\n style: defaults, MapToType>({\n x: true,\n y: true,\n width: true,\n height: true,\n sx: true,\n sy: true,\n sWidth: true,\n sHeight: true\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n };\n\nexport interface ImageProps extends DisplayableProps {\n style?: ImageStyleProps\n\n onload?: (image: ImageLike) => void\n}\n\nexport type ImageState = Pick & ElementCommonState\n\nfunction isImageLike(source: unknown): source is HTMLImageElement {\n return !!(source\n && typeof source !== 'string'\n // Image source is an image, canvas, video.\n && (source as HTMLImageElement).width && (source as HTMLImageElement).height);\n}\n\nclass ZRImage extends Displayable {\n\n style: ImageStyleProps\n\n // FOR CANVAS RENDERER\n __image: ImageLike\n // FOR SVG RENDERER\n __imageSrc: string\n\n onload: (image: ImageLike) => void\n\n /**\n * Create an image style object with default values in it's prototype.\n * @override\n */\n createStyle(obj?: ImageStyleProps) {\n return createObject(DEFAULT_IMAGE_STYLE, obj);\n }\n\n private _getSize(dim: 'width' | 'height') {\n const style = this.style;\n\n let size = style[dim];\n if (size != null) {\n return size;\n }\n\n const imageSource = isImageLike(style.image)\n ? style.image : this.__image;\n\n if (!imageSource) {\n return 0;\n }\n\n const otherDim = dim === 'width' ? 'height' : 'width';\n let otherDimSize = style[otherDim];\n if (otherDimSize == null) {\n return imageSource[dim];\n }\n else {\n return imageSource[dim] / imageSource[otherDim] * otherDimSize;\n }\n }\n\n getWidth(): number {\n return this._getSize('width');\n }\n\n getHeight(): number {\n return this._getSize('height');\n }\n\n getAnimationStyleProps() {\n return DEFAULT_IMAGE_ANIMATION_PROPS;\n }\n\n getBoundingRect(): BoundingRect {\n const style = this.style;\n if (!this._rect) {\n this._rect = new BoundingRect(\n style.x || 0, style.y || 0, this.getWidth(), this.getHeight()\n );\n }\n return this._rect;\n }\n}\n\nZRImage.prototype.type = 'image';\n\nexport default ZRImage;","/**\r\n * 圆形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class CircleShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n}\r\n\r\nexport interface CircleProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Circle extends Path {\r\n\r\n shape: CircleShape\r\n\r\n constructor(opts?: CircleProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new CircleShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: CircleShape) {\r\n // Use moveTo to start a new sub path.\r\n // Or it will be connected to other subpaths when in CompoundPath\r\n ctx.moveTo(shape.cx + shape.r, shape.cy);\r\n ctx.arc(shape.cx, shape.cy, shape.r, 0, Math.PI * 2);\r\n }\r\n};\r\n\r\nCircle.prototype.type = 'circle';\r\n\r\nexport default Circle;","import PathProxy from '../../core/PathProxy';\r\n\r\nexport function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n r?: number | number[]\r\n}) {\r\n let x = shape.x;\r\n let y = shape.y;\r\n let width = shape.width;\r\n let height = shape.height;\r\n let r = shape.r;\r\n let r1;\r\n let r2;\r\n let r3;\r\n let r4;\r\n\r\n // Convert width and height to positive for better borderRadius\r\n if (width < 0) {\r\n x = x + width;\r\n width = -width;\r\n }\r\n if (height < 0) {\r\n y = y + height;\r\n height = -height;\r\n }\r\n\r\n if (typeof r === 'number') {\r\n r1 = r2 = r3 = r4 = r;\r\n }\r\n else if (r instanceof Array) {\r\n if (r.length === 1) {\r\n r1 = r2 = r3 = r4 = r[0];\r\n }\r\n else if (r.length === 2) {\r\n r1 = r3 = r[0];\r\n r2 = r4 = r[1];\r\n }\r\n else if (r.length === 3) {\r\n r1 = r[0];\r\n r2 = r4 = r[1];\r\n r3 = r[2];\r\n }\r\n else {\r\n r1 = r[0];\r\n r2 = r[1];\r\n r3 = r[2];\r\n r4 = r[3];\r\n }\r\n }\r\n else {\r\n r1 = r2 = r3 = r4 = 0;\r\n }\r\n\r\n let total;\r\n if (r1 + r2 > width) {\r\n total = r1 + r2;\r\n r1 *= width / total;\r\n r2 *= width / total;\r\n }\r\n if (r3 + r4 > width) {\r\n total = r3 + r4;\r\n r3 *= width / total;\r\n r4 *= width / total;\r\n }\r\n if (r2 + r3 > height) {\r\n total = r2 + r3;\r\n r2 *= height / total;\r\n r3 *= height / total;\r\n }\r\n if (r1 + r4 > height) {\r\n total = r1 + r4;\r\n r1 *= height / total;\r\n r4 *= height / total;\r\n }\r\n ctx.moveTo(x + r1, y);\r\n ctx.lineTo(x + width - r2, y);\r\n r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);\r\n ctx.lineTo(x + width, y + height - r3);\r\n r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);\r\n ctx.lineTo(x + r4, y + height);\r\n r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);\r\n ctx.lineTo(x, y + r1);\r\n r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);\r\n}\r\n","import { PathStyleProps } from '../Path';\r\n\r\n/**\r\n * Sub-pixel optimize for canvas rendering, prevent from blur\r\n * when rendering a thin vertical/horizontal line.\r\n */\r\n\r\nconst round = Math.round;\r\n\r\ntype LineShape = {\r\n x1: number\r\n y1: number\r\n x2: number\r\n y2: number\r\n}\r\n\r\ntype RectShape = {\r\n x: number\r\n y: number\r\n width: number\r\n height: number\r\n r?: number | number[]\r\n}\r\n/**\r\n * Sub pixel optimize line for canvas\r\n *\r\n * @param outputShape The modification will be performed on `outputShape`.\r\n * `outputShape` and `inputShape` can be the same object.\r\n * `outputShape` object can be used repeatly, because all of\r\n * the `x1`, `x2`, `y1`, `y2` will be assigned in this method.\r\n */\r\nexport function subPixelOptimizeLine(\r\n outputShape: Partial,\r\n inputShape: LineShape,\r\n style: Pick // DO not optimize when lineWidth is 0\r\n): LineShape {\r\n if (!inputShape) {\r\n return;\r\n }\r\n\r\n const x1 = inputShape.x1;\r\n const x2 = inputShape.x2;\r\n const y1 = inputShape.y1;\r\n const y2 = inputShape.y2;\r\n\r\n outputShape.x1 = x1;\r\n outputShape.x2 = x2;\r\n outputShape.y1 = y1;\r\n outputShape.y2 = y2;\r\n\r\n const lineWidth = style && style.lineWidth;\r\n if (!lineWidth) {\r\n return outputShape as LineShape;\r\n }\r\n\r\n if (round(x1 * 2) === round(x2 * 2)) {\r\n outputShape.x1 = outputShape.x2 = subPixelOptimize(x1, lineWidth, true);\r\n }\r\n if (round(y1 * 2) === round(y2 * 2)) {\r\n outputShape.y1 = outputShape.y2 = subPixelOptimize(y1, lineWidth, true);\r\n }\r\n\r\n return outputShape as LineShape;\r\n}\r\n\r\n/**\r\n * Sub pixel optimize rect for canvas\r\n *\r\n * @param outputShape The modification will be performed on `outputShape`.\r\n * `outputShape` and `inputShape` can be the same object.\r\n * `outputShape` object can be used repeatly, because all of\r\n * the `x`, `y`, `width`, `height` will be assigned in this method.\r\n */\r\nexport function subPixelOptimizeRect(\r\n outputShape: Partial,\r\n inputShape: RectShape,\r\n style: Pick // DO not optimize when lineWidth is 0\r\n): RectShape {\r\n if (!inputShape) {\r\n return;\r\n }\r\n\r\n const originX = inputShape.x;\r\n const originY = inputShape.y;\r\n const originWidth = inputShape.width;\r\n const originHeight = inputShape.height;\r\n\r\n outputShape.x = originX;\r\n outputShape.y = originY;\r\n outputShape.width = originWidth;\r\n outputShape.height = originHeight;\r\n\r\n const lineWidth = style && style.lineWidth;\r\n if (!lineWidth) {\r\n return outputShape as RectShape;\r\n }\r\n\r\n outputShape.x = subPixelOptimize(originX, lineWidth, true);\r\n outputShape.y = subPixelOptimize(originY, lineWidth, true);\r\n outputShape.width = Math.max(\r\n subPixelOptimize(originX + originWidth, lineWidth, false) - outputShape.x,\r\n originWidth === 0 ? 0 : 1\r\n );\r\n outputShape.height = Math.max(\r\n subPixelOptimize(originY + originHeight, lineWidth, false) - outputShape.y,\r\n originHeight === 0 ? 0 : 1\r\n );\r\n\r\n return outputShape as RectShape;\r\n}\r\n\r\n/**\r\n * Sub pixel optimize for canvas\r\n *\r\n * @param position Coordinate, such as x, y\r\n * @param lineWidth If `null`/`undefined`/`0`, do not optimize.\r\n * @param positiveOrNegative Default false (negative).\r\n * @return Optimized position.\r\n */\r\nexport function subPixelOptimize(\r\n position: number,\r\n lineWidth?: number,\r\n positiveOrNegative?: boolean\r\n) {\r\n if (!lineWidth) {\r\n return position;\r\n }\r\n // Assure that (position + lineWidth / 2) is near integer edge,\r\n // otherwise line will be fuzzy in canvas.\r\n const doubledPosition = round(position * 2);\r\n return (doubledPosition + round(lineWidth)) % 2 === 0\r\n ? doubledPosition / 2\r\n : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;\r\n}\r\n","/**\r\n * 矩形\r\n * @module zrender/graphic/shape/Rect\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as roundRectHelper from '../helper/roundRect';\r\nimport {subPixelOptimizeRect} from '../helper/subPixelOptimize';\r\n\r\nexport class RectShape {\r\n // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4\r\n // r缩写为1 相当于 [1, 1, 1, 1]\r\n // r缩写为[1] 相当于 [1, 1, 1, 1]\r\n // r缩写为[1, 2] 相当于 [1, 2, 1, 2]\r\n // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]\r\n r?: number | number[]\r\n\r\n x = 0\r\n y = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface RectProps extends PathProps {\r\n shape?: Partial\r\n}\r\n// Avoid create repeatly.\r\nconst subPixelOptimizeOutputShape = {};\r\n\r\nclass Rect extends Path {\r\n\r\n shape: RectShape\r\n\r\n constructor(opts?: RectProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new RectShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RectShape) {\r\n let x: number;\r\n let y: number;\r\n let width: number;\r\n let height: number;\r\n\r\n if (this.subPixelOptimize) {\r\n const optimizedShape = subPixelOptimizeRect(subPixelOptimizeOutputShape, shape, this.style);\r\n x = optimizedShape.x;\r\n y = optimizedShape.y;\r\n width = optimizedShape.width;\r\n height = optimizedShape.height;\r\n optimizedShape.r = shape.r;\r\n shape = optimizedShape;\r\n }\r\n else {\r\n x = shape.x;\r\n y = shape.y;\r\n width = shape.width;\r\n height = shape.height;\r\n }\r\n\r\n if (!shape.r) {\r\n ctx.rect(x, y, width, height);\r\n }\r\n else {\r\n roundRectHelper.buildPath(ctx, shape);\r\n }\r\n }\r\n\r\n isZeroArea() {\r\n return !this.shape.width || !this.shape.height;\r\n }\r\n}\r\n\r\nRect.prototype.type = 'rect';\r\n\r\nexport default Rect;","/**\r\n * 椭圆形状\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class EllipseShape {\r\n cx = 0\r\n cy = 0\r\n rx = 0\r\n ry = 0\r\n}\r\n\r\nexport interface EllipseProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Ellipse extends Path {\r\n\r\n shape: EllipseShape\r\n\r\n constructor(opts?: EllipseProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new EllipseShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: EllipseShape) {\r\n const k = 0.5522848;\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.rx;\r\n const b = shape.ry;\r\n const ox = a * k; // 水平控制点偏移量\r\n const oy = b * k; // 垂直控制点偏移量\r\n // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线\r\n ctx.moveTo(x - a, y);\r\n ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);\r\n ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);\r\n ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);\r\n ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nEllipse.prototype.type = 'ellipse';\r\n\r\nexport default Ellipse;","/**\r\n * 直线\r\n * @module zrender/graphic/shape/Line\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport {subPixelOptimizeLine} from '../helper/subPixelOptimize';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\n// Avoid create repeatly.\r\nconst subPixelOptimizeOutputShape = {};\r\n\r\nexport class LineShape {\r\n // Start point\r\n x1 = 0\r\n y1 = 0\r\n // End point\r\n x2 = 0\r\n y2 = 0\r\n\r\n percent = 1\r\n}\r\n\r\nexport interface LineProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Line extends Path {\r\n\r\n shape: LineShape\r\n\r\n constructor(opts?: LineProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new LineShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: LineShape) {\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n if (this.subPixelOptimize) {\r\n const optimizedShape = subPixelOptimizeLine(\r\n subPixelOptimizeOutputShape, shape, this.style\r\n );\r\n x1 = optimizedShape.x1;\r\n y1 = optimizedShape.y1;\r\n x2 = optimizedShape.x2;\r\n y2 = optimizedShape.y2;\r\n }\r\n else {\r\n x1 = shape.x1;\r\n y1 = shape.y1;\r\n x2 = shape.x2;\r\n y2 = shape.y2;\r\n }\r\n\r\n const percent = shape.percent;\r\n\r\n if (percent === 0) {\r\n return;\r\n }\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n if (percent < 1) {\r\n x2 = x1 * (1 - percent) + x2 * percent;\r\n y2 = y1 * (1 - percent) + y2 * percent;\r\n }\r\n ctx.lineTo(x2, y2);\r\n }\r\n\r\n /**\r\n * Get point at percent\r\n */\r\n pointAt(p: number): VectorArray {\r\n const shape = this.shape;\r\n return [\r\n shape.x1 * (1 - p) + shape.x2 * p,\r\n shape.y1 * (1 - p) + shape.y2 * p\r\n ];\r\n }\r\n}\r\n\r\nLine.prototype.type = 'line';\r\nexport default Line;","/**\r\n * 贝塞尔平滑曲线\r\n */\r\n\r\nimport {\r\n min as v2Min,\r\n max as v2Max,\r\n scale as v2Scale,\r\n distance as v2Distance,\r\n add as v2Add,\r\n clone as v2Clone,\r\n sub as v2Sub,\r\n VectorArray\r\n} from '../../core/vector';\r\n\r\n/**\r\n * 贝塞尔平滑曲线\r\n * @param points 线段顶点数组\r\n * @param smooth 平滑等级, 0-1\r\n * @param isLoop\r\n * @param constraint 将计算出来的控制点约束在一个包围盒内\r\n * 比如 [[0, 0], [100, 100]], 这个包围盒会与\r\n * 整个折线的包围盒做一个并集用来约束控制点。\r\n * @param 计算出来的控制点数组\r\n */\r\nexport default function smoothBezier(\r\n points: VectorArray[],\r\n smooth?: number,\r\n isLoop?: boolean,\r\n constraint?: VectorArray[]\r\n) {\r\n const cps = [];\r\n\r\n const v: VectorArray = [];\r\n const v1: VectorArray = [];\r\n const v2: VectorArray = [];\r\n let prevPoint;\r\n let nextPoint;\r\n\r\n let min;\r\n let max;\r\n if (constraint) {\r\n min = [Infinity, Infinity];\r\n max = [-Infinity, -Infinity];\r\n for (let i = 0, len = points.length; i < len; i++) {\r\n v2Min(min, min, points[i]);\r\n v2Max(max, max, points[i]);\r\n }\r\n // 与指定的包围盒做并集\r\n v2Min(min, min, constraint[0]);\r\n v2Max(max, max, constraint[1]);\r\n }\r\n\r\n for (let i = 0, len = points.length; i < len; i++) {\r\n const point = points[i];\r\n\r\n if (isLoop) {\r\n prevPoint = points[i ? i - 1 : len - 1];\r\n nextPoint = points[(i + 1) % len];\r\n }\r\n else {\r\n if (i === 0 || i === len - 1) {\r\n cps.push(v2Clone(points[i]));\r\n continue;\r\n }\r\n else {\r\n prevPoint = points[i - 1];\r\n nextPoint = points[i + 1];\r\n }\r\n }\r\n\r\n v2Sub(v, nextPoint, prevPoint);\r\n\r\n // use degree to scale the handle length\r\n v2Scale(v, v, smooth);\r\n\r\n let d0 = v2Distance(point, prevPoint);\r\n let d1 = v2Distance(point, nextPoint);\r\n const sum = d0 + d1;\r\n if (sum !== 0) {\r\n d0 /= sum;\r\n d1 /= sum;\r\n }\r\n\r\n v2Scale(v1, v, -d0);\r\n v2Scale(v2, v, d1);\r\n const cp0 = v2Add([], point, v1);\r\n const cp1 = v2Add([], point, v2);\r\n if (constraint) {\r\n v2Max(cp0, cp0, min);\r\n v2Min(cp0, cp0, max);\r\n v2Max(cp1, cp1, min);\r\n v2Min(cp1, cp1, max);\r\n }\r\n cps.push(cp0);\r\n cps.push(cp1);\r\n }\r\n\r\n if (isLoop) {\r\n cps.push(cps.shift());\r\n }\r\n\r\n return cps;\r\n}","\r\nimport smoothBezier from './smoothBezier';\r\nimport { VectorArray } from '../../core/vector';\r\nimport PathProxy from '../../core/PathProxy';\r\n\r\nexport function buildPath(\r\n ctx: CanvasRenderingContext2D | PathProxy,\r\n shape: {\r\n points: VectorArray[],\r\n smooth?: number\r\n smoothConstraint?: VectorArray[]\r\n },\r\n closePath: boolean\r\n) {\r\n const smooth = shape.smooth;\r\n let points = shape.points;\r\n if (points && points.length >= 2) {\r\n if (smooth) {\r\n const controlPoints = smoothBezier(\r\n points, smooth, closePath, shape.smoothConstraint\r\n );\r\n\r\n ctx.moveTo(points[0][0], points[0][1]);\r\n const len = points.length;\r\n for (let i = 0; i < (closePath ? len : len - 1); i++) {\r\n const cp1 = controlPoints[i * 2];\r\n const cp2 = controlPoints[i * 2 + 1];\r\n const p = points[(i + 1) % len];\r\n ctx.bezierCurveTo(\r\n cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]\r\n );\r\n }\r\n }\r\n else {\r\n ctx.moveTo(points[0][0], points[0][1]);\r\n for (let i = 1, l = points.length; i < l; i++) {\r\n ctx.lineTo(points[i][0], points[i][1]);\r\n }\r\n }\r\n\r\n closePath && ctx.closePath();\r\n }\r\n}\r\n","/**\r\n * 多边形\r\n * @module zrender/shape/Polygon\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as polyHelper from '../helper/poly';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\nexport class PolygonShape {\r\n points: VectorArray[] = null\r\n smooth?: number = 0\r\n smoothConstraint?: VectorArray[] = null\r\n}\r\n\r\nexport interface PolygonProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Polygon extends Path {\r\n\r\n shape: PolygonShape\r\n\r\n constructor(opts?: PolygonProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new PolygonShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: PolygonShape) {\r\n polyHelper.buildPath(ctx, shape, true);\r\n }\r\n};\r\n\r\nPolygon.prototype.type = 'polygon';\r\n\r\nexport default Polygon;","/**\r\n * @module zrender/graphic/shape/Polyline\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as polyHelper from '../helper/poly';\r\nimport { VectorArray } from '../../core/vector';\r\n\r\nexport class PolylineShape {\r\n points: VectorArray[] = null\r\n // Percent of displayed polyline. For animating purpose\r\n percent?: number = 1\r\n smooth?: number = 0\r\n smoothConstraint?: VectorArray[] = null\r\n}\r\n\r\nexport interface PolylineProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Polyline extends Path {\r\n\r\n shape: PolylineShape\r\n\r\n constructor(opts?: PolylineProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new PolylineShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: PolylineShape) {\r\n polyHelper.buildPath(ctx, shape, false);\r\n }\r\n}\r\n\r\nPolyline.prototype.type = 'polyline';\r\nexport default Polyline;","// TODO Should GradientObject been LinearGradientObject | RadialGradientObject\r\nexport interface GradientObject {\r\n\r\n id?: number\r\n\r\n type: string\r\n\r\n colorStops: GradientColorStop[]\r\n\r\n global?: boolean\r\n}\r\n\r\nexport interface InnerGradientObject extends GradientObject {\r\n __canvasGradient: CanvasGradient\r\n __width: number\r\n __height: number\r\n}\r\n\r\nexport interface GradientColorStop {\r\n offset: number\r\n color: string\r\n}\r\n\r\nexport default class Gradient {\r\n\r\n id?: number\r\n\r\n type: string\r\n\r\n colorStops: GradientColorStop[]\r\n\r\n global: boolean\r\n\r\n constructor(colorStops: GradientColorStop[]) {\r\n this.colorStops = colorStops || [];\r\n }\r\n\r\n addColorStop(offset: number, color: string) {\r\n this.colorStops.push({\r\n offset,\r\n color\r\n });\r\n }\r\n}","import Gradient, {GradientObject, GradientColorStop} from './Gradient';\r\n\r\nexport interface LinearGradientObject extends GradientObject {\r\n type: 'linear'\r\n\r\n x: number\r\n y: number\r\n x2: number\r\n y2: number\r\n}\r\n/**\r\n * x, y, x2, y2 are all percent from 0 to 1 when globalCoord is false\r\n */\r\n\r\nexport default class LinearGradient extends Gradient {\r\n\r\n type: 'linear'\r\n\r\n x: number\r\n y: number\r\n x2: number\r\n y2: number\r\n\r\n constructor(\r\n x: number, y: number, x2: number, y2: number,\r\n colorStops?: GradientColorStop[], globalCoord?: boolean\r\n ) {\r\n\r\n super(colorStops);\r\n\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {type: 'linear', colorStops: ...}`, where\r\n // this constructor will not be called.\r\n\r\n this.x = x == null ? 0 : x;\r\n\r\n this.y = y == null ? 0 : y;\r\n\r\n this.x2 = x2 == null ? 1 : x2;\r\n\r\n this.y2 = y2 == null ? 0 : y2;\r\n\r\n // Can be cloned\r\n this.type = 'linear';\r\n\r\n // If use global coord\r\n this.global = globalCoord || false;\r\n }\r\n};\r\n","import Gradient, {GradientColorStop, GradientObject} from './Gradient';\r\n\r\nexport interface RadialGradientObject extends GradientObject {\r\n type: 'radial'\r\n\r\n x: number\r\n y: number\r\n r: number\r\n}\r\n/**\r\n * x, y, r are all percent from 0 to 1 when globalCoord is false\r\n */\r\nclass RadialGradient extends Gradient {\r\n\r\n type: 'radial'\r\n\r\n x: number\r\n y: number\r\n r: number\r\n\r\n constructor(\r\n x: number, y: number, r: number,\r\n colorStops?: GradientColorStop[], globalCoord?: boolean\r\n ) {\r\n super(colorStops);\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {type: 'radial', colorStops: ...}`, where\r\n // this constructor will not be called.\r\n this.x = x == null ? 0.5 : x;\r\n\r\n this.y = y == null ? 0.5 : y;\r\n\r\n this.r = r == null ? 0.5 : r;\r\n\r\n // Can be cloned\r\n this.type = 'radial';\r\n\r\n // If use global coord\r\n this.global = globalCoord || false;\r\n }\r\n}\r\n\r\nexport default RadialGradient;","import Displayable, { DisplayableProps, DisplayableStatePropNames } from './Displayable';\nimport { getBoundingRect } from '../contain/text';\nimport BoundingRect from '../core/BoundingRect';\nimport { PathStyleProps, DEFAULT_PATH_STYLE } from './Path';\nimport { createObject, defaults } from '../core/util';\nimport { FontStyle, FontWeight, TextAlign, TextVerticalAlign } from '../core/types';\nimport { DEFAULT_FONT } from '../core/platform';\n\nexport interface TSpanStyleProps extends PathStyleProps {\n\n x?: number\n y?: number\n\n // TODO Text is assigned inside zrender\n text?: string\n\n // Final generated font string\n // Used in canvas, and when developers specified it.\n font?: string\n\n // Value for each part of font\n // Used in svg.\n // NOTE: font should always been sync with these 4 properties.\n fontSize?: number\n fontWeight?: FontWeight\n fontStyle?: FontStyle\n fontFamily?: string\n\n textAlign?: CanvasTextAlign\n\n textBaseline?: CanvasTextBaseline\n}\n\nexport const DEFAULT_TSPAN_STYLE: TSpanStyleProps = defaults({\n strokeFirst: true,\n font: DEFAULT_FONT,\n x: 0,\n y: 0,\n textAlign: 'left',\n textBaseline: 'top',\n miterLimit: 2\n} as TSpanStyleProps, DEFAULT_PATH_STYLE);\n\n\nexport interface TSpanProps extends DisplayableProps {\n style?: TSpanStyleProps\n}\n\nexport type TSpanState = Pick\n\nclass TSpan extends Displayable {\n\n style: TSpanStyleProps\n\n hasStroke() {\n const style = this.style;\n const stroke = style.stroke;\n return stroke != null && stroke !== 'none' && style.lineWidth > 0;\n }\n\n hasFill() {\n const style = this.style;\n const fill = style.fill;\n return fill != null && fill !== 'none';\n }\n\n /**\n * Create an image style object with default values in it's prototype.\n * @override\n */\n createStyle(obj?: TSpanStyleProps) {\n return createObject(DEFAULT_TSPAN_STYLE, obj);\n }\n\n /**\n * Set bounding rect calculated from Text\n * For reducing time of calculating bounding rect.\n */\n setBoundingRect(rect: BoundingRect) {\n this._rect = rect;\n }\n\n getBoundingRect(): BoundingRect {\n const style = this.style;\n\n if (!this._rect) {\n let text = style.text;\n text != null ? (text += '') : (text = '');\n\n const rect = getBoundingRect(\n text,\n style.font,\n style.textAlign as TextAlign,\n style.textBaseline as TextVerticalAlign\n );\n\n rect.x += style.x || 0;\n rect.y += style.y || 0;\n\n if (this.hasStroke()) {\n const w = style.lineWidth;\n rect.x -= w / 2;\n rect.y -= w / 2;\n rect.width += w;\n rect.height += w;\n }\n\n this._rect = rect;\n }\n\n return this._rect;\n }\n\n protected static initDefaultProps = (function () {\n const tspanProto = TSpan.prototype;\n // TODO Calculate tolerance smarter\n tspanProto.dirtyRectTolerance = 10;\n })()\n}\n\nTSpan.prototype.type = 'tspan';\n\nexport default TSpan;","import { isString } from '../core/util';\r\n\r\n/**\r\n * For big svg string, this method might be time consuming.\r\n */\r\nexport function parseXML(svg: Document | string | SVGElement): SVGElement {\r\n if (isString(svg)) {\r\n const parser = new DOMParser();\r\n svg = parser.parseFromString(svg, 'text/xml');\r\n }\r\n let svgNode: Node = svg;\r\n // Document node. If using $.get, doc node may be input.\r\n if (svgNode.nodeType === 9) {\r\n svgNode = svgNode.firstChild;\r\n }\r\n // nodeName of is also 'svg'.\r\n while (svgNode.nodeName.toLowerCase() !== 'svg' || svgNode.nodeType !== 1) {\r\n svgNode = svgNode.nextSibling;\r\n }\r\n\r\n return svgNode as SVGElement;\r\n}\r\n","import Group from '../graphic/Group';\nimport ZRImage from '../graphic/Image';\nimport Circle from '../graphic/shape/Circle';\nimport Rect from '../graphic/shape/Rect';\nimport Ellipse from '../graphic/shape/Ellipse';\nimport Line from '../graphic/shape/Line';\nimport Polygon from '../graphic/shape/Polygon';\nimport Polyline from '../graphic/shape/Polyline';\nimport * as matrix from '../core/matrix';\nimport { createFromString } from './path';\nimport { defaults, trim, each, map, keys, hasOwn } from '../core/util';\nimport Displayable from '../graphic/Displayable';\nimport Element from '../Element';\nimport { RectLike } from '../core/BoundingRect';\nimport { Dictionary } from '../core/types';\nimport { PatternObject } from '../graphic/Pattern';\nimport LinearGradient, { LinearGradientObject } from '../graphic/LinearGradient';\nimport RadialGradient, { RadialGradientObject } from '../graphic/RadialGradient';\nimport Gradient, { GradientObject } from '../graphic/Gradient';\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\nimport { parseXML } from './parseXML';\n\n\ninterface SVGParserOption {\n // Default width if svg width not specified or is a percent value.\n width?: number;\n // Default height if svg height not specified or is a percent value.\n height?: number;\n ignoreViewBox?: boolean;\n ignoreRootClip?: boolean;\n}\n\nexport interface SVGParserResult {\n // Group, The root of the the result tree of zrender shapes\n root: Group;\n // number, the viewport width of the SVG\n width: number;\n // number, the viewport height of the SVG\n height: number;\n // {x, y, width, height}, the declared viewBox rect of the SVG, if exists\n viewBoxRect: RectLike;\n // the {scale, position} calculated by viewBox and viewport, is exists\n viewBoxTransform: {\n x: number;\n y: number;\n scale: number;\n };\n named: SVGParserResultNamedItem[];\n}\nexport interface SVGParserResultNamedItem {\n name: string;\n // If a tag has no name attribute but its ancester is named,\n // `namedFrom` is set to the named item of the ancester .\n // Otherwise null/undefined\n namedFrom: SVGParserResultNamedItem;\n svgNodeTagLower: SVGNodeTagLower;\n el: Element;\n};\n\nexport type SVGNodeTagLower =\n 'g' | 'rect' | 'circle' | 'line' | 'ellipse' | 'polygon'\n | 'polyline' | 'image' | 'text' | 'tspan' | 'path' | 'defs' | 'switch';\n\n\ntype DefsId = string;\ntype DefsMap = { [id in DefsId]: LinearGradientObject | RadialGradientObject | PatternObject };\ntype DefsUsePending = [Displayable, 'fill' | 'stroke', DefsId][];\n\ntype ElementExtended = Element & {\n __inheritedStyle?: InheritedStyleByZRKey;\n __selfStyle?: SelfStyleByZRKey;\n}\ntype DisplayableExtended = Displayable & {\n __inheritedStyle?: InheritedStyleByZRKey;\n __selfStyle?: SelfStyleByZRKey;\n}\n\ntype TextStyleOptionExtended = TSpanStyleProps & {\n fontSize: number;\n fontFamily: string;\n fontWeight: string;\n fontStyle: string;\n}\nlet nodeParsers: {[name in SVGNodeTagLower]?: (\n this: SVGParser, xmlNode: SVGElement, parentGroup: Group\n) => Element};\n\ntype InheritedStyleByZRKey = {[name in InheritableStyleZRKey]?: string};\ntype InheritableStyleZRKey =\n typeof INHERITABLE_STYLE_ATTRIBUTES_MAP[keyof typeof INHERITABLE_STYLE_ATTRIBUTES_MAP];\nconst INHERITABLE_STYLE_ATTRIBUTES_MAP = {\n 'fill': 'fill',\n 'stroke': 'stroke',\n 'stroke-width': 'lineWidth',\n 'opacity': 'opacity',\n 'fill-opacity': 'fillOpacity',\n 'stroke-opacity': 'strokeOpacity',\n 'stroke-dasharray': 'lineDash',\n 'stroke-dashoffset': 'lineDashOffset',\n 'stroke-linecap': 'lineCap',\n 'stroke-linejoin': 'lineJoin',\n 'stroke-miterlimit': 'miterLimit',\n 'font-family': 'fontFamily',\n 'font-size': 'fontSize',\n 'font-style': 'fontStyle',\n 'font-weight': 'fontWeight',\n 'text-anchor': 'textAlign',\n 'visibility': 'visibility',\n 'display': 'display'\n} as const;\nconst INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS = keys(INHERITABLE_STYLE_ATTRIBUTES_MAP);\n\ntype SelfStyleByZRKey = {[name in SelfStyleZRKey]?: string};\ntype SelfStyleZRKey =\n typeof SELF_STYLE_ATTRIBUTES_MAP[keyof typeof SELF_STYLE_ATTRIBUTES_MAP];\nconst SELF_STYLE_ATTRIBUTES_MAP = {\n 'alignment-baseline': 'textBaseline',\n 'stop-color': 'stopColor'\n};\nconst SELF_STYLE_ATTRIBUTES_MAP_KEYS = keys(SELF_STYLE_ATTRIBUTES_MAP);\n\n\nclass SVGParser {\n\n private _defs: DefsMap = {};\n // The use of can be in front of declared.\n // So save them temporarily in `_defsUsePending`.\n private _defsUsePending: DefsUsePending;\n private _root: Group = null;\n\n private _textX: number;\n private _textY: number;\n\n parse(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult {\n opt = opt || {};\n\n const svg = parseXML(xml);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!svg) {\n throw new Error('Illegal svg');\n }\n }\n\n this._defsUsePending = [];\n let root = new Group();\n this._root = root;\n const named: SVGParserResult['named'] = [];\n // parse view port\n const viewBox = svg.getAttribute('viewBox') || '';\n\n // If width/height not specified, means \"100%\" of `opt.width/height`.\n // TODO: Other percent value not supported yet.\n let width = parseFloat((svg.getAttribute('width') || opt.width) as string);\n let height = parseFloat((svg.getAttribute('height') || opt.height) as string);\n // If width/height not specified, set as null for output.\n isNaN(width) && (width = null);\n isNaN(height) && (height = null);\n\n // Apply inline style on svg element.\n parseAttributes(svg, root, null, true, false);\n\n let child = svg.firstChild as SVGElement;\n while (child) {\n this._parseNode(child, root, named, null, false, false);\n child = child.nextSibling as SVGElement;\n }\n\n applyDefs(this._defs, this._defsUsePending);\n this._defsUsePending = [];\n\n let viewBoxRect;\n let viewBoxTransform;\n\n if (viewBox) {\n const viewBoxArr = splitNumberSequence(viewBox);\n // Some invalid case like viewBox: 'none'.\n if (viewBoxArr.length >= 4) {\n viewBoxRect = {\n x: parseFloat((viewBoxArr[0] || 0) as string),\n y: parseFloat((viewBoxArr[1] || 0) as string),\n width: parseFloat(viewBoxArr[2]),\n height: parseFloat(viewBoxArr[3])\n };\n }\n }\n\n if (viewBoxRect && width != null && height != null) {\n viewBoxTransform = makeViewBoxTransform(viewBoxRect, { x: 0, y: 0, width: width, height: height });\n\n if (!opt.ignoreViewBox) {\n // If set transform on the output group, it probably bring trouble when\n // some users only intend to show the clipped content inside the viewBox,\n // but not intend to transform the output group. So we keep the output\n // group no transform. If the user intend to use the viewBox as a\n // camera, just set `opt.ignoreViewBox` as `true` and set transfrom\n // manually according to the viewBox info in the output of this method.\n const elRoot = root;\n root = new Group();\n root.add(elRoot);\n elRoot.scaleX = elRoot.scaleY = viewBoxTransform.scale;\n elRoot.x = viewBoxTransform.x;\n elRoot.y = viewBoxTransform.y;\n }\n }\n\n // Some shapes might be overflow the viewport, which should be\n // clipped despite whether the viewBox is used, as the SVG does.\n if (!opt.ignoreRootClip && width != null && height != null) {\n root.setClipPath(new Rect({\n shape: {x: 0, y: 0, width: width, height: height}\n }));\n }\n\n // Set width/height on group just for output the viewport size.\n return {\n root: root,\n width: width,\n height: height,\n viewBoxRect: viewBoxRect,\n viewBoxTransform: viewBoxTransform,\n named: named\n };\n }\n\n private _parseNode(\n xmlNode: SVGElement,\n parentGroup: Group,\n named: SVGParserResultNamedItem[],\n namedFrom: SVGParserResultNamedItem['namedFrom'],\n isInDefs: boolean,\n isInText: boolean\n ): void {\n\n const nodeName = xmlNode.nodeName.toLowerCase() as SVGNodeTagLower;\n\n // TODO:\n // support in svg, where nodeName is 'style',\n // CSS classes is defined globally wherever the style tags are declared.\n\n let el;\n let namedFromForSub = namedFrom;\n\n if (nodeName === 'defs') {\n isInDefs = true;\n }\n if (nodeName === 'text') {\n isInText = true;\n }\n\n if (nodeName === 'defs' || nodeName === 'switch') {\n // Just make displayable. Do not support\n // the full feature of it.\n el = parentGroup;\n }\n else {\n // In , elments will not be rendered.\n // TODO:\n // do not support elements in yet, until requirement come.\n // other graphic elements can also be in and referenced by\n // \n // multiple times\n if (!isInDefs) {\n const parser = nodeParsers[nodeName];\n if (parser && hasOwn(nodeParsers, nodeName)) {\n\n el = parser.call(this, xmlNode, parentGroup);\n\n // Do not support empty string;\n const nameAttr = xmlNode.getAttribute('name');\n if (nameAttr) {\n const newNamed: SVGParserResultNamedItem = {\n name: nameAttr,\n namedFrom: null,\n svgNodeTagLower: nodeName,\n el: el\n };\n named.push(newNamed);\n if (nodeName === 'g') {\n namedFromForSub = newNamed;\n }\n }\n else if (namedFrom) {\n named.push({\n name: namedFrom.name,\n namedFrom: namedFrom,\n svgNodeTagLower: nodeName,\n el: el\n });\n }\n\n parentGroup.add(el);\n }\n }\n\n // Whether gradients/patterns are declared in or not,\n // they all work.\n const parser = paintServerParsers[nodeName];\n if (parser && hasOwn(paintServerParsers, nodeName)) {\n const def = parser.call(this, xmlNode);\n const id = xmlNode.getAttribute('id');\n if (id) {\n this._defs[id] = def;\n }\n }\n }\n\n // If xmlNode is , , , , ,\n // el will be a group, and traverse the children.\n if (el && el.isGroup) {\n let child = xmlNode.firstChild as SVGElement;\n while (child) {\n if (child.nodeType === 1) {\n this._parseNode(child, el as Group, named, namedFromForSub, isInDefs, isInText);\n }\n // Is plain text rather than a tagged node.\n else if (child.nodeType === 3 && isInText) {\n this._parseText(child, el as Group);\n }\n child = child.nextSibling as SVGElement;\n }\n }\n\n }\n\n private _parseText(xmlNode: SVGElement, parentGroup: Group): TSpan {\n const text = new TSpan({\n style: {\n text: xmlNode.textContent\n },\n silent: true,\n x: this._textX || 0,\n y: this._textY || 0\n });\n\n inheritStyle(parentGroup, text);\n\n parseAttributes(xmlNode, text, this._defsUsePending, false, false);\n\n applyTextAlignment(text, parentGroup);\n\n const textStyle = text.style as TextStyleOptionExtended;\n const fontSize = textStyle.fontSize;\n if (fontSize && fontSize < 9) {\n // PENDING\n textStyle.fontSize = 9;\n text.scaleX *= fontSize / 9;\n text.scaleY *= fontSize / 9;\n }\n\n const font = (textStyle.fontSize || textStyle.fontFamily) && [\n textStyle.fontStyle,\n textStyle.fontWeight,\n (textStyle.fontSize || 12) + 'px',\n // If font properties are defined, `fontFamily` should not be ignored.\n textStyle.fontFamily || 'sans-serif'\n ].join(' ');\n // Make font\n textStyle.font = font;\n\n const rect = text.getBoundingRect();\n this._textX += rect.width;\n\n parentGroup.add(text);\n\n return text;\n }\n\n static internalField = (function () {\n\n nodeParsers = {\n 'g': function (xmlNode, parentGroup) {\n const g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, false);\n\n return g;\n },\n 'rect': function (xmlNode, parentGroup) {\n const rect = new Rect();\n inheritStyle(parentGroup, rect);\n parseAttributes(xmlNode, rect, this._defsUsePending, false, false);\n\n rect.setShape({\n x: parseFloat(xmlNode.getAttribute('x') || '0'),\n y: parseFloat(xmlNode.getAttribute('y') || '0'),\n width: parseFloat(xmlNode.getAttribute('width') || '0'),\n height: parseFloat(xmlNode.getAttribute('height') || '0')\n });\n\n rect.silent = true;\n\n return rect;\n },\n 'circle': function (xmlNode, parentGroup) {\n const circle = new Circle();\n inheritStyle(parentGroup, circle);\n parseAttributes(xmlNode, circle, this._defsUsePending, false, false);\n\n circle.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n r: parseFloat(xmlNode.getAttribute('r') || '0')\n });\n\n circle.silent = true;\n\n return circle;\n },\n 'line': function (xmlNode, parentGroup) {\n const line = new Line();\n inheritStyle(parentGroup, line);\n parseAttributes(xmlNode, line, this._defsUsePending, false, false);\n\n line.setShape({\n x1: parseFloat(xmlNode.getAttribute('x1') || '0'),\n y1: parseFloat(xmlNode.getAttribute('y1') || '0'),\n x2: parseFloat(xmlNode.getAttribute('x2') || '0'),\n y2: parseFloat(xmlNode.getAttribute('y2') || '0')\n });\n\n line.silent = true;\n\n return line;\n },\n 'ellipse': function (xmlNode, parentGroup) {\n const ellipse = new Ellipse();\n inheritStyle(parentGroup, ellipse);\n parseAttributes(xmlNode, ellipse, this._defsUsePending, false, false);\n\n ellipse.setShape({\n cx: parseFloat(xmlNode.getAttribute('cx') || '0'),\n cy: parseFloat(xmlNode.getAttribute('cy') || '0'),\n rx: parseFloat(xmlNode.getAttribute('rx') || '0'),\n ry: parseFloat(xmlNode.getAttribute('ry') || '0')\n });\n\n ellipse.silent = true;\n\n return ellipse;\n },\n 'polygon': function (xmlNode, parentGroup) {\n const pointsStr = xmlNode.getAttribute('points');\n let pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n const polygon = new Polygon({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n\n inheritStyle(parentGroup, polygon);\n parseAttributes(xmlNode, polygon, this._defsUsePending, false, false);\n\n return polygon;\n },\n 'polyline': function (xmlNode, parentGroup) {\n const pointsStr = xmlNode.getAttribute('points');\n let pointsArr;\n if (pointsStr) {\n pointsArr = parsePoints(pointsStr);\n }\n const polyline = new Polyline({\n shape: {\n points: pointsArr || []\n },\n silent: true\n });\n\n inheritStyle(parentGroup, polyline);\n parseAttributes(xmlNode, polyline, this._defsUsePending, false, false);\n\n return polyline;\n },\n 'image': function (xmlNode, parentGroup) {\n const img = new ZRImage();\n inheritStyle(parentGroup, img);\n parseAttributes(xmlNode, img, this._defsUsePending, false, false);\n\n img.setStyle({\n image: xmlNode.getAttribute('xlink:href') || xmlNode.getAttribute('href'),\n x: +xmlNode.getAttribute('x'),\n y: +xmlNode.getAttribute('y'),\n width: +xmlNode.getAttribute('width'),\n height: +xmlNode.getAttribute('height')\n });\n img.silent = true;\n\n return img;\n },\n 'text': function (xmlNode, parentGroup) {\n const x = xmlNode.getAttribute('x') || '0';\n const y = xmlNode.getAttribute('y') || '0';\n const dx = xmlNode.getAttribute('dx') || '0';\n const dy = xmlNode.getAttribute('dy') || '0';\n\n this._textX = parseFloat(x) + parseFloat(dx);\n this._textY = parseFloat(y) + parseFloat(dy);\n\n const g = new Group();\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n\n return g;\n },\n 'tspan': function (xmlNode, parentGroup) {\n const x = xmlNode.getAttribute('x');\n const y = xmlNode.getAttribute('y');\n if (x != null) {\n // new offset x\n this._textX = parseFloat(x);\n }\n if (y != null) {\n // new offset y\n this._textY = parseFloat(y);\n }\n const dx = xmlNode.getAttribute('dx') || '0';\n const dy = xmlNode.getAttribute('dy') || '0';\n\n const g = new Group();\n\n inheritStyle(parentGroup, g);\n parseAttributes(xmlNode, g, this._defsUsePending, false, true);\n\n this._textX += parseFloat(dx);\n this._textY += parseFloat(dy);\n\n return g;\n },\n 'path': function (xmlNode, parentGroup) {\n // TODO svg fill rule\n // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill-rule\n // path.style.globalCompositeOperation = 'xor';\n const d = xmlNode.getAttribute('d') || '';\n\n // Performance sensitive.\n\n const path = createFromString(d);\n\n inheritStyle(parentGroup, path);\n parseAttributes(xmlNode, path, this._defsUsePending, false, false);\n\n path.silent = true;\n\n return path;\n }\n };\n\n\n })();\n}\n\nconst paintServerParsers: Dictionary<(xmlNode: SVGElement) => any> = {\n\n 'lineargradient': function (xmlNode: SVGElement) {\n // TODO:\n // Support that x1,y1,x2,y2 are not declared lineargradient but in node.\n const x1 = parseInt(xmlNode.getAttribute('x1') || '0', 10);\n const y1 = parseInt(xmlNode.getAttribute('y1') || '0', 10);\n const x2 = parseInt(xmlNode.getAttribute('x2') || '10', 10);\n const y2 = parseInt(xmlNode.getAttribute('y2') || '0', 10);\n\n const gradient = new LinearGradient(x1, y1, x2, y2);\n\n parsePaintServerUnit(xmlNode, gradient);\n\n parseGradientColorStops(xmlNode, gradient);\n\n return gradient;\n },\n\n 'radialgradient': function (xmlNode) {\n // TODO:\n // Support that x1,y1,x2,y2 are not declared radialgradient but in node.\n // TODO:\n // Support fx, fy, fr.\n const cx = parseInt(xmlNode.getAttribute('cx') || '0', 10);\n const cy = parseInt(xmlNode.getAttribute('cy') || '0', 10);\n const r = parseInt(xmlNode.getAttribute('r') || '0', 10);\n\n const gradient = new RadialGradient(cx, cy, r);\n\n parsePaintServerUnit(xmlNode, gradient);\n\n parseGradientColorStops(xmlNode, gradient);\n\n return gradient;\n }\n\n // TODO\n // 'pattern': function (xmlNode: SVGElement) {\n // }\n};\n\nfunction parsePaintServerUnit(xmlNode: SVGElement, gradient: Gradient) {\n const gradientUnits = xmlNode.getAttribute('gradientUnits');\n if (gradientUnits === 'userSpaceOnUse') {\n gradient.global = true;\n }\n}\n\nfunction parseGradientColorStops(xmlNode: SVGElement, gradient: GradientObject): void {\n\n let stop = xmlNode.firstChild as SVGStopElement;\n\n while (stop) {\n if (stop.nodeType === 1\n // there might be some other irrelevant tags used by editor.\n && stop.nodeName.toLocaleLowerCase() === 'stop'\n ) {\n const offsetStr = stop.getAttribute('offset');\n let offset: number;\n if (offsetStr && offsetStr.indexOf('%') > 0) { // percentage\n offset = parseInt(offsetStr, 10) / 100;\n }\n else if (offsetStr) { // number from 0 to 1\n offset = parseFloat(offsetStr);\n }\n else {\n offset = 0;\n }\n\n // has higher priority than\n // \n const styleVals = {} as Dictionary;\n parseInlineStyle(stop, styleVals, styleVals);\n const stopColor = styleVals.stopColor\n || stop.getAttribute('stop-color')\n || '#000000';\n\n gradient.colorStops.push({\n offset: offset,\n color: stopColor\n });\n }\n stop = stop.nextSibling as SVGStopElement;\n }\n}\n\nfunction inheritStyle(parent: Element, child: Element): void {\n if (parent && (parent as ElementExtended).__inheritedStyle) {\n if (!(child as ElementExtended).__inheritedStyle) {\n (child as ElementExtended).__inheritedStyle = {};\n }\n defaults((child as ElementExtended).__inheritedStyle, (parent as ElementExtended).__inheritedStyle);\n }\n}\n\nfunction parsePoints(pointsString: string): number[][] {\n const list = splitNumberSequence(pointsString);\n const points = [];\n\n for (let i = 0; i < list.length; i += 2) {\n const x = parseFloat(list[i]);\n const y = parseFloat(list[i + 1]);\n points.push([x, y]);\n }\n return points;\n}\n\nfunction parseAttributes(\n xmlNode: SVGElement,\n el: Element,\n defsUsePending: DefsUsePending,\n onlyInlineStyle: boolean,\n isTextGroup: boolean\n): void {\n const disp = el as DisplayableExtended;\n const inheritedStyle = disp.__inheritedStyle = disp.__inheritedStyle || {};\n const selfStyle: SelfStyleByZRKey = {};\n\n // TODO Shadow\n if (xmlNode.nodeType === 1) {\n parseTransformAttribute(xmlNode, el);\n\n parseInlineStyle(xmlNode, inheritedStyle, selfStyle);\n\n if (!onlyInlineStyle) {\n parseAttributeStyle(xmlNode, inheritedStyle, selfStyle);\n }\n }\n\n disp.style = disp.style || {};\n\n if (inheritedStyle.fill != null) {\n disp.style.fill = getFillStrokeStyle(disp, 'fill', inheritedStyle.fill, defsUsePending);\n }\n if (inheritedStyle.stroke != null) {\n disp.style.stroke = getFillStrokeStyle(disp, 'stroke', inheritedStyle.stroke, defsUsePending);\n }\n\n each([\n 'lineWidth', 'opacity', 'fillOpacity', 'strokeOpacity', 'miterLimit', 'fontSize'\n ] as const, function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = parseFloat(inheritedStyle[propName]);\n }\n });\n\n each([\n 'lineDashOffset', 'lineCap', 'lineJoin', 'fontWeight', 'fontFamily', 'fontStyle', 'textAlign'\n ] as const, function (propName) {\n if (inheritedStyle[propName] != null) {\n disp.style[propName] = inheritedStyle[propName];\n }\n });\n\n // Because selfStyle only support textBaseline, so only text group need it.\n // in other cases selfStyle can be released.\n if (isTextGroup) {\n disp.__selfStyle = selfStyle;\n }\n\n if (inheritedStyle.lineDash) {\n disp.style.lineDash = map(splitNumberSequence(inheritedStyle.lineDash), function (str) {\n return parseFloat(str);\n });\n }\n\n if (inheritedStyle.visibility === 'hidden' || inheritedStyle.visibility === 'collapse') {\n disp.invisible = true;\n }\n\n if (inheritedStyle.display === 'none') {\n disp.ignore = true;\n }\n}\n\nfunction applyTextAlignment(\n text: TSpan,\n parentGroup: Group\n): void {\n const parentSelfStyle = (parentGroup as ElementExtended).__selfStyle;\n if (parentSelfStyle) {\n const textBaseline = parentSelfStyle.textBaseline;\n let zrTextBaseline = textBaseline as CanvasTextBaseline;\n if (!textBaseline || textBaseline === 'auto') {\n // FIXME: 'auto' means the value is the dominant-baseline of the script to\n // which the character belongs - i.e., use the dominant-baseline of the parent.\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'baseline') {\n zrTextBaseline = 'alphabetic';\n }\n else if (textBaseline === 'before-edge' || textBaseline === 'text-before-edge') {\n zrTextBaseline = 'top';\n }\n else if (textBaseline === 'after-edge' || textBaseline === 'text-after-edge') {\n zrTextBaseline = 'bottom';\n }\n else if (textBaseline === 'central' || textBaseline === 'mathematical') {\n zrTextBaseline = 'middle';\n }\n text.style.textBaseline = zrTextBaseline;\n }\n\n const parentInheritedStyle = (parentGroup as ElementExtended).__inheritedStyle;\n if (parentInheritedStyle) {\n // PENDING:\n // canvas `direction` is an experimental attribute.\n // so we do not support SVG direction \"rtl\" for text-anchor yet.\n const textAlign = parentInheritedStyle.textAlign;\n let zrTextAlign = textAlign as CanvasTextAlign;\n if (textAlign) {\n if (textAlign === 'middle') {\n zrTextAlign = 'center';\n }\n text.style.textAlign = zrTextAlign;\n }\n }\n}\n\n// Support `fill:url(#someId)`.\nconst urlRegex = /^url\\(\\s*#(.*?)\\)/;\nfunction getFillStrokeStyle(\n el: Displayable,\n method: 'fill' | 'stroke',\n str: string,\n defsUsePending: DefsUsePending\n): string {\n const urlMatch = str && str.match(urlRegex);\n if (urlMatch) {\n const url = trim(urlMatch[1]);\n defsUsePending.push([el, method, url]);\n return;\n }\n // SVG fill and stroke can be 'none'.\n if (str === 'none') {\n str = null;\n }\n return str;\n}\n\nfunction applyDefs(\n defs: DefsMap,\n defsUsePending: DefsUsePending\n): void {\n for (let i = 0; i < defsUsePending.length; i++) {\n const item = defsUsePending[i];\n item[0].style[item[1]] = defs[item[2]];\n }\n}\n\n// value can be like:\n// '2e-4', 'l.5.9' (ignore 0), 'M-10-10', 'l-2.43e-1,34.9983',\n// 'l-.5E1,54', '121-23-44-11' (no delimiter)\n// PENDING: here continuous commas are treat as one comma, but the\n// browser SVG parser treats this by printing error.\nconst numberReg = /-?([0-9]*\\.)?[0-9]+([eE]-?[0-9]+)?/g;\nfunction splitNumberSequence(rawStr: string): string[] {\n return rawStr.match(numberReg) || [];\n}\n// Most of the values can be separated by comma and/or white space.\n// const DILIMITER_REG = /[\\s,]+/;\n\n\nconst transformRegex = /(translate|scale|rotate|skewX|skewY|matrix)\\(([\\-\\s0-9\\.eE,]*)\\)/g;\nconst DEGREE_TO_ANGLE = Math.PI / 180;\n\nfunction parseTransformAttribute(xmlNode: SVGElement, node: Element): void {\n let transform = xmlNode.getAttribute('transform');\n if (transform) {\n transform = transform.replace(/,/g, ' ');\n const transformOps: string[] = [];\n let mt = null;\n transform.replace(transformRegex, function (str: string, type: string, value: string) {\n transformOps.push(type, value);\n return '';\n });\n\n for (let i = transformOps.length - 1; i > 0; i -= 2) {\n const value = transformOps[i];\n const type = transformOps[i - 1];\n const valueArr: string[] = splitNumberSequence(value);\n mt = mt || matrix.create();\n switch (type) {\n case 'translate':\n matrix.translate(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || '0')]);\n break;\n case 'scale':\n matrix.scale(mt, mt, [parseFloat(valueArr[0]), parseFloat(valueArr[1] || valueArr[0])]);\n break;\n case 'rotate':\n // TODO: zrender use different hand in coordinate system.\n matrix.rotate(mt, mt, -parseFloat(valueArr[0]) * DEGREE_TO_ANGLE, [\n parseFloat(valueArr[1] || '0'),\n parseFloat(valueArr[2] || '0')\n ]);\n break;\n case 'skewX':\n const sx = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, 0, sx, 1, 0, 0], mt);\n break;\n case 'skewY':\n const sy = Math.tan(parseFloat(valueArr[0]) * DEGREE_TO_ANGLE);\n matrix.mul(mt, [1, sy, 0, 1, 0, 0], mt);\n break;\n case 'matrix':\n mt[0] = parseFloat(valueArr[0]);\n mt[1] = parseFloat(valueArr[1]);\n mt[2] = parseFloat(valueArr[2]);\n mt[3] = parseFloat(valueArr[3]);\n mt[4] = parseFloat(valueArr[4]);\n mt[5] = parseFloat(valueArr[5]);\n break;\n }\n }\n node.setLocalTransform(mt);\n }\n}\n\n// Value may contain space.\nconst styleRegex = /([^\\s:;]+)\\s*:\\s*([^:;]+)/g;\nfunction parseInlineStyle(\n xmlNode: SVGElement,\n inheritableStyleResult: Dictionary,\n selfStyleResult: Dictionary\n): void {\n const style = xmlNode.getAttribute('style');\n\n if (!style) {\n return;\n }\n\n styleRegex.lastIndex = 0;\n let styleRegResult;\n while ((styleRegResult = styleRegex.exec(style)) != null) {\n const svgStlAttr = styleRegResult[1];\n\n const zrInheritableStlAttr = hasOwn(INHERITABLE_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? INHERITABLE_STYLE_ATTRIBUTES_MAP[svgStlAttr as keyof typeof INHERITABLE_STYLE_ATTRIBUTES_MAP]\n : null;\n if (zrInheritableStlAttr) {\n inheritableStyleResult[zrInheritableStlAttr] = styleRegResult[2];\n }\n\n const zrSelfStlAttr = hasOwn(SELF_STYLE_ATTRIBUTES_MAP, svgStlAttr)\n ? SELF_STYLE_ATTRIBUTES_MAP[svgStlAttr as keyof typeof SELF_STYLE_ATTRIBUTES_MAP]\n : null;\n if (zrSelfStlAttr) {\n selfStyleResult[zrSelfStlAttr] = styleRegResult[2];\n }\n }\n}\n\nfunction parseAttributeStyle(\n xmlNode: SVGElement,\n inheritableStyleResult: Dictionary,\n selfStyleResult: Dictionary\n): void {\n for (let i = 0; i < INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n const svgAttrName = INHERITABLE_STYLE_ATTRIBUTES_MAP_KEYS[i];\n const attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n inheritableStyleResult[INHERITABLE_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n for (let i = 0; i < SELF_STYLE_ATTRIBUTES_MAP_KEYS.length; i++) {\n const svgAttrName = SELF_STYLE_ATTRIBUTES_MAP_KEYS[i];\n const attrValue = xmlNode.getAttribute(svgAttrName);\n if (attrValue != null) {\n selfStyleResult[SELF_STYLE_ATTRIBUTES_MAP[svgAttrName]] = attrValue;\n }\n }\n}\n\nexport function makeViewBoxTransform(viewBoxRect: RectLike, boundingRect: RectLike): {\n scale: number;\n x: number;\n y: number;\n} {\n const scaleX = boundingRect.width / viewBoxRect.width;\n const scaleY = boundingRect.height / viewBoxRect.height;\n const scale = Math.min(scaleX, scaleY);\n // preserveAspectRatio 'xMidYMid'\n\n return {\n scale,\n x: -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),\n y: -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2)\n };\n}\n\nexport function parseSVG(xml: string | Document | SVGElement, opt: SVGParserOption): SVGParserResult {\n const parser = new SVGParser();\n return parser.parse(xml, opt);\n}\n\n\n// Also export parseXML to avoid breaking change.\nexport {parseXML};\n","import PathProxy from '../../core/PathProxy';\nimport { isArray } from '../../core/util';\n\nconst PI = Math.PI;\nconst PI2 = PI * 2;\nconst mathSin = Math.sin;\nconst mathCos = Math.cos;\nconst mathACos = Math.acos;\nconst mathATan2 = Math.atan2;\nconst mathAbs = Math.abs;\nconst mathSqrt = Math.sqrt;\nconst mathMax = Math.max;\nconst mathMin = Math.min;\nconst e = 1e-4;\n\nfunction intersect(\n x0: number, y0: number,\n x1: number, y1: number,\n x2: number, y2: number,\n x3: number, y3: number\n): [number, number] {\n const dx10 = x1 - x0;\n const dy10 = y1 - y0;\n const dx32 = x3 - x2;\n const dy32 = y3 - y2;\n let t = dy32 * dx10 - dx32 * dy10;\n if (t * t < e) {\n return;\n }\n t = (dx32 * (y0 - y2) - dy32 * (x0 - x2)) / t;\n return [x0 + t * dx10, y0 + t * dy10];\n}\n\n// Compute perpendicular offset line of length rc.\nfunction computeCornerTangents(\n x0: number, y0: number,\n x1: number, y1: number,\n radius: number, cr: number,\n clockwise: boolean\n) {\n const x01 = x0 - x1;\n const y01 = y0 - y1;\n const lo = (clockwise ? cr : -cr) / mathSqrt(x01 * x01 + y01 * y01);\n const ox = lo * y01;\n const oy = -lo * x01;\n const x11 = x0 + ox;\n const y11 = y0 + oy;\n const x10 = x1 + ox;\n const y10 = y1 + oy;\n const x00 = (x11 + x10) / 2;\n const y00 = (y11 + y10) / 2;\n const dx = x10 - x11;\n const dy = y10 - y11;\n const d2 = dx * dx + dy * dy;\n const r = radius - cr;\n const s = x11 * y10 - x10 * y11;\n const d = (dy < 0 ? -1 : 1) * mathSqrt(mathMax(0, r * r * d2 - s * s));\n let cx0 = (s * dy - dx * d) / d2;\n let cy0 = (-s * dx - dy * d) / d2;\n const cx1 = (s * dy + dx * d) / d2;\n const cy1 = (-s * dx + dy * d) / d2;\n const dx0 = cx0 - x00;\n const dy0 = cy0 - y00;\n const dx1 = cx1 - x00;\n const dy1 = cy1 - y00;\n\n // Pick the closer of the two intersection points\n // TODO: Is there a faster way to determine which intersection to use?\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1;\n cy0 = cy1;\n }\n\n return {\n cx: cx0,\n cy: cy0,\n x0: -ox,\n y0: -oy,\n x1: cx0 * (radius / r - 1),\n y1: cy0 * (radius / r - 1)\n };\n}\n\n// For compatibility, don't use normalizeCssArray\n// 5 represents [5, 5, 5, 5]\n// [5] represents [5, 5, 0, 0]\n// [5, 10] represents [5, 5, 10, 10]\n// [5, 10, 15] represents [5, 10, 15, 15]\n// [5, 10, 15, 20] represents [5, 10, 15, 20]\nfunction normalizeCornerRadius(cr: number | number[]): number[] {\n let arr: number[];\n if (isArray(cr)) {\n const len = cr.length;\n if (!len) {\n return cr as number[];\n }\n if (len === 1) {\n arr = [cr[0], cr[0], 0, 0];\n }\n else if (len === 2) {\n arr = [cr[0], cr[0], cr[1], cr[1]];\n }\n else if (len === 3) {\n arr = cr.concat(cr[2]);\n }\n else {\n arr = cr;\n }\n }\n else {\n arr = [cr, cr, cr, cr];\n }\n return arr;\n}\n\nexport function buildPath(ctx: CanvasRenderingContext2D | PathProxy, shape: {\n cx: number\n cy: number\n startAngle: number\n endAngle: number\n clockwise?: boolean,\n r?: number,\n r0?: number,\n cornerRadius?: number | number[]\n}) {\n let radius = mathMax(shape.r, 0);\n let innerRadius = mathMax(shape.r0 || 0, 0);\n const hasRadius = radius > 0;\n const hasInnerRadius = innerRadius > 0;\n\n if (!hasRadius && !hasInnerRadius) {\n return;\n }\n\n if (!hasRadius) {\n // use innerRadius as radius if no radius\n radius = innerRadius;\n innerRadius = 0;\n }\n\n if (innerRadius > radius) {\n // swap, ensure that radius is always larger than innerRadius\n const tmp = radius;\n radius = innerRadius;\n innerRadius = tmp;\n }\n\n const { startAngle, endAngle } = shape;\n if (isNaN(startAngle) || isNaN(endAngle)) {\n return;\n }\n\n const { cx, cy } = shape;\n const clockwise = !!shape.clockwise;\n\n let arc = mathAbs(endAngle - startAngle);\n const mod = arc > PI2 && arc % PI2;\n mod > e && (arc = mod);\n\n // is a point\n if (!(radius > e)) {\n ctx.moveTo(cx, cy);\n }\n // is a circle or annulus\n else if (arc > PI2 - e) {\n ctx.moveTo(\n cx + radius * mathCos(startAngle),\n cy + radius * mathSin(startAngle)\n );\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n\n if (innerRadius > e) {\n ctx.moveTo(\n cx + innerRadius * mathCos(endAngle),\n cy + innerRadius * mathSin(endAngle)\n );\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n // is a circular or annular sector\n else {\n let icrStart;\n let icrEnd;\n let ocrStart;\n let ocrEnd;\n\n let ocrs;\n let ocre;\n let icrs;\n let icre;\n\n let ocrMax;\n let icrMax;\n let limitedOcrMax;\n let limitedIcrMax;\n\n let xre;\n let yre;\n let xirs;\n let yirs;\n\n const xrs = radius * mathCos(startAngle);\n const yrs = radius * mathSin(startAngle);\n const xire = innerRadius * mathCos(endAngle);\n const yire = innerRadius * mathSin(endAngle);\n\n const hasArc = arc > e;\n if (hasArc) {\n const cornerRadius = shape.cornerRadius;\n if (cornerRadius) {\n [icrStart, icrEnd, ocrStart, ocrEnd] = normalizeCornerRadius(cornerRadius);\n }\n\n const halfRd = mathAbs(radius - innerRadius) / 2;\n ocrs = mathMin(halfRd, ocrStart);\n ocre = mathMin(halfRd, ocrEnd);\n icrs = mathMin(halfRd, icrStart);\n icre = mathMin(halfRd, icrEnd);\n\n limitedOcrMax = ocrMax = mathMax(ocrs, ocre);\n limitedIcrMax = icrMax = mathMax(icrs, icre);\n\n // draw corner radius\n if (ocrMax > e || icrMax > e) {\n xre = radius * mathCos(endAngle);\n yre = radius * mathSin(endAngle);\n xirs = innerRadius * mathCos(startAngle);\n yirs = innerRadius * mathSin(startAngle);\n\n // restrict the max value of corner radius\n if (arc < PI) {\n const it = intersect(xrs, yrs, xirs, yirs, xre, yre, xire, yire);\n if (it) {\n const x0 = xrs - it[0];\n const y0 = yrs - it[1];\n const x1 = xre - it[0];\n const y1 = yre - it[1];\n const a = 1 / mathSin(\n // eslint-disable-next-line max-len\n mathACos((x0 * x1 + y0 * y1) / (mathSqrt(x0 * x0 + y0 * y0) * mathSqrt(x1 * x1 + y1 * y1))) / 2\n );\n const b = mathSqrt(it[0] * it[0] + it[1] * it[1]);\n limitedOcrMax = mathMin(ocrMax, (radius - b) / (a + 1));\n limitedIcrMax = mathMin(icrMax, (innerRadius - b) / (a - 1));\n }\n }\n }\n }\n\n // the sector is collapsed to a line\n if (!hasArc) {\n ctx.moveTo(cx + xrs, cy + yrs);\n }\n // the outer ring has corners\n else if (limitedOcrMax > e) {\n const crStart = mathMin(ocrStart, limitedOcrMax);\n const crEnd = mathMin(ocrEnd, limitedOcrMax);\n const ct0 = computeCornerTangents(xirs, yirs, xrs, yrs, radius, crStart, clockwise);\n const ct1 = computeCornerTangents(xre, yre, xire, yire, radius, crEnd, clockwise);\n\n ctx.moveTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n\n // Have the corners merged?\n if (limitedOcrMax < ocrMax && crStart === crEnd) {\n // eslint-disable-next-line max-len\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedOcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n else {\n // draw the two corners and the ring\n // eslint-disable-next-line max-len\n crStart > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crStart, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n // eslint-disable-next-line max-len\n ctx.arc(cx, cy, radius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), !clockwise);\n // eslint-disable-next-line max-len\n crEnd > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crEnd, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n // the outer ring is a circular arc\n else {\n ctx.moveTo(cx + xrs, cy + yrs);\n ctx.arc(cx, cy, radius, startAngle, endAngle, !clockwise);\n }\n\n // no inner ring, is a circular sector\n if (!(innerRadius > e) || !hasArc) {\n ctx.lineTo(cx + xire, cy + yire);\n }\n // the inner ring has corners\n else if (limitedIcrMax > e) {\n const crStart = mathMin(icrStart, limitedIcrMax);\n const crEnd = mathMin(icrEnd, limitedIcrMax);\n const ct0 = computeCornerTangents(xire, yire, xre, yre, innerRadius, -crEnd, clockwise);\n const ct1 = computeCornerTangents(xrs, yrs, xirs, yirs, innerRadius, -crStart, clockwise);\n ctx.lineTo(cx + ct0.cx + ct0.x0, cy + ct0.cy + ct0.y0);\n\n // Have the corners merged?\n if (limitedIcrMax < icrMax && crStart === crEnd) {\n // eslint-disable-next-line max-len\n ctx.arc(cx + ct0.cx, cy + ct0.cy, limitedIcrMax, mathATan2(ct0.y0, ct0.x0), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n // draw the two corners and the ring\n else {\n // eslint-disable-next-line max-len\n crEnd > 0 && ctx.arc(cx + ct0.cx, cy + ct0.cy, crEnd, mathATan2(ct0.y0, ct0.x0), mathATan2(ct0.y1, ct0.x1), !clockwise);\n // eslint-disable-next-line max-len\n ctx.arc(cx, cy, innerRadius, mathATan2(ct0.cy + ct0.y1, ct0.cx + ct0.x1), mathATan2(ct1.cy + ct1.y1, ct1.cx + ct1.x1), clockwise);\n // eslint-disable-next-line max-len\n crStart > 0 && ctx.arc(cx + ct1.cx, cy + ct1.cy, crStart, mathATan2(ct1.y1, ct1.x1), mathATan2(ct1.y0, ct1.x0), !clockwise);\n }\n }\n // the inner ring is just a circular arc\n else {\n // FIXME: if no lineTo, svg renderer will perform an abnormal drawing behavior.\n ctx.lineTo(cx + xire, cy + yire);\n\n ctx.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise);\n }\n }\n\n ctx.closePath();\n}\n","import Path, { PathProps } from '../Path';\r\nimport * as roundSectorHelper from '../helper/roundSector';\r\n\r\nexport class SectorShape {\r\n cx = 0\r\n cy = 0\r\n r0 = 0\r\n r = 0\r\n startAngle = 0\r\n endAngle = Math.PI * 2\r\n clockwise = true\r\n /**\r\n * Corner radius of sector\r\n *\r\n * clockwise, from inside to outside, four corners are\r\n * inner start -> inner end\r\n * outer start -> outer end\r\n *\r\n * 5 => [5, 5, 5, 5]\r\n * [5] => [5, 5, 0, 0]\r\n * [5, 10] => [5, 5, 10, 10]\r\n * [5, 10, 15] => [5, 10, 15, 15]\r\n * [5, 10, 15, 20] => [5, 10, 15, 20]\r\n */\r\n cornerRadius: number | number[] = 0\r\n}\r\n\r\nexport interface SectorProps extends PathProps {\r\n shape?: Partial\r\n}\r\n\r\nclass Sector extends Path {\r\n\r\n shape: SectorShape\r\n\r\n constructor(opts?: SectorProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new SectorShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: SectorShape) {\r\n roundSectorHelper.buildPath(ctx, shape);\r\n }\r\n\r\n isZeroArea() {\r\n return this.shape.startAngle === this.shape.endAngle\r\n || this.shape.r === this.shape.r0;\r\n }\r\n}\r\n\r\nSector.prototype.type = 'sector';\r\n\r\nexport default Sector;\r\n","import { cubicSubdivide } from '../core/curve';\r\nimport PathProxy from '../core/PathProxy';\r\n\r\nconst CMD = PathProxy.CMD;\r\n\r\nfunction aroundEqual(a: number, b: number) {\r\n return Math.abs(a - b) < 1e-5;\r\n}\r\n\r\nexport function pathToBezierCurves(path: PathProxy) {\r\n\r\n const data = path.data;\r\n const len = path.len();\r\n\r\n const bezierArrayGroups: number[][] = [];\r\n let currentSubpath: number[];\r\n\r\n let xi = 0;\r\n let yi = 0;\r\n let x0 = 0;\r\n let y0 = 0;\r\n\r\n function createNewSubpath(x: number, y: number) {\r\n // More than one M command\r\n if (currentSubpath && currentSubpath.length > 2) {\r\n bezierArrayGroups.push(currentSubpath);\r\n }\r\n currentSubpath = [x, y];\r\n }\r\n\r\n function addLine(x0: number, y0: number, x1: number, y1: number) {\r\n if (!(aroundEqual(x0, x1) && aroundEqual(y0, y1))) {\r\n currentSubpath.push(x0, y0, x1, y1, x1, y1);\r\n }\r\n }\r\n\r\n function addArc(startAngle: number, endAngle: number, cx: number, cy: number, rx: number, ry: number) {\r\n // https://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves\r\n const delta = Math.abs(endAngle - startAngle);\r\n const len = Math.tan(delta / 4) * 4 / 3;\r\n const dir = endAngle < startAngle ? -1 : 1;\r\n\r\n const c1 = Math.cos(startAngle);\r\n const s1 = Math.sin(startAngle);\r\n const c2 = Math.cos(endAngle);\r\n const s2 = Math.sin(endAngle);\r\n\r\n const x1 = c1 * rx + cx;\r\n const y1 = s1 * ry + cy;\r\n\r\n const x4 = c2 * rx + cx;\r\n const y4 = s2 * ry + cy;\r\n\r\n const hx = rx * len * dir;\r\n const hy = ry * len * dir;\r\n currentSubpath.push(\r\n // Move control points on tangent.\r\n x1 - hx * s1, y1 + hy * c1,\r\n x4 + hx * s2, y4 - hy * c2,\r\n x4, y4\r\n );\r\n }\r\n\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n for (let i = 0; i < len;) {\r\n const cmd = data[i++];\r\n const isFirst = i === 1;\r\n\r\n if (isFirst) {\r\n // 如果第一个命令是 L, C, Q\r\n // 则 previous point 同绘制命令的第一个 point\r\n // 第一个命令为 Arc 的情况下会在后面特殊处理\r\n xi = data[i];\r\n yi = data[i + 1];\r\n\r\n x0 = xi;\r\n y0 = yi;\r\n\r\n if (cmd === CMD.L || cmd === CMD.C || cmd === CMD.Q) {\r\n // Start point\r\n currentSubpath = [x0, y0];\r\n }\r\n }\r\n\r\n switch (cmd) {\r\n case CMD.M:\r\n // moveTo 命令重新创建一个新的 subpath, 并且更新新的起点\r\n // 在 closePath 的时候使用\r\n xi = x0 = data[i++];\r\n yi = y0 = data[i++];\r\n\r\n createNewSubpath(x0, y0);\r\n break;\r\n case CMD.L:\r\n x1 = data[i++];\r\n y1 = data[i++];\r\n addLine(xi, yi, x1, y1);\r\n xi = x1;\r\n yi = y1;\r\n break;\r\n case CMD.C:\r\n currentSubpath.push(\r\n data[i++], data[i++], data[i++], data[i++],\r\n xi = data[i++], yi = data[i++]\r\n );\r\n break;\r\n case CMD.Q:\r\n x1 = data[i++];\r\n y1 = data[i++];\r\n x2 = data[i++];\r\n y2 = data[i++];\r\n currentSubpath.push(\r\n // Convert quadratic to cubic\r\n xi + 2 / 3 * (x1 - xi), yi + 2 / 3 * (y1 - yi),\r\n x2 + 2 / 3 * (x1 - x2), y2 + 2 / 3 * (y1 - y2),\r\n x2, y2\r\n );\r\n xi = x2;\r\n yi = y2;\r\n break;\r\n case CMD.A:\r\n const cx = data[i++];\r\n const cy = data[i++];\r\n const rx = data[i++];\r\n const ry = data[i++];\r\n const startAngle = data[i++];\r\n const endAngle = data[i++] + startAngle;\r\n\r\n // TODO Arc rotation\r\n i += 1;\r\n const anticlockwise = !data[i++];\r\n\r\n x1 = Math.cos(startAngle) * rx + cx;\r\n y1 = Math.sin(startAngle) * ry + cy;\r\n if (isFirst) {\r\n // 直接使用 arc 命令\r\n // 第一个命令起点还未定义\r\n x0 = x1;\r\n y0 = y1;\r\n createNewSubpath(x0, y0);\r\n }\r\n else {\r\n // Connect a line between current point to arc start point.\r\n addLine(xi, yi, x1, y1);\r\n }\r\n\r\n xi = Math.cos(endAngle) * rx + cx;\r\n yi = Math.sin(endAngle) * ry + cy;\r\n\r\n const step = (anticlockwise ? -1 : 1) * Math.PI / 2;\r\n\r\n for (let angle = startAngle; anticlockwise ? angle > endAngle : angle < endAngle; angle += step) {\r\n const nextAngle = anticlockwise ? Math.max(angle + step, endAngle)\r\n : Math.min(angle + step, endAngle);\r\n addArc(angle, nextAngle, cx, cy, rx, ry);\r\n }\r\n\r\n break;\r\n case CMD.R:\r\n x0 = xi = data[i++];\r\n y0 = yi = data[i++];\r\n x1 = x0 + data[i++];\r\n y1 = y0 + data[i++];\r\n\r\n // rect is an individual path.\r\n createNewSubpath(x1, y0);\r\n addLine(x1, y0, x1, y1);\r\n addLine(x1, y1, x0, y1);\r\n addLine(x0, y1, x0, y0);\r\n addLine(x0, y0, x1, y0);\r\n break;\r\n case CMD.Z:\r\n currentSubpath && addLine(xi, yi, x0, y0);\r\n xi = x0;\r\n yi = y0;\r\n break;\r\n }\r\n }\r\n\r\n if (currentSubpath && currentSubpath.length > 2) {\r\n bezierArrayGroups.push(currentSubpath);\r\n }\r\n\r\n return bezierArrayGroups;\r\n}\r\n\r\nfunction adpativeBezier(\r\n x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number,\r\n out: number[], scale: number\r\n) {\r\n // This bezier is used to simulates a line when converting path to beziers.\r\n if (aroundEqual(x0, x1) && aroundEqual(y0, y1) && aroundEqual(x2, x3) && aroundEqual(y2, y3)) {\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n const PIXEL_DISTANCE = 2 / scale;\r\n const PIXEL_DISTANCE_SQR = PIXEL_DISTANCE * PIXEL_DISTANCE;\r\n\r\n // Determine if curve is straight enough\r\n let dx = x3 - x0;\r\n let dy = y3 - y0;\r\n const d = Math.sqrt(dx * dx + dy * dy);\r\n dx /= d;\r\n dy /= d;\r\n\r\n const dx1 = x1 - x0;\r\n const dy1 = y1 - y0;\r\n const dx2 = x2 - x3;\r\n const dy2 = y2 - y3;\r\n\r\n const cp1LenSqr = dx1 * dx1 + dy1 * dy1;\r\n const cp2LenSqr = dx2 * dx2 + dy2 * dy2;\r\n\r\n if (cp1LenSqr < PIXEL_DISTANCE_SQR && cp2LenSqr < PIXEL_DISTANCE_SQR) {\r\n // Add small segment\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n // Project length of cp1\r\n const projLen1 = dx * dx1 + dy * dy1;\r\n // Project length of cp2\r\n const projLen2 = -dx * dx2 - dy * dy2;\r\n\r\n // Distance from cp1 to start-end line.\r\n const d1Sqr = cp1LenSqr - projLen1 * projLen1;\r\n // Distance from cp2 to start-end line.\r\n const d2Sqr = cp2LenSqr - projLen2 * projLen2;\r\n\r\n // IF the cp1 and cp2 is near to the start-line enough\r\n // We treat it straight enough\r\n if (d1Sqr < PIXEL_DISTANCE_SQR && projLen1 >= 0\r\n && d2Sqr < PIXEL_DISTANCE_SQR && projLen2 >= 0\r\n ) {\r\n out.push(x3, y3);\r\n return;\r\n }\r\n\r\n\r\n const tmpSegX: number[] = [];\r\n const tmpSegY: number[] = [];\r\n // Subdivide\r\n cubicSubdivide(x0, x1, x2, x3, 0.5, tmpSegX);\r\n cubicSubdivide(y0, y1, y2, y3, 0.5, tmpSegY);\r\n\r\n adpativeBezier(\r\n tmpSegX[0], tmpSegY[0], tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], tmpSegX[3], tmpSegY[3],\r\n out, scale\r\n );\r\n adpativeBezier(\r\n tmpSegX[4], tmpSegY[4], tmpSegX[5], tmpSegY[5], tmpSegX[6], tmpSegY[6], tmpSegX[7], tmpSegY[7],\r\n out, scale\r\n );\r\n}\r\n\r\nexport function pathToPolygons(path: PathProxy, scale?: number) {\r\n // TODO Optimize simple case like path is polygon and rect?\r\n const bezierArrayGroups = pathToBezierCurves(path);\r\n\r\n const polygons: number[][] = [];\r\n\r\n scale = scale || 1;\r\n\r\n for (let i = 0; i < bezierArrayGroups.length; i++) {\r\n const beziers = bezierArrayGroups[i];\r\n const polygon: number[] = [];\r\n let x0 = beziers[0];\r\n let y0 = beziers[1];\r\n\r\n polygon.push(x0, y0);\r\n\r\n for (let k = 2; k < beziers.length;) {\r\n\r\n const x1 = beziers[k++];\r\n const y1 = beziers[k++];\r\n const x2 = beziers[k++];\r\n const y2 = beziers[k++];\r\n const x3 = beziers[k++];\r\n const y3 = beziers[k++];\r\n\r\n adpativeBezier(x0, y0, x1, y1, x2, y2, x3, y3, polygon, scale);\r\n\r\n x0 = x3;\r\n y0 = y3;\r\n }\r\n\r\n polygons.push(polygon);\r\n }\r\n return polygons;\r\n}\r\n","import { fromPoints } from '../core/bbox';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport Point from '../core/Point';\r\nimport { map } from '../core/util';\r\nimport Path from '../graphic/Path';\r\nimport Polygon from '../graphic/shape/Polygon';\r\nimport Rect from '../graphic/shape/Rect';\r\nimport Sector from '../graphic/shape/Sector';\r\nimport { pathToPolygons } from './convertPath';\r\nimport { clonePath } from './path';\r\n\r\n// Default shape dividers\r\n// TODO divide polygon by grids.\r\ninterface BinaryDivide {\r\n (shape: Path['shape']): Path['shape'][]\r\n}\r\n\r\n/**\r\n * Calculating a grid to divide the shape.\r\n */\r\nfunction getDividingGrids(dimSize: number[], rowDim: number, count: number) {\r\n const rowSize = dimSize[rowDim];\r\n const columnSize = dimSize[1 - rowDim];\r\n\r\n const ratio = Math.abs(rowSize / columnSize);\r\n let rowCount = Math.ceil(Math.sqrt(ratio * count));\r\n let columnCount = Math.floor(count / rowCount);\r\n if (columnCount === 0) {\r\n columnCount = 1;\r\n rowCount = count;\r\n }\r\n\r\n const grids: number[] = [];\r\n for (let i = 0; i < rowCount; i++) {\r\n grids.push(columnCount);\r\n }\r\n const currentCount = rowCount * columnCount;\r\n // Distribute the remaind grid evenly on each row.\r\n const remained = count - currentCount;\r\n if (remained > 0) {\r\n // const stride = Math.max(Math.floor(rowCount / remained), 1);\r\n for (let i = 0; i < remained; i++) {\r\n grids[i % rowCount] += 1;\r\n }\r\n }\r\n return grids;\r\n}\r\n\r\n\r\n// TODO cornerRadius\r\nfunction divideSector(sectorShape: Sector['shape'], count: number, outShapes: Sector['shape'][]) {\r\n const r0 = sectorShape.r0;\r\n const r = sectorShape.r;\r\n const startAngle = sectorShape.startAngle;\r\n const endAngle = sectorShape.endAngle;\r\n const angle = Math.abs(endAngle - startAngle);\r\n const arcLen = angle * r;\r\n const deltaR = r - r0;\r\n\r\n const isAngleRow = arcLen > Math.abs(deltaR);\r\n const grids = getDividingGrids([arcLen, deltaR], isAngleRow ? 0 : 1, count);\r\n\r\n const rowSize = (isAngleRow ? angle : deltaR) / grids.length;\r\n\r\n for (let row = 0; row < grids.length; row++) {\r\n const columnSize = (isAngleRow ? deltaR : angle) / grids[row];\r\n for (let column = 0; column < grids[row]; column++) {\r\n const newShape = {} as Sector['shape'];\r\n\r\n if (isAngleRow) {\r\n newShape.startAngle = startAngle + rowSize * row;\r\n newShape.endAngle = startAngle + rowSize * (row + 1);\r\n newShape.r0 = r0 + columnSize * column;\r\n newShape.r = r0 + columnSize * (column + 1);\r\n }\r\n else {\r\n newShape.startAngle = startAngle + columnSize * column;\r\n newShape.endAngle = startAngle + columnSize * (column + 1);\r\n newShape.r0 = r0 + rowSize * row;\r\n newShape.r = r0 + rowSize * (row + 1);\r\n }\r\n\r\n newShape.clockwise = sectorShape.clockwise;\r\n newShape.cx = sectorShape.cx;\r\n newShape.cy = sectorShape.cy;\r\n\r\n outShapes.push(newShape);\r\n }\r\n }\r\n}\r\n\r\nfunction divideRect(rectShape: Rect['shape'], count: number, outShapes: Rect['shape'][]) {\r\n const width = rectShape.width;\r\n const height = rectShape.height;\r\n\r\n const isHorizontalRow = width > height;\r\n const grids = getDividingGrids([width, height], isHorizontalRow ? 0 : 1, count);\r\n const rowSizeDim = isHorizontalRow ? 'width' : 'height';\r\n const columnSizeDim = isHorizontalRow ? 'height' : 'width';\r\n const rowDim = isHorizontalRow ? 'x' : 'y';\r\n const columnDim = isHorizontalRow ? 'y' : 'x';\r\n const rowSize = rectShape[rowSizeDim] / grids.length;\r\n\r\n for (let row = 0; row < grids.length; row++) {\r\n const columnSize = rectShape[columnSizeDim] / grids[row];\r\n for (let column = 0; column < grids[row]; column++) {\r\n const newShape = {} as Rect['shape'];\r\n newShape[rowDim] = row * rowSize;\r\n newShape[columnDim] = column * columnSize;\r\n newShape[rowSizeDim] = rowSize;\r\n newShape[columnSizeDim] = columnSize;\r\n\r\n newShape.x += rectShape.x;\r\n newShape.y += rectShape.y;\r\n\r\n outShapes.push(newShape);\r\n }\r\n }\r\n}\r\n\r\nfunction crossProduct2d(x1: number, y1: number, x2: number, y2: number) {\r\n return x1 * y2 - x2 * y1;\r\n}\r\n\r\nfunction lineLineIntersect(\r\n a1x: number, a1y: number, a2x: number, a2y: number, // p1\r\n b1x: number, b1y: number, b2x: number, b2y: number // p2\r\n): Point {\r\n const mx = a2x - a1x;\r\n const my = a2y - a1y;\r\n const nx = b2x - b1x;\r\n const ny = b2y - b1y;\r\n\r\n const nmCrossProduct = crossProduct2d(nx, ny, mx, my);\r\n if (Math.abs(nmCrossProduct) < 1e-6) {\r\n return null;\r\n }\r\n\r\n const b1a1x = a1x - b1x;\r\n const b1a1y = a1y - b1y;\r\n\r\n const p = crossProduct2d(b1a1x, b1a1y, nx, ny) / nmCrossProduct;\r\n if (p < 0 || p > 1) {\r\n return null;\r\n }\r\n // p2 is an infinite line\r\n return new Point(\r\n p * mx + a1x,\r\n p * my + a1y\r\n );\r\n}\r\n\r\nfunction projPtOnLine(pt: Point, lineA: Point, lineB: Point): number {\r\n const dir = new Point();\r\n Point.sub(dir, lineB, lineA);\r\n dir.normalize();\r\n const dir2 = new Point();\r\n Point.sub(dir2, pt, lineA);\r\n const len = dir2.dot(dir);\r\n return len;\r\n}\r\n\r\nfunction addToPoly(poly: number[][], pt: number[]) {\r\n const last = poly[poly.length - 1];\r\n if (last && last[0] === pt[0] && last[1] === pt[1]) {\r\n return;\r\n }\r\n poly.push(pt);\r\n}\r\n\r\nfunction splitPolygonByLine(points: number[][], lineA: Point, lineB: Point) {\r\n const len = points.length;\r\n const intersections: {\r\n projPt: number,\r\n pt: Point\r\n idx: number\r\n }[] = [];\r\n for (let i = 0; i < len; i++) {\r\n const p0 = points[i];\r\n const p1 = points[(i + 1) % len];\r\n const intersectionPt = lineLineIntersect(\r\n p0[0], p0[1], p1[0], p1[1],\r\n lineA.x, lineA.y, lineB.x, lineB.y\r\n );\r\n if (intersectionPt) {\r\n intersections.push({\r\n projPt: projPtOnLine(intersectionPt, lineA, lineB),\r\n pt: intersectionPt,\r\n idx: i\r\n });\r\n }\r\n }\r\n\r\n // TODO No intersection?\r\n if (intersections.length < 2) {\r\n // Do clone\r\n return [ { points}, {points} ];\r\n }\r\n\r\n // Find two farthest points.\r\n intersections.sort((a, b) => {\r\n return a.projPt - b.projPt;\r\n });\r\n let splitPt0 = intersections[0];\r\n let splitPt1 = intersections[intersections.length - 1];\r\n if (splitPt1.idx < splitPt0.idx) {\r\n const tmp = splitPt0;\r\n splitPt0 = splitPt1;\r\n splitPt1 = tmp;\r\n }\r\n\r\n const splitPt0Arr = [splitPt0.pt.x, splitPt0.pt.y];\r\n const splitPt1Arr = [splitPt1.pt.x, splitPt1.pt.y];\r\n\r\n const newPolyA: number[][] = [splitPt0Arr];\r\n const newPolyB: number[][] = [splitPt1Arr];\r\n\r\n for (let i = splitPt0.idx + 1; i <= splitPt1.idx; i++) {\r\n addToPoly(newPolyA, points[i].slice());\r\n }\r\n addToPoly(newPolyA, splitPt1Arr);\r\n // Close the path\r\n addToPoly(newPolyA, splitPt0Arr);\r\n\r\n for (let i = splitPt1.idx + 1; i <= splitPt0.idx + len; i++) {\r\n addToPoly(newPolyB, points[i % len].slice());\r\n }\r\n addToPoly(newPolyB, splitPt0Arr);\r\n // Close the path\r\n addToPoly(newPolyB, splitPt1Arr);\r\n\r\n return [{\r\n points: newPolyA\r\n }, {\r\n points: newPolyB\r\n }];\r\n}\r\n\r\nfunction binaryDividePolygon(\r\n polygonShape: Pick\r\n) {\r\n const points = polygonShape.points;\r\n const min: number[] = [];\r\n const max: number[] = [];\r\n fromPoints(points, min, max);\r\n const boundingRect = new BoundingRect(\r\n min[0], min[1], max[0] - min[0], max[1] - min[1]\r\n );\r\n\r\n const width = boundingRect.width;\r\n const height = boundingRect.height;\r\n const x = boundingRect.x;\r\n const y = boundingRect.y;\r\n\r\n const pt0 = new Point();\r\n const pt1 = new Point();\r\n if (width > height) {\r\n pt0.x = pt1.x = x + width / 2;\r\n pt0.y = y;\r\n pt1.y = y + height;\r\n }\r\n else {\r\n pt0.y = pt1.y = y + height / 2;\r\n pt0.x = x;\r\n pt1.x = x + width;\r\n }\r\n return splitPolygonByLine(points, pt0, pt1);\r\n}\r\n\r\n\r\nfunction binaryDivideRecursive(\r\n divider: BinaryDivide, shape: T, count: number, out: T[]\r\n): T[] {\r\n if (count === 1) {\r\n out.push(shape);\r\n }\r\n else {\r\n const mid = Math.floor(count / 2);\r\n const sub = divider(shape);\r\n binaryDivideRecursive(divider, sub[0], mid, out);\r\n binaryDivideRecursive(divider, sub[1], count - mid, out);\r\n }\r\n\r\n return out;\r\n}\r\n\r\nexport function clone(path: Path, count: number) {\r\n const paths = [];\r\n for (let i = 0; i < count; i++) {\r\n paths.push(clonePath(path));\r\n }\r\n return paths;\r\n}\r\n\r\nfunction copyPathProps(source: Path, target: Path) {\r\n target.setStyle(source.style);\r\n target.z = source.z;\r\n target.z2 = source.z2;\r\n target.zlevel = source.zlevel;\r\n}\r\n\r\nfunction polygonConvert(points: number[]): number[][] {\r\n const out = [];\r\n for (let i = 0; i < points.length;) {\r\n out.push([points[i++], points[i++]]);\r\n }\r\n return out;\r\n}\r\n\r\nexport function split(\r\n path: Path, count: number\r\n) {\r\n const outShapes: Path['shape'][] = [];\r\n const shape = path.shape;\r\n let OutShapeCtor: new() => Path;\r\n // TODO Use clone when shape size is small\r\n switch (path.type) {\r\n case 'rect':\r\n divideRect(shape as Rect['shape'], count, outShapes as Rect['shape'][]);\r\n OutShapeCtor = Rect;\r\n break;\r\n case 'sector':\r\n divideSector(shape as Sector['shape'], count, outShapes as Sector['shape'][]);\r\n OutShapeCtor = Sector;\r\n break;\r\n case 'circle':\r\n divideSector({\r\n r0: 0, r: shape.r, startAngle: 0, endAngle: Math.PI * 2,\r\n cx: shape.cx, cy: shape.cy\r\n } as Sector['shape'], count, outShapes as Sector['shape'][]);\r\n OutShapeCtor = Sector;\r\n break;\r\n default:\r\n const m = path.getComputedTransform();\r\n const scale = m ? Math.sqrt(Math.max(m[0] * m[0] + m[1] * m[1], m[2] * m[2] + m[3] * m[3])) : 1;\r\n const polygons = map(\r\n pathToPolygons(path.getUpdatedPathProxy(), scale),\r\n poly => polygonConvert(poly)\r\n );\r\n const polygonCount = polygons.length;\r\n if (polygonCount === 0) {\r\n binaryDivideRecursive(binaryDividePolygon, {\r\n points: polygons[0]\r\n }, count, outShapes);\r\n }\r\n else if (polygonCount === count) { // In case we only split batched paths to non-batched paths. No need to split.\r\n for (let i = 0; i < polygonCount; i++) {\r\n outShapes.push({\r\n points: polygons[i]\r\n } as Polygon['shape']);\r\n }\r\n }\r\n else {\r\n // Most complex case. Assign multiple subpath to each polygon based on it's area.\r\n let totalArea = 0;\r\n const items = map(polygons, poly => {\r\n const min: number[] = [];\r\n const max: number[] = [];\r\n fromPoints(poly, min, max);\r\n // TODO: polygon area?\r\n const area = (max[1] - min[1]) * (max[0] - min[0]);\r\n totalArea += area;\r\n return { poly, area };\r\n });\r\n items.sort((a, b) => b.area - a.area);\r\n\r\n let left = count;\r\n for (let i = 0; i < polygonCount; i++) {\r\n const item = items[i];\r\n if (left <= 0) {\r\n break;\r\n }\r\n\r\n const selfCount = i === polygonCount - 1\r\n ? left // Use the last piece directly\r\n : Math.ceil(item.area / totalArea * count);\r\n\r\n if (selfCount < 0) {\r\n continue;\r\n }\r\n\r\n binaryDivideRecursive(binaryDividePolygon, {\r\n points: item.poly\r\n }, selfCount, outShapes);\r\n left -= selfCount;\r\n };\r\n }\r\n OutShapeCtor = Polygon;\r\n break;\r\n }\r\n\r\n if (!OutShapeCtor) {\r\n // Unkown split algorithm. Use clone instead\r\n return clone(path, count);\r\n }\r\n const out: Path[] = [];\r\n\r\n for (let i = 0; i < outShapes.length; i++) {\r\n const subPath = new OutShapeCtor();\r\n subPath.setShape(outShapes[i]);\r\n copyPathProps(path, subPath);\r\n out.push(subPath);\r\n }\r\n\r\n return out;\r\n}","import PathProxy from '../core/PathProxy';\r\nimport { cubicSubdivide } from '../core/curve';\r\nimport Path from '../graphic/Path';\r\nimport Element, { ElementAnimateConfig } from '../Element';\r\nimport { defaults, map } from '../core/util';\r\nimport { lerp } from '../core/vector';\r\nimport Group, { GroupLike } from '../graphic/Group';\r\nimport { clonePath } from './path';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Transformable from '../core/Transformable';\r\nimport { ZRenderType } from '../zrender';\r\nimport { split } from './dividePath';\r\nimport { pathToBezierCurves } from './convertPath';\r\n\r\nfunction alignSubpath(subpath1: number[], subpath2: number[]): [number[], number[]] {\r\n const len1 = subpath1.length;\r\n const len2 = subpath2.length;\r\n if (len1 === len2) {\r\n return [subpath1, subpath2];\r\n }\r\n const tmpSegX: number[] = [];\r\n const tmpSegY: number[] = [];\r\n\r\n const shorterPath = len1 < len2 ? subpath1 : subpath2;\r\n const shorterLen = Math.min(len1, len2);\r\n // Should divide excatly\r\n const diff = Math.abs(len2 - len1) / 6;\r\n const shorterBezierCount = (shorterLen - 2) / 6;\r\n // Add `diff` number of beziers\r\n const eachCurveSubDivCount = Math.ceil(diff / shorterBezierCount) + 1;\r\n\r\n const newSubpath = [shorterPath[0], shorterPath[1]];\r\n let remained = diff;\r\n\r\n for (let i = 2; i < shorterLen;) {\r\n let x0 = shorterPath[i - 2];\r\n let y0 = shorterPath[i - 1];\r\n let x1 = shorterPath[i++];\r\n let y1 = shorterPath[i++];\r\n let x2 = shorterPath[i++];\r\n let y2 = shorterPath[i++];\r\n let x3 = shorterPath[i++];\r\n let y3 = shorterPath[i++];\r\n\r\n if (remained <= 0) {\r\n newSubpath.push(x1, y1, x2, y2, x3, y3);\r\n continue;\r\n }\r\n\r\n let actualSubDivCount = Math.min(remained, eachCurveSubDivCount - 1) + 1;\r\n for (let k = 1; k <= actualSubDivCount; k++) {\r\n const p = k / actualSubDivCount;\r\n\r\n cubicSubdivide(x0, x1, x2, x3, p, tmpSegX);\r\n cubicSubdivide(y0, y1, y2, y3, p, tmpSegY);\r\n\r\n // tmpSegX[3] === tmpSegX[4]\r\n x0 = tmpSegX[3];\r\n y0 = tmpSegY[3];\r\n\r\n newSubpath.push(tmpSegX[1], tmpSegY[1], tmpSegX[2], tmpSegY[2], x0, y0);\r\n x1 = tmpSegX[5];\r\n y1 = tmpSegY[5];\r\n x2 = tmpSegX[6];\r\n y2 = tmpSegY[6];\r\n // The last point (x3, y3) is still the same.\r\n }\r\n remained -= actualSubDivCount - 1;\r\n }\r\n\r\n return shorterPath === subpath1 ? [newSubpath, subpath2] : [subpath1, newSubpath];\r\n}\r\n\r\nfunction createSubpath(lastSubpathSubpath: number[], otherSubpath: number[]) {\r\n const len = lastSubpathSubpath.length;\r\n const lastX = lastSubpathSubpath[len - 2];\r\n const lastY = lastSubpathSubpath[len - 1];\r\n\r\n const newSubpath: number[] = [];\r\n for (let i = 0; i < otherSubpath.length;) {\r\n newSubpath[i++] = lastX;\r\n newSubpath[i++] = lastY;\r\n }\r\n return newSubpath;\r\n}\r\n\r\n/**\r\n * Make two bezier arrays aligns on structure. To have better animation.\r\n *\r\n * It will:\r\n * Make two bezier arrays have same number of subpaths.\r\n * Make each subpath has equal number of bezier curves.\r\n *\r\n * array is the convert result of pathToBezierCurves.\r\n */\r\nexport function alignBezierCurves(array1: number[][], array2: number[][]) {\r\n\r\n let lastSubpath1;\r\n let lastSubpath2;\r\n\r\n let newArray1 = [];\r\n let newArray2 = [];\r\n\r\n for (let i = 0; i < Math.max(array1.length, array2.length); i++) {\r\n const subpath1 = array1[i];\r\n const subpath2 = array2[i];\r\n\r\n let newSubpath1;\r\n let newSubpath2;\r\n\r\n if (!subpath1) {\r\n newSubpath1 = createSubpath(lastSubpath1 || subpath2, subpath2);\r\n newSubpath2 = subpath2;\r\n }\r\n else if (!subpath2) {\r\n newSubpath2 = createSubpath(lastSubpath2 || subpath1, subpath1);\r\n newSubpath1 = subpath1;\r\n }\r\n else {\r\n [newSubpath1, newSubpath2] = alignSubpath(subpath1, subpath2);\r\n lastSubpath1 = newSubpath1;\r\n lastSubpath2 = newSubpath2;\r\n }\r\n\r\n newArray1.push(newSubpath1);\r\n newArray2.push(newSubpath2);\r\n }\r\n\r\n return [newArray1, newArray2];\r\n}\r\n\r\ninterface MorphingPath extends Path {\r\n __morphT: number;\r\n}\r\n\r\nexport interface CombineMorphingPath extends Path {\r\n childrenRef(): (CombineMorphingPath | Path)[]\r\n __isCombineMorphing: boolean;\r\n}\r\n\r\nexport function centroid(array: number[]) {\r\n // https://en.wikipedia.org/wiki/Centroid#Of_a_polygon\r\n let signedArea = 0;\r\n let cx = 0;\r\n let cy = 0;\r\n const len = array.length;\r\n // Polygon should been closed.\r\n for (let i = 0, j = len - 2; i < len; j = i, i += 2) {\r\n const x0 = array[j];\r\n const y0 = array[j + 1];\r\n const x1 = array[i];\r\n const y1 = array[i + 1];\r\n const a = x0 * y1 - x1 * y0;\r\n signedArea += a;\r\n cx += (x0 + x1) * a;\r\n cy += (y0 + y1) * a;\r\n }\r\n\r\n if (signedArea === 0) {\r\n return [array[0] || 0, array[1] || 0];\r\n }\r\n\r\n return [cx / signedArea / 3, cy / signedArea / 3, signedArea];\r\n}\r\n\r\n/**\r\n * Offset the points to find the nearest morphing distance.\r\n * Return beziers count needs to be offset.\r\n */\r\nfunction findBestRingOffset(\r\n fromSubBeziers: number[],\r\n toSubBeziers: number[],\r\n fromCp: number[],\r\n toCp: number[]\r\n) {\r\n const bezierCount = (fromSubBeziers.length - 2) / 6;\r\n let bestScore = Infinity;\r\n let bestOffset = 0;\r\n\r\n const len = fromSubBeziers.length;\r\n const len2 = len - 2;\r\n for (let offset = 0; offset < bezierCount; offset++) {\r\n const cursorOffset = offset * 6;\r\n let score = 0;\r\n\r\n for (let k = 0; k < len; k += 2) {\r\n let idx = k === 0 ? cursorOffset : ((cursorOffset + k - 2) % len2 + 2);\r\n\r\n const x0 = fromSubBeziers[idx] - fromCp[0];\r\n const y0 = fromSubBeziers[idx + 1] - fromCp[1];\r\n const x1 = toSubBeziers[k] - toCp[0];\r\n const y1 = toSubBeziers[k + 1] - toCp[1];\r\n\r\n const dx = x1 - x0;\r\n const dy = y1 - y0;\r\n score += dx * dx + dy * dy;\r\n }\r\n if (score < bestScore) {\r\n bestScore = score;\r\n bestOffset = offset;\r\n }\r\n }\r\n\r\n return bestOffset;\r\n}\r\n\r\nfunction reverse(array: number[]) {\r\n const newArr: number[] = [];\r\n const len = array.length;\r\n for (let i = 0; i < len; i += 2) {\r\n newArr[i] = array[len - i - 2];\r\n newArr[i + 1] = array[len - i - 1];\r\n }\r\n return newArr;\r\n}\r\n\r\ntype MorphingData = {\r\n from: number[];\r\n to: number[];\r\n fromCp: number[];\r\n toCp: number[];\r\n rotation: number;\r\n}[];\r\n\r\n/**\r\n * If we interpolating between two bezier curve arrays.\r\n * It will have many broken effects during the transition.\r\n * So we try to apply an extra rotation which can make each bezier curve morph as small as possible.\r\n */\r\nfunction findBestMorphingRotation(\r\n fromArr: number[][],\r\n toArr: number[][],\r\n searchAngleIteration: number,\r\n searchAngleRange: number\r\n): MorphingData {\r\n const result = [];\r\n\r\n let fromNeedsReverse: boolean;\r\n\r\n for (let i = 0; i < fromArr.length; i++) {\r\n let fromSubpathBezier = fromArr[i];\r\n const toSubpathBezier = toArr[i];\r\n\r\n const fromCp = centroid(fromSubpathBezier);\r\n const toCp = centroid(toSubpathBezier);\r\n\r\n if (fromNeedsReverse == null) {\r\n // Reverse from array if two have different directions.\r\n // Determine the clockwise based on the first subpath.\r\n // Reverse all subpaths or not. Avoid winding rule changed.\r\n fromNeedsReverse = fromCp[2] < 0 !== toCp[2] < 0;\r\n }\r\n\r\n const newFromSubpathBezier: number[] = [];\r\n const newToSubpathBezier: number[] = [];\r\n let bestAngle = 0;\r\n let bestScore = Infinity;\r\n let tmpArr: number[] = [];\r\n\r\n const len = fromSubpathBezier.length;\r\n if (fromNeedsReverse) {\r\n // Make sure clockwise\r\n fromSubpathBezier = reverse(fromSubpathBezier);\r\n }\r\n const offset = findBestRingOffset(fromSubpathBezier, toSubpathBezier, fromCp, toCp) * 6;\r\n\r\n const len2 = len - 2;\r\n for (let k = 0; k < len2; k += 2) {\r\n // Not include the start point.\r\n const idx = (offset + k) % len2 + 2;\r\n newFromSubpathBezier[k + 2] = fromSubpathBezier[idx] - fromCp[0];\r\n newFromSubpathBezier[k + 3] = fromSubpathBezier[idx + 1] - fromCp[1];\r\n }\r\n newFromSubpathBezier[0] = fromSubpathBezier[offset] - fromCp[0];\r\n newFromSubpathBezier[1] = fromSubpathBezier[offset + 1] - fromCp[1];\r\n\r\n if (searchAngleIteration > 0) {\r\n const step = searchAngleRange / searchAngleIteration;\r\n for (let angle = -searchAngleRange / 2; angle <= searchAngleRange / 2; angle += step) {\r\n const sa = Math.sin(angle);\r\n const ca = Math.cos(angle);\r\n let score = 0;\r\n\r\n for (let k = 0; k < fromSubpathBezier.length; k += 2) {\r\n const x0 = newFromSubpathBezier[k];\r\n const y0 = newFromSubpathBezier[k + 1];\r\n const x1 = toSubpathBezier[k] - toCp[0];\r\n const y1 = toSubpathBezier[k + 1] - toCp[1];\r\n\r\n // Apply rotation on the target point.\r\n const newX1 = x1 * ca - y1 * sa;\r\n const newY1 = x1 * sa + y1 * ca;\r\n\r\n tmpArr[k] = newX1;\r\n tmpArr[k + 1] = newY1;\r\n\r\n const dx = newX1 - x0;\r\n const dy = newY1 - y0;\r\n\r\n // Use dot product to have min direction change.\r\n // const d = Math.sqrt(x0 * x0 + y0 * y0);\r\n // score += x0 * dx / d + y0 * dy / d;\r\n score += dx * dx + dy * dy;\r\n }\r\n\r\n if (score < bestScore) {\r\n bestScore = score;\r\n bestAngle = angle;\r\n // Copy.\r\n for (let m = 0; m < tmpArr.length; m++) {\r\n newToSubpathBezier[m] = tmpArr[m];\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < len; i += 2) {\r\n newToSubpathBezier[i] = toSubpathBezier[i] - toCp[0];\r\n newToSubpathBezier[i + 1] = toSubpathBezier[i + 1] - toCp[1];\r\n }\r\n }\r\n\r\n result.push({\r\n from: newFromSubpathBezier,\r\n to: newToSubpathBezier,\r\n fromCp,\r\n toCp,\r\n rotation: -bestAngle\r\n });\r\n }\r\n return result;\r\n}\r\n\r\nexport function isCombineMorphing(path: Element): path is CombineMorphingPath {\r\n return (path as CombineMorphingPath).__isCombineMorphing;\r\n}\r\n\r\nexport function isMorphing(el: Element) {\r\n return (el as MorphingPath).__morphT >= 0;\r\n}\r\n\r\nconst SAVED_METHOD_PREFIX = '__mOriginal_';\r\nfunction saveAndModifyMethod(\r\n obj: T,\r\n methodName: M,\r\n modifiers: { replace?: T[M], after?: T[M], before?: T[M] }\r\n) {\r\n const savedMethodName = SAVED_METHOD_PREFIX + methodName;\r\n const originalMethod = (obj as any)[savedMethodName] || obj[methodName];\r\n if (!(obj as any)[savedMethodName]) {\r\n (obj as any)[savedMethodName] = obj[methodName];\r\n }\r\n const replace = modifiers.replace;\r\n const after = modifiers.after;\r\n const before = modifiers.before;\r\n\r\n (obj as any)[methodName] = function () {\r\n const args = arguments;\r\n let res;\r\n before && (before as unknown as Function).apply(this, args);\r\n // Still call the original method if not replacement.\r\n if (replace) {\r\n res = (replace as unknown as Function).apply(this, args);\r\n }\r\n else {\r\n res = originalMethod.apply(this, args);\r\n }\r\n after && (after as unknown as Function).apply(this, args);\r\n return res;\r\n };\r\n}\r\nfunction restoreMethod(\r\n obj: T,\r\n methodName: keyof T\r\n) {\r\n const savedMethodName = SAVED_METHOD_PREFIX + methodName;\r\n if ((obj as any)[savedMethodName]) {\r\n obj[methodName] = (obj as any)[savedMethodName];\r\n (obj as any)[savedMethodName] = null;\r\n }\r\n}\r\n\r\nfunction applyTransformOnBeziers(bezierCurves: number[][], mm: MatrixArray) {\r\n for (let i = 0; i < bezierCurves.length; i++) {\r\n const subBeziers = bezierCurves[i];\r\n for (let k = 0; k < subBeziers.length;) {\r\n const x = subBeziers[k];\r\n const y = subBeziers[k + 1];\r\n\r\n subBeziers[k++] = mm[0] * x + mm[2] * y + mm[4];\r\n subBeziers[k++] = mm[1] * x + mm[3] * y + mm[5];\r\n }\r\n }\r\n}\r\n\r\nfunction prepareMorphPath(\r\n fromPath: Path,\r\n toPath: Path\r\n) {\r\n const fromPathProxy = fromPath.getUpdatedPathProxy();\r\n const toPathProxy = toPath.getUpdatedPathProxy();\r\n\r\n const [fromBezierCurves, toBezierCurves] =\r\n alignBezierCurves(pathToBezierCurves(fromPathProxy), pathToBezierCurves(toPathProxy));\r\n\r\n const fromPathTransform = fromPath.getComputedTransform();\r\n const toPathTransform = toPath.getComputedTransform();\r\n function updateIdentityTransform(this: Transformable) {\r\n this.transform = null;\r\n }\r\n fromPathTransform && applyTransformOnBeziers(fromBezierCurves, fromPathTransform);\r\n toPathTransform && applyTransformOnBeziers(toBezierCurves, toPathTransform);\r\n // Just ignore transform\r\n saveAndModifyMethod(toPath, 'updateTransform', { replace: updateIdentityTransform });\r\n toPath.transform = null;\r\n\r\n const morphingData = findBestMorphingRotation(fromBezierCurves, toBezierCurves, 10, Math.PI);\r\n\r\n const tmpArr: number[] = [];\r\n\r\n saveAndModifyMethod(toPath, 'buildPath', { replace(path: PathProxy) {\r\n const t = (toPath as MorphingPath).__morphT;\r\n const onet = 1 - t;\r\n\r\n const newCp: number[] = [];\r\n\r\n for (let i = 0; i < morphingData.length; i++) {\r\n const item = morphingData[i];\r\n const from = item.from;\r\n const to = item.to;\r\n const angle = item.rotation * t;\r\n const fromCp = item.fromCp;\r\n const toCp = item.toCp;\r\n const sa = Math.sin(angle);\r\n const ca = Math.cos(angle);\r\n\r\n lerp(newCp, fromCp, toCp, t);\r\n\r\n for (let m = 0; m < from.length; m += 2) {\r\n const x0 = from[m];\r\n const y0 = from[m + 1];\r\n const x1 = to[m];\r\n const y1 = to[m + 1];\r\n\r\n const x = x0 * onet + x1 * t;\r\n const y = y0 * onet + y1 * t;\r\n\r\n tmpArr[m] = (x * ca - y * sa) + newCp[0];\r\n tmpArr[m + 1] = (x * sa + y * ca) + newCp[1];\r\n }\r\n\r\n let x0 = tmpArr[0];\r\n let y0 = tmpArr[1];\r\n\r\n path.moveTo(x0, y0);\r\n\r\n for (let m = 2; m < from.length;) {\r\n const x1 = tmpArr[m++];\r\n const y1 = tmpArr[m++];\r\n const x2 = tmpArr[m++];\r\n const y2 = tmpArr[m++];\r\n const x3 = tmpArr[m++];\r\n const y3 = tmpArr[m++];\r\n\r\n // Is a line.\r\n if (x0 === x1 && y0 === y1 && x2 === x3 && y2 === y3) {\r\n path.lineTo(x3, y3);\r\n }\r\n else {\r\n path.bezierCurveTo(x1, y1, x2, y2, x3, y3);\r\n }\r\n x0 = x3;\r\n y0 = y3;\r\n }\r\n }\r\n } });\r\n}\r\n\r\n/**\r\n * Morphing from old path to new path.\r\n */\r\nexport function morphPath(\r\n fromPath: Path,\r\n toPath: Path,\r\n animationOpts: ElementAnimateConfig\r\n): Path {\r\n if (!fromPath || !toPath) {\r\n return toPath;\r\n }\r\n\r\n const oldDone = animationOpts.done;\r\n // const oldAborted = animationOpts.aborted;\r\n const oldDuring = animationOpts.during;\r\n\r\n prepareMorphPath(fromPath, toPath);\r\n\r\n (toPath as MorphingPath).__morphT = 0;\r\n\r\n function restoreToPath() {\r\n restoreMethod(toPath, 'buildPath');\r\n restoreMethod(toPath, 'updateTransform');\r\n // Mark as not in morphing\r\n (toPath as MorphingPath).__morphT = -1;\r\n // Cleanup.\r\n toPath.createPathProxy();\r\n toPath.dirtyShape();\r\n }\r\n\r\n toPath.animateTo({\r\n __morphT: 1\r\n } as any, defaults({\r\n during(p) {\r\n toPath.dirtyShape();\r\n oldDuring && oldDuring(p);\r\n },\r\n done() {\r\n restoreToPath();\r\n oldDone && oldDone();\r\n }\r\n // NOTE: Don't do restore if aborted.\r\n // Because all status was just set when animation started.\r\n // aborted() {\r\n // oldAborted && oldAborted();\r\n // }\r\n } as ElementAnimateConfig, animationOpts));\r\n\r\n return toPath;\r\n}\r\n\r\n// https://github.com/mapbox/earcut/blob/master/src/earcut.js#L437\r\n// https://jsfiddle.net/pissang/2jk7x145/\r\n// function zOrder(x: number, y: number, minX: number, minY: number, maxX: number, maxY: number) {\r\n// // Normalize coords to 0 - 1\r\n// // The transformed into non-negative 15-bit integer range\r\n// x = (maxX === minX) ? 0 : Math.round(32767 * (x - minX) / (maxX - minX));\r\n// y = (maxY === minY) ? 0 : Math.round(32767 * (y - minY) / (maxY - minY));\r\n\r\n// x = (x | (x << 8)) & 0x00FF00FF;\r\n// x = (x | (x << 4)) & 0x0F0F0F0F;\r\n// x = (x | (x << 2)) & 0x33333333;\r\n// x = (x | (x << 1)) & 0x55555555;\r\n\r\n// y = (y | (y << 8)) & 0x00FF00FF;\r\n// y = (y | (y << 4)) & 0x0F0F0F0F;\r\n// y = (y | (y << 2)) & 0x33333333;\r\n// y = (y | (y << 1)) & 0x55555555;\r\n\r\n// return x | (y << 1);\r\n// }\r\n\r\n// https://github.com/w8r/hilbert/blob/master/hilbert.js#L30\r\n// https://jsfiddle.net/pissang/xdnbzg6v/\r\nfunction hilbert(x: number, y: number, minX: number, minY: number, maxX: number, maxY: number) {\r\n const bits = 16;\r\n x = (maxX === minX) ? 0 : Math.round(32767 * (x - minX) / (maxX - minX));\r\n y = (maxY === minY) ? 0 : Math.round(32767 * (y - minY) / (maxY - minY));\r\n\r\n let d = 0;\r\n let tmp: number;\r\n for (let s = (1 << bits) / 2; s > 0; s /= 2) {\r\n let rx = 0;\r\n let ry = 0;\r\n\r\n if ((x & s) > 0) {\r\n rx = 1;\r\n }\r\n if ((y & s) > 0) {\r\n ry = 1;\r\n }\r\n\r\n d += s * s * ((3 * rx) ^ ry);\r\n\r\n if (ry === 0) {\r\n if (rx === 1) {\r\n x = s - 1 - x;\r\n y = s - 1 - y;\r\n }\r\n tmp = x;\r\n x = y;\r\n y = tmp;\r\n }\r\n }\r\n return d;\r\n}\r\n\r\n// Sort paths on hilbert. Not using z-order because it may still have large cross.\r\n// So the left most source can animate to the left most target, not right most target.\r\n// Hope in this way. We can make sure each element is animated to the proper target. Not the farthest.\r\nfunction sortPaths(pathList: Path[]): Path[] {\r\n let xMin = Infinity;\r\n let yMin = Infinity;\r\n let xMax = -Infinity;\r\n let yMax = -Infinity;\r\n const cps = map(pathList, path => {\r\n const rect = path.getBoundingRect();\r\n const m = path.getComputedTransform();\r\n const x = rect.x + rect.width / 2 + (m ? m[4] : 0);\r\n const y = rect.y + rect.height / 2 + (m ? m[5] : 0);\r\n xMin = Math.min(x, xMin);\r\n yMin = Math.min(y, yMin);\r\n xMax = Math.max(x, xMax);\r\n yMax = Math.max(y, yMax);\r\n return [x, y];\r\n });\r\n\r\n const items = map(cps, (cp, idx) => {\r\n return {\r\n cp,\r\n z: hilbert(cp[0], cp[1], xMin, yMin, xMax, yMax),\r\n path: pathList[idx]\r\n };\r\n });\r\n\r\n return items.sort((a, b) => a.z - b.z).map(item => item.path);\r\n}\r\n\r\nexport interface DividePathParams {\r\n path: Path,\r\n count: number\r\n};\r\nexport interface DividePath {\r\n (params: DividePathParams): Path[]\r\n}\r\n\r\nexport interface IndividualDelay {\r\n (index: number, count: number, fromPath: Path, toPath: Path): number\r\n}\r\n\r\nfunction defaultDividePath(param: DividePathParams) {\r\n return split(param.path, param.count);\r\n}\r\nexport interface CombineConfig extends ElementAnimateConfig {\r\n /**\r\n * Transform of returned will be ignored.\r\n */\r\n dividePath?: DividePath\r\n /**\r\n * delay of each individual.\r\n * Because individual are sorted on z-order. The index is also sorted top-left / right-down.\r\n */\r\n individualDelay?: IndividualDelay\r\n /**\r\n * If sort splitted paths so the movement between them can be more natural\r\n */\r\n // sort?: boolean\r\n}\r\n\r\nfunction createEmptyReturn() {\r\n return {\r\n fromIndividuals: [] as Path[],\r\n toIndividuals: [] as Path[],\r\n count: 0\r\n };\r\n}\r\n/**\r\n * Make combine morphing from many paths to one.\r\n * Will return a group to replace the original path.\r\n */\r\nexport function combineMorph(\r\n fromList: (CombineMorphingPath | Path)[],\r\n toPath: Path,\r\n animationOpts: CombineConfig\r\n) {\r\n let fromPathList: Path[] = [];\r\n\r\n function addFromPath(fromList: Element[]) {\r\n for (let i = 0; i < fromList.length; i++) {\r\n const from = fromList[i];\r\n if (isCombineMorphing(from)) {\r\n addFromPath((from as GroupLike).childrenRef());\r\n }\r\n else if (from instanceof Path) {\r\n fromPathList.push(from);\r\n }\r\n }\r\n }\r\n addFromPath(fromList);\r\n\r\n const separateCount = fromPathList.length;\r\n\r\n // fromPathList.length is 0.\r\n if (!separateCount) {\r\n return createEmptyReturn();\r\n }\r\n\r\n const dividePath = animationOpts.dividePath || defaultDividePath;\r\n\r\n let toSubPathList = dividePath({\r\n path: toPath, count: separateCount\r\n });\r\n if (toSubPathList.length !== separateCount) {\r\n console.error('Invalid morphing: unmatched splitted path');\r\n return createEmptyReturn();\r\n }\r\n\r\n fromPathList = sortPaths(fromPathList);\r\n toSubPathList = sortPaths(toSubPathList);\r\n\r\n const oldDone = animationOpts.done;\r\n // const oldAborted = animationOpts.aborted;\r\n const oldDuring = animationOpts.during;\r\n const individualDelay = animationOpts.individualDelay;\r\n\r\n const identityTransform = new Transformable();\r\n\r\n for (let i = 0; i < separateCount; i++) {\r\n const from = fromPathList[i];\r\n const to = toSubPathList[i];\r\n\r\n to.parent = toPath as unknown as Group;\r\n\r\n // Ignore transform in each subpath.\r\n to.copyTransform(identityTransform);\r\n\r\n // Will do morphPath for each individual if individualDelay is set.\r\n if (!individualDelay) {\r\n prepareMorphPath(from, to);\r\n }\r\n }\r\n\r\n (toPath as CombineMorphingPath).__isCombineMorphing = true;\r\n (toPath as CombineMorphingPath).childrenRef = function () {\r\n return toSubPathList;\r\n };\r\n\r\n function addToSubPathListToZr(zr: ZRenderType) {\r\n for (let i = 0; i < toSubPathList.length; i++) {\r\n toSubPathList[i].addSelfToZr(zr);\r\n }\r\n }\r\n saveAndModifyMethod(toPath, 'addSelfToZr', {\r\n after(zr) {\r\n addToSubPathListToZr(zr);\r\n }\r\n });\r\n saveAndModifyMethod(toPath, 'removeSelfFromZr', {\r\n after(zr) {\r\n for (let i = 0; i < toSubPathList.length; i++) {\r\n toSubPathList[i].removeSelfFromZr(zr);\r\n }\r\n }\r\n });\r\n\r\n function restoreToPath() {\r\n (toPath as CombineMorphingPath).__isCombineMorphing = false;\r\n // Mark as not in morphing\r\n (toPath as MorphingPath).__morphT = -1;\r\n (toPath as CombineMorphingPath).childrenRef = null;\r\n\r\n restoreMethod(toPath, 'addSelfToZr');\r\n restoreMethod(toPath, 'removeSelfFromZr');\r\n }\r\n\r\n const toLen = toSubPathList.length;\r\n\r\n if (individualDelay) {\r\n let animating = toLen;\r\n const eachDone = () => {\r\n animating--;\r\n if (animating === 0) {\r\n restoreToPath();\r\n oldDone && oldDone();\r\n }\r\n };\r\n // Animate each element individually.\r\n for (let i = 0; i < toLen; i++) {\r\n // TODO only call during once?\r\n const indivdualAnimationOpts = individualDelay ? defaults({\r\n delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toSubPathList[i]),\r\n done: eachDone\r\n } as ElementAnimateConfig, animationOpts) : animationOpts;\r\n morphPath(fromPathList[i], toSubPathList[i], indivdualAnimationOpts);\r\n }\r\n }\r\n else {\r\n (toPath as MorphingPath).__morphT = 0;\r\n toPath.animateTo({\r\n __morphT: 1\r\n } as any, defaults({\r\n during(p) {\r\n for (let i = 0; i < toLen; i++) {\r\n const child = toSubPathList[i] as MorphingPath;\r\n child.__morphT = (toPath as MorphingPath).__morphT;\r\n child.dirtyShape();\r\n }\r\n oldDuring && oldDuring(p);\r\n },\r\n done() {\r\n restoreToPath();\r\n for (let i = 0; i < fromList.length; i++) {\r\n restoreMethod(fromList[i], 'updateTransform');\r\n }\r\n oldDone && oldDone();\r\n }\r\n } as ElementAnimateConfig, animationOpts));\r\n }\r\n\r\n if (toPath.__zr) {\r\n addToSubPathListToZr(toPath.__zr);\r\n }\r\n\r\n return {\r\n fromIndividuals: fromPathList,\r\n toIndividuals: toSubPathList,\r\n count: toLen\r\n };\r\n}\r\nexport interface SeparateConfig extends ElementAnimateConfig {\r\n dividePath?: DividePath\r\n individualDelay?: IndividualDelay\r\n /**\r\n * If sort splitted paths so the movement between them can be more natural\r\n */\r\n // sort?: boolean\r\n // // If the from path of separate animation is doing combine animation.\r\n // // And the paths number is not same with toPathList. We need to do enter/leave animation\r\n // // on the missing/spare paths.\r\n // enter?: (el: Path) => void\r\n // leave?: (el: Path) => void\r\n}\r\n\r\n/**\r\n * Make separate morphing from one path to many paths.\r\n * Make the MorphingKind of `toPath` become `'ONE_ONE'`.\r\n */\r\nexport function separateMorph(\r\n fromPath: Path,\r\n toPathList: Path[],\r\n animationOpts: SeparateConfig\r\n) {\r\n const toLen = toPathList.length;\r\n let fromPathList: Path[] = [];\r\n\r\n const dividePath = animationOpts.dividePath || defaultDividePath;\r\n\r\n function addFromPath(fromList: Element[]) {\r\n for (let i = 0; i < fromList.length; i++) {\r\n const from = fromList[i];\r\n if (isCombineMorphing(from)) {\r\n addFromPath((from as GroupLike).childrenRef());\r\n }\r\n else if (from instanceof Path) {\r\n fromPathList.push(from);\r\n }\r\n }\r\n }\r\n // This case most happen when a combining path is called to reverse the animation\r\n // to its original separated state.\r\n if (isCombineMorphing(fromPath)) {\r\n addFromPath(fromPath.childrenRef());\r\n\r\n const fromLen = fromPathList.length;\r\n if (fromLen < toLen) {\r\n let k = 0;\r\n for (let i = fromLen; i < toLen; i++) {\r\n // Create a clone\r\n fromPathList.push(clonePath(fromPathList[k++ % fromLen]));\r\n }\r\n }\r\n // Else simply remove if fromLen > toLen\r\n fromPathList.length = toLen;\r\n }\r\n else {\r\n fromPathList = dividePath({ path: fromPath, count: toLen });\r\n const fromPathTransform = fromPath.getComputedTransform();\r\n for (let i = 0; i < fromPathList.length; i++) {\r\n // Force use transform of source path.\r\n fromPathList[i].setLocalTransform(fromPathTransform);\r\n }\r\n if (fromPathList.length !== toLen) {\r\n console.error('Invalid morphing: unmatched splitted path');\r\n return createEmptyReturn();\r\n }\r\n }\r\n\r\n fromPathList = sortPaths(fromPathList);\r\n toPathList = sortPaths(toPathList);\r\n\r\n const individualDelay = animationOpts.individualDelay;\r\n for (let i = 0; i < toLen; i++) {\r\n const indivdualAnimationOpts = individualDelay ? defaults({\r\n delay: (animationOpts.delay || 0) + individualDelay(i, toLen, fromPathList[i], toPathList[i])\r\n } as ElementAnimateConfig, animationOpts) : animationOpts;\r\n morphPath(fromPathList[i], toPathList[i], indivdualAnimationOpts);\r\n }\r\n\r\n return {\r\n fromIndividuals: fromPathList,\r\n toIndividuals: toPathList,\r\n count: toPathList.length\r\n };\r\n}\r\n\r\nexport { split as defaultDividePath };\r\n","// CompoundPath to improve performance\r\n\r\nimport Path from './Path';\r\nimport PathProxy from '../core/PathProxy';\r\n\r\nexport interface CompoundPathShape {\r\n paths: Path[]\r\n}\r\n\r\nexport default class CompoundPath extends Path {\r\n\r\n type = 'compound'\r\n\r\n shape: CompoundPathShape\r\n\r\n private _updatePathDirty() {\r\n const paths = this.shape.paths;\r\n let dirtyPath = this.shapeChanged();\r\n for (let i = 0; i < paths.length; i++) {\r\n // Mark as dirty if any subpath is dirty\r\n dirtyPath = dirtyPath || paths[i].shapeChanged();\r\n }\r\n if (dirtyPath) {\r\n this.dirtyShape();\r\n }\r\n }\r\n\r\n beforeBrush() {\r\n this._updatePathDirty();\r\n const paths = this.shape.paths || [];\r\n const scale = this.getGlobalScale();\r\n // Update path scale\r\n for (let i = 0; i < paths.length; i++) {\r\n if (!paths[i].path) {\r\n paths[i].createPathProxy();\r\n }\r\n paths[i].path.setScale(scale[0], scale[1], paths[i].segmentIgnoreThreshold);\r\n }\r\n }\r\n\r\n buildPath(ctx: PathProxy | CanvasRenderingContext2D, shape: CompoundPathShape) {\r\n const paths = shape.paths || [];\r\n for (let i = 0; i < paths.length; i++) {\r\n paths[i].buildPath(ctx, paths[i].shape, true);\r\n }\r\n }\r\n\r\n afterBrush() {\r\n const paths = this.shape.paths || [];\r\n for (let i = 0; i < paths.length; i++) {\r\n paths[i].pathUpdated();\r\n }\r\n }\r\n\r\n getBoundingRect() {\r\n this._updatePathDirty.call(this);\r\n return Path.prototype.getBoundingRect.call(this);\r\n }\r\n}","/**\r\n * Displayable for incremental rendering. It will be rendered in a separate layer\r\n * IncrementalDisplay have two main methods. `clearDisplayables` and `addDisplayables`\r\n * addDisplayables will render the added displayables incremetally.\r\n *\r\n * It use a notClear flag to tell the painter don't clear the layer if it's the first element.\r\n *\r\n * It's not available for SVG rendering.\r\n */\r\nimport Displayble from './Displayable';\r\nimport BoundingRect from '../core/BoundingRect';\r\nimport { MatrixArray } from '../core/matrix';\r\nimport Group from './Group';\r\n\r\nconst m: MatrixArray = [];\r\n// TODO Style override ?\r\n\r\nexport default class IncrementalDisplayable extends Displayble {\r\n\r\n notClear: boolean = true\r\n\r\n incremental = true\r\n\r\n private _displayables: Displayble[] = []\r\n private _temporaryDisplayables: Displayble[] = []\r\n\r\n private _cursor = 0\r\n\r\n traverse(\r\n cb: (this: T, el: this) => void,\r\n context: T\r\n ) {\r\n cb.call(context, this);\r\n }\r\n\r\n useStyle() {\r\n // Use an empty style\r\n // PENDING\r\n this.style = {};\r\n }\r\n\r\n // getCurrentCursor / updateCursorAfterBrush\r\n // is used in graphic.ts. It's not provided for developers\r\n getCursor() {\r\n return this._cursor;\r\n }\r\n // Update cursor after brush.\r\n innerAfterBrush() {\r\n this._cursor = this._displayables.length;\r\n }\r\n\r\n clearDisplaybles() {\r\n this._displayables = [];\r\n this._temporaryDisplayables = [];\r\n this._cursor = 0;\r\n this.markRedraw();\r\n\r\n this.notClear = false;\r\n }\r\n\r\n clearTemporalDisplayables() {\r\n this._temporaryDisplayables = [];\r\n }\r\n\r\n addDisplayable(displayable: Displayble, notPersistent?: boolean) {\r\n if (notPersistent) {\r\n this._temporaryDisplayables.push(displayable);\r\n }\r\n else {\r\n this._displayables.push(displayable);\r\n }\r\n this.markRedraw();\r\n }\r\n\r\n addDisplayables(displayables: Displayble[], notPersistent?: boolean) {\r\n notPersistent = notPersistent || false;\r\n for (let i = 0; i < displayables.length; i++) {\r\n this.addDisplayable(displayables[i], notPersistent);\r\n }\r\n }\r\n\r\n getDisplayables(): Displayble[] {\r\n return this._displayables;\r\n }\r\n\r\n getTemporalDisplayables(): Displayble[] {\r\n return this._temporaryDisplayables;\r\n }\r\n\r\n eachPendingDisplayable(cb: (displayable: Displayble) => void) {\r\n for (let i = this._cursor; i < this._displayables.length; i++) {\r\n cb && cb(this._displayables[i]);\r\n }\r\n for (let i = 0; i < this._temporaryDisplayables.length; i++) {\r\n cb && cb(this._temporaryDisplayables[i]);\r\n }\r\n }\r\n\r\n update() {\r\n this.updateTransform();\r\n for (let i = this._cursor; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n // PENDING\r\n displayable.parent = this as unknown as Group;\r\n displayable.update();\r\n displayable.parent = null;\r\n }\r\n for (let i = 0; i < this._temporaryDisplayables.length; i++) {\r\n const displayable = this._temporaryDisplayables[i];\r\n // PENDING\r\n displayable.parent = this as unknown as Group;\r\n displayable.update();\r\n displayable.parent = null;\r\n }\r\n }\r\n\r\n getBoundingRect() {\r\n if (!this._rect) {\r\n const rect = new BoundingRect(Infinity, Infinity, -Infinity, -Infinity);\r\n for (let i = 0; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n const childRect = displayable.getBoundingRect().clone();\r\n if (displayable.needLocalTransform()) {\r\n childRect.applyTransform(displayable.getLocalTransform(m));\r\n }\r\n rect.union(childRect);\r\n }\r\n this._rect = rect;\r\n }\r\n return this._rect;\r\n }\r\n\r\n contain(x: number, y: number): boolean {\r\n const localPos = this.transformCoordToLocal(x, y);\r\n const rect = this.getBoundingRect();\r\n\r\n if (rect.contain(localPos[0], localPos[1])) {\r\n for (let i = 0; i < this._displayables.length; i++) {\r\n const displayable = this._displayables[i];\r\n if (displayable.contain(x, y)) {\r\n return true;\r\n }\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n}","\r\nimport LRU from '../../core/LRU';\r\nimport { platformApi } from '../../core/platform';\r\nimport { ImageLike } from '../../core/types';\r\n\r\nconst globalImageCache = new LRU(50);\r\n\r\ntype PendingWrap = {\r\n hostEl: {dirty: () => void}\r\n cb: (image: ImageLike, payload: any) => void\r\n cbPayload: any\r\n}\r\n\r\ntype CachedImageObj = {\r\n image: ImageLike\r\n pending: PendingWrap[]\r\n}\r\n\r\nexport function findExistImage(newImageOrSrc: string | ImageLike): ImageLike {\r\n if (typeof newImageOrSrc === 'string') {\r\n const cachedImgObj = globalImageCache.get(newImageOrSrc);\r\n return cachedImgObj && cachedImgObj.image;\r\n }\r\n else {\r\n return newImageOrSrc;\r\n }\r\n}\r\n\r\n/**\r\n * Caution: User should cache loaded images, but not just count on LRU.\r\n * Consider if required images more than LRU size, will dead loop occur?\r\n *\r\n * @param newImageOrSrc\r\n * @param image Existent image.\r\n * @param hostEl For calling `dirty`.\r\n * @param onload params: (image, cbPayload)\r\n * @param cbPayload Payload on cb calling.\r\n * @return image\r\n */\r\nexport function createOrUpdateImage(\r\n newImageOrSrc: string | ImageLike,\r\n image: ImageLike,\r\n hostEl: { dirty: () => void },\r\n onload?: (image: ImageLike, payload: T) => void,\r\n cbPayload?: T\r\n) {\r\n if (!newImageOrSrc) {\r\n return image;\r\n }\r\n else if (typeof newImageOrSrc === 'string') {\r\n\r\n // Image should not be loaded repeatly.\r\n if ((image && (image as any).__zrImageSrc === newImageOrSrc) || !hostEl) {\r\n return image;\r\n }\r\n\r\n // Only when there is no existent image or existent image src\r\n // is different, this method is responsible for load.\r\n const cachedImgObj = globalImageCache.get(newImageOrSrc);\r\n\r\n const pendingWrap = {hostEl: hostEl, cb: onload, cbPayload: cbPayload};\r\n\r\n if (cachedImgObj) {\r\n image = cachedImgObj.image;\r\n !isImageReady(image) && cachedImgObj.pending.push(pendingWrap);\r\n }\r\n else {\r\n image = platformApi.loadImage(\r\n newImageOrSrc, imageOnLoad, imageOnLoad\r\n );\r\n (image as any).__zrImageSrc = newImageOrSrc;\r\n\r\n globalImageCache.put(\r\n newImageOrSrc,\r\n (image as any).__cachedImgObj = {\r\n image: image,\r\n pending: [pendingWrap]\r\n }\r\n );\r\n }\r\n\r\n return image;\r\n }\r\n // newImageOrSrc is an HTMLImageElement or HTMLCanvasElement or Canvas\r\n else {\r\n return newImageOrSrc;\r\n }\r\n}\r\n\r\nfunction imageOnLoad(this: any) {\r\n const cachedImgObj = this.__cachedImgObj;\r\n this.onload = this.onerror = this.__cachedImgObj = null;\r\n\r\n for (let i = 0; i < cachedImgObj.pending.length; i++) {\r\n const pendingWrap = cachedImgObj.pending[i];\r\n const cb = pendingWrap.cb;\r\n cb && cb(this, pendingWrap.cbPayload);\r\n pendingWrap.hostEl.dirty();\r\n }\r\n cachedImgObj.pending.length = 0;\r\n}\r\n\r\nexport function isImageReady(image: ImageLike) {\r\n return image && image.width && image.height;\r\n}\r\n\r\n","import * as imageHelper from '../helper/image';\nimport {\n extend,\n retrieve2,\n retrieve3,\n reduce\n} from '../../core/util';\nimport { TextAlign, TextVerticalAlign, ImageLike, Dictionary } from '../../core/types';\nimport { TextStyleProps } from '../Text';\nimport { getLineHeight, getWidth, parsePercent } from '../../contain/text';\n\nconst STYLE_REG = /\\{([a-zA-Z0-9_]+)\\|([^}]*)\\}/g;\n\ninterface InnerTruncateOption {\n maxIteration?: number\n // If truncate result are less than minChar, ellipsis will not show\n // which is better for user hint in some cases\n minChar?: number\n // When all truncated, use the placeholder\n placeholder?: string\n\n maxIterations?: number\n}\n\ninterface InnerPreparedTruncateOption extends Required {\n font: string\n\n ellipsis: string\n ellipsisWidth: number\n contentWidth: number\n\n containerWidth: number\n cnCharWidth: number\n ascCharWidth: number\n}\n\n/**\n * Show ellipsis if overflow.\n */\nexport function truncateText(\n text: string,\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): string {\n const out = {} as Parameters[0];\n truncateText2(out, text, containerWidth, font, ellipsis, options);\n return out.text;\n}\n\n// PENDING: not sure whether `truncateText` is used outside zrender, since it has an `export`\n// specifier. So keep it and perform the interface modification in `truncateText2`.\nfunction truncateText2(\n out: {text: string, isTruncated: boolean},\n text: string,\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): void {\n if (!containerWidth) {\n out.text = '';\n out.isTruncated = false;\n return;\n }\n\n const textLines = (text + '').split('\\n');\n options = prepareTruncateOptions(containerWidth, font, ellipsis, options);\n\n // FIXME\n // It is not appropriate that every line has '...' when truncate multiple lines.\n let isTruncated = false;\n const truncateOut = {} as Parameters[0];\n for (let i = 0, len = textLines.length; i < len; i++) {\n truncateSingleLine(truncateOut, textLines[i], options as InnerPreparedTruncateOption);\n textLines[i] = truncateOut.textLine;\n isTruncated = isTruncated || truncateOut.isTruncated;\n }\n\n out.text = textLines.join('\\n');\n out.isTruncated = isTruncated;\n}\n\nfunction prepareTruncateOptions(\n containerWidth: number,\n font: string,\n ellipsis?: string,\n options?: InnerTruncateOption\n): InnerPreparedTruncateOption {\n options = options || {};\n let preparedOpts = extend({}, options) as InnerPreparedTruncateOption;\n\n preparedOpts.font = font;\n ellipsis = retrieve2(ellipsis, '...');\n preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);\n const minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);\n // FIXME\n // Other languages?\n preparedOpts.cnCharWidth = getWidth('国', font);\n // FIXME\n // Consider proportional font?\n const ascCharWidth = preparedOpts.ascCharWidth = getWidth('a', font);\n preparedOpts.placeholder = retrieve2(options.placeholder, '');\n\n // Example 1: minChar: 3, text: 'asdfzxcv', truncate result: 'asdf', but not: 'a...'.\n // Example 2: minChar: 3, text: '维度', truncate result: '维', but not: '...'.\n let contentWidth = containerWidth = Math.max(0, containerWidth - 1); // Reserve some gap.\n for (let i = 0; i < minChar && contentWidth >= ascCharWidth; i++) {\n contentWidth -= ascCharWidth;\n }\n\n let ellipsisWidth = getWidth(ellipsis, font);\n if (ellipsisWidth > contentWidth) {\n ellipsis = '';\n ellipsisWidth = 0;\n }\n\n contentWidth = containerWidth - ellipsisWidth;\n\n preparedOpts.ellipsis = ellipsis;\n preparedOpts.ellipsisWidth = ellipsisWidth;\n preparedOpts.contentWidth = contentWidth;\n preparedOpts.containerWidth = containerWidth;\n\n return preparedOpts;\n}\n\nfunction truncateSingleLine(\n out: {textLine: string, isTruncated: boolean},\n textLine: string,\n options: InnerPreparedTruncateOption\n): void {\n const containerWidth = options.containerWidth;\n const font = options.font;\n const contentWidth = options.contentWidth;\n\n if (!containerWidth) {\n out.textLine = '';\n out.isTruncated = false;\n return;\n }\n\n let lineWidth = getWidth(textLine, font);\n\n if (lineWidth <= containerWidth) {\n out.textLine = textLine;\n out.isTruncated = false;\n return;\n }\n\n for (let j = 0; ; j++) {\n if (lineWidth <= contentWidth || j >= options.maxIterations) {\n textLine += options.ellipsis;\n break;\n }\n\n const subLength = j === 0\n ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth)\n : lineWidth > 0\n ? Math.floor(textLine.length * contentWidth / lineWidth)\n : 0;\n\n textLine = textLine.substr(0, subLength);\n lineWidth = getWidth(textLine, font);\n }\n\n if (textLine === '') {\n textLine = options.placeholder;\n }\n\n out.textLine = textLine;\n out.isTruncated = true;\n}\n\nfunction estimateLength(\n text: string, contentWidth: number, ascCharWidth: number, cnCharWidth: number\n): number {\n let width = 0;\n let i = 0;\n for (let len = text.length; i < len && width < contentWidth; i++) {\n const charCode = text.charCodeAt(i);\n width += (0 <= charCode && charCode <= 127) ? ascCharWidth : cnCharWidth;\n }\n return i;\n}\n\nexport interface PlainTextContentBlock {\n lineHeight: number\n // Line height of actual content.\n calculatedLineHeight: number\n\n contentWidth: number\n contentHeight: number\n\n width: number\n height: number\n\n /**\n * Real text width containing padding.\n * It should be the same as `width` if background is rendered\n * and `width` is set by user.\n */\n outerWidth: number\n outerHeight: number\n\n lines: string[]\n\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`\n isTruncated: boolean\n}\n\nexport function parsePlainText(\n text: string,\n style?: TextStyleProps\n): PlainTextContentBlock {\n text != null && (text += '');\n\n // textPadding has been normalized\n const overflow = style.overflow;\n const padding = style.padding as number[];\n const font = style.font;\n const truncate = overflow === 'truncate';\n const calculatedLineHeight = getLineHeight(font);\n const lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);\n const bgColorDrawn = !!(style.backgroundColor);\n\n const truncateLineOverflow = style.lineOverflow === 'truncate';\n let isTruncated = false;\n\n let width = style.width;\n let lines: string[];\n\n if (width != null && (overflow === 'break' || overflow === 'breakAll')) {\n lines = text ? wrapText(text, style.font, width, overflow === 'breakAll', 0).lines : [];\n }\n else {\n lines = text ? text.split('\\n') : [];\n }\n\n const contentHeight = lines.length * lineHeight;\n const height = retrieve2(style.height, contentHeight);\n\n // Truncate lines.\n if (contentHeight > height && truncateLineOverflow) {\n const lineCount = Math.floor(height / lineHeight);\n\n isTruncated = isTruncated || (lines.length > lineCount);\n lines = lines.slice(0, lineCount);\n\n // TODO If show ellipse for line truncate\n // if (style.ellipsis) {\n // const options = prepareTruncateOptions(width, font, style.ellipsis, {\n // minChar: style.truncateMinChar,\n // placeholder: style.placeholder\n // });\n // lines[lineCount - 1] = truncateSingleLine(lastLine, options);\n // }\n }\n\n if (text && truncate && width != null) {\n const options = prepareTruncateOptions(width, font, style.ellipsis, {\n minChar: style.truncateMinChar,\n placeholder: style.placeholder\n });\n // Having every line has '...' when truncate multiple lines.\n const singleOut = {} as Parameters[0];\n for (let i = 0; i < lines.length; i++) {\n truncateSingleLine(singleOut, lines[i], options);\n lines[i] = singleOut.textLine;\n isTruncated = isTruncated || singleOut.isTruncated;\n }\n }\n\n // Calculate real text width and height\n let outerHeight = height;\n let contentWidth = 0;\n for (let i = 0; i < lines.length; i++) {\n contentWidth = Math.max(getWidth(lines[i], font), contentWidth);\n }\n if (width == null) {\n // When width is not explicitly set, use outerWidth as width.\n width = contentWidth;\n }\n\n let outerWidth = contentWidth;\n if (padding) {\n outerHeight += padding[0] + padding[2];\n outerWidth += padding[1] + padding[3];\n width += padding[1] + padding[3];\n }\n\n if (bgColorDrawn) {\n // When render background, outerWidth should be the same as width.\n outerWidth = width;\n }\n\n return {\n lines: lines,\n height: height,\n outerWidth: outerWidth,\n outerHeight: outerHeight,\n lineHeight: lineHeight,\n calculatedLineHeight: calculatedLineHeight,\n contentWidth: contentWidth,\n contentHeight: contentHeight,\n width: width,\n isTruncated: isTruncated\n };\n}\n\nclass RichTextToken {\n styleName: string\n text: string\n width: number\n height: number\n\n // Inner height exclude padding\n innerHeight: number\n\n // Width and height of actual text content.\n contentHeight: number\n contentWidth: number\n\n lineHeight: number\n font: string\n align: TextAlign\n verticalAlign: TextVerticalAlign\n\n textPadding: number[]\n percentWidth?: string\n\n isLineHolder: boolean\n}\nclass RichTextLine {\n lineHeight: number\n width: number\n tokens: RichTextToken[] = []\n\n constructor(tokens?: RichTextToken[]) {\n if (tokens) {\n this.tokens = tokens;\n }\n }\n}\nexport class RichTextContentBlock {\n // width/height of content\n width: number = 0\n height: number = 0\n // Calculated text height\n contentWidth: number = 0\n contentHeight: number = 0\n // outerWidth/outerHeight with padding\n outerWidth: number = 0\n outerHeight: number = 0\n lines: RichTextLine[] = []\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`\n isTruncated: boolean = false\n}\n\ntype WrapInfo = {\n width: number,\n accumWidth: number,\n breakAll: boolean\n}\n/**\n * For example: 'some text {a|some text}other text{b|some text}xxx{c|}xxx'\n * Also consider 'bbbb{a|xxx\\nzzz}xxxx\\naaaa'.\n * If styleName is undefined, it is plain text.\n */\nexport function parseRichText(text: string, style: TextStyleProps): RichTextContentBlock {\n const contentBlock = new RichTextContentBlock();\n\n text != null && (text += '');\n if (!text) {\n return contentBlock;\n }\n\n const topWidth = style.width;\n const topHeight = style.height;\n const overflow = style.overflow;\n let wrapInfo: WrapInfo = (overflow === 'break' || overflow === 'breakAll') && topWidth != null\n ? {width: topWidth, accumWidth: 0, breakAll: overflow === 'breakAll'}\n : null;\n\n let lastIndex = STYLE_REG.lastIndex = 0;\n let result;\n while ((result = STYLE_REG.exec(text)) != null) {\n const matchedIndex = result.index;\n if (matchedIndex > lastIndex) {\n pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);\n }\n pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);\n lastIndex = STYLE_REG.lastIndex;\n }\n\n if (lastIndex < text.length) {\n pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);\n }\n\n // For `textWidth: xx%`\n let pendingList = [];\n\n let calculatedHeight = 0;\n let calculatedWidth = 0;\n\n const stlPadding = style.padding as number[];\n\n const truncate = overflow === 'truncate';\n const truncateLine = style.lineOverflow === 'truncate';\n const tmpTruncateOut = {} as Parameters[0];\n\n // let prevToken: RichTextToken;\n\n function finishLine(line: RichTextLine, lineWidth: number, lineHeight: number) {\n line.width = lineWidth;\n line.lineHeight = lineHeight;\n calculatedHeight += lineHeight;\n calculatedWidth = Math.max(calculatedWidth, lineWidth);\n }\n // Calculate layout info of tokens.\n outer: for (let i = 0; i < contentBlock.lines.length; i++) {\n const line = contentBlock.lines[i];\n let lineHeight = 0;\n let lineWidth = 0;\n\n for (let j = 0; j < line.tokens.length; j++) {\n const token = line.tokens[j];\n const tokenStyle = token.styleName && style.rich[token.styleName] || {};\n // textPadding should not inherit from style.\n const textPadding = token.textPadding = tokenStyle.padding as number[];\n const paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;\n\n const font = token.font = tokenStyle.font || style.font;\n\n token.contentHeight = getLineHeight(font);\n // textHeight can be used when textVerticalAlign is specified in token.\n let tokenHeight = retrieve2(\n // textHeight should not be inherited, consider it can be specified\n // as box height of the block.\n tokenStyle.height, token.contentHeight\n );\n token.innerHeight = tokenHeight;\n\n textPadding && (tokenHeight += textPadding[0] + textPadding[2]);\n token.height = tokenHeight;\n // Inlcude padding in lineHeight.\n token.lineHeight = retrieve3(\n tokenStyle.lineHeight, style.lineHeight, tokenHeight\n );\n\n token.align = tokenStyle && tokenStyle.align || style.align;\n token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || 'middle';\n\n if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {\n // TODO Add ellipsis on the previous token.\n // prevToken.text =\n const originalLength = contentBlock.lines.length;\n if (j > 0) {\n line.tokens = line.tokens.slice(0, j);\n finishLine(line, lineWidth, lineHeight);\n contentBlock.lines = contentBlock.lines.slice(0, i + 1);\n }\n else {\n contentBlock.lines = contentBlock.lines.slice(0, i);\n }\n contentBlock.isTruncated = contentBlock.isTruncated || (contentBlock.lines.length < originalLength);\n break outer;\n }\n\n let styleTokenWidth = tokenStyle.width;\n let tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === 'auto';\n\n // Percent width, can be `100%`, can be used in drawing separate\n // line when box width is needed to be auto.\n if (typeof styleTokenWidth === 'string' && styleTokenWidth.charAt(styleTokenWidth.length - 1) === '%') {\n token.percentWidth = styleTokenWidth;\n pendingList.push(token);\n\n token.contentWidth = getWidth(token.text, font);\n // Do not truncate in this case, because there is no user case\n // and it is too complicated.\n }\n else {\n if (tokenWidthNotSpecified) {\n // FIXME: If image is not loaded and textWidth is not specified, calling\n // `getBoundingRect()` will not get correct result.\n const textBackgroundColor = tokenStyle.backgroundColor;\n let bgImg = textBackgroundColor && (textBackgroundColor as { image: ImageLike }).image;\n\n if (bgImg) {\n bgImg = imageHelper.findExistImage(bgImg);\n if (imageHelper.isImageReady(bgImg)) {\n // Update token width from image size.\n token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);\n }\n }\n }\n\n const remainTruncWidth = truncate && topWidth != null\n ? topWidth - lineWidth : null;\n\n if (remainTruncWidth != null && remainTruncWidth < token.width) {\n if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {\n token.text = '';\n token.width = token.contentWidth = 0;\n }\n else {\n truncateText2(\n tmpTruncateOut,\n token.text, remainTruncWidth - paddingH, font, style.ellipsis,\n {minChar: style.truncateMinChar}\n );\n token.text = tmpTruncateOut.text;\n contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;\n token.width = token.contentWidth = getWidth(token.text, font);\n }\n }\n else {\n token.contentWidth = getWidth(token.text, font);\n }\n }\n\n token.width += paddingH;\n\n lineWidth += token.width;\n tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));\n\n // prevToken = token;\n }\n\n finishLine(line, lineWidth, lineHeight);\n }\n\n contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);\n contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);\n contentBlock.contentHeight = calculatedHeight;\n contentBlock.contentWidth = calculatedWidth;\n\n if (stlPadding) {\n contentBlock.outerWidth += stlPadding[1] + stlPadding[3];\n contentBlock.outerHeight += stlPadding[0] + stlPadding[2];\n }\n\n for (let i = 0; i < pendingList.length; i++) {\n const token = pendingList[i];\n const percentWidth = token.percentWidth;\n // Should not base on outerWidth, because token can not be placed out of padding.\n token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;\n }\n\n return contentBlock;\n}\n\ntype TokenStyle = TextStyleProps['rich'][string];\n\nfunction pushTokens(\n block: RichTextContentBlock,\n str: string,\n style: TextStyleProps,\n wrapInfo: WrapInfo,\n styleName?: string\n) {\n const isEmptyStr = str === '';\n const tokenStyle: TokenStyle = styleName && style.rich[styleName] || {};\n const lines = block.lines;\n const font = tokenStyle.font || style.font;\n let newLine = false;\n let strLines;\n let linesWidths;\n\n if (wrapInfo) {\n const tokenPadding = tokenStyle.padding as number[];\n let tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;\n if (tokenStyle.width != null && tokenStyle.width !== 'auto') {\n // Wrap the whole token if tokenWidth if fixed.\n const outerWidth = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;\n if (lines.length > 0) { // Not first line\n if (outerWidth + wrapInfo.accumWidth > wrapInfo.width) {\n // TODO Support wrap text in token.\n strLines = str.split('\\n');\n newLine = true;\n }\n }\n\n wrapInfo.accumWidth = outerWidth;\n }\n else {\n const res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);\n wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;\n linesWidths = res.linesWidths;\n strLines = res.lines;\n }\n }\n else {\n strLines = str.split('\\n');\n }\n\n for (let i = 0; i < strLines.length; i++) {\n const text = strLines[i];\n const token = new RichTextToken();\n token.styleName = styleName;\n token.text = text;\n token.isLineHolder = !text && !isEmptyStr;\n\n if (typeof tokenStyle.width === 'number') {\n token.width = tokenStyle.width;\n }\n else {\n token.width = linesWidths\n ? linesWidths[i] // Caculated width in the wrap\n : getWidth(text, font);\n }\n\n // The first token should be appended to the last line if not new line.\n if (!i && !newLine) {\n const tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;\n\n // Consider cases:\n // (1) ''.split('\\n') => ['', '\\n', ''], the '' at the first item\n // (which is a placeholder) should be replaced by new token.\n // (2) A image backage, where token likes {a|}.\n // (3) A redundant '' will affect textAlign in line.\n // (4) tokens with the same tplName should not be merged, because\n // they should be displayed in different box (with border and padding).\n const tokensLen = tokens.length;\n (tokensLen === 1 && tokens[0].isLineHolder)\n ? (tokens[0] = token)\n // Consider text is '', only insert when it is the \"lineHolder\" or\n // \"emptyStr\". Otherwise a redundant '' will affect textAlign in line.\n : ((text || !tokensLen || isEmptyStr) && tokens.push(token));\n }\n // Other tokens always start a new line.\n else {\n // If there is '', insert it as a placeholder.\n lines.push(new RichTextLine([token]));\n }\n }\n}\n\n\nfunction isAlphabeticLetter(ch: string) {\n // Unicode Character Ranges\n // https://jrgraphix.net/research/unicode_blocks.php\n // The following ranges may not cover all letter ranges but only the more\n // popular ones. Developers could make pull requests when they find those\n // not covered.\n let code = ch.charCodeAt(0);\n return code >= 0x20 && code <= 0x24F // Latin\n || code >= 0x370 && code <= 0x10FF // Greek, Coptic, Cyrilic, and etc.\n || code >= 0x1200 && code <= 0x13FF // Ethiopic and Cherokee\n || code >= 0x1E00 && code <= 0x206F; // Latin and Greek extended\n}\n\nconst breakCharMap = reduce(',&?/;] '.split(''), function (obj, ch) {\n obj[ch] = true;\n return obj;\n}, {} as Dictionary);\n/**\n * If break by word. For latin languages.\n */\nfunction isWordBreakChar(ch: string) {\n if (isAlphabeticLetter(ch)) {\n if (breakCharMap[ch]) {\n return true;\n }\n return false;\n }\n return true;\n}\n\nfunction wrapText(\n text: string,\n font: string,\n lineWidth: number,\n isBreakAll: boolean,\n lastAccumWidth: number\n) {\n let lines: string[] = [];\n let linesWidths: number[] = [];\n let line = '';\n let currentWord = '';\n let currentWordWidth = 0;\n let accumWidth = 0;\n\n for (let i = 0; i < text.length; i++) {\n\n const ch = text.charAt(i);\n if (ch === '\\n') {\n if (currentWord) {\n line += currentWord;\n accumWidth += currentWordWidth;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n // Reset\n line = '';\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = 0;\n continue;\n }\n\n const chWidth = getWidth(ch, font);\n const inWord = isBreakAll ? false : !isWordBreakChar(ch);\n\n if (!lines.length\n ? lastAccumWidth + accumWidth + chWidth > lineWidth\n : accumWidth + chWidth > lineWidth\n ) {\n if (!accumWidth) { // If nothing appended yet.\n if (inWord) {\n // The word length is still too long for one line\n // Force break the word\n lines.push(currentWord);\n linesWidths.push(currentWordWidth);\n\n currentWord = ch;\n currentWordWidth = chWidth;\n }\n else {\n // lineWidth is too small for ch\n lines.push(ch);\n linesWidths.push(chWidth);\n }\n }\n else if (line || currentWord) {\n if (inWord) {\n if (!line) {\n // The one word is still too long for one line\n // Force break the word\n // TODO Keep the word?\n line = currentWord;\n currentWord = '';\n currentWordWidth = 0;\n accumWidth = currentWordWidth;\n }\n\n lines.push(line);\n linesWidths.push(accumWidth - currentWordWidth);\n\n // Break the whole word\n currentWord += ch;\n currentWordWidth += chWidth;\n line = '';\n accumWidth = currentWordWidth;\n }\n else {\n // Append lastWord if have\n if (currentWord) {\n line += currentWord;\n currentWord = '';\n currentWordWidth = 0;\n }\n lines.push(line);\n linesWidths.push(accumWidth);\n\n line = ch;\n accumWidth = chWidth;\n }\n }\n\n continue;\n }\n\n accumWidth += chWidth;\n\n if (inWord) {\n currentWord += ch;\n currentWordWidth += chWidth;\n }\n else {\n // Append whole word\n if (currentWord) {\n line += currentWord;\n // Reset\n currentWord = '';\n currentWordWidth = 0;\n }\n\n // Append character\n line += ch;\n }\n }\n\n if (!lines.length && !line) {\n line = text;\n currentWord = '';\n currentWordWidth = 0;\n }\n\n // Append last line.\n if (currentWord) {\n line += currentWord;\n }\n if (line) {\n lines.push(line);\n linesWidths.push(accumWidth);\n }\n\n if (lines.length === 1) {\n // No new line.\n accumWidth += lastAccumWidth;\n }\n\n return {\n // Accum width of last line\n accumWidth,\n lines: lines,\n linesWidths\n };\n}","/**\n * RichText is a container that manages complex text label.\n * It will parse text string and create sub displayble elements respectively.\n */\nimport { TextAlign, TextVerticalAlign, ImageLike, Dictionary, MapToType, FontWeight, FontStyle } from '../core/types';\nimport { parseRichText, parsePlainText } from './helper/parseText';\nimport TSpan, { TSpanStyleProps } from './TSpan';\nimport { retrieve2, each, normalizeCssArray, trim, retrieve3, extend, keys, defaults } from '../core/util';\nimport { adjustTextX, adjustTextY } from '../contain/text';\nimport ZRImage from './Image';\nimport Rect from './shape/Rect';\nimport BoundingRect from '../core/BoundingRect';\nimport { MatrixArray } from '../core/matrix';\nimport Displayable, {\n DisplayableStatePropNames,\n DisplayableProps,\n DEFAULT_COMMON_ANIMATION_PROPS\n} from './Displayable';\nimport { ZRenderType } from '../zrender';\nimport Animator from '../animation/Animator';\nimport Transformable from '../core/Transformable';\nimport { ElementCommonState } from '../Element';\nimport { GroupLike } from './Group';\nimport { DEFAULT_FONT, DEFAULT_FONT_SIZE } from '../core/platform';\n\ntype TextContentBlock = ReturnType\ntype TextLine = TextContentBlock['lines'][0]\ntype TextToken = TextLine['tokens'][0]\n\n// TODO Default value?\nexport interface TextStylePropsPart {\n // TODO Text is assigned inside zrender\n text?: string\n\n fill?: string\n stroke?: string\n strokeNoScale?: boolean\n\n opacity?: number\n fillOpacity?: number\n strokeOpacity?: number\n /**\n * textStroke may be set as some color as a default\n * value in upper applicaion, where the default value\n * of lineWidth should be 0 to make sure that\n * user can choose to do not use text stroke.\n */\n lineWidth?: number\n lineDash?: false | number[]\n lineDashOffset?: number\n borderDash?: false | number[]\n borderDashOffset?: number\n\n /**\n * If `fontSize` or `fontFamily` exists, `font` will be reset by\n * `fontSize`, `fontStyle`, `fontWeight`, `fontFamily`.\n * So do not visit it directly in upper application (like echarts),\n * but use `contain/text#makeFont` instead.\n */\n font?: string\n /**\n * The same as font. Use font please.\n * @deprecated\n */\n textFont?: string\n\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontStyle?: FontStyle\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontWeight?: FontWeight\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n */\n fontFamily?: string\n /**\n * It helps merging respectively, rather than parsing an entire font string.\n * Should be 12 but not '12px'.\n */\n fontSize?: number | string\n\n align?: TextAlign\n verticalAlign?: TextVerticalAlign\n\n /**\n * Line height. Default to be text height of '国'\n */\n lineHeight?: number\n /**\n * Width of text block. Not include padding\n * Used for background, truncate, wrap\n */\n width?: number | string\n /**\n * Height of text block. Not include padding\n * Used for background, truncate\n */\n height?: number\n /**\n * Reserved for special functinality, like 'hr'.\n */\n tag?: string\n\n textShadowColor?: string\n textShadowBlur?: number\n textShadowOffsetX?: number\n textShadowOffsetY?: number\n\n // Shadow, background, border of text box.\n backgroundColor?: string | {\n image: ImageLike | string\n }\n\n /**\n * Can be `2` or `[2, 4]` or `[2, 3, 4, 5]`\n */\n padding?: number | number[]\n /**\n * Margin of label. Used when layouting the label.\n */\n margin?: number\n\n borderColor?: string\n borderWidth?: number\n borderRadius?: number | number[]\n\n /**\n * Shadow color for background box.\n */\n shadowColor?: string\n /**\n * Shadow blur for background box.\n */\n shadowBlur?: number\n /**\n * Shadow offset x for background box.\n */\n shadowOffsetX?: number\n /**\n * Shadow offset y for background box.\n */\n shadowOffsetY?: number\n}\nexport interface TextStyleProps extends TextStylePropsPart {\n\n text?: string\n\n x?: number\n y?: number\n\n /**\n * Only support number in the top block.\n */\n width?: number\n /**\n * Text styles for rich text.\n */\n rich?: Dictionary\n\n /**\n * Strategy when calculated text width exceeds textWidth.\n * break: break by word\n * break: will break inside the word\n * truncate: truncate the text and show ellipsis\n * Do nothing if not set\n */\n overflow?: 'break' | 'breakAll' | 'truncate' | 'none'\n\n /**\n * Strategy when text lines exceeds textHeight.\n * Do nothing if not set\n */\n lineOverflow?: 'truncate'\n\n /**\n * Epllipsis used if text is truncated\n */\n ellipsis?: string\n /**\n * Placeholder used if text is truncated to empty\n */\n placeholder?: string\n /**\n * Min characters for truncating\n */\n truncateMinChar?: number\n}\n\nexport interface TextProps extends DisplayableProps {\n style?: TextStyleProps\n\n zlevel?: number\n z?: number\n z2?: number\n\n culling?: boolean\n cursor?: string\n}\n\nexport type TextState = Pick & ElementCommonState\n\nexport type DefaultTextStyle = Pick & {\n autoStroke?: boolean\n};\n\nconst DEFAULT_RICH_TEXT_COLOR = {\n fill: '#000'\n};\nconst DEFAULT_STROKE_LINE_WIDTH = 2;\n\n// const DEFAULT_TEXT_STYLE: TextStyleProps = {\n// x: 0,\n// y: 0,\n// fill: '#000',\n// stroke: null,\n// opacity: 0,\n// fillOpacity:\n// }\n\nexport const DEFAULT_TEXT_ANIMATION_PROPS: MapToType = {\n style: defaults, MapToType>({\n fill: true,\n stroke: true,\n fillOpacity: true,\n strokeOpacity: true,\n lineWidth: true,\n fontSize: true,\n lineHeight: true,\n width: true,\n height: true,\n textShadowColor: true,\n textShadowBlur: true,\n textShadowOffsetX: true,\n textShadowOffsetY: true,\n backgroundColor: true,\n padding: true, // TODO needs normalize padding before animate\n borderColor: true,\n borderWidth: true,\n borderRadius: true // TODO needs normalize radius before animate\n }, DEFAULT_COMMON_ANIMATION_PROPS.style)\n };\n\n\ninterface ZRText {\n animate(key?: '', loop?: boolean): Animator\n animate(key: 'style', loop?: boolean): Animator\n\n getState(stateName: string): TextState\n ensureState(stateName: string): TextState\n\n states: Dictionary\n stateProxy: (stateName: string) => TextState\n}\n\nclass ZRText extends Displayable implements GroupLike {\n\n type = 'text'\n\n style: TextStyleProps\n\n /**\n * How to handling label overlap\n *\n * hidden:\n */\n overlap: 'hidden' | 'show' | 'blur'\n\n /**\n * Will use this to calculate transform matrix\n * instead of Element itseelf if it's give.\n * Not exposed to developers\n */\n innerTransformable: Transformable\n\n // Be `true` if and only if the result text is modified due to overflow, due to\n // settings on either `overflow` or `lineOverflow`. Based on this the caller can\n // take some action like showing the original text in a particular tip.\n // Only take effect after rendering. So do not visit it before it.\n isTruncated: boolean\n\n private _children: (ZRImage | Rect | TSpan)[] = []\n\n private _childCursor: 0\n\n private _defaultStyle: DefaultTextStyle = DEFAULT_RICH_TEXT_COLOR\n\n constructor(opts?: TextProps) {\n super();\n this.attr(opts);\n }\n\n childrenRef() {\n return this._children;\n }\n\n update() {\n\n super.update();\n\n // Update children\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n\n for (let i = 0; i < this._children.length; i++) {\n const child = this._children[i];\n // Set common properties.\n child.zlevel = this.zlevel;\n child.z = this.z;\n child.z2 = this.z2;\n child.culling = this.culling;\n child.cursor = this.cursor;\n child.invisible = this.invisible;\n }\n }\n\n updateTransform() {\n const innerTransformable = this.innerTransformable;\n if (innerTransformable) {\n innerTransformable.updateTransform();\n if (innerTransformable.transform) {\n this.transform = innerTransformable.transform;\n }\n }\n else {\n super.updateTransform();\n }\n }\n\n getLocalTransform(m?: MatrixArray): MatrixArray {\n const innerTransformable = this.innerTransformable;\n return innerTransformable\n ? innerTransformable.getLocalTransform(m)\n : super.getLocalTransform(m);\n }\n\n // TODO override setLocalTransform?\n getComputedTransform() {\n if (this.__hostTarget) {\n // Update host target transform\n this.__hostTarget.getComputedTransform();\n // Update text position.\n this.__hostTarget.updateInnerText(true);\n }\n\n return super.getComputedTransform();\n }\n\n private _updateSubTexts() {\n // Reset child visit cursor\n this._childCursor = 0;\n\n normalizeTextStyle(this.style);\n this.style.rich\n ? this._updateRichTexts()\n : this._updatePlainTexts();\n\n this._children.length = this._childCursor;\n\n this.styleUpdated();\n }\n\n addSelfToZr(zr: ZRenderType) {\n super.addSelfToZr(zr);\n for (let i = 0; i < this._children.length; i++) {\n // Also need mount __zr for case like hover detection.\n // The case: hover on a label (position: 'top') causes host el\n // scaled and label Y position lifts a bit so that out of the\n // pointer, then mouse move should be able to trigger \"mouseout\".\n this._children[i].__zr = zr;\n }\n }\n\n removeSelfFromZr(zr: ZRenderType) {\n super.removeSelfFromZr(zr);\n for (let i = 0; i < this._children.length; i++) {\n this._children[i].__zr = null;\n }\n }\n\n getBoundingRect(): BoundingRect {\n if (this.styleChanged()) {\n this._updateSubTexts();\n }\n if (!this._rect) {\n // TODO: Optimize when using width and overflow: wrap/truncate\n const tmpRect = new BoundingRect(0, 0, 0, 0);\n const children = this._children;\n const tmpMat: MatrixArray = [];\n let rect = null;\n\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const childRect = child.getBoundingRect();\n const transform = child.getLocalTransform(tmpMat);\n\n if (transform) {\n tmpRect.copy(childRect);\n tmpRect.applyTransform(transform);\n rect = rect || tmpRect.clone();\n rect.union(tmpRect);\n }\n else {\n rect = rect || childRect.clone();\n rect.union(childRect);\n }\n }\n this._rect = rect || tmpRect;\n }\n return this._rect;\n }\n\n // Can be set in Element. To calculate text fill automatically when textContent is inside element\n setDefaultTextStyle(defaultTextStyle: DefaultTextStyle) {\n // Use builtin if defaultTextStyle is not given.\n this._defaultStyle = defaultTextStyle || DEFAULT_RICH_TEXT_COLOR;\n }\n\n setTextContent(textContent: never) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('Can\\'t attach text on another text');\n }\n }\n\n // getDefaultStyleValue(key: T): TextStyleProps[T] {\n // // Default value is on the prototype.\n // return this.style.prototype[key];\n // }\n\n protected _mergeStyle(targetStyle: TextStyleProps, sourceStyle: TextStyleProps) {\n if (!sourceStyle) {\n return targetStyle;\n }\n\n // DO deep merge on rich configurations.\n const sourceRich = sourceStyle.rich;\n const targetRich = targetStyle.rich || (sourceRich && {}); // Create a new one if source have rich but target don't\n\n extend(targetStyle, sourceStyle);\n\n if (sourceRich && targetRich) {\n // merge rich and assign rich again.\n this._mergeRich(targetRich, sourceRich);\n targetStyle.rich = targetRich;\n }\n else if (targetRich) {\n // If source rich not exists. DON'T override the target rich\n targetStyle.rich = targetRich;\n }\n\n return targetStyle;\n }\n\n private _mergeRich(targetRich: TextStyleProps['rich'], sourceRich: TextStyleProps['rich']) {\n const richNames = keys(sourceRich);\n // Merge by rich names.\n for (let i = 0; i < richNames.length; i++) {\n const richName = richNames[i];\n targetRich[richName] = targetRich[richName] || {};\n extend(targetRich[richName], sourceRich[richName]);\n }\n }\n\n getAnimationStyleProps() {\n return DEFAULT_TEXT_ANIMATION_PROPS;\n }\n\n\n private _getOrCreateChild(Ctor: {new(): TSpan}): TSpan\n private _getOrCreateChild(Ctor: {new(): ZRImage}): ZRImage\n private _getOrCreateChild(Ctor: {new(): Rect}): Rect\n private _getOrCreateChild(Ctor: {new(): TSpan | Rect | ZRImage}): TSpan | Rect | ZRImage {\n let child = this._children[this._childCursor];\n if (!child || !(child instanceof Ctor)) {\n child = new Ctor();\n }\n this._children[this._childCursor++] = child;\n child.__zr = this.__zr;\n // TODO to users parent can only be group.\n child.parent = this as any;\n return child;\n }\n\n private _updatePlainTexts() {\n const style = this.style;\n const textFont = style.font || DEFAULT_FONT;\n const textPadding = style.padding as number[];\n\n const text = getStyleText(style);\n const contentBlock = parsePlainText(text, style);\n const needDrawBg = needDrawBackground(style);\n const bgColorDrawn = !!(style.backgroundColor);\n\n const outerHeight = contentBlock.outerHeight;\n const outerWidth = contentBlock.outerWidth;\n const contentWidth = contentBlock.contentWidth;\n\n const textLines = contentBlock.lines;\n const lineHeight = contentBlock.lineHeight;\n\n const defaultStyle = this._defaultStyle;\n\n this.isTruncated = !!contentBlock.isTruncated;\n\n const baseX = style.x || 0;\n const baseY = style.y || 0;\n const textAlign = style.align || defaultStyle.align || 'left';\n const verticalAlign = style.verticalAlign || defaultStyle.verticalAlign || 'top';\n\n let textX = baseX;\n let textY = adjustTextY(baseY, contentBlock.contentHeight, verticalAlign);\n\n if (needDrawBg || textPadding) {\n // Consider performance, do not call getTextWidth util necessary.\n const boxX = adjustTextX(baseX, outerWidth, textAlign);\n const boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n needDrawBg && this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n\n // `textBaseline` is set as 'middle'.\n textY += lineHeight / 2;\n\n if (textPadding) {\n textX = getTextXForPadding(baseX, textAlign, textPadding);\n if (verticalAlign === 'top') {\n textY += textPadding[0];\n }\n else if (verticalAlign === 'bottom') {\n textY -= textPadding[2];\n }\n }\n\n let defaultLineWidth = 0;\n let useDefaultFill = false;\n const textFill = getFill(\n 'fill' in style\n ? style.fill\n : (useDefaultFill = true, defaultStyle.fill)\n );\n const textStroke = getStroke(\n 'stroke' in style\n ? style.stroke\n : (!bgColorDrawn\n // If we use \"auto lineWidth\" widely, it probably bring about some bad case.\n // So the current strategy is:\n // If `style.fill` is specified (i.e., `useDefaultFill` is `false`)\n // (A) And if `textConfig.insideStroke/outsideStroke` is not specified as a color\n // (i.e., `defaultStyle.autoStroke` is `true`), we do not actually display\n // the auto stroke because we can not make sure wether the stoke is approperiate to\n // the given `fill`.\n // (B) But if `textConfig.insideStroke/outsideStroke` is specified as a color,\n // we give the auto lineWidth to display the given stoke color.\n && (!defaultStyle.autoStroke || useDefaultFill)\n )\n ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null\n );\n\n const hasShadow = style.textShadowBlur > 0;\n\n const fixedBoundingRect = style.width != null\n && (style.overflow === 'truncate' || style.overflow === 'break' || style.overflow === 'breakAll');\n const calculatedLineHeight = contentBlock.calculatedLineHeight;\n\n for (let i = 0; i < textLines.length; i++) {\n const el = this._getOrCreateChild(TSpan);\n // Always create new style.\n const subElStyle: TSpanStyleProps = el.createStyle();\n el.useStyle(subElStyle);\n subElStyle.text = textLines[i];\n subElStyle.x = textX;\n subElStyle.y = textY;\n // Always set textAlign and textBase line, because it is difficute to calculate\n // textAlign from prevEl, and we dont sure whether textAlign will be reset if\n // font set happened.\n if (textAlign) {\n subElStyle.textAlign = textAlign;\n }\n // Force baseline to be \"middle\". Otherwise, if using \"top\", the\n // text will offset downward a little bit in font \"Microsoft YaHei\".\n subElStyle.textBaseline = 'middle';\n subElStyle.opacity = style.opacity;\n // Fill after stroke so the outline will not cover the main part.\n subElStyle.strokeFirst = true;\n\n if (hasShadow) {\n subElStyle.shadowBlur = style.textShadowBlur || 0;\n subElStyle.shadowColor = style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = style.textShadowOffsetY || 0;\n }\n\n // Always override default fill and stroke value.\n subElStyle.stroke = textStroke as string;\n subElStyle.fill = textFill as string;\n\n if (textStroke) {\n subElStyle.lineWidth = style.lineWidth || defaultLineWidth;\n subElStyle.lineDash = style.lineDash;\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n }\n\n subElStyle.font = textFont;\n setSeparateFont(subElStyle, style);\n\n textY += lineHeight;\n\n if (fixedBoundingRect) {\n el.setBoundingRect(new BoundingRect(\n adjustTextX(subElStyle.x, contentWidth, subElStyle.textAlign as TextAlign),\n adjustTextY(subElStyle.y, calculatedLineHeight, subElStyle.textBaseline as TextVerticalAlign),\n /**\n * Text boundary should be the real text width.\n * Otherwise, there will be extra space in the\n * bounding rect calculated.\n */\n contentWidth,\n calculatedLineHeight\n ));\n }\n }\n }\n\n\n private _updateRichTexts() {\n const style = this.style;\n\n // TODO Only parse when text changed?\n const text = getStyleText(style);\n const contentBlock = parseRichText(text, style);\n\n const contentWidth = contentBlock.width;\n const outerWidth = contentBlock.outerWidth;\n const outerHeight = contentBlock.outerHeight;\n const textPadding = style.padding as number[];\n\n const baseX = style.x || 0;\n const baseY = style.y || 0;\n const defaultStyle = this._defaultStyle;\n const textAlign = style.align || defaultStyle.align;\n const verticalAlign = style.verticalAlign || defaultStyle.verticalAlign;\n\n this.isTruncated = !!contentBlock.isTruncated;\n\n const boxX = adjustTextX(baseX, outerWidth, textAlign);\n const boxY = adjustTextY(baseY, outerHeight, verticalAlign);\n let xLeft = boxX;\n let lineTop = boxY;\n\n if (textPadding) {\n xLeft += textPadding[3];\n lineTop += textPadding[0];\n }\n\n let xRight = xLeft + contentWidth;\n\n if (needDrawBackground(style)) {\n this._renderBackground(style, style, boxX, boxY, outerWidth, outerHeight);\n }\n const bgColorDrawn = !!(style.backgroundColor);\n\n for (let i = 0; i < contentBlock.lines.length; i++) {\n const line = contentBlock.lines[i];\n const tokens = line.tokens;\n const tokenCount = tokens.length;\n const lineHeight = line.lineHeight;\n\n let remainedWidth = line.width;\n let leftIndex = 0;\n let lineXLeft = xLeft;\n let lineXRight = xRight;\n let rightIndex = tokenCount - 1;\n let token;\n\n while (\n leftIndex < tokenCount\n && (token = tokens[leftIndex], !token.align || token.align === 'left')\n ) {\n this._placeToken(token, style, lineHeight, lineTop, lineXLeft, 'left', bgColorDrawn);\n remainedWidth -= token.width;\n lineXLeft += token.width;\n leftIndex++;\n }\n\n while (\n rightIndex >= 0\n && (token = tokens[rightIndex], token.align === 'right')\n ) {\n this._placeToken(token, style, lineHeight, lineTop, lineXRight, 'right', bgColorDrawn);\n remainedWidth -= token.width;\n lineXRight -= token.width;\n rightIndex--;\n }\n\n // The other tokens are placed as textAlign 'center' if there is enough space.\n lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - remainedWidth) / 2;\n while (leftIndex <= rightIndex) {\n token = tokens[leftIndex];\n // Consider width specified by user, use 'center' rather than 'left'.\n this._placeToken(\n token, style, lineHeight, lineTop,\n lineXLeft + token.width / 2, 'center', bgColorDrawn\n );\n lineXLeft += token.width;\n leftIndex++;\n }\n\n lineTop += lineHeight;\n }\n }\n\n private _placeToken(\n token: TextToken,\n style: TextStyleProps,\n lineHeight: number,\n lineTop: number,\n x: number,\n textAlign: string,\n parentBgColorDrawn: boolean\n ) {\n const tokenStyle = style.rich[token.styleName] || {};\n tokenStyle.text = token.text;\n\n // 'ctx.textBaseline' is always set as 'middle', for sake of\n // the bias of \"Microsoft YaHei\".\n const verticalAlign = token.verticalAlign;\n let y = lineTop + lineHeight / 2;\n if (verticalAlign === 'top') {\n y = lineTop + token.height / 2;\n }\n else if (verticalAlign === 'bottom') {\n y = lineTop + lineHeight - token.height / 2;\n }\n\n const needDrawBg = !token.isLineHolder && needDrawBackground(tokenStyle);\n needDrawBg && this._renderBackground(\n tokenStyle,\n style,\n textAlign === 'right'\n ? x - token.width\n : textAlign === 'center'\n ? x - token.width / 2\n : x,\n y - token.height / 2,\n token.width,\n token.height\n );\n const bgColorDrawn = !!tokenStyle.backgroundColor;\n\n const textPadding = token.textPadding;\n if (textPadding) {\n x = getTextXForPadding(x, textAlign, textPadding);\n y -= token.height / 2 - textPadding[0] - token.innerHeight / 2;\n }\n\n const el = this._getOrCreateChild(TSpan);\n const subElStyle: TSpanStyleProps = el.createStyle();\n // Always create new style.\n el.useStyle(subElStyle);\n\n const defaultStyle = this._defaultStyle;\n let useDefaultFill = false;\n let defaultLineWidth = 0;\n const textFill = getFill(\n 'fill' in tokenStyle ? tokenStyle.fill\n : 'fill' in style ? style.fill\n : (useDefaultFill = true, defaultStyle.fill)\n );\n const textStroke = getStroke(\n 'stroke' in tokenStyle ? tokenStyle.stroke\n : 'stroke' in style ? style.stroke\n : (\n !bgColorDrawn\n && !parentBgColorDrawn\n // See the strategy explained above.\n && (!defaultStyle.autoStroke || useDefaultFill)\n ) ? (defaultLineWidth = DEFAULT_STROKE_LINE_WIDTH, defaultStyle.stroke)\n : null\n );\n\n const hasShadow = tokenStyle.textShadowBlur > 0\n || style.textShadowBlur > 0;\n\n subElStyle.text = token.text;\n subElStyle.x = x;\n subElStyle.y = y;\n if (hasShadow) {\n subElStyle.shadowBlur = tokenStyle.textShadowBlur || style.textShadowBlur || 0;\n subElStyle.shadowColor = tokenStyle.textShadowColor || style.textShadowColor || 'transparent';\n subElStyle.shadowOffsetX = tokenStyle.textShadowOffsetX || style.textShadowOffsetX || 0;\n subElStyle.shadowOffsetY = tokenStyle.textShadowOffsetY || style.textShadowOffsetY || 0;\n }\n\n subElStyle.textAlign = textAlign as CanvasTextAlign;\n // Force baseline to be \"middle\". Otherwise, if using \"top\", the\n // text will offset downward a little bit in font \"Microsoft YaHei\".\n subElStyle.textBaseline = 'middle';\n subElStyle.font = token.font || DEFAULT_FONT;\n subElStyle.opacity = retrieve3(tokenStyle.opacity, style.opacity, 1);\n\n\n // TODO inherit each item from top style in token style?\n setSeparateFont(subElStyle, tokenStyle);\n\n if (textStroke) {\n subElStyle.lineWidth = retrieve3(tokenStyle.lineWidth, style.lineWidth, defaultLineWidth);\n subElStyle.lineDash = retrieve2(tokenStyle.lineDash, style.lineDash);\n subElStyle.lineDashOffset = style.lineDashOffset || 0;\n subElStyle.stroke = textStroke;\n }\n if (textFill) {\n subElStyle.fill = textFill;\n }\n\n const textWidth = token.contentWidth;\n const textHeight = token.contentHeight;\n // NOTE: Should not call dirtyStyle after setBoundingRect. Or it will be cleared.\n el.setBoundingRect(new BoundingRect(\n adjustTextX(subElStyle.x, textWidth, subElStyle.textAlign as TextAlign),\n adjustTextY(subElStyle.y, textHeight, subElStyle.textBaseline as TextVerticalAlign),\n textWidth,\n textHeight\n ));\n }\n\n private _renderBackground(\n style: TextStylePropsPart,\n topStyle: TextStylePropsPart,\n x: number,\n y: number,\n width: number,\n height: number\n ) {\n const textBackgroundColor = style.backgroundColor;\n const textBorderWidth = style.borderWidth;\n const textBorderColor = style.borderColor;\n const isImageBg = textBackgroundColor && (textBackgroundColor as {image: ImageLike}).image;\n const isPlainOrGradientBg = textBackgroundColor && !isImageBg;\n const textBorderRadius = style.borderRadius;\n const self = this;\n\n let rectEl: Rect;\n let imgEl: ZRImage;\n if (isPlainOrGradientBg || style.lineHeight || (textBorderWidth && textBorderColor)) {\n // Background is color\n rectEl = this._getOrCreateChild(Rect);\n rectEl.useStyle(rectEl.createStyle()); // Create an empty style.\n rectEl.style.fill = null;\n const rectShape = rectEl.shape;\n rectShape.x = x;\n rectShape.y = y;\n rectShape.width = width;\n rectShape.height = height;\n rectShape.r = textBorderRadius;\n rectEl.dirtyShape();\n }\n\n if (isPlainOrGradientBg) {\n const rectStyle = rectEl.style;\n rectStyle.fill = textBackgroundColor as string || null;\n rectStyle.fillOpacity = retrieve2(style.fillOpacity, 1);\n }\n else if (isImageBg) {\n imgEl = this._getOrCreateChild(ZRImage);\n imgEl.onload = function () {\n // Refresh and relayout after image loaded.\n self.dirtyStyle();\n };\n const imgStyle = imgEl.style;\n imgStyle.image = (textBackgroundColor as {image: ImageLike}).image;\n imgStyle.x = x;\n imgStyle.y = y;\n imgStyle.width = width;\n imgStyle.height = height;\n }\n\n if (textBorderWidth && textBorderColor) {\n const rectStyle = rectEl.style;\n rectStyle.lineWidth = textBorderWidth;\n rectStyle.stroke = textBorderColor;\n rectStyle.strokeOpacity = retrieve2(style.strokeOpacity, 1);\n rectStyle.lineDash = style.borderDash;\n rectStyle.lineDashOffset = style.borderDashOffset || 0;\n rectEl.strokeContainThreshold = 0;\n\n // Making shadow looks better.\n if (rectEl.hasFill() && rectEl.hasStroke()) {\n rectStyle.strokeFirst = true;\n rectStyle.lineWidth *= 2;\n }\n }\n\n const commonStyle = (rectEl || imgEl).style;\n commonStyle.shadowBlur = style.shadowBlur || 0;\n commonStyle.shadowColor = style.shadowColor || 'transparent';\n commonStyle.shadowOffsetX = style.shadowOffsetX || 0;\n commonStyle.shadowOffsetY = style.shadowOffsetY || 0;\n commonStyle.opacity = retrieve3(style.opacity, topStyle.opacity, 1);\n }\n\n static makeFont(style: TextStylePropsPart): string {\n // FIXME in node-canvas fontWeight is before fontStyle\n // Use `fontSize` `fontFamily` to check whether font properties are defined.\n let font = '';\n if (hasSeparateFont(style)) {\n font = [\n style.fontStyle,\n style.fontWeight,\n parseFontSize(style.fontSize),\n // If font properties are defined, `fontFamily` should not be ignored.\n style.fontFamily || 'sans-serif'\n ].join(' ');\n }\n return font && trim(font) || style.textFont || style.font;\n }\n}\n\n\nconst VALID_TEXT_ALIGN = {left: true, right: 1, center: 1};\nconst VALID_TEXT_VERTICAL_ALIGN = {top: 1, bottom: 1, middle: 1};\n\nconst FONT_PARTS = ['fontStyle', 'fontWeight', 'fontSize', 'fontFamily'] as const;\n\nexport function parseFontSize(fontSize: number | string) {\n if (\n typeof fontSize === 'string'\n && (\n fontSize.indexOf('px') !== -1\n || fontSize.indexOf('rem') !== -1\n || fontSize.indexOf('em') !== -1\n )\n ) {\n return fontSize;\n }\n else if (!isNaN(+fontSize)) {\n return fontSize + 'px';\n }\n else {\n return DEFAULT_FONT_SIZE + 'px';\n }\n}\n\nfunction setSeparateFont(\n targetStyle: TSpanStyleProps,\n sourceStyle: TextStylePropsPart\n) {\n for (let i = 0; i < FONT_PARTS.length; i++) {\n const fontProp = FONT_PARTS[i];\n const val = sourceStyle[fontProp];\n if (val != null) {\n (targetStyle as any)[fontProp] = val;\n }\n }\n}\n\nexport function hasSeparateFont(style: Pick) {\n return style.fontSize != null || style.fontFamily || style.fontWeight;\n}\n\nexport function normalizeTextStyle(style: TextStyleProps): TextStyleProps {\n normalizeStyle(style);\n // TODO inherit each item from top style in token style?\n each(style.rich, normalizeStyle);\n return style;\n}\n\nfunction normalizeStyle(style: TextStylePropsPart) {\n if (style) {\n style.font = ZRText.makeFont(style);\n let textAlign = style.align;\n // 'middle' is invalid, convert it to 'center'\n (textAlign as string) === 'middle' && (textAlign = 'center');\n style.align = (\n textAlign == null || VALID_TEXT_ALIGN[textAlign]\n ) ? textAlign : 'left';\n\n // Compatible with textBaseline.\n let verticalAlign = style.verticalAlign;\n (verticalAlign as string) === 'center' && (verticalAlign = 'middle');\n style.verticalAlign = (\n verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign]\n ) ? verticalAlign : 'top';\n\n // TODO Should not change the orignal value.\n const textPadding = style.padding;\n if (textPadding) {\n style.padding = normalizeCssArray(style.padding);\n }\n }\n}\n\n/**\n * @param stroke If specified, do not check style.textStroke.\n * @param lineWidth If specified, do not check style.textStroke.\n */\nfunction getStroke(\n stroke?: TextStylePropsPart['stroke'],\n lineWidth?: number\n) {\n return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')\n ? null\n : ((stroke as any).image || (stroke as any).colorStops)\n ? '#000'\n : stroke;\n}\n\nfunction getFill(\n fill?: TextStylePropsPart['fill']\n) {\n return (fill == null || fill === 'none')\n ? null\n // TODO pattern and gradient?\n : ((fill as any).image || (fill as any).colorStops)\n ? '#000'\n : fill;\n}\n\nfunction getTextXForPadding(x: number, textAlign: string, textPadding: number[]): number {\n return textAlign === 'right'\n ? (x - textPadding[1])\n : textAlign === 'center'\n ? (x + textPadding[3] / 2 - textPadding[1] / 2)\n : (x + textPadding[3]);\n}\n\nfunction getStyleText(style: TextStylePropsPart): string {\n // Compat: set number to text is supported.\n // set null/undefined to text is supported.\n let text = style.text;\n text != null && (text += '');\n return text;\n}\n\n/**\n * If needs draw background\n * @param style Style of element\n */\nfunction needDrawBackground(style: TextStylePropsPart): boolean {\n return !!(\n style.backgroundColor\n || style.lineHeight\n || (style.borderWidth && style.borderColor)\n );\n}\n\nexport default ZRText;","/**\r\n * 圆弧\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class ArcShape {\r\n cx = 0;\r\n cy = 0;\r\n r = 0;\r\n startAngle = 0;\r\n endAngle = Math.PI * 2\r\n clockwise? = true\r\n}\r\n\r\nexport interface ArcProps extends PathProps {\r\n shape?: Partial\r\n}\r\n\r\nclass Arc extends Path {\r\n\r\n shape: ArcShape\r\n\r\n constructor(opts?: ArcProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new ArcShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: ArcShape) {\r\n\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const r = Math.max(shape.r, 0);\r\n const startAngle = shape.startAngle;\r\n const endAngle = shape.endAngle;\r\n const clockwise = shape.clockwise;\r\n\r\n const unitX = Math.cos(startAngle);\r\n const unitY = Math.sin(startAngle);\r\n\r\n ctx.moveTo(unitX * r + x, unitY * r + y);\r\n ctx.arc(x, y, r, startAngle, endAngle, !clockwise);\r\n }\r\n}\r\n\r\nArc.prototype.type = 'arc';\r\n\r\nexport default Arc;","/**\r\n * 贝塞尔曲线\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\nimport * as vec2 from '../../core/vector';\r\nimport {\r\n quadraticSubdivide,\r\n cubicSubdivide,\r\n quadraticAt,\r\n cubicAt,\r\n quadraticDerivativeAt,\r\n cubicDerivativeAt\r\n} from '../../core/curve';\r\n\r\nconst out: number[] = [];\r\n\r\nexport class BezierCurveShape {\r\n x1 = 0\r\n y1 = 0\r\n x2 = 0\r\n y2 = 0\r\n cpx1 = 0\r\n cpy1 = 0\r\n cpx2?: number\r\n cpy2?: number\r\n // Curve show percent, for animating\r\n percent = 1\r\n}\r\n\r\nfunction someVectorAt(shape: BezierCurveShape, t: number, isTangent: boolean) {\r\n const cpx2 = shape.cpx2;\r\n const cpy2 = shape.cpy2;\r\n if (cpx2 != null || cpy2 != null) {\r\n return [\r\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.x1, shape.cpx1, shape.cpx2, shape.x2, t),\r\n (isTangent ? cubicDerivativeAt : cubicAt)(shape.y1, shape.cpy1, shape.cpy2, shape.y2, t)\r\n ];\r\n }\r\n else {\r\n return [\r\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.x1, shape.cpx1, shape.x2, t),\r\n (isTangent ? quadraticDerivativeAt : quadraticAt)(shape.y1, shape.cpy1, shape.y2, t)\r\n ];\r\n }\r\n}\r\n\r\nexport interface BezierCurveProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass BezierCurve extends Path {\r\n\r\n shape: BezierCurveShape\r\n\r\n constructor(opts?: BezierCurveProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new BezierCurveShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: BezierCurveShape) {\r\n let x1 = shape.x1;\r\n let y1 = shape.y1;\r\n let x2 = shape.x2;\r\n let y2 = shape.y2;\r\n let cpx1 = shape.cpx1;\r\n let cpy1 = shape.cpy1;\r\n let cpx2 = shape.cpx2;\r\n let cpy2 = shape.cpy2;\r\n let percent = shape.percent;\r\n if (percent === 0) {\r\n return;\r\n }\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n if (cpx2 == null || cpy2 == null) {\r\n if (percent < 1) {\r\n quadraticSubdivide(x1, cpx1, x2, percent, out);\r\n cpx1 = out[1];\r\n x2 = out[2];\r\n quadraticSubdivide(y1, cpy1, y2, percent, out);\r\n cpy1 = out[1];\r\n y2 = out[2];\r\n }\r\n\r\n ctx.quadraticCurveTo(\r\n cpx1, cpy1,\r\n x2, y2\r\n );\r\n }\r\n else {\r\n if (percent < 1) {\r\n cubicSubdivide(x1, cpx1, cpx2, x2, percent, out);\r\n cpx1 = out[1];\r\n cpx2 = out[2];\r\n x2 = out[3];\r\n cubicSubdivide(y1, cpy1, cpy2, y2, percent, out);\r\n cpy1 = out[1];\r\n cpy2 = out[2];\r\n y2 = out[3];\r\n }\r\n ctx.bezierCurveTo(\r\n cpx1, cpy1,\r\n cpx2, cpy2,\r\n x2, y2\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get point at percent\r\n */\r\n pointAt(t: number) {\r\n return someVectorAt(this.shape, t, false);\r\n }\r\n\r\n /**\r\n * Get tangent at percent\r\n */\r\n tangentAt(t: number) {\r\n const p = someVectorAt(this.shape, t, true);\r\n return vec2.normalize(p, p);\r\n }\r\n};\r\n\r\nBezierCurve.prototype.type = 'bezier-curve';\r\n\r\nexport default BezierCurve;\r\n","/**\r\n * 水滴形状\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class DropletShape {\r\n cx = 0\r\n cy = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface DropletProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Droplet extends Path {\r\n\r\n shape: DropletShape\r\n\r\n constructor(opts?: DropletProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new DropletShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: DropletShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.width;\r\n const b = shape.height;\r\n\r\n ctx.moveTo(x, y + a);\r\n ctx.bezierCurveTo(\r\n x + a,\r\n y + a,\r\n x + a * 3 / 2,\r\n y - a / 3,\r\n x,\r\n y - b\r\n );\r\n ctx.bezierCurveTo(\r\n x - a * 3 / 2,\r\n y - a / 3,\r\n x - a,\r\n y + a,\r\n x,\r\n y + a\r\n );\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nDroplet.prototype.type = 'droplet';\r\n\r\nexport default Droplet;\r\n","/**\r\n * 心形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class HeartShape {\r\n cx = 0\r\n cy = 0\r\n width = 0\r\n height = 0\r\n}\r\n\r\nexport interface HeartProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Heart extends Path {\r\n\r\n shape: HeartShape\r\n\r\n constructor(opts?: HeartProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new HeartShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: HeartShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const a = shape.width;\r\n const b = shape.height;\r\n ctx.moveTo(x, y);\r\n ctx.bezierCurveTo(\r\n x + a / 2, y - b * 2 / 3,\r\n x + a * 2, y + b / 3,\r\n x, y + b\r\n );\r\n ctx.bezierCurveTo(\r\n x - a * 2, y + b / 3,\r\n x - a / 2, y - b * 2 / 3,\r\n x, y\r\n );\r\n }\r\n}\r\n\r\n\r\nHeart.prototype.type = 'heart';\r\n\r\nexport default Heart;","/**\r\n * 正多边形\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst PI = Math.PI;\r\nconst sin = Math.sin;\r\nconst cos = Math.cos;\r\n\r\nexport class IsogonShape {\r\n x = 0\r\n y = 0\r\n r = 0\r\n n = 0\r\n}\r\n\r\nexport interface IsogonProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Isogon extends Path {\r\n\r\n shape: IsogonShape\r\n\r\n constructor(opts?: IsogonProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new IsogonShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: IsogonShape) {\r\n const n = shape.n;\r\n if (!n || n < 2) {\r\n return;\r\n }\r\n\r\n const x = shape.x;\r\n const y = shape.y;\r\n const r = shape.r;\r\n\r\n const dStep = 2 * PI / n;\r\n let deg = -PI / 2;\r\n\r\n ctx.moveTo(x + r * cos(deg), y + r * sin(deg));\r\n for (let i = 0, end = n - 1; i < end; i++) {\r\n deg += dStep;\r\n ctx.lineTo(x + r * cos(deg), y + r * sin(deg));\r\n }\r\n\r\n ctx.closePath();\r\n\r\n return;\r\n }\r\n}\r\n\r\nIsogon.prototype.type = 'isogon';\r\n\r\nexport default Isogon;\r\n","/**\r\n * 圆环\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nexport class RingShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n r0 = 0\r\n}\r\n\r\nexport interface RingProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Ring extends Path {\r\n\r\n shape: RingShape\r\n\r\n constructor(opts?: RingProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new RingShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RingShape) {\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const PI2 = Math.PI * 2;\r\n ctx.moveTo(x + shape.r, y);\r\n ctx.arc(x, y, shape.r, 0, PI2, false);\r\n ctx.moveTo(x + shape.r0, y);\r\n ctx.arc(x, y, shape.r0, 0, PI2, true);\r\n }\r\n}\r\n\r\nRing.prototype.type = 'ring';\r\nexport default Ring;","/**\r\n * 玫瑰线\r\n * @module zrender/graphic/shape/Rose\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst sin = Math.sin;\r\nconst cos = Math.cos;\r\nconst radian = Math.PI / 180;\r\n\r\nexport class RoseShape {\r\n cx = 0\r\n cy = 0\r\n r: number[] = []\r\n k = 0\r\n n = 1\r\n}\r\n\r\nexport interface RoseProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Rose extends Path {\r\n\r\n shape: RoseShape\r\n\r\n constructor(opts?: RoseProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new RoseShape();\r\n }\r\n\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: RoseShape) {\r\n const R = shape.r;\r\n const k = shape.k;\r\n const n = shape.n;\r\n const x0 = shape.cx;\r\n const y0 = shape.cy;\r\n let x;\r\n let y;\r\n let r;\r\n\r\n\r\n ctx.moveTo(x0, y0);\r\n\r\n for (let i = 0, len = R.length; i < len; i++) {\r\n r = R[i];\r\n\r\n for (let j = 0; j <= 360 * n; j++) {\r\n x = r\r\n * sin(k / n * j % 360 * radian)\r\n * cos(j * radian)\r\n + x0;\r\n y = r\r\n * sin(k / n * j % 360 * radian)\r\n * sin(j * radian)\r\n + y0;\r\n ctx.lineTo(x, y);\r\n }\r\n }\r\n }\r\n}\r\n\r\nRose.prototype.type = 'rose';\r\n\r\nexport default Rose;","/**\r\n * n角星(n>3)\r\n * @module zrender/graphic/shape/Star\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst PI = Math.PI;\r\nconst cos = Math.cos;\r\nconst sin = Math.sin;\r\n\r\nexport class StarShape {\r\n cx = 0\r\n cy = 0\r\n n = 3\r\n r0: number\r\n r = 0\r\n}\r\n\r\nexport interface StarProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Star extends Path {\r\n\r\n shape: StarShape\r\n\r\n constructor(opts?: StarProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultShape() {\r\n return new StarShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: StarShape) {\r\n\r\n const n = shape.n;\r\n if (!n || n < 2) {\r\n return;\r\n }\r\n\r\n const x = shape.cx;\r\n const y = shape.cy;\r\n const r = shape.r;\r\n let r0 = shape.r0;\r\n\r\n // 如果未指定内部顶点外接圆半径,则自动计算\r\n if (r0 == null) {\r\n r0 = n > 4\r\n // 相隔的外部顶点的连线的交点,\r\n // 被取为内部交点,以此计算r0\r\n ? r * cos(2 * PI / n) / cos(PI / n)\r\n // 二三四角星的特殊处理\r\n : r / 3;\r\n }\r\n\r\n const dStep = PI / n;\r\n let deg = -PI / 2;\r\n const xStart = x + r * cos(deg);\r\n const yStart = y + r * sin(deg);\r\n deg += dStep;\r\n\r\n // 记录边界点,用于判断inside\r\n ctx.moveTo(xStart, yStart);\r\n for (let i = 0, end = n * 2 - 1, ri; i < end; i++) {\r\n ri = i % 2 === 0 ? r0 : r;\r\n ctx.lineTo(x + ri * cos(deg), y + ri * sin(deg));\r\n deg += dStep;\r\n }\r\n\r\n ctx.closePath();\r\n }\r\n}\r\n\r\nStar.prototype.type = 'star';\r\nexport default Star;","/**\r\n * 内外旋轮曲线\r\n * @module zrender/graphic/shape/Trochold\r\n */\r\n\r\nimport Path, { PathProps } from '../Path';\r\n\r\nconst cos = Math.cos;\r\nconst sin = Math.sin;\r\n\r\nexport class TrochoidShape {\r\n cx = 0\r\n cy = 0\r\n r = 0\r\n r0 = 0\r\n d = 0\r\n location = 'out'\r\n}\r\n\r\nexport interface TrochoidProps extends PathProps {\r\n shape?: Partial\r\n}\r\nclass Trochoid extends Path {\r\n\r\n shape: TrochoidShape\r\n\r\n constructor(opts?: TrochoidProps) {\r\n super(opts);\r\n }\r\n\r\n getDefaultStyle() {\r\n return {\r\n stroke: '#000',\r\n fill: null as string\r\n };\r\n }\r\n\r\n getDefaultShape() {\r\n return new TrochoidShape();\r\n }\r\n\r\n buildPath(ctx: CanvasRenderingContext2D, shape: TrochoidShape) {\r\n const R = shape.r;\r\n const r = shape.r0;\r\n const d = shape.d;\r\n const offsetX = shape.cx;\r\n const offsetY = shape.cy;\r\n const delta = shape.location === 'out' ? 1 : -1;\r\n let x1;\r\n let y1;\r\n let x2;\r\n let y2;\r\n\r\n if (shape.location && R <= r) {\r\n return;\r\n }\r\n\r\n let num = 0;\r\n let i = 1;\r\n let theta;\r\n\r\n x1 = (R + delta * r) * cos(0)\r\n - delta * d * cos(0) + offsetX;\r\n y1 = (R + delta * r) * sin(0)\r\n - d * sin(0) + offsetY;\r\n\r\n ctx.moveTo(x1, y1);\r\n\r\n // 计算结束时的i\r\n do {\r\n num++;\r\n }\r\n while ((r * num) % (R + delta * r) !== 0);\r\n\r\n do {\r\n theta = Math.PI / 180 * i;\r\n x2 = (R + delta * r) * cos(theta)\r\n - delta * d * cos((R / r + delta) * theta)\r\n + offsetX;\r\n y2 = (R + delta * r) * sin(theta)\r\n - d * sin((R / r + delta) * theta)\r\n + offsetY;\r\n ctx.lineTo(x2, y2);\r\n i++;\r\n }\r\n while (i <= (r * num) / (R + delta * r) * 360);\r\n\r\n }\r\n}\r\n\r\nTrochoid.prototype.type = 'trochoid';\r\nexport default Trochoid;","import { ImageLike } from '../core/types';\r\nimport { SVGVNode } from '../svg/core';\r\n\r\ntype ImagePatternRepeat = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'\r\n\r\nexport interface PatternObjectBase {\r\n id?: number\r\n // type is now unused, so make it optional\r\n type?: 'pattern'\r\n\r\n x?: number\r\n y?: number\r\n rotation?: number\r\n scaleX?: number\r\n scaleY?: number\r\n}\r\n\r\nexport interface ImagePatternObject extends PatternObjectBase {\r\n image: ImageLike | string\r\n repeat?: ImagePatternRepeat\r\n\r\n /**\r\n * Width and height of image.\r\n * `imageWidth` and `imageHeight` are only used in svg-ssr renderer.\r\n * Because we can't get the size of image in svg-ssr renderer.\r\n * They need to be give explictly.\r\n */\r\n imageWidth?: number\r\n imageHeight?: number\r\n}\r\n\r\nexport interface InnerImagePatternObject extends ImagePatternObject {\r\n // Cached image. Which is created in the canvas painter.\r\n __image?: ImageLike\r\n}\r\n\r\nexport interface SVGPatternObject extends PatternObjectBase {\r\n /**\r\n * svg vnode can only be used in svg renderer currently.\r\n * svgWidth, svgHeight defines width and height used for pattern.\r\n */\r\n svgElement?: SVGVNode\r\n svgWidth?: number\r\n svgHeight?: number\r\n}\r\n\r\nexport type PatternObject = ImagePatternObject | SVGPatternObject\r\n\r\nclass Pattern {\r\n\r\n type: 'pattern'\r\n\r\n image: ImageLike | string\r\n /**\r\n * svg element can only be used in svg renderer currently.\r\n *\r\n * Will be string if using SSR rendering.\r\n */\r\n svgElement: SVGElement | string\r\n\r\n repeat: ImagePatternRepeat\r\n\r\n x: number\r\n y: number\r\n rotation: number\r\n scaleX: number\r\n scaleY: number\r\n\r\n constructor(image: ImageLike | string, repeat: ImagePatternRepeat) {\r\n // Should do nothing more in this constructor. Because gradient can be\r\n // declard by `color: {image: ...}`, where this constructor will not be called.\r\n this.image = image;\r\n this.repeat = repeat;\r\n\r\n this.x = 0;\r\n this.y = 0;\r\n this.rotation = 0;\r\n this.scaleX = 1;\r\n this.scaleY = 1;\r\n }\r\n}\r\n\r\nexport default Pattern;","/*\r\n* Licensed to the Apache Software Foundation (ASF) under one\r\n* or more contributor license agreements. See the NOTICE file\r\n* distributed with this work for additional information\r\n* regarding copyright ownership. The ASF licenses this file\r\n* to you under the Apache License, Version 2.0 (the\r\n* \"License\"); you may not use this file except in compliance\r\n* with the License. You may obtain a copy of the License at\r\n*\r\n* http://www.apache.org/licenses/LICENSE-2.0\r\n*\r\n* Unless required by applicable law or agreed to in writing,\r\n* software distributed under the License is distributed on an\r\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\n* KIND, either express or implied. See the License for the\r\n* specific language governing permissions and limitations\r\n* under the License.\r\n*/\r\n\r\nimport Point, { PointLike } from './Point';\r\nimport BoundingRect from './BoundingRect';\r\nimport { MatrixArray } from './matrix';\r\n\r\nconst extent = [0, 0];\r\nconst extent2 = [0, 0];\r\n\r\nconst minTv = new Point();\r\nconst maxTv = new Point();\r\n\r\nclass OrientedBoundingRect {\r\n\r\n // lt, rt, rb, lb\r\n private _corners: Point[] = [];\r\n\r\n private _axes: Point[] = [];\r\n\r\n private _origin: number[] = [0, 0];\r\n\r\n constructor(rect?: BoundingRect, transform?: MatrixArray) {\r\n for (let i = 0; i < 4; i++) {\r\n this._corners[i] = new Point();\r\n }\r\n for (let i = 0; i < 2; i++) {\r\n this._axes[i] = new Point();\r\n }\r\n\r\n if (rect) {\r\n this.fromBoundingRect(rect, transform);\r\n }\r\n }\r\n\r\n fromBoundingRect(rect: BoundingRect, transform?: MatrixArray) {\r\n const corners = this._corners;\r\n const axes = this._axes;\r\n const x = rect.x;\r\n const y = rect.y;\r\n const x2 = x + rect.width;\r\n const y2 = y + rect.height;\r\n corners[0].set(x, y);\r\n corners[1].set(x2, y);\r\n corners[2].set(x2, y2);\r\n corners[3].set(x, y2);\r\n\r\n if (transform) {\r\n for (let i = 0; i < 4; i++) {\r\n corners[i].transform(transform);\r\n }\r\n }\r\n\r\n // Calculate axes\r\n Point.sub(axes[0], corners[1], corners[0]);\r\n Point.sub(axes[1], corners[3], corners[0]);\r\n axes[0].normalize();\r\n axes[1].normalize();\r\n\r\n // Calculate projected origin\r\n for (let i = 0; i < 2; i++) {\r\n this._origin[i] = axes[i].dot(corners[0]);\r\n }\r\n }\r\n\r\n /**\r\n * If intersect with another OBB\r\n * @param other Bounding rect to be intersected with\r\n * @param mtv Calculated .\r\n * If it's not overlapped. it means needs to move given rect with Maximum Translation Vector to be overlapped.\r\n * Else it means needs to move given rect with Minimum Translation Vector to be not overlapped.\r\n */\r\n intersect(other: OrientedBoundingRect, mtv?: PointLike): boolean {\r\n // OBB collision with SAT method\r\n\r\n let overlapped = true;\r\n const noMtv = !mtv;\r\n minTv.set(Infinity, Infinity);\r\n maxTv.set(0, 0);\r\n // Check two axes for both two obb.\r\n if (!this._intersectCheckOneSide(this, other, minTv, maxTv, noMtv, 1)) {\r\n overlapped = false;\r\n if (noMtv) {\r\n // Early return if no need to calculate mtv\r\n return overlapped;\r\n }\r\n }\r\n if (!this._intersectCheckOneSide(other, this, minTv, maxTv, noMtv, -1)) {\r\n overlapped = false;\r\n if (noMtv) {\r\n return overlapped;\r\n }\r\n }\r\n\r\n if (!noMtv) {\r\n Point.copy(mtv, overlapped ? minTv : maxTv);\r\n }\r\n\r\n return overlapped;\r\n }\r\n\r\n\r\n private _intersectCheckOneSide(\r\n self: OrientedBoundingRect,\r\n other: OrientedBoundingRect,\r\n minTv: Point,\r\n maxTv: Point,\r\n noMtv: boolean,\r\n inverse: 1 | -1\r\n ): boolean {\r\n let overlapped = true;\r\n for (let i = 0; i < 2; i++) {\r\n const axis = this._axes[i];\r\n this._getProjMinMaxOnAxis(i, self._corners, extent);\r\n this._getProjMinMaxOnAxis(i, other._corners, extent2);\r\n\r\n // Not overlap on the any axis.\r\n if (extent[1] < extent2[0] || extent[0] > extent2[1]) {\r\n overlapped = false;\r\n if (noMtv) {\r\n return overlapped;\r\n }\r\n const dist0 = Math.abs(extent2[0] - extent[1]);\r\n const dist1 = Math.abs(extent[0] - extent2[1]);\r\n\r\n // Find longest distance of all axes.\r\n if (Math.min(dist0, dist1) > maxTv.len()) {\r\n if (dist0 < dist1) {\r\n Point.scale(maxTv, axis, -dist0 * inverse);\r\n }\r\n else {\r\n Point.scale(maxTv, axis, dist1 * inverse);\r\n }\r\n }\r\n }\r\n else if (minTv) {\r\n const dist0 = Math.abs(extent2[0] - extent[1]);\r\n const dist1 = Math.abs(extent[0] - extent2[1]);\r\n\r\n if (Math.min(dist0, dist1) < minTv.len()) {\r\n if (dist0 < dist1) {\r\n Point.scale(minTv, axis, dist0 * inverse);\r\n }\r\n else {\r\n Point.scale(minTv, axis, -dist1 * inverse);\r\n }\r\n }\r\n }\r\n }\r\n return overlapped;\r\n }\r\n\r\n private _getProjMinMaxOnAxis(dim: number, corners: Point[], out: number[]) {\r\n const axis = this._axes[dim];\r\n const origin = this._origin;\r\n const proj = corners[0].dot(axis) + origin[dim];\r\n let min = proj;\r\n let max = proj;\r\n\r\n for (let i = 1; i < corners.length; i++) {\r\n const proj = corners[i].dot(axis) + origin[dim];\r\n min = Math.min(proj, min);\r\n max = Math.max(proj, max);\r\n }\r\n\r\n out[0] = min;\r\n out[1] = max;\r\n }\r\n}\r\n\r\nexport default OrientedBoundingRect;","import type { ZRenderType } from '../zrender';\r\nimport type CanvasPainter from '../canvas/Painter';\r\nimport type BoundingRect from '../core/BoundingRect';\r\nimport { extend } from '../core/util';\r\n\r\nclass DebugRect {\r\n\r\n dom: HTMLDivElement\r\n\r\n private _hideTimeout: number\r\n\r\n constructor(style: Opts['style']) {\r\n const dom = this.dom = document.createElement('div');\r\n dom.className = 'ec-debug-dirty-rect';\r\n\r\n style = extend({}, style);\r\n extend(style, {\r\n backgroundColor: 'rgba(0, 0, 255, 0.2)',\r\n border: '1px solid #00f'\r\n });\r\n dom.style.cssText = `\r\nposition: absolute;\r\nopacity: 0;\r\ntransition: opacity 0.5s linear;\r\npointer-events: none;\r\n`;\r\n\r\n for (let key in style) {\r\n if (style.hasOwnProperty(key)) {\r\n (dom.style as any)[key] = (style as any)[key];\r\n }\r\n }\r\n }\r\n\r\n update(rect: BoundingRect) {\r\n const domStyle = this.dom.style;\r\n domStyle.width = rect.width + 'px';\r\n domStyle.height = rect.height + 'px';\r\n domStyle.left = rect.x + 'px';\r\n domStyle.top = rect.y + 'px';\r\n }\r\n\r\n hide() {\r\n this.dom.style.opacity = '0';\r\n }\r\n show(autoHideDelay?: number) {\r\n clearTimeout(this._hideTimeout);\r\n\r\n this.dom.style.opacity = '1';\r\n\r\n // Auto hide after 2 second\r\n this._hideTimeout = setTimeout(() => {\r\n this.hide();\r\n }, autoHideDelay || 1000) as unknown as number;\r\n }\r\n\r\n}\r\n\r\ninterface Opts {\r\n style?: {\r\n backgroundColor?: string\r\n color?: string\r\n }\r\n\r\n autoHideDelay?: number\r\n}\r\n\r\nexport default function showDebugDirtyRect(zr: ZRenderType, opts?: Opts) {\r\n opts = opts || {};\r\n const painter = zr.painter as CanvasPainter;\r\n if (!painter.getLayers) {\r\n throw new Error('Debug dirty rect can only been used on canvas renderer.');\r\n }\r\n if (painter.isSingleCanvas()) {\r\n throw new Error('Debug dirty rect can only been used on zrender inited with container.');\r\n }\r\n const debugViewRoot = document.createElement('div');\r\n debugViewRoot.style.cssText = `\r\nposition:absolute;\r\nleft:0;\r\ntop:0;\r\nright:0;\r\nbottom:0;\r\npointer-events:none;\r\n`;\r\n debugViewRoot.className = 'ec-debug-dirty-rect-container';\r\n\r\n const debugRects: DebugRect[] = [];\r\n const dom = zr.dom;\r\n dom.appendChild(debugViewRoot);\r\n const computedStyle = getComputedStyle(dom);\r\n if (computedStyle.position === 'static') {\r\n dom.style.position = 'relative';\r\n }\r\n\r\n zr.on('rendered', function () {\r\n if (painter.getLayers) {\r\n let idx = 0;\r\n painter.eachBuiltinLayer((layer) => {\r\n if (!layer.debugGetPaintRects) {\r\n return;\r\n }\r\n const paintRects = layer.debugGetPaintRects();\r\n for (let i = 0; i < paintRects.length; i++) {\r\n if (!paintRects[i].width || !paintRects[i].height) {\r\n continue;\r\n }\r\n\r\n if (!debugRects[idx]) {\r\n debugRects[idx] = new DebugRect(opts.style);\r\n debugViewRoot.appendChild(debugRects[idx].dom);\r\n }\r\n debugRects[idx].show(opts.autoHideDelay);\r\n debugRects[idx].update(paintRects[i]);\r\n idx++;\r\n }\r\n });\r\n for (let i = idx; i < debugRects.length; i++) {\r\n debugRects[i].hide();\r\n }\r\n }\r\n });\r\n}","import { LinearGradientObject } from '../graphic/LinearGradient';\r\nimport { RadialGradientObject } from '../graphic/RadialGradient';\r\nimport { GradientObject } from '../graphic/Gradient';\r\nimport { RectLike } from '../core/BoundingRect';\r\nimport Path from '../graphic/Path';\r\n\r\nfunction isSafeNum(num: number) {\r\n // NaN、Infinity、undefined、'xx'\r\n return isFinite(num);\r\n}\r\n\r\nexport function createLinearGradient(\r\n this: void,\r\n ctx: CanvasRenderingContext2D,\r\n obj: LinearGradientObject,\r\n rect: RectLike\r\n) {\r\n let x = obj.x == null ? 0 : obj.x;\r\n let x2 = obj.x2 == null ? 1 : obj.x2;\r\n let y = obj.y == null ? 0 : obj.y;\r\n let y2 = obj.y2 == null ? 0 : obj.y2;\r\n\r\n if (!obj.global) {\r\n x = x * rect.width + rect.x;\r\n x2 = x2 * rect.width + rect.x;\r\n y = y * rect.height + rect.y;\r\n y2 = y2 * rect.height + rect.y;\r\n }\r\n\r\n // Fix NaN when rect is Infinity\r\n x = isSafeNum(x) ? x : 0;\r\n x2 = isSafeNum(x2) ? x2 : 1;\r\n y = isSafeNum(y) ? y : 0;\r\n y2 = isSafeNum(y2) ? y2 : 0;\r\n\r\n const canvasGradient = ctx.createLinearGradient(x, y, x2, y2);\r\n\r\n return canvasGradient;\r\n}\r\n\r\nexport function createRadialGradient(\r\n this: void,\r\n ctx: CanvasRenderingContext2D,\r\n obj: RadialGradientObject,\r\n rect: RectLike\r\n) {\r\n const width = rect.width;\r\n const height = rect.height;\r\n const min = Math.min(width, height);\r\n\r\n let x = obj.x == null ? 0.5 : obj.x;\r\n let y = obj.y == null ? 0.5 : obj.y;\r\n let r = obj.r == null ? 0.5 : obj.r;\r\n\r\n if (!obj.global) {\r\n x = x * width + rect.x;\r\n y = y * height + rect.y;\r\n r = r * min;\r\n }\r\n\r\n x = isSafeNum(x) ? x : 0.5;\r\n y = isSafeNum(y) ? y : 0.5;\r\n r = r >= 0 && isSafeNum(r) ? r : 0.5;\r\n\r\n const canvasGradient = ctx.createRadialGradient(x, y, 0, x, y, r);\r\n\r\n return canvasGradient;\r\n}\r\n\r\nexport function getCanvasGradient(this: void, ctx: CanvasRenderingContext2D, obj: GradientObject, rect: RectLike) {\r\n // TODO Cache?\r\n const canvasGradient = obj.type === 'radial'\r\n ? createRadialGradient(ctx, obj as RadialGradientObject, rect)\r\n : createLinearGradient(ctx, obj as LinearGradientObject, rect);\r\n\r\n const colorStops = obj.colorStops;\r\n for (let i = 0; i < colorStops.length; i++) {\r\n canvasGradient.addColorStop(\r\n colorStops[i].offset, colorStops[i].color\r\n );\r\n }\r\n return canvasGradient;\r\n}\r\n\r\nexport function isClipPathChanged(clipPaths: Path[], prevClipPaths: Path[]): boolean {\r\n // displayable.__clipPaths can only be `null`/`undefined` or an non-empty array.\r\n if (clipPaths === prevClipPaths || (!clipPaths && !prevClipPaths)) {\r\n return false;\r\n }\r\n if (!clipPaths || !prevClipPaths || (clipPaths.length !== prevClipPaths.length)) {\r\n return true;\r\n }\r\n for (let i = 0; i < clipPaths.length; i++) {\r\n if (clipPaths[i] !== prevClipPaths[i]) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n}\r\n\r\nfunction parseInt10(val: string) {\r\n return parseInt(val, 10);\r\n}\r\nexport function getSize(\r\n root: HTMLElement,\r\n whIdx: number,\r\n opts: { width?: number | string, height?: number | string}\r\n) {\r\n\r\n const wh = ['width', 'height'][whIdx] as 'width' | 'height';\r\n const cwh = ['clientWidth', 'clientHeight'][whIdx] as 'clientWidth' | 'clientHeight';\r\n const plt = ['paddingLeft', 'paddingTop'][whIdx] as 'paddingLeft' | 'paddingTop';\r\n const prb = ['paddingRight', 'paddingBottom'][whIdx] as 'paddingRight' | 'paddingBottom';\r\n\r\n if (opts[wh] != null && opts[wh] !== 'auto') {\r\n return parseFloat(opts[wh] as string);\r\n }\r\n\r\n // IE8 does not support getComputedStyle, but it use VML.\r\n const stl = document.defaultView.getComputedStyle(root);\r\n\r\n return (\r\n (root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh]))\r\n - (parseInt10(stl[plt]) || 0)\r\n - (parseInt10(stl[prb]) || 0)\r\n ) | 0;\r\n}","import { isArray, isNumber, map } from '../core/util';\r\nimport Path from '../graphic/Path';\r\nimport TSpan from '../graphic/TSpan';\r\n\r\nexport function normalizeLineDash(lineType: any, lineWidth?: number): number[] | false {\r\n if (!lineType || lineType === 'solid' || !(lineWidth > 0)) {\r\n return null;\r\n }\r\n return lineType === 'dashed'\r\n ? [4 * lineWidth, 2 * lineWidth]\r\n : lineType === 'dotted'\r\n ? [lineWidth]\r\n : isNumber(lineType)\r\n ? [lineType] : isArray(lineType) ? lineType : null;\r\n}\r\nexport function getLineDash(el: Path | TSpan): [number[] | false, number] {\r\n const style = el.style;\r\n\r\n let lineDash = style.lineDash && style.lineWidth > 0 && normalizeLineDash(style.lineDash, style.lineWidth);\r\n let lineDashOffset = style.lineDashOffset;\r\n\r\n if (lineDash) {\r\n const lineScale = (style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1;\r\n if (lineScale && lineScale !== 1) {\r\n lineDash = map(lineDash, function (rawVal) {\r\n return rawVal / lineScale;\r\n });\r\n lineDashOffset /= lineScale;\r\n }\r\n }\r\n return [lineDash, lineDashOffset];\r\n}","import Displayable, { DEFAULT_COMMON_STYLE } from '../graphic/Displayable';\nimport PathProxy from '../core/PathProxy';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject, InnerImagePatternObject } from '../graphic/Pattern';\nimport { LinearGradientObject } from '../graphic/LinearGradient';\nimport { RadialGradientObject } from '../graphic/RadialGradient';\nimport { ZRCanvasRenderingContext } from '../core/types';\nimport { createOrUpdateImage, isImageReady } from '../graphic/helper/image';\nimport { getCanvasGradient, isClipPathChanged } from './helper';\nimport Path, { PathStyleProps } from '../graphic/Path';\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\nimport TSpan, {TSpanStyleProps} from '../graphic/TSpan';\nimport { MatrixArray } from '../core/matrix';\nimport { RADIAN_TO_DEGREE } from '../core/util';\nimport { getLineDash } from './dashStyle';\nimport { REDRAW_BIT, SHAPE_CHANGED_BIT } from '../graphic/constants';\nimport type IncrementalDisplayable from '../graphic/IncrementalDisplayable';\nimport { DEFAULT_FONT } from '../core/platform';\n\nconst pathProxyForDraw = new PathProxy(true);\n\n// Not use el#hasStroke because style may be different.\nfunction styleHasStroke(style: PathStyleProps) {\n const stroke = style.stroke;\n return !(stroke == null || stroke === 'none' || !(style.lineWidth > 0));\n}\n\n// ignore lineWidth and must be string\n// Expected color but found '[' when color is gradient\nfunction isValidStrokeFillStyle(\n strokeOrFill: PathStyleProps['stroke'] | PathStyleProps['fill']\n): strokeOrFill is string {\n return typeof strokeOrFill === 'string' && strokeOrFill !== 'none';\n}\n\nfunction styleHasFill(style: PathStyleProps) {\n const fill = style.fill;\n return fill != null && fill !== 'none';\n}\nfunction doFillPath(ctx: CanvasRenderingContext2D, style: PathStyleProps) {\n if (style.fillOpacity != null && style.fillOpacity !== 1) {\n const originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.fillOpacity * style.opacity;\n ctx.fill();\n // Set back globalAlpha\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.fill();\n }\n}\n\nfunction doStrokePath(ctx: CanvasRenderingContext2D, style: PathStyleProps) {\n if (style.strokeOpacity != null && style.strokeOpacity !== 1) {\n const originalGlobalAlpha = ctx.globalAlpha;\n ctx.globalAlpha = style.strokeOpacity * style.opacity;\n ctx.stroke();\n // Set back globalAlpha\n ctx.globalAlpha = originalGlobalAlpha;\n }\n else {\n ctx.stroke();\n }\n}\n\nexport function createCanvasPattern(\n this: void,\n ctx: CanvasRenderingContext2D,\n pattern: ImagePatternObject,\n el: {dirty: () => void}\n): CanvasPattern {\n const image = createOrUpdateImage(pattern.image, (pattern as InnerImagePatternObject).__image, el);\n if (isImageReady(image)) {\n const canvasPattern = ctx.createPattern(image, pattern.repeat || 'repeat');\n if (\n typeof DOMMatrix === 'function'\n && canvasPattern // image may be not ready\n && canvasPattern.setTransform // setTransform may not be supported in some old devices.\n ) {\n const matrix = new DOMMatrix();\n matrix.translateSelf((pattern.x || 0), (pattern.y || 0));\n matrix.rotateSelf(0, 0, (pattern.rotation || 0) * RADIAN_TO_DEGREE);\n matrix.scaleSelf((pattern.scaleX || 1), (pattern.scaleY || 1));\n canvasPattern.setTransform(matrix);\n }\n return canvasPattern;\n }\n}\n\n// Draw Path Elements\nfunction brushPath(ctx: CanvasRenderingContext2D, el: Path, style: PathStyleProps, inBatch: boolean) {\n let hasStroke = styleHasStroke(style);\n let hasFill = styleHasFill(style);\n\n const strokePercent = style.strokePercent;\n const strokePart = strokePercent < 1;\n\n // TODO Reduce path memory cost.\n const firstDraw = !el.path;\n // Create path for each element when:\n // 1. Element has interactions.\n // 2. Element draw part of the line.\n if ((!el.silent || strokePart) && firstDraw) {\n el.createPathProxy();\n }\n\n const path = el.path || pathProxyForDraw;\n const dirtyFlag = el.__dirty;\n\n if (!inBatch) {\n const fill = style.fill;\n const stroke = style.stroke;\n\n const hasFillGradient = hasFill && !!(fill as GradientObject).colorStops;\n const hasStrokeGradient = hasStroke && !!(stroke as GradientObject).colorStops;\n const hasFillPattern = hasFill && !!(fill as ImagePatternObject).image;\n const hasStrokePattern = hasStroke && !!(stroke as ImagePatternObject).image;\n\n let fillGradient;\n let strokeGradient;\n let fillPattern;\n let strokePattern;\n let rect;\n if (hasFillGradient || hasStrokeGradient) {\n rect = el.getBoundingRect();\n }\n\n // Update gradient because bounding rect may changed\n if (hasFillGradient) {\n fillGradient = dirtyFlag\n ? getCanvasGradient(ctx, fill as (LinearGradientObject | RadialGradientObject), rect)\n : el.__canvasFillGradient;\n // No need to clear cache when fill is not gradient.\n // It will always been updated when fill changed back to gradient.\n el.__canvasFillGradient = fillGradient;\n }\n if (hasStrokeGradient) {\n strokeGradient = dirtyFlag\n ? getCanvasGradient(ctx, stroke as (LinearGradientObject | RadialGradientObject), rect)\n : el.__canvasStrokeGradient;\n el.__canvasStrokeGradient = strokeGradient;\n }\n if (hasFillPattern) {\n // Pattern might be null if image not ready (even created from dataURI)\n fillPattern = (dirtyFlag || !el.__canvasFillPattern)\n ? createCanvasPattern(ctx, fill as ImagePatternObject, el)\n : el.__canvasFillPattern;\n el.__canvasFillPattern = fillPattern;\n }\n if (hasStrokePattern) {\n // Pattern might be null if image not ready (even created from dataURI)\n strokePattern = (dirtyFlag || !el.__canvasStrokePattern)\n ? createCanvasPattern(ctx, stroke as ImagePatternObject, el)\n : el.__canvasStrokePattern;\n el.__canvasStrokePattern = fillPattern;\n }\n // Use the gradient or pattern\n if (hasFillGradient) {\n // PENDING If may have affect the state\n ctx.fillStyle = fillGradient;\n }\n else if (hasFillPattern) {\n if (fillPattern) { // createCanvasPattern may return false if image is not ready.\n ctx.fillStyle = fillPattern;\n }\n else {\n // Don't fill if image is not ready\n hasFill = false;\n }\n }\n if (hasStrokeGradient) {\n ctx.strokeStyle = strokeGradient;\n }\n else if (hasStrokePattern) {\n if (strokePattern) {\n ctx.strokeStyle = strokePattern;\n }\n else {\n // Don't stroke if image is not ready\n hasStroke = false;\n }\n }\n }\n\n // Update path sx, sy\n const scale = el.getGlobalScale();\n path.setScale(scale[0], scale[1], el.segmentIgnoreThreshold);\n\n let lineDash;\n let lineDashOffset;\n if (ctx.setLineDash && style.lineDash) {\n [lineDash, lineDashOffset] = getLineDash(el);\n }\n\n let needsRebuild = true;\n\n if (firstDraw || (dirtyFlag & SHAPE_CHANGED_BIT)) {\n path.setDPR((ctx as any).dpr);\n if (strokePart) {\n // Use rebuildPath for percent stroke, so no context.\n path.setContext(null);\n }\n else {\n path.setContext(ctx);\n needsRebuild = false;\n }\n path.reset();\n\n el.buildPath(path, el.shape, inBatch);\n path.toStatic();\n\n // Clear path dirty flag\n el.pathUpdated();\n }\n\n // Not support separate fill and stroke. For the compatibility of SVG\n if (needsRebuild) {\n path.rebuildPath(ctx, strokePart ? strokePercent : 1);\n }\n\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n\n if (!inBatch) {\n if (style.strokeFirst) {\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n if (hasFill) {\n doFillPath(ctx, style);\n }\n }\n else {\n if (hasFill) {\n doFillPath(ctx, style);\n }\n if (hasStroke) {\n doStrokePath(ctx, style);\n }\n }\n }\n\n if (lineDash) {\n // PENDING\n // Remove lineDash\n ctx.setLineDash([]);\n }\n}\n\n// Draw Image Elements\nfunction brushImage(ctx: CanvasRenderingContext2D, el: ZRImage, style: ImageStyleProps) {\n const image = el.__image = createOrUpdateImage(\n style.image,\n el.__image,\n el,\n el.onload\n );\n\n if (!image || !isImageReady(image)) {\n return;\n }\n\n const x = style.x || 0;\n const y = style.y || 0;\n let width = el.getWidth();\n let height = el.getHeight();\n const aspect = image.width / image.height;\n if (width == null && height != null) {\n // Keep image/height ratio\n width = height * aspect;\n }\n else if (height == null && width != null) {\n height = width / aspect;\n }\n else if (width == null && height == null) {\n width = image.width;\n height = image.height;\n }\n\n if (style.sWidth && style.sHeight) {\n const sx = style.sx || 0;\n const sy = style.sy || 0;\n ctx.drawImage(\n image,\n sx, sy, style.sWidth, style.sHeight,\n x, y, width, height\n );\n }\n else if (style.sx && style.sy) {\n const sx = style.sx;\n const sy = style.sy;\n const sWidth = width - sx;\n const sHeight = height - sy;\n ctx.drawImage(\n image,\n sx, sy, sWidth, sHeight,\n x, y, width, height\n );\n }\n else {\n ctx.drawImage(image, x, y, width, height);\n }\n}\n\n// Draw Text Elements\nfunction brushText(ctx: CanvasRenderingContext2D, el: TSpan, style: TSpanStyleProps) {\n\n let text = style.text;\n // Convert to string\n text != null && (text += '');\n\n if (text) {\n ctx.font = style.font || DEFAULT_FONT;\n ctx.textAlign = style.textAlign;\n ctx.textBaseline = style.textBaseline;\n\n let lineDash;\n let lineDashOffset;\n if (ctx.setLineDash && style.lineDash) {\n [lineDash, lineDashOffset] = getLineDash(el);\n }\n\n if (lineDash) {\n ctx.setLineDash(lineDash);\n ctx.lineDashOffset = lineDashOffset;\n }\n\n if (style.strokeFirst) {\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n }\n else {\n if (styleHasFill(style)) {\n ctx.fillText(text, style.x, style.y);\n }\n if (styleHasStroke(style)) {\n ctx.strokeText(text, style.x, style.y);\n }\n }\n\n if (lineDash) {\n // Remove lineDash\n ctx.setLineDash([]);\n }\n }\n\n}\n\nconst SHADOW_NUMBER_PROPS = ['shadowBlur', 'shadowOffsetX', 'shadowOffsetY'] as const;\nconst STROKE_PROPS = [\n ['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]\n] as const;\n\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\n// type ShadowPropNames = typeof SHADOW_PROPS[number][0];\n// type StrokePropNames = typeof STROKE_PROPS[number][0];\n// type DrawPropNames = typeof DRAW_PROPS[number][0];\n\nfunction bindCommonProps(\n ctx: CanvasRenderingContext2D,\n style: AllStyleOption,\n prevStyle: AllStyleOption,\n forceSetAll: boolean,\n scope: BrushScope\n): boolean {\n let styleChanged = false;\n\n if (!forceSetAll) {\n prevStyle = prevStyle || {};\n\n // Shared same style.\n if (style === prevStyle) {\n return false;\n }\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n // Ensure opacity is between 0 ~ 1. Invalid opacity will lead to a failure set and use the leaked opacity from the previous.\n const opacity = Math.max(Math.min(style.opacity, 1), 0);\n ctx.globalAlpha = isNaN(opacity) ? DEFAULT_COMMON_STYLE.opacity : opacity;\n }\n\n if (forceSetAll || style.blend !== prevStyle.blend) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalCompositeOperation = style.blend || DEFAULT_COMMON_STYLE.blend;\n }\n for (let i = 0; i < SHADOW_NUMBER_PROPS.length; i++) {\n const propName = SHADOW_NUMBER_PROPS[i];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n // FIXME Invalid property value will cause style leak from previous element.\n ctx[propName] = (ctx as ZRCanvasRenderingContext).dpr * (style[propName] || 0);\n }\n }\n if (forceSetAll || style.shadowColor !== prevStyle.shadowColor) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.shadowColor = style.shadowColor || DEFAULT_COMMON_STYLE.shadowColor;\n }\n return styleChanged;\n}\n\nfunction bindPathAndTextCommonStyle(\n ctx: CanvasRenderingContext2D,\n el: TSpan | Path,\n prevEl: TSpan | Path,\n forceSetAll: boolean,\n scope: BrushScope\n) {\n const style = getStyle(el, scope.inHover);\n const prevStyle = forceSetAll\n ? null\n : (prevEl && getStyle(prevEl, scope.inHover) || {});\n // Shared same style. prevStyle will be null if forceSetAll.\n if (style === prevStyle) {\n return false;\n }\n\n let styleChanged = bindCommonProps(ctx, style, prevStyle, forceSetAll, scope);\n\n if (forceSetAll || style.fill !== prevStyle.fill) {\n if (!styleChanged) {\n // Flush before set\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.fill) && (ctx.fillStyle = style.fill);\n }\n if (forceSetAll || style.stroke !== prevStyle.stroke) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n isValidStrokeFillStyle(style.stroke) && (ctx.strokeStyle = style.stroke);\n }\n if (forceSetAll || style.opacity !== prevStyle.opacity) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;\n }\n if (el.hasStroke()) {\n const lineWidth = style.lineWidth;\n const newLineWidth = lineWidth / (\n (style.strokeNoScale && el.getLineScale) ? el.getLineScale() : 1\n );\n if (ctx.lineWidth !== newLineWidth) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n ctx.lineWidth = newLineWidth;\n }\n }\n\n for (let i = 0; i < STROKE_PROPS.length; i++) {\n const prop = STROKE_PROPS[i];\n const propName = prop[0];\n if (forceSetAll || style[propName] !== prevStyle[propName]) {\n if (!styleChanged) {\n flushPathDrawn(ctx, scope);\n styleChanged = true;\n }\n // FIXME Invalid property value will cause style leak from previous element.\n (ctx as any)[propName] = style[propName] || prop[1];\n }\n }\n\n return styleChanged;\n}\n\nfunction bindImageStyle(\n ctx: CanvasRenderingContext2D,\n el: ZRImage,\n prevEl: ZRImage,\n // forceSetAll must be true if prevEl is null\n forceSetAll: boolean,\n scope: BrushScope\n) {\n return bindCommonProps(\n ctx,\n getStyle(el, scope.inHover),\n prevEl && getStyle(prevEl, scope.inHover),\n forceSetAll,\n scope\n );\n}\n\nfunction setContextTransform(ctx: CanvasRenderingContext2D, el: Displayable) {\n const m = el.transform;\n const dpr = (ctx as ZRCanvasRenderingContext).dpr || 1;\n if (m) {\n ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);\n }\n else {\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n }\n}\n\nfunction updateClipStatus(clipPaths: Path[], ctx: CanvasRenderingContext2D, scope: BrushScope) {\n let allClipped = false;\n for (let i = 0; i < clipPaths.length; i++) {\n const clipPath = clipPaths[i];\n // Ignore draw following elements if clipPath has zero area.\n allClipped = allClipped || clipPath.isZeroArea();\n\n setContextTransform(ctx, clipPath);\n ctx.beginPath();\n clipPath.buildPath(ctx, clipPath.shape);\n ctx.clip();\n }\n scope.allClipped = allClipped;\n}\n\nfunction isTransformChanged(m0: MatrixArray, m1: MatrixArray): boolean {\n if (m0 && m1) {\n return m0[0] !== m1[0]\n || m0[1] !== m1[1]\n || m0[2] !== m1[2]\n || m0[3] !== m1[3]\n || m0[4] !== m1[4]\n || m0[5] !== m1[5];\n }\n else if (!m0 && !m1) { // All identity matrix.\n return false;\n }\n\n return true;\n}\n\nconst DRAW_TYPE_PATH = 1;\nconst DRAW_TYPE_IMAGE = 2;\nconst DRAW_TYPE_TEXT = 3;\nconst DRAW_TYPE_INCREMENTAL = 4;\n\nexport type BrushScope = {\n inHover: boolean\n\n // width / height of viewport\n viewWidth: number\n viewHeight: number\n\n // Status for clipping\n prevElClipPaths?: Path[]\n prevEl?: Displayable\n allClipped?: boolean // If the whole element can be clipped\n\n // Status for batching\n batchFill?: string\n batchStroke?: string\n\n lastDrawType?: number\n}\n\n// If path can be batched\nfunction canPathBatch(style: PathStyleProps) {\n\n const hasFill = styleHasFill(style);\n const hasStroke = styleHasStroke(style);\n\n return !(\n // Line dash is dynamically set in brush function.\n style.lineDash\n // Can't batch if element is both set fill and stroke. Or both not set\n || !(+hasFill ^ +hasStroke)\n // Can't batch if element is drawn with gradient or pattern.\n || (hasFill && typeof style.fill !== 'string')\n || (hasStroke && typeof style.stroke !== 'string')\n // Can't batch if element only stroke part of line.\n || style.strokePercent < 1\n // Has stroke or fill opacity\n || style.strokeOpacity < 1\n || style.fillOpacity < 1\n );\n}\n\nfunction flushPathDrawn(ctx: CanvasRenderingContext2D, scope: BrushScope) {\n // Force flush all after drawn last element\n scope.batchFill && ctx.fill();\n scope.batchStroke && ctx.stroke();\n scope.batchFill = '';\n scope.batchStroke = '';\n}\n\nfunction getStyle(el: Displayable, inHover?: boolean) {\n return inHover ? (el.__hoverStyle || el.style) : el.style;\n}\n\nexport function brushSingle(ctx: CanvasRenderingContext2D, el: Displayable) {\n brush(ctx, el, { inHover: false, viewWidth: 0, viewHeight: 0 }, true);\n}\n\n// Brush different type of elements.\nexport function brush(\n ctx: CanvasRenderingContext2D,\n el: Displayable,\n scope: BrushScope,\n isLast: boolean\n) {\n const m = el.transform;\n\n if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {\n // Needs to mark el rendered.\n // Or this element will always been rendered in progressive rendering.\n // But other dirty bit should not be cleared, otherwise it cause the shape\n // can not be updated in this case.\n el.__dirty &= ~REDRAW_BIT;\n el.__isRendered = false;\n return;\n }\n\n // HANDLE CLIPPING\n const clipPaths = el.__clipPaths;\n const prevElClipPaths = scope.prevElClipPaths;\n\n let forceSetTransform = false;\n let forceSetStyle = false;\n // Optimize when clipping on group with several elements\n if (!prevElClipPaths || isClipPathChanged(clipPaths, prevElClipPaths)) {\n // If has previous clipping state, restore from it\n if (prevElClipPaths && prevElClipPaths.length) {\n // Flush restore\n flushPathDrawn(ctx, scope);\n\n ctx.restore();\n // Must set all style and transform because context changed by restore\n forceSetStyle = forceSetTransform = true;\n\n scope.prevElClipPaths = null;\n scope.allClipped = false;\n // Reset prevEl since context has been restored\n scope.prevEl = null;\n }\n // New clipping state\n if (clipPaths && clipPaths.length) {\n // Flush before clip\n flushPathDrawn(ctx, scope);\n\n ctx.save();\n updateClipStatus(clipPaths, ctx, scope);\n // Must set transform because it's changed when clip.\n forceSetTransform = true;\n }\n scope.prevElClipPaths = clipPaths;\n }\n\n // Not rendering elements if it's clipped by a zero area path.\n // Or it may cause bug on some version of IE11 (like 11.0.9600.178**),\n // where exception \"unexpected call to method or property access\"\n // might be thrown when calling ctx.fill or ctx.stroke after a path\n // whose area size is zero is drawn and ctx.clip() is called and\n // shadowBlur is set. See #4572, #3112, #5777.\n // (e.g.,\n // ctx.moveTo(10, 10);\n // ctx.lineTo(20, 10);\n // ctx.closePath();\n // ctx.clip();\n // ctx.shadowBlur = 10;\n // ...\n // ctx.fill();\n // )\n if (scope.allClipped) {\n el.__isRendered = false;\n return;\n }\n\n // START BRUSH\n el.beforeBrush && el.beforeBrush();\n el.innerBeforeBrush();\n\n const prevEl = scope.prevEl;\n // TODO el type changed.\n if (!prevEl) {\n forceSetStyle = forceSetTransform = true;\n }\n\n let canBatchPath = el instanceof Path // Only path supports batch\n && el.autoBatch\n && canPathBatch(el.style);\n\n if (forceSetTransform || isTransformChanged(m, prevEl.transform)) {\n // Flush\n flushPathDrawn(ctx, scope);\n setContextTransform(ctx, el);\n }\n else if (!canBatchPath) {\n // Flush\n flushPathDrawn(ctx, scope);\n }\n\n const style = getStyle(el, scope.inHover);\n if (el instanceof Path) {\n // PENDING do we need to rebind all style if displayable type changed?\n if (scope.lastDrawType !== DRAW_TYPE_PATH) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_PATH;\n }\n\n bindPathAndTextCommonStyle(ctx, el as Path, prevEl as Path, forceSetStyle, scope);\n // Begin path at start\n if (!canBatchPath || (!scope.batchFill && !scope.batchStroke)) {\n ctx.beginPath();\n }\n brushPath(ctx, el as Path, style, canBatchPath);\n\n if (canBatchPath) {\n scope.batchFill = style.fill as string || '';\n scope.batchStroke = style.stroke as string || '';\n }\n }\n else {\n if (el instanceof TSpan) {\n if (scope.lastDrawType !== DRAW_TYPE_TEXT) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_TEXT;\n }\n\n bindPathAndTextCommonStyle(ctx, el as TSpan, prevEl as TSpan, forceSetStyle, scope);\n brushText(ctx, el as TSpan, style);\n }\n else if (el instanceof ZRImage) {\n if (scope.lastDrawType !== DRAW_TYPE_IMAGE) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_IMAGE;\n }\n\n bindImageStyle(ctx, el as ZRImage, prevEl as ZRImage, forceSetStyle, scope);\n brushImage(ctx, el as ZRImage, style);\n }\n // Assume it's a IncrementalDisplayable\n else if ((el as IncrementalDisplayable).getTemporalDisplayables) {\n if (scope.lastDrawType !== DRAW_TYPE_INCREMENTAL) {\n forceSetStyle = true;\n scope.lastDrawType = DRAW_TYPE_INCREMENTAL;\n }\n\n brushIncremental(ctx, el as IncrementalDisplayable, scope);\n }\n\n }\n\n if (canBatchPath && isLast) {\n flushPathDrawn(ctx, scope);\n }\n\n el.innerAfterBrush();\n el.afterBrush && el.afterBrush();\n\n scope.prevEl = el;\n\n // Mark as painted.\n el.__dirty = 0;\n el.__isRendered = true;\n}\n\nfunction brushIncremental(\n ctx: CanvasRenderingContext2D,\n el: IncrementalDisplayable,\n scope: BrushScope\n) {\n let displayables = el.getDisplayables();\n let temporalDisplayables = el.getTemporalDisplayables();\n // Provide an inner scope.\n // Save current context and restore after brushed.\n ctx.save();\n let innerScope: BrushScope = {\n prevElClipPaths: null,\n prevEl: null,\n allClipped: false,\n viewWidth: scope.viewWidth,\n viewHeight: scope.viewHeight,\n inHover: scope.inHover\n };\n let i;\n let len;\n // Render persistant displayables.\n for (i = el.getCursor(), len = displayables.length; i < len; i++) {\n const displayable = displayables[i];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i === len - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n // Render temporary displayables.\n for (let i = 0, len = temporalDisplayables.length; i < len; i++) {\n const displayable = temporalDisplayables[i];\n displayable.beforeBrush && displayable.beforeBrush();\n displayable.innerBeforeBrush();\n brush(ctx, displayable, innerScope, i === len - 1);\n displayable.innerAfterBrush();\n displayable.afterBrush && displayable.afterBrush();\n innerScope.prevEl = displayable;\n }\n el.clearTemporalDisplayables();\n el.notClear = true;\n\n ctx.restore();\n}","import * as util from '../core/util';\nimport {devicePixelRatio} from '../config';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport CanvasPainter from './Painter';\nimport { GradientObject, InnerGradientObject } from '../graphic/Gradient';\nimport { ZRCanvasRenderingContext } from '../core/types';\nimport Eventful from '../core/Eventful';\nimport { ElementEventCallback } from '../Element';\nimport { getCanvasGradient } from './helper';\nimport { createCanvasPattern } from './graphic';\nimport Displayable from '../graphic/Displayable';\nimport BoundingRect from '../core/BoundingRect';\nimport { REDRAW_BIT } from '../graphic/constants';\nimport { platformApi } from '../core/platform';\n\nfunction createDom(id: string, painter: CanvasPainter, dpr: number) {\n const newDom = platformApi.createCanvas();\n const width = painter.getWidth();\n const height = painter.getHeight();\n\n const newDomStyle = newDom.style;\n if (newDomStyle) { // In node or some other non-browser environment\n newDomStyle.position = 'absolute';\n newDomStyle.left = '0';\n newDomStyle.top = '0';\n newDomStyle.width = width + 'px';\n newDomStyle.height = height + 'px';\n\n newDom.setAttribute('data-zr-dom-id', id);\n }\n\n newDom.width = width * dpr;\n newDom.height = height * dpr;\n\n return newDom;\n}\n\nexport interface LayerConfig {\n // 每次清空画布的颜色\n clearColor?: string | GradientObject | ImagePatternObject\n // 是否开启动态模糊\n motionBlur?: boolean\n // 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显\n lastFrameAlpha?: number\n};\n\nexport default class Layer extends Eventful {\n\n id: string\n\n dom: HTMLCanvasElement\n domBack: HTMLCanvasElement\n\n ctx: CanvasRenderingContext2D\n ctxBack: CanvasRenderingContext2D\n\n painter: CanvasPainter\n\n // Configs\n /**\n * 每次清空画布的颜色\n */\n clearColor: string | GradientObject | ImagePatternObject\n /**\n * 是否开启动态模糊\n */\n motionBlur = false\n /**\n * 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显\n */\n lastFrameAlpha = 0.7\n /**\n * Layer dpr\n */\n dpr = 1\n\n /**\n * Virtual layer will not be inserted into dom.\n */\n virtual = false\n\n config = {}\n\n incremental = false\n\n zlevel = 0\n\n maxRepaintRectCount = 5\n\n private _paintRects: BoundingRect[]\n\n __dirty = true\n __firstTimePaint = true\n\n __used = false\n\n __drawIndex = 0\n __startIndex = 0\n __endIndex = 0\n\n // indices in the previous frame\n __prevStartIndex: number = null\n __prevEndIndex: number = null\n\n __builtin__: boolean\n\n constructor(id: string | HTMLCanvasElement, painter: CanvasPainter, dpr?: number) {\n super();\n\n let dom;\n dpr = dpr || devicePixelRatio;\n if (typeof id === 'string') {\n dom = createDom(id, painter, dpr);\n }\n // Not using isDom because in node it will return false\n else if (util.isObject(id)) {\n dom = id;\n id = dom.id;\n }\n this.id = id as string;\n this.dom = dom;\n\n const domStyle = dom.style;\n if (domStyle) { // Not in node\n util.disableUserSelect(dom);\n dom.onselectstart = () => false;\n domStyle.padding = '0';\n domStyle.margin = '0';\n domStyle.borderWidth = '0';\n }\n\n this.painter = painter;\n\n this.dpr = dpr;\n }\n\n getElementCount() {\n return this.__endIndex - this.__startIndex;\n }\n\n afterBrush() {\n this.__prevStartIndex = this.__startIndex;\n this.__prevEndIndex = this.__endIndex;\n }\n\n initContext() {\n this.ctx = this.dom.getContext('2d');\n (this.ctx as ZRCanvasRenderingContext).dpr = this.dpr;\n }\n\n setUnpainted() {\n this.__firstTimePaint = true;\n }\n\n createBackBuffer() {\n const dpr = this.dpr;\n\n this.domBack = createDom('back-' + this.id, this.painter, dpr);\n this.ctxBack = this.domBack.getContext('2d');\n\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n }\n\n /**\n * Create repaint list when using dirty rect rendering.\n *\n * @param displayList current rendering list\n * @param prevList last frame rendering list\n * @return repaint rects. null for the first frame, [] for no element dirty\n */\n createRepaintRects(\n displayList: Displayable[],\n prevList: Displayable[],\n viewWidth: number,\n viewHeight: number\n ) {\n if (this.__firstTimePaint) {\n this.__firstTimePaint = false;\n return null;\n }\n\n const mergedRepaintRects: BoundingRect[] = [];\n const maxRepaintRectCount = this.maxRepaintRectCount;\n let full = false;\n const pendingRect = new BoundingRect(0, 0, 0, 0);\n\n function addRectToMergePool(rect: BoundingRect) {\n if (!rect.isFinite() || rect.isZero()) {\n return;\n }\n\n if (mergedRepaintRects.length === 0) {\n // First rect, create new merged rect\n const boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n else {\n let isMerged = false;\n let minDeltaArea = Infinity;\n let bestRectToMergeIdx = 0;\n for (let i = 0; i < mergedRepaintRects.length; ++i) {\n const mergedRect = mergedRepaintRects[i];\n\n // Merge if has intersection\n if (mergedRect.intersect(rect)) {\n const pendingRect = new BoundingRect(0, 0, 0, 0);\n pendingRect.copy(mergedRect);\n pendingRect.union(rect);\n mergedRepaintRects[i] = pendingRect;\n isMerged = true;\n break;\n }\n else if (full) {\n // Merged to exists rectangles if full\n pendingRect.copy(rect);\n pendingRect.union(mergedRect);\n const aArea = rect.width * rect.height;\n const bArea = mergedRect.width * mergedRect.height;\n const pendingArea = pendingRect.width * pendingRect.height;\n const deltaArea = pendingArea - aArea - bArea;\n if (deltaArea < minDeltaArea) {\n minDeltaArea = deltaArea;\n bestRectToMergeIdx = i;\n }\n }\n }\n\n if (full) {\n mergedRepaintRects[bestRectToMergeIdx].union(rect);\n isMerged = true;\n }\n\n if (!isMerged) {\n // Create new merged rect if cannot merge with current\n const boundingRect = new BoundingRect(0, 0, 0, 0);\n boundingRect.copy(rect);\n mergedRepaintRects.push(boundingRect);\n }\n if (!full) {\n full = mergedRepaintRects.length >= maxRepaintRectCount;\n }\n }\n }\n\n /**\n * Loop the paint list of this frame and get the dirty rects of elements\n * in this frame.\n */\n for (let i = this.__startIndex; i < this.__endIndex; ++i) {\n const el = displayList[i];\n if (el) {\n /**\n * `shouldPaint` is true only when the element is not ignored or\n * invisible and all its ancestors are not ignored.\n * `shouldPaint` being true means it will be brushed this frame.\n *\n * `__isRendered` being true means the element is currently on\n * the canvas.\n *\n * `__dirty` being true means the element should be brushed this\n * frame.\n *\n * We only need to repaint the element's previous painting rect\n * if it's currently on the canvas and needs repaint this frame\n * or not painted this frame.\n */\n const shouldPaint = el.shouldBePainted(viewWidth, viewHeight, true, true);\n const prevRect = el.__isRendered && ((el.__dirty & REDRAW_BIT) || !shouldPaint)\n ? el.getPrevPaintRect()\n : null;\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n\n /**\n * On the other hand, we only need to paint the current rect\n * if the element should be brushed this frame and either being\n * dirty or not rendered before.\n */\n const curRect = shouldPaint && ((el.__dirty & REDRAW_BIT) || !el.__isRendered)\n ? el.getPaintRect()\n : null;\n if (curRect) {\n addRectToMergePool(curRect);\n }\n }\n }\n\n /**\n * The above loop calculates the dirty rects of elements that are in the\n * paint list this frame, which does not include those elements removed\n * in this frame. So we loop the `prevList` to get the removed elements.\n */\n for (let i = this.__prevStartIndex; i < this.__prevEndIndex; ++i) {\n const el = prevList[i];\n /**\n * Consider the elements whose ancestors are invisible, they should\n * not be painted and their previous painting rects should be\n * cleared if they are rendered on the canvas (`__isRendered` being\n * true). `!shouldPaint` means the element is not brushed in this\n * frame.\n *\n * `!el.__zr` means it's removed from the storage.\n *\n * In conclusion, an element needs to repaint the previous painting\n * rect if and only if it's not painted this frame and was\n * previously painted on the canvas.\n */\n const shouldPaint = el && el.shouldBePainted(viewWidth, viewHeight, true, true);\n if (el && (!shouldPaint || !el.__zr) && el.__isRendered) {\n // el was removed\n const prevRect = el.getPrevPaintRect();\n if (prevRect) {\n addRectToMergePool(prevRect);\n }\n }\n }\n\n // Merge intersected rects in the result\n let hasIntersections;\n do {\n hasIntersections = false;\n for (let i = 0; i < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].isZero()) {\n mergedRepaintRects.splice(i, 1);\n continue;\n }\n for (let j = i + 1; j < mergedRepaintRects.length;) {\n if (mergedRepaintRects[i].intersect(mergedRepaintRects[j])) {\n hasIntersections = true;\n mergedRepaintRects[i].union(mergedRepaintRects[j]);\n mergedRepaintRects.splice(j, 1);\n }\n else {\n j++;\n }\n }\n i++;\n }\n } while (hasIntersections);\n\n this._paintRects = mergedRepaintRects;\n\n return mergedRepaintRects;\n }\n\n /**\n * Get paint rects for debug usage.\n */\n debugGetPaintRects() {\n return (this._paintRects || []).slice();\n }\n\n resize(width: number, height: number) {\n const dpr = this.dpr;\n\n const dom = this.dom;\n const domStyle = dom.style;\n const domBack = this.domBack;\n\n if (domStyle) {\n domStyle.width = width + 'px';\n domStyle.height = height + 'px';\n }\n\n dom.width = width * dpr;\n dom.height = height * dpr;\n\n if (domBack) {\n domBack.width = width * dpr;\n domBack.height = height * dpr;\n\n if (dpr !== 1) {\n this.ctxBack.scale(dpr, dpr);\n }\n }\n }\n\n /**\n * 清空该层画布\n */\n clear(\n clearAll?: boolean,\n clearColor?: string | GradientObject | ImagePatternObject,\n repaintRects?: BoundingRect[]\n ) {\n const dom = this.dom;\n const ctx = this.ctx;\n const width = dom.width;\n const height = dom.height;\n\n clearColor = clearColor || this.clearColor;\n const haveMotionBLur = this.motionBlur && !clearAll;\n const lastFrameAlpha = this.lastFrameAlpha;\n\n const dpr = this.dpr;\n const self = this;\n\n if (haveMotionBLur) {\n if (!this.domBack) {\n this.createBackBuffer();\n }\n\n this.ctxBack.globalCompositeOperation = 'copy';\n this.ctxBack.drawImage(\n dom, 0, 0,\n width / dpr,\n height / dpr\n );\n }\n\n const domBack = this.domBack;\n\n function doClear(x: number, y: number, width: number, height: number) {\n ctx.clearRect(x, y, width, height);\n if (clearColor && clearColor !== 'transparent') {\n let clearColorGradientOrPattern;\n // Gradient\n if (util.isGradientObject(clearColor)) {\n // shouldn't cache when clearColor is not global and size changed\n const shouldCache = clearColor.global || (\n (clearColor as InnerGradientObject).__width === width\n && (clearColor as InnerGradientObject).__height === height\n );\n // Cache canvas gradient\n clearColorGradientOrPattern = shouldCache\n && (clearColor as InnerGradientObject).__canvasGradient\n || getCanvasGradient(ctx, clearColor, {\n x: 0,\n y: 0,\n width: width,\n height: height\n });\n\n (clearColor as InnerGradientObject).__canvasGradient = clearColorGradientOrPattern;\n (clearColor as InnerGradientObject).__width = width;\n (clearColor as InnerGradientObject).__height = height;\n }\n // Pattern\n else if (util.isImagePatternObject(clearColor)) {\n // scale pattern by dpr\n clearColor.scaleX = clearColor.scaleX || dpr;\n clearColor.scaleY = clearColor.scaleY || dpr;\n clearColorGradientOrPattern = createCanvasPattern(\n ctx, clearColor, {\n dirty() {\n self.setUnpainted();\n self.painter.refresh();\n }\n }\n );\n }\n ctx.save();\n ctx.fillStyle = clearColorGradientOrPattern || (clearColor as string);\n ctx.fillRect(x, y, width, height);\n ctx.restore();\n }\n\n if (haveMotionBLur) {\n ctx.save();\n ctx.globalAlpha = lastFrameAlpha;\n ctx.drawImage(domBack, x, y, width, height);\n ctx.restore();\n }\n };\n\n if (!repaintRects || haveMotionBLur) {\n // Clear the full canvas\n doClear(0, 0, width, height);\n }\n else if (repaintRects.length) {\n // Clear the repaint areas\n util.each(repaintRects, rect => {\n doClear(\n rect.x * dpr,\n rect.y * dpr,\n rect.width * dpr,\n rect.height * dpr\n );\n });\n }\n }\n\n // Interface of refresh\n refresh: (clearColor?: string | GradientObject | ImagePatternObject) => void\n\n // Interface of renderToCanvas in getRenderedCanvas\n renderToCanvas: (ctx: CanvasRenderingContext2D) => void\n\n // Events\n onclick: ElementEventCallback\n ondblclick: ElementEventCallback\n onmouseover: ElementEventCallback\n onmouseout: ElementEventCallback\n onmousemove: ElementEventCallback\n onmousewheel: ElementEventCallback\n onmousedown: ElementEventCallback\n onmouseup: ElementEventCallback\n oncontextmenu: ElementEventCallback\n\n ondrag: ElementEventCallback\n ondragstart: ElementEventCallback\n ondragend: ElementEventCallback\n ondragenter: ElementEventCallback\n ondragleave: ElementEventCallback\n ondragover: ElementEventCallback\n ondrop: ElementEventCallback\n}\n","import {devicePixelRatio} from '../config';\nimport * as util from '../core/util';\nimport Layer, { LayerConfig } from './Layer';\nimport requestAnimationFrame from '../animation/requestAnimationFrame';\nimport env from '../core/env';\nimport Displayable from '../graphic/Displayable';\nimport { WXCanvasRenderingContext } from '../core/types';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject } from '../graphic/Pattern';\nimport Storage from '../Storage';\nimport { brush, BrushScope, brushSingle } from './graphic';\nimport { PainterBase } from '../PainterBase';\nimport BoundingRect from '../core/BoundingRect';\nimport { REDRAW_BIT } from '../graphic/constants';\nimport { getSize } from './helper';\nimport type IncrementalDisplayable from '../graphic/IncrementalDisplayable';\n\nconst HOVER_LAYER_ZLEVEL = 1e5;\nconst CANVAS_ZLEVEL = 314159;\n\nconst EL_AFTER_INCREMENTAL_INC = 0.01;\nconst INCREMENTAL_INC = 0.001;\n\n\nfunction isLayerValid(layer: Layer) {\n if (!layer) {\n return false;\n }\n\n if (layer.__builtin__) {\n return true;\n }\n\n if (typeof (layer.resize) !== 'function'\n || typeof (layer.refresh) !== 'function'\n ) {\n return false;\n }\n\n return true;\n}\n\nfunction createRoot(width: number, height: number) {\n const domRoot = document.createElement('div');\n\n // domRoot.onselectstart = returnFalse; // Avoid page selected\n domRoot.style.cssText = [\n 'position:relative',\n // IOS13 safari probably has a compositing bug (z order of the canvas and the consequent\n // dom does not act as expected) when some of the parent dom has\n // `-webkit-overflow-scrolling: touch;` and the webpage is longer than one screen and\n // the canvas is not at the top part of the page.\n // Check `https://bugs.webkit.org/show_bug.cgi?id=203681` for more details. We remove\n // this `overflow:hidden` to avoid the bug.\n // 'overflow:hidden',\n 'width:' + width + 'px',\n 'height:' + height + 'px',\n 'padding:0',\n 'margin:0',\n 'border-width:0'\n ].join(';') + ';';\n\n return domRoot;\n}\n\ninterface CanvasPainterOption {\n devicePixelRatio?: number\n width?: number | string // Can be 10 / 10px / auto\n height?: number | string,\n useDirtyRect?: boolean\n}\n\nexport default class CanvasPainter implements PainterBase {\n\n type = 'canvas'\n\n root: HTMLElement\n\n dpr: number\n\n storage: Storage\n\n private _singleCanvas: boolean\n\n private _opts: CanvasPainterOption\n\n private _zlevelList: number[] = []\n\n private _prevDisplayList: Displayable[] = []\n\n private _layers: {[key: number]: Layer} = {} // key is zlevel\n\n private _layerConfig: {[key: number]: LayerConfig} = {} // key is zlevel\n\n /**\n * zrender will do compositing when root is a canvas and have multiple zlevels.\n */\n private _needsManuallyCompositing = false\n\n private _width: number\n private _height: number\n\n private _domRoot: HTMLElement\n\n private _hoverlayer: Layer\n\n private _redrawId: number\n\n private _backgroundColor: string | GradientObject | ImagePatternObject\n\n\n constructor(root: HTMLElement, storage: Storage, opts: CanvasPainterOption, id: number) {\n\n this.type = 'canvas';\n\n // In node environment using node-canvas\n const singleCanvas = !root.nodeName // In node ?\n || root.nodeName.toUpperCase() === 'CANVAS';\n\n this._opts = opts = util.extend({}, opts || {}) as CanvasPainterOption;\n\n /**\n * @type {number}\n */\n this.dpr = opts.devicePixelRatio || devicePixelRatio;\n /**\n * @type {boolean}\n * @private\n */\n this._singleCanvas = singleCanvas;\n /**\n * 绘图容器\n * @type {HTMLElement}\n */\n this.root = root;\n\n const rootStyle = root.style;\n\n if (rootStyle) {\n // @ts-ignore\n util.disableUserSelect(root);\n root.innerHTML = '';\n }\n\n /**\n * @type {module:zrender/Storage}\n */\n this.storage = storage;\n\n const zlevelList: number[] = this._zlevelList;\n\n this._prevDisplayList = [];\n\n const layers = this._layers;\n\n if (!singleCanvas) {\n this._width = getSize(root, 0, opts);\n this._height = getSize(root, 1, opts);\n\n const domRoot = this._domRoot = createRoot(\n this._width, this._height\n );\n root.appendChild(domRoot);\n }\n else {\n const rootCanvas = root as HTMLCanvasElement;\n let width = rootCanvas.width;\n let height = rootCanvas.height;\n\n if (opts.width != null) {\n // TODO sting?\n width = opts.width as number;\n }\n if (opts.height != null) {\n // TODO sting?\n height = opts.height as number;\n }\n this.dpr = opts.devicePixelRatio || 1;\n\n // Use canvas width and height directly\n rootCanvas.width = width * this.dpr;\n rootCanvas.height = height * this.dpr;\n\n this._width = width;\n this._height = height;\n\n // Create layer if only one given canvas\n // Device can be specified to create a high dpi image.\n const mainLayer = new Layer(rootCanvas, this, this.dpr);\n mainLayer.__builtin__ = true;\n mainLayer.initContext();\n // FIXME Use canvas width and height\n // mainLayer.resize(width, height);\n layers[CANVAS_ZLEVEL] = mainLayer;\n mainLayer.zlevel = CANVAS_ZLEVEL;\n // Not use common zlevel.\n zlevelList.push(CANVAS_ZLEVEL);\n\n this._domRoot = root;\n }\n }\n\n\n getType() {\n return 'canvas';\n }\n\n /**\n * If painter use a single canvas\n */\n isSingleCanvas() {\n return this._singleCanvas;\n }\n\n getViewportRoot() {\n return this._domRoot;\n }\n\n getViewportRootOffset() {\n const viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n }\n\n /**\n * 刷新\n * @param paintAll 强制绘制所有displayable\n */\n refresh(paintAll?: boolean) {\n const list = this.storage.getDisplayList(true);\n const prevList = this._prevDisplayList;\n\n const zlevelList = this._zlevelList;\n\n this._redrawId = Math.random();\n\n this._paintList(list, prevList, paintAll, this._redrawId);\n\n // Paint custum layers\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (!layer.__builtin__ && layer.refresh) {\n const clearColor = i === 0 ? this._backgroundColor : null;\n layer.refresh(clearColor);\n }\n }\n\n if (this._opts.useDirtyRect) {\n this._prevDisplayList = list.slice();\n }\n\n return this;\n }\n\n\n refreshHover() {\n this._paintHoverList(this.storage.getDisplayList(false));\n }\n\n private _paintHoverList(list: Displayable[]) {\n let len = list.length;\n let hoverLayer = this._hoverlayer;\n hoverLayer && hoverLayer.clear();\n\n if (!len) {\n return;\n }\n\n const scope: BrushScope = {\n inHover: true,\n viewWidth: this._width,\n viewHeight: this._height\n };\n\n let ctx;\n for (let i = 0; i < len; i++) {\n const el = list[i];\n if (el.__inHover) {\n // Use a extream large zlevel\n // FIXME?\n if (!hoverLayer) {\n hoverLayer = this._hoverlayer = this.getLayer(HOVER_LAYER_ZLEVEL);\n }\n\n if (!ctx) {\n ctx = hoverLayer.ctx;\n ctx.save();\n }\n\n brush(ctx, el, scope, i === len - 1);\n }\n }\n if (ctx) {\n ctx.restore();\n }\n }\n\n getHoverLayer() {\n return this.getLayer(HOVER_LAYER_ZLEVEL);\n }\n\n paintOne(ctx: CanvasRenderingContext2D, el: Displayable) {\n brushSingle(ctx, el);\n }\n\n private _paintList(list: Displayable[], prevList: Displayable[], paintAll: boolean, redrawId?: number) {\n if (this._redrawId !== redrawId) {\n return;\n }\n\n paintAll = paintAll || false;\n\n this._updateLayerStatus(list);\n\n const {finished, needsRefreshHover} = this._doPaintList(list, prevList, paintAll);\n\n if (this._needsManuallyCompositing) {\n this._compositeManually();\n }\n\n if (needsRefreshHover) {\n this._paintHoverList(list);\n }\n\n if (!finished) {\n const self = this;\n requestAnimationFrame(function () {\n self._paintList(list, prevList, paintAll, redrawId);\n });\n }\n else {\n this.eachLayer(layer => {\n layer.afterBrush && layer.afterBrush();\n });\n }\n }\n\n private _compositeManually() {\n const ctx = this.getLayer(CANVAS_ZLEVEL).ctx;\n const width = (this._domRoot as HTMLCanvasElement).width;\n const height = (this._domRoot as HTMLCanvasElement).height;\n ctx.clearRect(0, 0, width, height);\n // PENDING, If only builtin layer?\n this.eachBuiltinLayer(function (layer) {\n if (layer.virtual) {\n ctx.drawImage(layer.dom, 0, 0, width, height);\n }\n });\n }\n\n private _doPaintList(\n list: Displayable[],\n prevList: Displayable[],\n paintAll?: boolean\n ): {\n finished: boolean\n needsRefreshHover: boolean\n } {\n const layerList = [];\n const useDirtyRect = this._opts.useDirtyRect;\n for (let zi = 0; zi < this._zlevelList.length; zi++) {\n const zlevel = this._zlevelList[zi];\n const layer = this._layers[zlevel];\n if (layer.__builtin__\n && layer !== this._hoverlayer\n && (layer.__dirty || paintAll)\n // Layer with hover elements can't be redrawn.\n // && !layer.__hasHoverLayerELement\n ) {\n layerList.push(layer);\n }\n }\n\n let finished = true;\n let needsRefreshHover = false;\n\n for (let k = 0; k < layerList.length; k++) {\n const layer = layerList[k];\n const ctx = layer.ctx;\n\n const repaintRects = useDirtyRect\n && layer.createRepaintRects(list, prevList, this._width, this._height);\n\n let start = paintAll ? layer.__startIndex : layer.__drawIndex;\n\n const useTimer = !paintAll && layer.incremental && Date.now;\n const startTime = useTimer && Date.now();\n\n const clearColor = layer.zlevel === this._zlevelList[0]\n ? this._backgroundColor : null;\n\n // All elements in this layer are removed.\n if (layer.__startIndex === layer.__endIndex) {\n layer.clear(false, clearColor, repaintRects);\n }\n else if (start === layer.__startIndex) {\n const firstEl = list[start];\n if (!firstEl.incremental || !(firstEl as IncrementalDisplayable).notClear || paintAll) {\n layer.clear(false, clearColor, repaintRects);\n }\n }\n if (start === -1) {\n console.error('For some unknown reason. drawIndex is -1');\n start = layer.__startIndex;\n }\n let i: number;\n /* eslint-disable-next-line */\n const repaint = (repaintRect?: BoundingRect) => {\n const scope: BrushScope = {\n inHover: false,\n allClipped: false,\n prevEl: null,\n viewWidth: this._width,\n viewHeight: this._height\n };\n\n for (i = start; i < layer.__endIndex; i++) {\n const el = list[i];\n\n if (el.__inHover) {\n needsRefreshHover = true;\n }\n\n this._doPaintEl(el, layer, useDirtyRect, repaintRect, scope, i === layer.__endIndex - 1);\n\n if (useTimer) {\n // Date.now can be executed in 13,025,305 ops/second.\n const dTime = Date.now() - startTime;\n // Give 15 millisecond to draw.\n // The rest elements will be drawn in the next frame.\n if (dTime > 15) {\n break;\n }\n }\n }\n\n if (scope.prevElClipPaths) {\n // Needs restore the state. If last drawn element is in the clipping area.\n ctx.restore();\n }\n };\n\n if (repaintRects) {\n if (repaintRects.length === 0) {\n // Nothing to repaint, mark as finished\n i = layer.__endIndex;\n }\n else {\n const dpr = this.dpr;\n // Set repaintRect as clipPath\n for (var r = 0; r < repaintRects.length; ++r) {\n const rect = repaintRects[r];\n\n ctx.save();\n ctx.beginPath();\n ctx.rect(\n rect.x * dpr,\n rect.y * dpr,\n rect.width * dpr,\n rect.height * dpr\n );\n ctx.clip();\n\n repaint(rect);\n ctx.restore();\n }\n }\n }\n else {\n // Paint all once\n ctx.save();\n repaint();\n ctx.restore();\n }\n\n layer.__drawIndex = i;\n\n if (layer.__drawIndex < layer.__endIndex) {\n finished = false;\n }\n }\n\n if (env.wxa) {\n // Flush for weixin application\n util.each(this._layers, function (layer) {\n if (layer && layer.ctx && (layer.ctx as WXCanvasRenderingContext).draw) {\n (layer.ctx as WXCanvasRenderingContext).draw();\n }\n });\n }\n\n return {\n finished,\n needsRefreshHover\n };\n }\n\n private _doPaintEl(\n el: Displayable,\n currentLayer: Layer,\n useDirtyRect: boolean,\n repaintRect: BoundingRect,\n scope: BrushScope,\n isLast: boolean\n ) {\n const ctx = currentLayer.ctx;\n if (useDirtyRect) {\n const paintRect = el.getPaintRect();\n if (!repaintRect || paintRect && paintRect.intersect(repaintRect)) {\n brush(ctx, el, scope, isLast);\n el.setPrevPaintRect(paintRect);\n }\n }\n else {\n brush(ctx, el, scope, isLast);\n }\n }\n\n /**\n * 获取 zlevel 所在层,如果不存在则会创建一个新的层\n * @param zlevel\n * @param virtual Virtual layer will not be inserted into dom.\n */\n getLayer(zlevel: number, virtual?: boolean) {\n if (this._singleCanvas && !this._needsManuallyCompositing) {\n zlevel = CANVAS_ZLEVEL;\n }\n let layer = this._layers[zlevel];\n if (!layer) {\n // Create a new layer\n layer = new Layer('zr_' + zlevel, this, this.dpr);\n layer.zlevel = zlevel;\n layer.__builtin__ = true;\n\n if (this._layerConfig[zlevel]) {\n util.merge(layer, this._layerConfig[zlevel], true);\n }\n // TODO Remove EL_AFTER_INCREMENTAL_INC magic number\n else if (this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC]) {\n util.merge(layer, this._layerConfig[zlevel - EL_AFTER_INCREMENTAL_INC], true);\n }\n\n if (virtual) {\n layer.virtual = virtual;\n }\n\n this.insertLayer(zlevel, layer);\n\n // Context is created after dom inserted to document\n // Or excanvas will get 0px clientWidth and clientHeight\n layer.initContext();\n }\n\n return layer;\n }\n\n insertLayer(zlevel: number, layer: Layer) {\n\n const layersMap = this._layers;\n const zlevelList = this._zlevelList;\n const len = zlevelList.length;\n const domRoot = this._domRoot;\n let prevLayer = null;\n let i = -1;\n\n if (layersMap[zlevel]) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('ZLevel ' + zlevel + ' has been used already');\n }\n return;\n }\n // Check if is a valid layer\n if (!isLayerValid(layer)) {\n if (process.env.NODE_ENV !== 'production') {\n util.logError('Layer of zlevel ' + zlevel + ' is not valid');\n }\n return;\n }\n\n if (len > 0 && zlevel > zlevelList[0]) {\n for (i = 0; i < len - 1; i++) {\n if (\n zlevelList[i] < zlevel\n && zlevelList[i + 1] > zlevel\n ) {\n break;\n }\n }\n prevLayer = layersMap[zlevelList[i]];\n }\n zlevelList.splice(i + 1, 0, zlevel);\n\n layersMap[zlevel] = layer;\n\n // Virtual layer will not directly show on the screen.\n // (It can be a WebGL layer and assigned to a ZRImage element)\n // But it still under management of zrender.\n if (!layer.virtual) {\n if (prevLayer) {\n const prevDom = prevLayer.dom;\n if (prevDom.nextSibling) {\n domRoot.insertBefore(\n layer.dom,\n prevDom.nextSibling\n );\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n else {\n if (domRoot.firstChild) {\n domRoot.insertBefore(layer.dom, domRoot.firstChild);\n }\n else {\n domRoot.appendChild(layer.dom);\n }\n }\n }\n\n layer.painter || (layer.painter = this);\n }\n\n // Iterate each layer\n eachLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n cb.call(context, this._layers[z], z);\n }\n }\n\n // Iterate each buildin layer\n eachBuiltinLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n }\n\n // Iterate each other layer except buildin layer\n eachOtherLayer(cb: (this: T, layer: Layer, z: number) => void, context?: T) {\n const zlevelList = this._zlevelList;\n for (let i = 0; i < zlevelList.length; i++) {\n const z = zlevelList[i];\n const layer = this._layers[z];\n if (!layer.__builtin__) {\n cb.call(context, layer, z);\n }\n }\n }\n\n /**\n * 获取所有已创建的层\n * @param prevLayer\n */\n getLayers() {\n return this._layers;\n }\n\n _updateLayerStatus(list: Displayable[]) {\n\n this.eachBuiltinLayer(function (layer, z) {\n layer.__dirty = layer.__used = false;\n });\n\n function updatePrevLayer(idx: number) {\n if (prevLayer) {\n if (prevLayer.__endIndex !== idx) {\n prevLayer.__dirty = true;\n }\n prevLayer.__endIndex = idx;\n }\n }\n\n if (this._singleCanvas) {\n for (let i = 1; i < list.length; i++) {\n const el = list[i];\n if (el.zlevel !== list[i - 1].zlevel || el.incremental) {\n this._needsManuallyCompositing = true;\n break;\n }\n }\n }\n\n let prevLayer: Layer = null;\n let incrementalLayerCount = 0;\n let prevZlevel;\n let i;\n\n for (i = 0; i < list.length; i++) {\n const el = list[i];\n const zlevel = el.zlevel;\n let layer;\n\n if (prevZlevel !== zlevel) {\n prevZlevel = zlevel;\n incrementalLayerCount = 0;\n }\n\n // TODO Not use magic number on zlevel.\n\n // Each layer with increment element can be separated to 3 layers.\n // (Other Element drawn after incremental element)\n // -----------------zlevel + EL_AFTER_INCREMENTAL_INC--------------------\n // (Incremental element)\n // ----------------------zlevel + INCREMENTAL_INC------------------------\n // (Element drawn before incremental element)\n // --------------------------------zlevel--------------------------------\n if (el.incremental) {\n layer = this.getLayer(zlevel + INCREMENTAL_INC, this._needsManuallyCompositing);\n layer.incremental = true;\n incrementalLayerCount = 1;\n }\n else {\n layer = this.getLayer(\n zlevel + (incrementalLayerCount > 0 ? EL_AFTER_INCREMENTAL_INC : 0),\n this._needsManuallyCompositing\n );\n }\n\n if (!layer.__builtin__) {\n util.logError('ZLevel ' + zlevel + ' has been used by unkown layer ' + layer.id);\n }\n\n if (layer !== prevLayer) {\n layer.__used = true;\n if (layer.__startIndex !== i) {\n layer.__dirty = true;\n }\n layer.__startIndex = i;\n if (!layer.incremental) {\n layer.__drawIndex = i;\n }\n else {\n // Mark layer draw index needs to update.\n layer.__drawIndex = -1;\n }\n updatePrevLayer(i);\n prevLayer = layer;\n }\n if ((el.__dirty & REDRAW_BIT) && !el.__inHover) { // Ignore dirty elements in hover layer.\n layer.__dirty = true;\n if (layer.incremental && layer.__drawIndex < 0) {\n // Start draw from the first dirty element.\n layer.__drawIndex = i;\n }\n }\n }\n\n updatePrevLayer(i);\n\n this.eachBuiltinLayer(function (layer, z) {\n // Used in last frame but not in this frame. Needs clear\n if (!layer.__used && layer.getElementCount() > 0) {\n layer.__dirty = true;\n layer.__startIndex = layer.__endIndex = layer.__drawIndex = 0;\n }\n // For incremental layer. In case start index changed and no elements are dirty.\n if (layer.__dirty && layer.__drawIndex < 0) {\n layer.__drawIndex = layer.__startIndex;\n }\n });\n }\n\n /**\n * 清除hover层外所有内容\n */\n clear() {\n this.eachBuiltinLayer(this._clearLayer);\n return this;\n }\n\n _clearLayer(layer: Layer) {\n layer.clear();\n }\n\n setBackgroundColor(backgroundColor: string | GradientObject | ImagePatternObject) {\n this._backgroundColor = backgroundColor;\n\n util.each(this._layers, layer => {\n layer.setUnpainted();\n });\n }\n\n /**\n * 修改指定zlevel的绘制参数\n */\n configLayer(zlevel: number, config: LayerConfig) {\n if (config) {\n const layerConfig = this._layerConfig;\n if (!layerConfig[zlevel]) {\n layerConfig[zlevel] = config;\n }\n else {\n util.merge(layerConfig[zlevel], config, true);\n }\n\n for (let i = 0; i < this._zlevelList.length; i++) {\n const _zlevel = this._zlevelList[i];\n // TODO Remove EL_AFTER_INCREMENTAL_INC magic number\n if (_zlevel === zlevel || _zlevel === zlevel + EL_AFTER_INCREMENTAL_INC) {\n const layer = this._layers[_zlevel];\n util.merge(layer, layerConfig[zlevel], true);\n }\n }\n }\n }\n\n /**\n * 删除指定层\n * @param zlevel 层所在的zlevel\n */\n delLayer(zlevel: number) {\n const layers = this._layers;\n const zlevelList = this._zlevelList;\n const layer = layers[zlevel];\n if (!layer) {\n return;\n }\n layer.dom.parentNode.removeChild(layer.dom);\n delete layers[zlevel];\n\n zlevelList.splice(util.indexOf(zlevelList, zlevel), 1);\n }\n\n /**\n * 区域大小变化后重绘\n */\n resize(\n width?: number | string,\n height?: number | string\n ) {\n if (!this._domRoot.style) { // Maybe in node or worker\n if (width == null || height == null) {\n return;\n }\n // TODO width / height may be string\n this._width = width as number;\n this._height = height as number;\n\n this.getLayer(CANVAS_ZLEVEL).resize(width as number, height as number);\n }\n else {\n const domRoot = this._domRoot;\n // FIXME Why ?\n domRoot.style.display = 'none';\n\n // Save input w/h\n const opts = this._opts;\n const root = this.root;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n\n domRoot.style.display = '';\n\n // 优化没有实际改变的resize\n if (this._width !== width || height !== this._height) {\n domRoot.style.width = width + 'px';\n domRoot.style.height = height + 'px';\n\n for (let id in this._layers) {\n if (this._layers.hasOwnProperty(id)) {\n this._layers[id].resize(width, height);\n }\n }\n\n this.refresh(true);\n }\n\n this._width = width;\n this._height = height;\n\n }\n return this;\n }\n\n /**\n * 清除单独的一个层\n * @param {number} zlevel\n */\n clearLayer(zlevel: number) {\n const layer = this._layers[zlevel];\n if (layer) {\n layer.clear();\n }\n }\n\n /**\n * 释放\n */\n dispose() {\n this.root.innerHTML = '';\n\n this.root =\n this.storage =\n\n this._domRoot =\n this._layers = null;\n }\n\n /**\n * Get canvas which has all thing rendered\n */\n getRenderedCanvas(opts?: {\n backgroundColor?: string | GradientObject | ImagePatternObject\n pixelRatio?: number\n }) {\n opts = opts || {};\n if (this._singleCanvas && !this._compositeManually) {\n return this._layers[CANVAS_ZLEVEL].dom;\n }\n\n const imageLayer = new Layer('image', this, opts.pixelRatio || this.dpr);\n imageLayer.initContext();\n imageLayer.clear(false, opts.backgroundColor || this._backgroundColor);\n\n const ctx = imageLayer.ctx;\n\n if (opts.pixelRatio <= this.dpr) {\n this.refresh();\n\n const width = imageLayer.dom.width;\n const height = imageLayer.dom.height;\n this.eachLayer(function (layer) {\n if (layer.__builtin__) {\n ctx.drawImage(layer.dom, 0, 0, width, height);\n }\n else if (layer.renderToCanvas) {\n ctx.save();\n layer.renderToCanvas(ctx);\n ctx.restore();\n }\n });\n }\n else {\n // PENDING, echarts-gl and incremental rendering.\n const scope = {\n inHover: false,\n viewWidth: this._width,\n viewHeight: this._height\n };\n const displayList = this.storage.getDisplayList(true);\n for (let i = 0, len = displayList.length; i < len; i++) {\n const el = displayList[i];\n brush(ctx, el, scope, i === len - 1);\n }\n }\n\n return imageLayer.dom;\n }\n /**\n * 获取绘图区域宽度\n */\n getWidth() {\n return this._width;\n }\n\n /**\n * 获取绘图区域高度\n */\n getHeight() {\n return this._height;\n }\n};","import { PathRebuilder } from '../core/PathProxy';\r\nimport { isAroundZero } from './helper';\r\n\r\nconst mathSin = Math.sin;\r\nconst mathCos = Math.cos;\r\nconst PI = Math.PI;\r\nconst PI2 = Math.PI * 2;\r\nconst degree = 180 / PI;\r\n\r\n\r\nexport default class SVGPathRebuilder implements PathRebuilder {\r\n private _d: (string | number)[]\r\n private _str: string\r\n private _invalid: boolean\r\n\r\n // If is start of subpath\r\n private _start: boolean\r\n private _p: number\r\n\r\n reset(precision?: number) {\r\n this._start = true;\r\n this._d = [];\r\n this._str = '';\r\n\r\n this._p = Math.pow(10, precision || 4);\r\n }\r\n moveTo(x: number, y: number) {\r\n this._add('M', x, y);\r\n }\r\n lineTo(x: number, y: number) {\r\n this._add('L', x, y);\r\n }\r\n bezierCurveTo(x: number, y: number, x2: number, y2: number, x3: number, y3: number) {\r\n this._add('C', x, y, x2, y2, x3, y3);\r\n }\r\n quadraticCurveTo(x: number, y: number, x2: number, y2: number) {\r\n this._add('Q', x, y, x2, y2);\r\n }\r\n arc(cx: number, cy: number, r: number, startAngle: number, endAngle: number, anticlockwise: boolean) {\r\n this.ellipse(cx, cy, r, r, 0, startAngle, endAngle, anticlockwise);\r\n }\r\n ellipse(\r\n cx: number, cy: number,\r\n rx: number, ry: number,\r\n psi: number,\r\n startAngle: number,\r\n endAngle: number,\r\n anticlockwise: boolean\r\n ) {\r\n let dTheta = endAngle - startAngle;\r\n const clockwise = !anticlockwise;\r\n\r\n const dThetaPositive = Math.abs(dTheta);\r\n const isCircle = isAroundZero(dThetaPositive - PI2)\r\n || (clockwise ? dTheta >= PI2 : -dTheta >= PI2);\r\n\r\n // Mapping to 0~2PI\r\n const unifiedTheta = dTheta > 0 ? dTheta % PI2 : (dTheta % PI2 + PI2);\r\n\r\n let large = false;\r\n if (isCircle) {\r\n large = true;\r\n }\r\n else if (isAroundZero(dThetaPositive)) {\r\n large = false;\r\n }\r\n else {\r\n large = (unifiedTheta >= PI) === !!clockwise;\r\n }\r\n\r\n const x0 = cx + rx * mathCos(startAngle);\r\n const y0 = cy + ry * mathSin(startAngle);\r\n\r\n if (this._start) {\r\n // Move to (x0, y0) only when CMD.A comes at the\r\n // first position of a shape.\r\n // For instance, when drawing a ring, CMD.A comes\r\n // after CMD.M, so it's unnecessary to move to\r\n // (x0, y0).\r\n this._add('M', x0, y0);\r\n }\r\n\r\n const xRot = Math.round(psi * degree);\r\n // It will not draw if start point and end point are exactly the same\r\n // We need to add two arcs\r\n if (isCircle) {\r\n const p = 1 / this._p;\r\n const dTheta = (clockwise ? 1 : -1) * (PI2 - p);\r\n this._add(\r\n 'A', rx, ry, xRot, 1, +clockwise,\r\n cx + rx * mathCos(startAngle + dTheta),\r\n cy + ry * mathSin(startAngle + dTheta)\r\n );\r\n // TODO.\r\n // Usually we can simply divide the circle into two halfs arcs.\r\n // But it will cause slightly diff with previous screenshot.\r\n // We can't tell it but visual regression test can. To avoid too much breaks.\r\n // We keep the logic on the browser as before.\r\n // But in SSR mode wich has lower precision. We close the circle by adding another arc.\r\n if (p > 1e-2) {\r\n this._add('A', rx, ry, xRot, 0, +clockwise, x0, y0);\r\n }\r\n }\r\n else {\r\n const x = cx + rx * mathCos(endAngle);\r\n const y = cy + ry * mathSin(endAngle);\r\n\r\n // FIXME Ellipse\r\n this._add('A', rx, ry, xRot, +large, +clockwise, x, y);\r\n }\r\n\r\n }\r\n rect(x: number, y: number, w: number, h: number) {\r\n this._add('M', x, y);\r\n // Use relative coordinates to reduce the size.\r\n this._add('l', w, 0);\r\n this._add('l', 0, h);\r\n this._add('l', -w, 0);\r\n // this._add('L', x, y);\r\n this._add('Z');\r\n }\r\n closePath() {\r\n // Not use Z as first command\r\n if (this._d.length > 0) {\r\n this._add('Z');\r\n }\r\n }\r\n\r\n _add(cmd: string, a?: number, b?: number, c?: number, d?: number, e?: number, f?: number, g?: number, h?: number) {\r\n const vals = [];\r\n const p = this._p;\r\n for (let i = 1; i < arguments.length; i++) {\r\n const val = arguments[i];\r\n if (isNaN(val)) {\r\n this._invalid = true;\r\n return;\r\n }\r\n vals.push(Math.round(val * p) / p);\r\n }\r\n this._d.push(cmd + vals.join(' '));\r\n this._start = cmd === 'Z';\r\n }\r\n\r\n generateStr() {\r\n this._str = this._invalid ? '' : this._d.join('');\r\n this._d = [];\r\n }\r\n getStr() {\r\n return this._str;\r\n }\r\n}","\r\nimport Path, { DEFAULT_PATH_STYLE, PathStyleProps } from '../graphic/Path';\r\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\r\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\r\nimport { getLineDash } from '../canvas/dashStyle';\r\nimport { map } from '../core/util';\r\nimport { normalizeColor } from './helper';\r\n\r\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\r\n\r\nconst NONE = 'none';\r\nconst mathRound = Math.round;\r\n\r\nfunction pathHasFill(style: AllStyleOption): style is PathStyleProps {\r\n const fill = (style as PathStyleProps).fill;\r\n return fill != null && fill !== NONE;\r\n}\r\n\r\nfunction pathHasStroke(style: AllStyleOption): style is PathStyleProps {\r\n const stroke = (style as PathStyleProps).stroke;\r\n return stroke != null && stroke !== NONE;\r\n}\r\n\r\nconst strokeProps = ['lineCap', 'miterLimit', 'lineJoin'] as const;\r\nconst svgStrokeProps = map(strokeProps, prop => `stroke-${prop.toLowerCase()}`);\r\n\r\nexport default function mapStyleToAttrs(\r\n updateAttr: (key: string, val: string | number) => void,\r\n style: AllStyleOption,\r\n el: Path | TSpan | ZRImage,\r\n /**\r\n * Will try not to set the attribute if it's using default value if not using forceUpdate.\r\n * Mainly for reduce the generated size in svg-ssr mode.\r\n */\r\n forceUpdate: boolean\r\n): void {\r\n const opacity = style.opacity == null ? 1 : style.opacity;\r\n\r\n // only set opacity. stroke and fill cannot be applied to svg image\r\n if (el instanceof ZRImage) {\r\n updateAttr('opacity', opacity);\r\n return;\r\n }\r\n\r\n if (pathHasFill(style)) {\r\n const fill = normalizeColor(style.fill as string);\r\n updateAttr('fill', fill.color);\r\n const fillOpacity = style.fillOpacity != null\r\n ? style.fillOpacity * fill.opacity * opacity\r\n : fill.opacity * opacity;\r\n if (forceUpdate || fillOpacity < 1) {\r\n updateAttr('fill-opacity', fillOpacity);\r\n }\r\n }\r\n else {\r\n updateAttr('fill', NONE);\r\n }\r\n\r\n if (pathHasStroke(style)) {\r\n const stroke = normalizeColor(style.stroke as string);\r\n updateAttr('stroke', stroke.color);\r\n const strokeScale = style.strokeNoScale\r\n ? (el as Path).getLineScale()\r\n : 1;\r\n const strokeWidth = (strokeScale ? (style.lineWidth || 0) / strokeScale : 0);\r\n const strokeOpacity = style.strokeOpacity != null\r\n ? style.strokeOpacity * stroke.opacity * opacity\r\n : stroke.opacity * opacity;\r\n const strokeFirst = style.strokeFirst;\r\n\r\n if (forceUpdate || strokeWidth !== 1) {\r\n updateAttr('stroke-width', strokeWidth);\r\n }\r\n // stroke then fill for text; fill then stroke for others\r\n if (forceUpdate || strokeFirst) {\r\n updateAttr('paint-order', strokeFirst ? 'stroke' : 'fill');\r\n }\r\n if (forceUpdate || strokeOpacity < 1) {\r\n updateAttr('stroke-opacity', strokeOpacity);\r\n }\r\n\r\n if (style.lineDash) {\r\n let [lineDash, lineDashOffset] = getLineDash(el);\r\n if (lineDash) {\r\n lineDashOffset = mathRound(lineDashOffset || 0);\r\n updateAttr('stroke-dasharray', lineDash.join(','));\r\n if (lineDashOffset || forceUpdate) {\r\n updateAttr('stroke-dashoffset', lineDashOffset);\r\n }\r\n }\r\n }\r\n else if (forceUpdate) {\r\n // Reset if force update.\r\n updateAttr('stroke-dasharray', NONE);\r\n }\r\n\r\n // PENDING reset\r\n for (let i = 0; i < strokeProps.length; i++) {\r\n const propName = strokeProps[i];\r\n if (forceUpdate || style[propName] !== DEFAULT_PATH_STYLE[propName]) {\r\n const val = style[propName] || DEFAULT_PATH_STYLE[propName];\r\n // TODO reset\r\n val && updateAttr(svgStrokeProps[i], val);\r\n }\r\n }\r\n }\r\n else if (forceUpdate) {\r\n updateAttr('stroke', NONE);\r\n }\r\n}\r\n","import { keys, map } from '../core/util';\nimport { encodeHTML } from '../core/dom';\n\nexport type CSSSelectorVNode = Record\nexport type CSSAnimationVNode = Record>\n\nexport const SVGNS = 'http://www.w3.org/2000/svg';\nexport const XLINKNS = 'http://www.w3.org/1999/xlink';\nexport const XMLNS = 'http://www.w3.org/2000/xmlns/';\nexport const XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\nexport const META_DATA_PREFIX = 'ecmeta_';\n\nexport function createElement(name: string) {\n return document.createElementNS(SVGNS, name);\n}\n\nexport type SVGVNodeAttrs = Record\nexport interface SVGVNode {\n tag: string,\n attrs: SVGVNodeAttrs,\n children?: SVGVNode[],\n text?: string\n\n // For patching\n elm?: Node\n key: string\n};\nexport function createVNode(\n tag: string,\n key: string,\n attrs?: SVGVNodeAttrs,\n children?: SVGVNode[],\n text?: string\n): SVGVNode {\n return {\n tag,\n attrs: attrs || {},\n children,\n text,\n key\n };\n}\n\nfunction createElementOpen(name: string, attrs?: SVGVNodeAttrs) {\n const attrsStr: string[] = [];\n if (attrs) {\n // eslint-disable-next-line\n for (let key in attrs) {\n const val = attrs[key];\n let part = key;\n // Same with the logic in patch.\n if (val === false) {\n continue;\n }\n else if (val !== true && val != null) {\n part += `=\"${val}\"`;\n }\n attrsStr.push(part);\n }\n }\n return `<${name} ${attrsStr.join(' ')}>`;\n}\n\nfunction createElementClose(name: string) {\n return ``;\n}\n\nexport function vNodeToString(el: SVGVNode, opts?: {\n newline?: boolean\n}) {\n opts = opts || {};\n const S = opts.newline ? '\\n' : '';\n function convertElToString(el: SVGVNode): string {\n const {children, tag, attrs, text} = el;\n return createElementOpen(tag, attrs)\n + (tag !== 'style' ? encodeHTML(text) : text || '')\n + (children ? `${S}${map(children, child => convertElToString(child)).join(S)}${S}` : '')\n + createElementClose(tag);\n }\n return convertElToString(el);\n}\n\nexport function getCssString(\n selectorNodes: Record,\n animationNodes: Record,\n opts?: {\n newline?: boolean\n }\n) {\n opts = opts || {};\n const S = opts.newline ? '\\n' : '';\n const bracketBegin = ` {${S}`;\n const bracketEnd = `${S}}`;\n const selectors = map(keys(selectorNodes), className => {\n return className + bracketBegin + map(keys(selectorNodes[className]), attrName => {\n return `${attrName}:${selectorNodes[className][attrName]};`;\n }).join(S) + bracketEnd;\n }).join(S);\n const animations = map(keys(animationNodes), (animationName) => {\n return `@keyframes ${animationName}${bracketBegin}` + map(keys(animationNodes[animationName]), percent => {\n return percent + bracketBegin + map(keys(animationNodes[animationName][percent]), attrName => {\n let val = animationNodes[animationName][percent][attrName];\n // postprocess\n if (attrName === 'd') {\n val = `path(\"${val}\")`;\n }\n return `${attrName}:${val};`;\n }).join(S) + bracketEnd;\n }).join(S) + bracketEnd;\n }).join(S);\n\n if (!selectors && !animations) {\n return '';\n }\n\n return [''].join(S);\n}\n\n\nexport interface BrushScope {\n zrId: string\n\n shadowCache: Record\n gradientCache: Record\n patternCache: Record\n clipPathCache: Record\n\n defs: Record\n\n cssNodes: Record\n cssAnims: Record>>\n /**\n * Cache for css style string, mapping from style string to class name.\n */\n cssStyleCache: Record\n\n cssAnimIdx: number\n\n shadowIdx: number\n gradientIdx: number\n patternIdx: number\n clipPathIdx: number\n // configs\n /**\n * If create animates nodes.\n */\n animation?: boolean,\n /**\n * If create emphasis styles.\n */\n emphasis?: boolean,\n\n /**\n * If will update. Some optimization for string generation can't be applied.\n */\n willUpdate?: boolean\n\n /**\n * If compress the output string.\n */\n compress?: boolean\n\n ssr?: boolean\n}\n\nexport function createBrushScope(zrId: string): BrushScope {\n return {\n zrId,\n shadowCache: {},\n patternCache: {},\n gradientCache: {},\n clipPathCache: {},\n defs: {},\n\n cssNodes: {},\n cssAnims: {},\n cssStyleCache: {},\n\n cssAnimIdx: 0,\n\n shadowIdx: 0,\n gradientIdx: 0,\n patternIdx: 0,\n clipPathIdx: 0\n };\n}\n\nexport function createSVGVNode(\n width: number | string,\n height: number | string,\n children?: SVGVNode[],\n useViewBox?: boolean\n) {\n return createVNode(\n 'svg',\n 'root',\n {\n 'width': width,\n 'height': height,\n 'xmlns': SVGNS,\n 'xmlns:xlink': XLINKNS,\n 'version': '1.1',\n 'baseProfile': 'full',\n 'viewBox': useViewBox ? `0 0 ${width} ${height}` : false\n },\n children\n );\n}","let cssClassIdx = 0;\n\nexport function getClassId() {\n return cssClassIdx++;\n}\n","import Transformable, { copyTransform } from '../core/Transformable';\nimport Displayable from '../graphic/Displayable';\nimport { SVGVNodeAttrs, BrushScope, createBrushScope} from './core';\nimport Path from '../graphic/Path';\nimport SVGPathRebuilder from './SVGPathRebuilder';\nimport PathProxy from '../core/PathProxy';\nimport { getPathPrecision, getSRTTransformString } from './helper';\nimport { each, extend, filter, isNumber, isString, keys } from '../core/util';\nimport Animator from '../animation/Animator';\nimport CompoundPath from '../graphic/CompoundPath';\nimport { AnimationEasing } from '../animation/easing';\nimport { createCubicEasingFunc } from '../animation/cubicEasing';\nimport { getClassId } from './cssClassId';\n\nexport const EASING_MAP: Record = {\n // From https://easings.net/\n cubicIn: '0.32,0,0.67,0',\n cubicOut: '0.33,1,0.68,1',\n cubicInOut: '0.65,0,0.35,1',\n quadraticIn: '0.11,0,0.5,0',\n quadraticOut: '0.5,1,0.89,1',\n quadraticInOut: '0.45,0,0.55,1',\n quarticIn: '0.5,0,0.75,0',\n quarticOut: '0.25,1,0.5,1',\n quarticInOut: '0.76,0,0.24,1',\n quinticIn: '0.64,0,0.78,0',\n quinticOut: '0.22,1,0.36,1',\n quinticInOut: '0.83,0,0.17,1',\n sinusoidalIn: '0.12,0,0.39,0',\n sinusoidalOut: '0.61,1,0.88,1',\n sinusoidalInOut: '0.37,0,0.63,1',\n exponentialIn: '0.7,0,0.84,0',\n exponentialOut: '0.16,1,0.3,1',\n exponentialInOut: '0.87,0,0.13,1',\n circularIn: '0.55,0,1,0.45',\n circularOut: '0,0.55,0.45,1',\n circularInOut: '0.85,0,0.15,1'\n // TODO elastic, bounce\n};\n\nconst transformOriginKey = 'transform-origin';\n\nfunction buildPathString(el: Path, kfShape: Path['shape'], path: PathProxy) {\n const shape = extend({}, el.shape);\n extend(shape, kfShape);\n\n el.buildPath(path, shape);\n const svgPathBuilder = new SVGPathRebuilder();\n svgPathBuilder.reset(getPathPrecision(el));\n path.rebuildPath(svgPathBuilder, 1);\n svgPathBuilder.generateStr();\n // will add path(\"\") when generated to css string in the final step.\n return svgPathBuilder.getStr();\n}\n\nfunction setTransformOrigin(target: Record, transform: Transformable) {\n const {originX, originY} = transform;\n if (originX || originY) {\n target[transformOriginKey] = `${originX}px ${originY}px`;\n }\n}\n\nexport const ANIMATE_STYLE_MAP: Record = {\n fill: 'fill',\n opacity: 'opacity',\n lineWidth: 'stroke-width',\n lineDashOffset: 'stroke-dashoffset'\n // TODO shadow is not supported.\n};\n\ntype CssKF = Record;\n\nfunction addAnimation(cssAnim: Record, scope: BrushScope) {\n const animationName = scope.zrId + '-ani-' + scope.cssAnimIdx++;\n scope.cssAnims[animationName] = cssAnim;\n return animationName;\n}\n\nfunction createCompoundPathCSSAnimation(\n el: CompoundPath,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const paths = el.shape.paths;\n const composedAnim: Record = {};\n let cssAnimationCfg: string;\n let cssAnimationName: string;\n each(paths, path => {\n const subScope = createBrushScope(scope.zrId);\n subScope.animation = true;\n createCSSAnimation(path, {}, subScope, true);\n const cssAnims = subScope.cssAnims;\n const cssNodes = subScope.cssNodes;\n const animNames = keys(cssAnims);\n const len = animNames.length;\n if (!len) {\n return;\n }\n cssAnimationName = animNames[len - 1];\n // Only use last animation because they are conflicted.\n const lastAnim = cssAnims[cssAnimationName];\n // eslint-disable-next-line\n for (let percent in lastAnim) {\n const kf = lastAnim[percent];\n composedAnim[percent] = composedAnim[percent] || { d: '' };\n composedAnim[percent].d += kf.d || '';\n }\n // eslint-disable-next-line\n for (let className in cssNodes) {\n const val = cssNodes[className].animation;\n if (val.indexOf(cssAnimationName) >= 0) {\n // Only pick the animation configuration of last subpath.\n cssAnimationCfg = val;\n }\n }\n });\n\n if (!cssAnimationCfg) {\n return;\n }\n\n // Remove the attrs in the element because it will be set by animation.\n // Reduce the size.\n attrs.d = false;\n const animationName = addAnimation(composedAnim, scope);\n return cssAnimationCfg.replace(cssAnimationName, animationName);\n}\n\nfunction getEasingFunc(easing: AnimationEasing) {\n return isString(easing)\n ? EASING_MAP[easing]\n ? `cubic-bezier(${EASING_MAP[easing]})`\n : createCubicEasingFunc(easing) ? easing : ''\n : '';\n}\n\nexport function createCSSAnimation(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope,\n onlyShape?: boolean\n) {\n const animators = el.animators;\n const len = animators.length;\n\n const cssAnimations: string[] = [];\n\n if (el instanceof CompoundPath) {\n const animationCfg = createCompoundPathCSSAnimation(el, attrs, scope);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n else if (!len) {\n return;\n }\n }\n else if (!len) {\n return;\n }\n // Group animators by it's configuration\n const groupAnimators: Record[]]> = {};\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const cfgArr: (string | number)[] = [animator.getMaxTime() / 1000 + 's'];\n const easing = getEasingFunc(animator.getClip().easing);\n const delay = animator.getDelay();\n\n if (easing) {\n cfgArr.push(easing);\n }\n else {\n cfgArr.push('linear');\n }\n if (delay) {\n cfgArr.push(delay / 1000 + 's');\n }\n if (animator.getLoop()) {\n cfgArr.push('infinite');\n }\n const cfg = cfgArr.join(' ');\n\n // TODO fill mode\n groupAnimators[cfg] = groupAnimators[cfg] || [cfg, [] as Animator[]];\n groupAnimators[cfg][1].push(animator);\n }\n\n function createSingleCSSAnimation(groupAnimator: [string, Animator[]]) {\n const animators = groupAnimator[1];\n const len = animators.length;\n const transformKfs: Record = {};\n const shapeKfs: Record = {};\n\n const finalKfs: Record = {};\n\n const animationTimingFunctionAttrName = 'animation-timing-function';\n\n function saveAnimatorTrackToCssKfs(\n animator: Animator,\n cssKfs: Record,\n toCssAttrName?: (propName: string) => string\n ) {\n const tracks = animator.getTracks();\n const maxTime = animator.getMaxTime();\n for (let k = 0; k < tracks.length; k++) {\n const track = tracks[k];\n if (track.needsAnimate()) {\n const kfs = track.keyframes;\n let attrName = track.propName;\n toCssAttrName && (attrName = toCssAttrName(attrName));\n if (attrName) {\n for (let i = 0; i < kfs.length; i++) {\n const kf = kfs[i];\n const percent = Math.round(kf.time / maxTime * 100) + '%';\n const kfEasing = getEasingFunc(kf.easing);\n const rawValue = kf.rawValue;\n\n // TODO gradient\n if (isString(rawValue) || isNumber(rawValue)) {\n cssKfs[percent] = cssKfs[percent] || {};\n cssKfs[percent][attrName] = kf.rawValue;\n\n if (kfEasing) {\n // TODO. If different property have different easings.\n cssKfs[percent][animationTimingFunctionAttrName] = kfEasing;\n }\n }\n }\n }\n }\n }\n }\n\n // Find all transform animations.\n // TODO origin, parent\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const targetProp = animator.targetName;\n if (!targetProp) {\n !onlyShape && saveAnimatorTrackToCssKfs(animator, transformKfs);\n }\n else if (targetProp === 'shape') {\n saveAnimatorTrackToCssKfs(animator, shapeKfs);\n }\n }\n\n // eslint-disable-next-line\n for (let percent in transformKfs) {\n const transform = {} as Transformable;\n copyTransform(transform, el);\n extend(transform, transformKfs[percent]);\n const str = getSRTTransformString(transform);\n const timingFunction = transformKfs[percent][animationTimingFunctionAttrName];\n finalKfs[percent] = str ? {\n transform: str\n } : {};\n // TODO set transform origin in element?\n setTransformOrigin(finalKfs[percent], transform);\n\n // Save timing function\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n };\n\n\n let path: PathProxy;\n let canAnimateShape = true;\n // eslint-disable-next-line\n for (let percent in shapeKfs) {\n finalKfs[percent] = finalKfs[percent] || {};\n\n const isFirst = !path;\n const timingFunction = shapeKfs[percent][animationTimingFunctionAttrName];\n\n if (isFirst) {\n path = new PathProxy();\n }\n let len = path.len();\n path.reset();\n finalKfs[percent].d = buildPathString(el as Path, shapeKfs[percent], path);\n let newLen = path.len();\n // Path data don't match.\n if (!isFirst && len !== newLen) {\n canAnimateShape = false;\n break;\n }\n\n // Save timing function\n if (timingFunction) {\n finalKfs[percent][animationTimingFunctionAttrName] = timingFunction;\n }\n };\n if (!canAnimateShape) {\n // eslint-disable-next-line\n for (let percent in finalKfs) {\n delete finalKfs[percent].d;\n }\n }\n\n if (!onlyShape) {\n for (let i = 0; i < len; i++) {\n const animator = animators[i];\n const targetProp = animator.targetName;\n if (targetProp === 'style') {\n saveAnimatorTrackToCssKfs(\n animator, finalKfs, (propName) => ANIMATE_STYLE_MAP[propName]\n );\n }\n }\n }\n\n const percents = keys(finalKfs);\n\n // Set transform origin in attribute to reduce the size.\n let allTransformOriginSame = true;\n let transformOrigin;\n for (let i = 1; i < percents.length; i++) {\n const p0 = percents[i - 1];\n const p1 = percents[i];\n if (finalKfs[p0][transformOriginKey] !== finalKfs[p1][transformOriginKey]) {\n allTransformOriginSame = false;\n break;\n }\n transformOrigin = finalKfs[p0][transformOriginKey];\n }\n if (allTransformOriginSame && transformOrigin) {\n for (const percent in finalKfs) {\n if (finalKfs[percent][transformOriginKey]) {\n delete finalKfs[percent][transformOriginKey];\n }\n }\n attrs[transformOriginKey] = transformOrigin;\n }\n\n if (filter(\n percents, (percent) => keys(finalKfs[percent]).length > 0\n ).length) {\n const animationName = addAnimation(finalKfs, scope);\n // eslint-disable-next-line\n // for (const attrName in finalKfs[percents[0]]) {\n // // Remove the attrs in the element because it will be set by animation.\n // // Reduce the size.\n // attrs[attrName] = false;\n // }\n // animationName {duration easing delay loop} fillMode\n return `${animationName} ${groupAnimator[0]} both`;\n }\n }\n\n // eslint-disable-next-line\n for (let key in groupAnimators) {\n const animationCfg = createSingleCSSAnimation(groupAnimators[key]);\n if (animationCfg) {\n cssAnimations.push(animationCfg);\n }\n }\n\n if (cssAnimations.length) {\n const className = scope.zrId + '-cls-' + getClassId();\n scope.cssNodes['.' + className] = {\n animation: cssAnimations.join(',')\n };\n // TODO exists class?\n attrs.class = className;\n }\n}","import Displayable from '../graphic/Displayable';\nimport { liftColor } from '../tool/color';\nimport { BrushScope, SVGVNodeAttrs } from './core';\nimport { getClassId } from './cssClassId';\n\nexport function createCSSEmphasis(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n if (!el.ignore) {\n if (el.isSilent()) {\n // If el is silent, it can not be hovered nor selected.\n // So set pointer-events to pass through.\n const style = {\n 'pointer-events': 'none'\n };\n setClassAttribute(style, attrs, scope, true);\n }\n else {\n const emphasisStyle = el.states.emphasis && el.states.emphasis.style\n ? el.states.emphasis.style\n : {};\n let fill = emphasisStyle.fill;\n if (!fill) {\n // No empahsis fill, lift color\n const normalFill = el.style && el.style.fill;\n const selectFill = el.states.select\n && el.states.select.style\n && el.states.select.style.fill;\n const fromFill = el.currentStates.indexOf('select') >= 0\n ? (selectFill || normalFill)\n : normalFill;\n if (fromFill) {\n fill = liftColor(fromFill);\n }\n }\n let lineWidth = emphasisStyle.lineWidth;\n if (lineWidth) {\n // Symbols use transform to set size, so lineWidth\n // should be divided by scaleX\n const scaleX = (!emphasisStyle.strokeNoScale && el.transform)\n ? el.transform[0]\n : 1;\n lineWidth = lineWidth / scaleX;\n }\n const style = {\n cursor: 'pointer', // TODO: Should this be customized?\n } as any;\n if (fill) {\n style.fill = fill;\n }\n if (emphasisStyle.stroke) {\n style.stroke = emphasisStyle.stroke;\n }\n if (lineWidth) {\n style['stroke-width'] = lineWidth;\n }\n setClassAttribute(style, attrs, scope, true);\n }\n }\n}\n\nfunction setClassAttribute(style: object, attrs: SVGVNodeAttrs, scope: BrushScope, withHover: boolean) {\n const styleKey = JSON.stringify(style);\n let className = scope.cssStyleCache[styleKey];\n if (!className) {\n className = scope.zrId + '-cls-' + getClassId();\n scope.cssStyleCache[styleKey] = className;\n scope.cssNodes['.' + className + (withHover ? ':hover' : '')] = style as any;\n }\n attrs.class = attrs.class ? (attrs.class + ' ' + className) : className;\n}\n","// TODO\n// 1. shadow\n// 2. Image: sx, sy, sw, sh\n\nimport {\n adjustTextY,\n getIdURL,\n getMatrixStr,\n getPathPrecision,\n getShadowKey,\n getSRTTransformString,\n hasShadow,\n isAroundZero,\n isGradient,\n isImagePattern,\n isLinearGradient,\n isPattern,\n isRadialGradient,\n normalizeColor,\n round4,\n TEXT_ALIGN_TO_ANCHOR\n} from './helper';\nimport Path, { PathStyleProps } from '../graphic/Path';\nimport ZRImage, { ImageStyleProps } from '../graphic/Image';\nimport { getLineHeight } from '../contain/text';\nimport TSpan, { TSpanStyleProps } from '../graphic/TSpan';\nimport SVGPathRebuilder from './SVGPathRebuilder';\nimport mapStyleToAttrs from './mapStyleToAttrs';\nimport { SVGVNodeAttrs, createVNode, SVGVNode, vNodeToString, BrushScope, META_DATA_PREFIX } from './core';\nimport { MatrixArray } from '../core/matrix';\nimport Displayable from '../graphic/Displayable';\nimport { assert, clone, isFunction, isString, logError, map, retrieve2 } from '../core/util';\nimport Polyline from '../graphic/shape/Polyline';\nimport Polygon from '../graphic/shape/Polygon';\nimport { GradientObject } from '../graphic/Gradient';\nimport { ImagePatternObject, SVGPatternObject } from '../graphic/Pattern';\nimport { createOrUpdateImage } from '../graphic/helper/image';\nimport { ImageLike } from '../core/types';\nimport { createCSSAnimation } from './cssAnimation';\nimport { hasSeparateFont, parseFontSize } from '../graphic/Text';\nimport { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform';\nimport { createCSSEmphasis } from './cssEmphasis';\nimport { getElementSSRData } from '../zrender';\n\nconst round = Math.round;\n\nfunction isImageLike(val: any): val is HTMLImageElement {\n return val && isString(val.src);\n}\nfunction isCanvasLike(val: any): val is HTMLCanvasElement {\n return val && isFunction(val.toDataURL);\n}\n\n\ntype AllStyleOption = PathStyleProps | TSpanStyleProps | ImageStyleProps;\n\nfunction setStyleAttrs(attrs: SVGVNodeAttrs, style: AllStyleOption, el: Path | TSpan | ZRImage, scope: BrushScope) {\n mapStyleToAttrs((key, val) => {\n const isFillStroke = key === 'fill' || key === 'stroke';\n if (isFillStroke && isGradient(val)) {\n setGradient(style, attrs, key, scope);\n }\n else if (isFillStroke && isPattern(val)) {\n setPattern(el, attrs, key, scope);\n }\n else {\n attrs[key] = val;\n }\n if (isFillStroke && scope.ssr && val === 'none') {\n // When is none, it cannot be interacted when ssr\n // Setting `pointer-events` as `visible` to make it responding\n // See also https://www.w3.org/TR/SVG/interact.html#PointerEventsProperty\n attrs['pointer-events'] = 'visible';\n }\n }, style, el, false);\n\n setShadow(el, attrs, scope);\n}\n\nfunction setMetaData(attrs: SVGVNodeAttrs, el: Path | TSpan | ZRImage) {\n const metaData = getElementSSRData(el);\n if (metaData) {\n metaData.each((val, key) => {\n val != null && (attrs[(META_DATA_PREFIX + key).toLowerCase()] = val + '');\n });\n if (el.isSilent()) {\n attrs[META_DATA_PREFIX + 'silent'] = 'true';\n }\n }\n}\n\nfunction noRotateScale(m: MatrixArray) {\n return isAroundZero(m[0] - 1)\n && isAroundZero(m[1])\n && isAroundZero(m[2])\n && isAroundZero(m[3] - 1);\n}\n\nfunction noTranslate(m: MatrixArray) {\n return isAroundZero(m[4]) && isAroundZero(m[5]);\n}\n\nfunction setTransform(attrs: SVGVNodeAttrs, m: MatrixArray, compress?: boolean) {\n if (m && !(noTranslate(m) && noRotateScale(m))) {\n const mul = compress ? 10 : 1e4;\n // Use translate possible to reduce the size a bit.\n attrs.transform = noRotateScale(m)\n ? `translate(${round(m[4] * mul) / mul} ${round(m[5] * mul) / mul})` : getMatrixStr(m);\n }\n}\n\ntype ShapeMapDesc = (string | [string, string])[];\ntype ConvertShapeToAttr = (shape: any, attrs: SVGVNodeAttrs, mul?: number) => void;\ntype ShapeValidator = (shape: any) => boolean;\n\nfunction convertPolyShape(shape: Polygon['shape'], attrs: SVGVNodeAttrs, mul: number) {\n const points = shape.points;\n const strArr = [];\n for (let i = 0; i < points.length; i++) {\n strArr.push(round(points[i][0] * mul) / mul);\n strArr.push(round(points[i][1] * mul) / mul);\n }\n attrs.points = strArr.join(' ');\n}\n\nfunction validatePolyShape(shape: Polyline['shape']) {\n return !shape.smooth;\n}\n\nfunction createAttrsConvert(desc: ShapeMapDesc): ConvertShapeToAttr {\n const normalizedDesc: [string, string][] = map(desc, (item) =>\n (typeof item === 'string' ? [item, item] : item)\n );\n\n return function (shape, attrs, mul) {\n for (let i = 0; i < normalizedDesc.length; i++) {\n const item = normalizedDesc[i];\n const val = shape[item[0]];\n if (val != null) {\n attrs[item[1]] = round(val * mul) / mul;\n }\n }\n };\n}\n\nconst builtinShapesDef: Record = {\n circle: [createAttrsConvert(['cx', 'cy', 'r'])],\n polyline: [convertPolyShape, validatePolyShape],\n polygon: [convertPolyShape, validatePolyShape]\n // Ignore line because it will be larger.\n};\n\ninterface PathWithSVGBuildPath extends Path {\n __svgPathVersion: number\n __svgPathBuilder: SVGPathRebuilder\n __svgPathStrokePercent: number\n}\n\nfunction hasShapeAnimation(el: Displayable) {\n const animators = el.animators;\n for (let i = 0; i < animators.length; i++) {\n if (animators[i].targetName === 'shape') {\n return true;\n }\n }\n return false;\n}\n\nexport function brushSVGPath(el: Path, scope: BrushScope) {\n const style = el.style;\n const shape = el.shape;\n const builtinShpDef = builtinShapesDef[el.type];\n const attrs: SVGVNodeAttrs = {};\n const needsAnimate = scope.animation;\n let svgElType = 'path';\n const strokePercent = el.style.strokePercent;\n const precision = (scope.compress && getPathPrecision(el)) || 4;\n // Using SVG builtin shapes if possible\n if (builtinShpDef\n // Force to use path if it will update later.\n // To avoid some animation(like morph) fail\n && !scope.willUpdate\n && !(builtinShpDef[1] && !builtinShpDef[1](shape))\n // use `path` to simplify the animate element creation logic.\n && !(needsAnimate && hasShapeAnimation(el))\n && !(strokePercent < 1)\n ) {\n svgElType = el.type;\n const mul = Math.pow(10, precision);\n builtinShpDef[0](shape, attrs, mul);\n }\n else {\n const needBuildPath = !el.path || el.shapeChanged();\n if (!el.path) {\n el.createPathProxy();\n }\n const path = el.path;\n\n if (needBuildPath) {\n path.beginPath();\n el.buildPath(path, el.shape);\n el.pathUpdated();\n }\n const pathVersion = path.getVersion();\n const elExt = el as PathWithSVGBuildPath;\n\n let svgPathBuilder = elExt.__svgPathBuilder;\n if (elExt.__svgPathVersion !== pathVersion\n || !svgPathBuilder\n || strokePercent !== elExt.__svgPathStrokePercent\n ) {\n if (!svgPathBuilder) {\n svgPathBuilder = elExt.__svgPathBuilder = new SVGPathRebuilder();\n }\n svgPathBuilder.reset(precision);\n path.rebuildPath(svgPathBuilder, strokePercent);\n svgPathBuilder.generateStr();\n elExt.__svgPathVersion = pathVersion;\n elExt.__svgPathStrokePercent = strokePercent;\n }\n\n attrs.d = svgPathBuilder.getStr();\n }\n\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n scope.emphasis && createCSSEmphasis(el, attrs, scope);\n\n return createVNode(svgElType, el.id + '', attrs);\n}\n\nexport function brushSVGImage(el: ZRImage, scope: BrushScope) {\n const style = el.style;\n let image = style.image;\n\n if (image && !isString(image)) {\n if (isImageLike(image)) {\n image = image.src;\n }\n // heatmap layer in geo may be a canvas\n else if (isCanvasLike(image)) {\n image = image.toDataURL();\n }\n }\n\n if (!image) {\n return;\n }\n\n const x = style.x || 0;\n const y = style.y || 0;\n\n const dw = style.width;\n const dh = style.height;\n\n const attrs: SVGVNodeAttrs = {\n href: image as string,\n width: dw,\n height: dh\n };\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n\n return createVNode('image', el.id + '', attrs);\n};\n\nexport function brushSVGTSpan(el: TSpan, scope: BrushScope) {\n const style = el.style;\n\n let text = style.text;\n // Convert to string\n text != null && (text += '');\n if (!text || isNaN(style.x) || isNaN(style.y)) {\n return;\n }\n\n // style.font has been normalized by `normalizeTextStyle`.\n const font = style.font || DEFAULT_FONT;\n\n // Consider different font display differently in vertical align, we always\n // set verticalAlign as 'middle', and use 'y' to locate text vertically.\n const x = style.x || 0;\n const y = adjustTextY(style.y || 0, getLineHeight(font), style.textBaseline);\n const textAlign = TEXT_ALIGN_TO_ANCHOR[style.textAlign as keyof typeof TEXT_ALIGN_TO_ANCHOR]\n || style.textAlign;\n\n const attrs: SVGVNodeAttrs = {\n 'dominant-baseline': 'central',\n 'text-anchor': textAlign\n };\n\n if (hasSeparateFont(style)) {\n // Set separate font attributes if possible. Or some platform like PowerPoint may not support it.\n let separatedFontStr = '';\n const fontStyle = style.fontStyle;\n const fontSize = parseFontSize(style.fontSize);\n if (!parseFloat(fontSize)) { // is 0px\n return;\n }\n\n const fontFamily = style.fontFamily || DEFAULT_FONT_FAMILY;\n const fontWeight = style.fontWeight;\n separatedFontStr += `font-size:${fontSize};font-family:${fontFamily};`;\n\n // TODO reduce the attribute to set. But should it inherit from the container element?\n if (fontStyle && fontStyle !== 'normal') {\n separatedFontStr += `font-style:${fontStyle};`;\n }\n if (fontWeight && fontWeight !== 'normal') {\n separatedFontStr += `font-weight:${fontWeight};`;\n }\n attrs.style = separatedFontStr;\n }\n else {\n // Use set font manually\n attrs.style = `font: ${font}`;\n }\n\n\n if (text.match(/\\s/)) {\n // only enabled when have space in text.\n attrs['xml:space'] = 'preserve';\n }\n if (x) {\n attrs.x = x;\n }\n if (y) {\n attrs.y = y;\n }\n setTransform(attrs, el.transform);\n setStyleAttrs(attrs, style, el, scope);\n setMetaData(attrs, el);\n\n scope.animation && createCSSAnimation(el, attrs, scope);\n\n return createVNode('text', el.id + '', attrs, undefined, text);\n}\n\nexport function brush(el: Displayable, scope: BrushScope): SVGVNode {\n if (el instanceof Path) {\n return brushSVGPath(el, scope);\n }\n else if (el instanceof ZRImage) {\n return brushSVGImage(el, scope);\n }\n else if (el instanceof TSpan) {\n return brushSVGTSpan(el, scope);\n }\n}\n\nfunction setShadow(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const style = el.style;\n if (hasShadow(style)) {\n const shadowKey = getShadowKey(el);\n const shadowCache = scope.shadowCache;\n let shadowId = shadowCache[shadowKey];\n if (!shadowId) {\n const globalScale = el.getGlobalScale();\n const scaleX = globalScale[0];\n const scaleY = globalScale[1];\n if (!scaleX || !scaleY) {\n return;\n }\n\n const offsetX = style.shadowOffsetX || 0;\n const offsetY = style.shadowOffsetY || 0;\n const blur = style.shadowBlur;\n const {opacity, color} = normalizeColor(style.shadowColor);\n const stdDx = blur / 2 / scaleX;\n const stdDy = blur / 2 / scaleY;\n const stdDeviation = stdDx + ' ' + stdDy;\n // Use a simple prefix to reduce the size\n shadowId = scope.zrId + '-s' + scope.shadowIdx++;\n scope.defs[shadowId] = createVNode(\n 'filter', shadowId,\n {\n 'id': shadowId,\n 'x': '-100%',\n 'y': '-100%',\n 'width': '300%',\n 'height': '300%'\n },\n [\n createVNode('feDropShadow', '', {\n 'dx': offsetX / scaleX,\n 'dy': offsetY / scaleY,\n 'stdDeviation': stdDeviation,\n 'flood-color': color,\n 'flood-opacity': opacity\n })\n ]\n );\n shadowCache[shadowKey] = shadowId;\n }\n attrs.filter = getIdURL(shadowId);\n }\n}\n\nexport function setGradient(\n style: PathStyleProps,\n attrs: SVGVNodeAttrs,\n target: 'fill' | 'stroke',\n scope: BrushScope\n) {\n const val = style[target] as GradientObject;\n let gradientTag;\n let gradientAttrs: SVGVNodeAttrs = {\n 'gradientUnits': val.global\n ? 'userSpaceOnUse' // x1, x2, y1, y2 in range of 0 to canvas width or height\n : 'objectBoundingBox' // x1, x2, y1, y2 in range of 0 to 1]\n };\n if (isLinearGradient(val)) {\n gradientTag = 'linearGradient';\n gradientAttrs.x1 = val.x;\n gradientAttrs.y1 = val.y;\n gradientAttrs.x2 = val.x2;\n gradientAttrs.y2 = val.y2;\n }\n else if (isRadialGradient(val)) {\n gradientTag = 'radialGradient';\n gradientAttrs.cx = retrieve2(val.x, 0.5);\n gradientAttrs.cy = retrieve2(val.y, 0.5);\n gradientAttrs.r = retrieve2(val.r, 0.5);\n }\n else {\n if (process.env.NODE_ENV !== 'production') {\n logError('Illegal gradient type.');\n }\n return;\n }\n\n const colors = val.colorStops;\n\n const colorStops = [];\n for (let i = 0, len = colors.length; i < len; ++i) {\n const offset = round4(colors[i].offset) * 100 + '%';\n\n const stopColor = colors[i].color;\n // Fix Safari bug that stop-color not recognizing alpha #9014\n const {color, opacity} = normalizeColor(stopColor);\n\n const stopsAttrs: SVGVNodeAttrs = {\n 'offset': offset\n };\n // stop-color cannot be color, since:\n // The opacity value used for the gradient calculation is the\n // *product* of the value of stop-opacity and the opacity of the\n // value of stop-color.\n // See https://www.w3.org/TR/SVG2/pservers.html#StopOpacityProperty\n\n stopsAttrs['stop-color'] = color;\n if (opacity < 1) {\n stopsAttrs['stop-opacity'] = opacity;\n }\n colorStops.push(\n createVNode('stop', i + '', stopsAttrs)\n );\n }\n\n // Use the whole html as cache key.\n const gradientVNode = createVNode(gradientTag, '', gradientAttrs, colorStops);\n const gradientKey = vNodeToString(gradientVNode);\n const gradientCache = scope.gradientCache;\n let gradientId = gradientCache[gradientKey];\n if (!gradientId) {\n gradientId = scope.zrId + '-g' + scope.gradientIdx++;\n gradientCache[gradientKey] = gradientId;\n\n gradientAttrs.id = gradientId;\n scope.defs[gradientId] = createVNode(\n gradientTag, gradientId, gradientAttrs, colorStops\n );\n }\n\n attrs[target] = getIdURL(gradientId);\n}\n\nexport function setPattern(\n el: Displayable,\n attrs: SVGVNodeAttrs,\n target: 'fill' | 'stroke',\n scope: BrushScope\n) {\n const val = el.style[target] as ImagePatternObject | SVGPatternObject;\n const boundingRect = el.getBoundingRect();\n const patternAttrs: SVGVNodeAttrs = {};\n const repeat = (val as ImagePatternObject).repeat;\n const noRepeat = repeat === 'no-repeat';\n const repeatX = repeat === 'repeat-x';\n const repeatY = repeat === 'repeat-y';\n let child: SVGVNode;\n if (isImagePattern(val)) {\n let imageWidth = val.imageWidth;\n let imageHeight = val.imageHeight;\n let imageSrc;\n const patternImage = val.image;\n if (isString(patternImage)) {\n imageSrc = patternImage;\n }\n else if (isImageLike(patternImage)) {\n imageSrc = patternImage.src;\n }\n else if (isCanvasLike(patternImage)) {\n imageSrc = patternImage.toDataURL();\n }\n\n if (typeof Image === 'undefined') {\n const errMsg = 'Image width/height must been given explictly in svg-ssr renderer.';\n assert(imageWidth, errMsg);\n assert(imageHeight, errMsg);\n }\n else if (imageWidth == null || imageHeight == null) {\n // TODO\n const setSizeToVNode = (vNode: SVGVNode, img: ImageLike) => {\n if (vNode) {\n const svgEl = vNode.elm as SVGElement;\n let width = imageWidth || img.width;\n let height = imageHeight || img.height;\n if (vNode.tag === 'pattern') {\n if (repeatX) {\n height = 1;\n width /= boundingRect.width;\n }\n else if (repeatY) {\n width = 1;\n height /= boundingRect.height;\n }\n }\n vNode.attrs.width = width;\n vNode.attrs.height = height;\n if (svgEl) {\n svgEl.setAttribute('width', width as any);\n svgEl.setAttribute('height', height as any);\n }\n }\n };\n const createdImage = createOrUpdateImage(\n imageSrc, null, el, (img) => {\n noRepeat || setSizeToVNode(patternVNode, img);\n setSizeToVNode(child, img);\n }\n );\n if (createdImage && createdImage.width && createdImage.height) {\n // Loaded before\n imageWidth = imageWidth || createdImage.width;\n imageHeight = imageHeight || createdImage.height;\n }\n }\n\n child = createVNode(\n 'image',\n 'img',\n {\n href: imageSrc,\n width: imageWidth,\n height: imageHeight\n }\n );\n patternAttrs.width = imageWidth;\n patternAttrs.height = imageHeight;\n }\n else if (val.svgElement) { // Only string supported in SSR.\n // TODO it's not so good to use textContent as innerHTML\n child = clone(val.svgElement);\n patternAttrs.width = val.svgWidth;\n patternAttrs.height = val.svgHeight;\n }\n if (!child) {\n return;\n }\n\n let patternWidth;\n let patternHeight;\n if (noRepeat) {\n patternWidth = patternHeight = 1;\n }\n else if (repeatX) {\n patternHeight = 1;\n patternWidth = (patternAttrs.width as number) / boundingRect.width;\n }\n else if (repeatY) {\n patternWidth = 1;\n patternHeight = (patternAttrs.height as number) / boundingRect.height;\n }\n else {\n patternAttrs.patternUnits = 'userSpaceOnUse';\n }\n\n if (patternWidth != null && !isNaN(patternWidth)) {\n patternAttrs.width = patternWidth;\n }\n if (patternHeight != null && !isNaN(patternHeight)) {\n patternAttrs.height = patternHeight;\n }\n\n const patternTransform = getSRTTransformString(val);\n patternTransform && (patternAttrs.patternTransform = patternTransform);\n\n // Use the whole html as cache key.\n let patternVNode = createVNode(\n 'pattern',\n '',\n patternAttrs,\n [child]\n );\n const patternKey = vNodeToString(patternVNode);\n const patternCache = scope.patternCache;\n let patternId = patternCache[patternKey];\n if (!patternId) {\n patternId = scope.zrId + '-p' + scope.patternIdx++;\n patternCache[patternKey] = patternId;\n patternAttrs.id = patternId;\n patternVNode = scope.defs[patternId] = createVNode(\n 'pattern',\n patternId,\n patternAttrs,\n [child]\n );\n }\n\n attrs[target] = getIdURL(patternId);\n}\n\nexport function setClipPath(\n clipPath: Path,\n attrs: SVGVNodeAttrs,\n scope: BrushScope\n) {\n const {clipPathCache, defs} = scope;\n let clipPathId = clipPathCache[clipPath.id];\n if (!clipPathId) {\n clipPathId = scope.zrId + '-c' + scope.clipPathIdx++;\n const clipPathAttrs: SVGVNodeAttrs = {\n id: clipPathId\n };\n\n clipPathCache[clipPath.id] = clipPathId;\n defs[clipPathId] = createVNode(\n 'clipPath', clipPathId, clipPathAttrs,\n [brushSVGPath(clipPath, scope)]\n );\n }\n attrs['clip-path'] = getIdURL(clipPathId);\n}\n","export function createTextNode(text: string): Text {\r\n return document.createTextNode(text);\r\n}\r\n\r\nexport function createComment(text: string): Comment {\r\n return document.createComment(text);\r\n}\r\n\r\nexport function insertBefore(\r\n parentNode: Node,\r\n newNode: Node,\r\n referenceNode: Node | null\r\n): void {\r\n parentNode.insertBefore(newNode, referenceNode);\r\n}\r\n\r\nexport function removeChild(node: Node, child: Node): void {\r\n node.removeChild(child);\r\n}\r\n\r\nexport function appendChild(node: Node, child: Node): void {\r\n node.appendChild(child);\r\n}\r\n\r\nexport function parentNode(node: Node): Node | null {\r\n return node.parentNode;\r\n}\r\n\r\nexport function nextSibling(node: Node): Node | null {\r\n return node.nextSibling;\r\n}\r\n\r\nexport function tagName(elm: Element): string {\r\n return elm.tagName;\r\n}\r\n\r\nexport function setTextContent(node: Node, text: string | null): void {\r\n node.textContent = text;\r\n}\r\n\r\nexport function getTextContent(node: Node): string | null {\r\n return node.textContent;\r\n}\r\n\r\nexport function isElement(node: Node): node is Element {\r\n return node.nodeType === 1;\r\n}\r\n\r\nexport function isText(node: Node): node is Text {\r\n return node.nodeType === 3;\r\n}\r\n\r\nexport function isComment(node: Node): node is Comment {\r\n return node.nodeType === 8;\r\n}\r\n","/**\n * Virtual DOM patching\n * Modified from snabbdom https://github.com/snabbdom/snabbdom/blob/master/src/init.ts\n *\n * The design has been simplified to focus on the purpose in SVG rendering in SVG.\n *\n * Licensed under the MIT License\n * https://github.com/paldepind/snabbdom/blob/master/LICENSE\n */\n\nimport { isArray, isObject } from '../core/util';\nimport { createElement, createVNode, SVGVNode, XMLNS, XML_NAMESPACE, XLINKNS } from './core';\nimport * as api from './domapi';\n\nconst colonChar = 58;\nconst xChar = 120;\nconst emptyNode = createVNode('', '');\n\ntype NonUndefined = T extends undefined ? never : T;\n\nfunction isUndef(s: any): boolean {\n return s === undefined;\n}\n\nfunction isDef(s: A): s is NonUndefined {\n return s !== undefined;\n}\n\nfunction createKeyToOldIdx(\n children: SVGVNode[],\n beginIdx: number,\n endIdx: number\n): KeyToIndexMap {\n const map: KeyToIndexMap = {};\n for (let i = beginIdx; i <= endIdx; ++i) {\n const key = children[i].key;\n if (key !== undefined) {\n if (process.env.NODE_ENV !== 'production') {\n if (map[key] != null) {\n console.error(`Duplicate key ${key}`);\n }\n }\n map[key] = i;\n }\n }\n return map;\n}\n\nfunction sameVnode(vnode1: SVGVNode, vnode2: SVGVNode): boolean {\n const isSameKey = vnode1.key === vnode2.key;\n const isSameTag = vnode1.tag === vnode2.tag;\n\n return isSameTag && isSameKey;\n}\n\ntype KeyToIndexMap = { [key: string]: number };\n\nfunction createElm(vnode: SVGVNode): Node {\n let i: any;\n const children = vnode.children;\n const tag = vnode.tag;\n // if (tag === '!') {\n // if (isUndef(vnode.text)) {\n // vnode.text = '';\n // }\n // vnode.elm = api.createComment(vnode.text!);\n // }\n // else\n if (isDef(tag)) {\n const elm = (vnode.elm = createElement(tag));\n\n updateAttrs(emptyNode, vnode);\n\n if (isArray(children)) {\n for (i = 0; i < children.length; ++i) {\n const ch = children[i];\n if (ch != null) {\n api.appendChild(elm, createElm(ch));\n }\n }\n }\n else if (isDef(vnode.text) && !isObject(vnode.text)) {\n api.appendChild(elm, api.createTextNode(vnode.text));\n }\n }\n else {\n vnode.elm = api.createTextNode(vnode.text!);\n }\n return vnode.elm;\n}\n\nfunction addVnodes(\n parentElm: Node,\n before: Node | null,\n vnodes: SVGVNode[],\n startIdx: number,\n endIdx: number\n) {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx];\n if (ch != null) {\n api.insertBefore(parentElm, createElm(ch), before);\n }\n }\n}\n\nfunction removeVnodes(parentElm: Node, vnodes: SVGVNode[], startIdx: number, endIdx: number): void {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx];\n if (ch != null) {\n if (isDef(ch.tag)) {\n const parent = api.parentNode(ch.elm);\n api.removeChild(parent, ch.elm);\n }\n else {\n // Text node\n api.removeChild(parentElm, ch.elm!);\n }\n }\n }\n}\n\nexport function updateAttrs(oldVnode: SVGVNode, vnode: SVGVNode): void {\n let key: string;\n const elm = vnode.elm as SVGElement;\n const oldAttrs = oldVnode && oldVnode.attrs || {};\n const attrs = vnode.attrs || {};\n\n if (oldAttrs === attrs) {\n return;\n }\n\n // update modified attributes, add new attributes\n // eslint-disable-next-line\n for (key in attrs) {\n const cur = attrs[key];\n const old = oldAttrs[key];\n if (old !== cur) {\n if (cur === true) {\n elm.setAttribute(key, '');\n }\n else if (cur === false) {\n elm.removeAttribute(key);\n }\n else {\n if (key === 'style') {\n elm.style.cssText = cur as string;\n }\n else if (key.charCodeAt(0) !== xChar) {\n elm.setAttribute(key, cur as any);\n }\n // TODO\n else if (key === 'xmlns:xlink' || key === 'xmlns') {\n elm.setAttributeNS(XMLNS, key, cur as any);\n }\n else if (key.charCodeAt(3) === colonChar) {\n // Assume xml namespace\n elm.setAttributeNS(XML_NAMESPACE, key, cur as any);\n }\n else if (key.charCodeAt(5) === colonChar) {\n // Assume xlink namespace\n elm.setAttributeNS(XLINKNS, key, cur as any);\n }\n else {\n elm.setAttribute(key, cur as any);\n }\n }\n }\n }\n\n // remove removed attributes\n // use `in` operator since the previous `for` iteration uses it (.i.e. add even attributes with undefined value)\n // the other option is to remove all attributes with value == undefined\n for (key in oldAttrs) {\n if (!(key in attrs)) {\n elm.removeAttribute(key);\n }\n }\n}\n\n\nfunction updateChildren(parentElm: Node, oldCh: SVGVNode[], newCh: SVGVNode[]) {\n let oldStartIdx = 0;\n let newStartIdx = 0;\n let oldEndIdx = oldCh.length - 1;\n let oldStartVnode = oldCh[0];\n let oldEndVnode = oldCh[oldEndIdx];\n let newEndIdx = newCh.length - 1;\n let newStartVnode = newCh[0];\n let newEndVnode = newCh[newEndIdx];\n let oldKeyToIdx: KeyToIndexMap | undefined;\n let idxInOld: number;\n let elmToMove: SVGVNode;\n let before: any;\n\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (oldStartVnode == null) {\n oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left\n }\n else if (oldEndVnode == null) {\n oldEndVnode = oldCh[--oldEndIdx];\n }\n else if (newStartVnode == null) {\n newStartVnode = newCh[++newStartIdx];\n }\n else if (newEndVnode == null) {\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else if (sameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldStartVnode, newEndVnode)) {\n // Vnode moved right\n patchVnode(oldStartVnode, newEndVnode);\n api.insertBefore(parentElm, oldStartVnode.elm!, api.nextSibling(oldEndVnode.elm!));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n }\n else if (sameVnode(oldEndVnode, newStartVnode)) {\n // Vnode moved left\n patchVnode(oldEndVnode, newStartVnode);\n api.insertBefore(parentElm, oldEndVnode.elm!, oldStartVnode.elm!);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n }\n else {\n if (isUndef(oldKeyToIdx)) {\n oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n }\n idxInOld = oldKeyToIdx[newStartVnode.key];\n if (isUndef(idxInOld)) {\n // New element\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm!);\n }\n else {\n elmToMove = oldCh[idxInOld];\n if (elmToMove.tag !== newStartVnode.tag) {\n api.insertBefore(parentElm, createElm(newStartVnode), oldStartVnode.elm!);\n }\n else {\n patchVnode(elmToMove, newStartVnode);\n oldCh[idxInOld] = undefined;\n api.insertBefore(parentElm, elmToMove.elm!, oldStartVnode.elm!);\n }\n }\n newStartVnode = newCh[++newStartIdx];\n }\n }\n if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {\n if (oldStartIdx > oldEndIdx) {\n before = newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].elm;\n addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);\n }\n else {\n removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n }\n }\n}\n\nfunction patchVnode(oldVnode: SVGVNode, vnode: SVGVNode) {\n const elm = (vnode.elm = oldVnode.elm)!;\n const oldCh = oldVnode.children;\n const ch = vnode.children;\n if (oldVnode === vnode) {\n return;\n }\n\n updateAttrs(oldVnode, vnode);\n\n if (isUndef(vnode.text)) {\n if (isDef(oldCh) && isDef(ch)) {\n if (oldCh !== ch) {\n updateChildren(elm, oldCh, ch);\n }\n }\n else if (isDef(ch)) {\n if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n addVnodes(elm, null, ch, 0, ch.length - 1);\n }\n else if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n else if (isDef(oldVnode.text)) {\n api.setTextContent(elm, '');\n }\n }\n else if (oldVnode.text !== vnode.text) {\n if (isDef(oldCh)) {\n removeVnodes(elm, oldCh, 0, oldCh.length - 1);\n }\n api.setTextContent(elm, vnode.text!);\n }\n}\n\nexport default function patch(oldVnode: SVGVNode, vnode: SVGVNode): SVGVNode {\n if (sameVnode(oldVnode, vnode)) {\n patchVnode(oldVnode, vnode);\n }\n else {\n const elm = oldVnode.elm!;\n const parent = api.parentNode(elm);\n\n createElm(vnode);\n\n if (parent !== null) {\n api.insertBefore(parent, vnode.elm!, api.nextSibling(elm));\n removeVnodes(parent, [oldVnode], 0, 0);\n }\n }\n\n return vnode;\n}\n","/**\n * SVG Painter\n */\n\nimport {\n brush,\n setClipPath,\n setGradient,\n setPattern\n} from './graphic';\nimport Displayable from '../graphic/Displayable';\nimport Storage from '../Storage';\nimport { PainterBase } from '../PainterBase';\nimport {\n createElement,\n createVNode,\n vNodeToString,\n SVGVNodeAttrs,\n SVGVNode,\n getCssString,\n BrushScope,\n createBrushScope,\n createSVGVNode\n} from './core';\nimport { normalizeColor, encodeBase64, isGradient, isPattern } from './helper';\nimport { extend, keys, logError, map, noop, retrieve2 } from '../core/util';\nimport Path from '../graphic/Path';\nimport patch, { updateAttrs } from './patch';\nimport { getSize } from '../canvas/helper';\nimport { GradientObject } from '../graphic/Gradient';\nimport { PatternObject } from '../graphic/Pattern';\n\nlet svgId = 0;\n\ninterface SVGPainterOption {\n width?: number\n height?: number\n ssr?: boolean\n}\n\ntype SVGPainterBackgroundColor = string | GradientObject | PatternObject;\n\nclass SVGPainter implements PainterBase {\n\n type = 'svg'\n\n storage: Storage\n\n root: HTMLElement\n\n private _svgDom: SVGElement\n private _viewport: HTMLElement\n\n private _opts: SVGPainterOption\n\n private _oldVNode: SVGVNode\n private _bgVNode: SVGVNode\n private _mainVNode: SVGVNode\n\n private _width: number\n private _height: number\n\n private _backgroundColor: SVGPainterBackgroundColor\n\n private _id: string\n\n constructor(root: HTMLElement, storage: Storage, opts: SVGPainterOption) {\n this.storage = storage;\n this._opts = opts = extend({}, opts);\n\n this.root = root;\n // A unique id for generating svg ids.\n this._id = 'zr' + svgId++;\n\n this._oldVNode = createSVGVNode(opts.width, opts.height);\n\n if (root && !opts.ssr) {\n const viewport = this._viewport = document.createElement('div');\n viewport.style.cssText = 'position:relative;overflow:hidden';\n const svgDom = this._svgDom = this._oldVNode.elm = createElement('svg');\n updateAttrs(null, this._oldVNode);\n viewport.appendChild(svgDom);\n root.appendChild(viewport);\n }\n\n this.resize(opts.width, opts.height);\n }\n\n getType() {\n return this.type;\n }\n\n getViewportRoot() {\n return this._viewport;\n }\n getViewportRootOffset() {\n const viewportRoot = this.getViewportRoot();\n if (viewportRoot) {\n return {\n offsetLeft: viewportRoot.offsetLeft || 0,\n offsetTop: viewportRoot.offsetTop || 0\n };\n }\n }\n\n getSvgDom() {\n return this._svgDom;\n }\n\n refresh() {\n if (this.root) {\n const vnode = this.renderToVNode({\n willUpdate: true\n });\n // Disable user selection.\n vnode.attrs.style = 'position:absolute;left:0;top:0;user-select:none';\n patch(this._oldVNode, vnode);\n this._oldVNode = vnode;\n }\n }\n\n renderOneToVNode(el: Displayable) {\n return brush(el, createBrushScope(this._id));\n }\n\n renderToVNode(opts?: {\n animation?: boolean,\n willUpdate?: boolean,\n compress?: boolean,\n useViewBox?: boolean,\n emphasis?: boolean\n }) {\n\n opts = opts || {};\n\n const list = this.storage.getDisplayList(true);\n const width = this._width;\n const height = this._height;\n\n const scope = createBrushScope(this._id);\n scope.animation = opts.animation;\n scope.willUpdate = opts.willUpdate;\n scope.compress = opts.compress;\n scope.emphasis = opts.emphasis;\n scope.ssr = this._opts.ssr;\n\n const children: SVGVNode[] = [];\n\n const bgVNode = this._bgVNode = createBackgroundVNode(width, height, this._backgroundColor, scope);\n bgVNode && children.push(bgVNode);\n\n // Ignore the root g if wan't the output to be more tight.\n const mainVNode = !opts.compress\n ? (this._mainVNode = createVNode('g', 'main', {}, [])) : null;\n this._paintList(list, scope, mainVNode ? mainVNode.children : children);\n mainVNode && children.push(mainVNode);\n\n const defs = map(keys(scope.defs), (id) => scope.defs[id]);\n if (defs.length) {\n children.push(createVNode('defs', 'defs', {}, defs));\n }\n\n if (opts.animation) {\n const animationCssStr = getCssString(scope.cssNodes, scope.cssAnims, { newline: true });\n if (animationCssStr) {\n const styleNode = createVNode('style', 'stl', {}, [], animationCssStr);\n children.push(styleNode);\n }\n }\n\n return createSVGVNode(width, height, children, opts.useViewBox);\n }\n\n renderToString(opts?: {\n /**\n * If add css animation.\n * @default true\n */\n cssAnimation?: boolean,\n /**\n * If add css emphasis.\n * @default true\n */\n cssEmphasis?: boolean,\n /**\n * If use viewBox\n * @default true\n */\n useViewBox?: boolean\n }) {\n opts = opts || {};\n return vNodeToString(this.renderToVNode({\n animation: retrieve2(opts.cssAnimation, true),\n emphasis: retrieve2(opts.cssEmphasis, true),\n willUpdate: false,\n compress: true,\n useViewBox: retrieve2(opts.useViewBox, true)\n }), { newline: true });\n }\n\n setBackgroundColor(backgroundColor: SVGPainterBackgroundColor) {\n this._backgroundColor = backgroundColor;\n }\n\n getSvgRoot() {\n return this._mainVNode && this._mainVNode.elm as SVGElement;\n }\n\n _paintList(list: Displayable[], scope: BrushScope, out?: SVGVNode[]) {\n const listLen = list.length;\n\n const clipPathsGroupsStack: SVGVNode[] = [];\n let clipPathsGroupsStackDepth = 0;\n let currentClipPathGroup;\n let prevClipPaths: Path[];\n let clipGroupNodeIdx = 0;\n for (let i = 0; i < listLen; i++) {\n const displayable = list[i];\n if (!displayable.invisible) {\n const clipPaths = displayable.__clipPaths;\n const len = clipPaths && clipPaths.length || 0;\n const prevLen = prevClipPaths && prevClipPaths.length || 0;\n let lca;\n // Find the lowest common ancestor\n for (lca = Math.max(len - 1, prevLen - 1); lca >= 0; lca--) {\n if (clipPaths && prevClipPaths\n && clipPaths[lca] === prevClipPaths[lca]\n ) {\n break;\n }\n }\n // pop the stack\n for (let i = prevLen - 1; i > lca; i--) {\n clipPathsGroupsStackDepth--;\n // svgEls.push(closeGroup);\n currentClipPathGroup = clipPathsGroupsStack[clipPathsGroupsStackDepth - 1];\n }\n // Pop clip path group for clipPaths not match the previous.\n for (let i = lca + 1; i < len; i++) {\n const groupAttrs: SVGVNodeAttrs = {};\n setClipPath(\n clipPaths[i],\n groupAttrs,\n scope\n );\n const g = createVNode(\n 'g',\n 'clip-g-' + clipGroupNodeIdx++,\n groupAttrs,\n []\n );\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(g);\n clipPathsGroupsStack[clipPathsGroupsStackDepth++] = g;\n currentClipPathGroup = g;\n }\n prevClipPaths = clipPaths;\n\n const ret = brush(displayable, scope);\n if (ret) {\n (currentClipPathGroup ? currentClipPathGroup.children : out).push(ret);\n }\n }\n }\n }\n\n resize(width: number, height: number) {\n // Save input w/h\n const opts = this._opts;\n const root = this.root;\n const viewport = this._viewport;\n width != null && (opts.width = width);\n height != null && (opts.height = height);\n\n if (root && viewport) {\n // FIXME Why ?\n viewport.style.display = 'none';\n\n width = getSize(root, 0, opts);\n height = getSize(root, 1, opts);\n\n viewport.style.display = '';\n }\n\n if (this._width !== width || this._height !== height) {\n this._width = width;\n this._height = height;\n\n if (viewport) {\n const viewportStyle = viewport.style;\n viewportStyle.width = width + 'px';\n viewportStyle.height = height + 'px';\n }\n\n if (!isPattern(this._backgroundColor)) {\n const svgDom = this._svgDom;\n if (svgDom) {\n // Set width by 'svgRoot.width = width' is invalid\n svgDom.setAttribute('width', width as any);\n svgDom.setAttribute('height', height as any);\n }\n\n const bgEl = this._bgVNode && this._bgVNode.elm as SVGElement;\n if (bgEl) {\n bgEl.setAttribute('width', width as any);\n bgEl.setAttribute('height', height as any);\n }\n }\n else {\n // pattern backgroundColor requires a full refresh\n this.refresh();\n }\n }\n }\n\n /**\n * 获取绘图区域宽度\n */\n getWidth() {\n return this._width;\n }\n\n /**\n * 获取绘图区域高度\n */\n getHeight() {\n return this._height;\n }\n\n dispose() {\n if (this.root) {\n this.root.innerHTML = '';\n }\n\n this._svgDom =\n this._viewport =\n this.storage =\n this._oldVNode =\n this._bgVNode =\n this._mainVNode = null;\n }\n clear() {\n if (this._svgDom) {\n this._svgDom.innerHTML = null;\n }\n this._oldVNode = null;\n }\n toDataURL(base64?: boolean) {\n let str = this.renderToString();\n const prefix = 'data:image/svg+xml;';\n if (base64) {\n str = encodeBase64(str);\n return str && prefix + 'base64,' + str;\n }\n return prefix + 'charset=UTF-8,' + encodeURIComponent(str);\n }\n\n refreshHover = createMethodNotSupport('refreshHover') as PainterBase['refreshHover'];\n configLayer = createMethodNotSupport('configLayer') as PainterBase['configLayer'];\n}\n\n\n// Not supported methods\nfunction createMethodNotSupport(method: string): any {\n return function () {\n if (process.env.NODE_ENV !== 'production') {\n logError('In SVG mode painter not support method \"' + method + '\"');\n }\n };\n}\n\nfunction createBackgroundVNode(\n width: number,\n height: number,\n backgroundColor: SVGPainterBackgroundColor,\n scope: BrushScope\n) {\n let bgVNode;\n if (backgroundColor && backgroundColor !== 'none') {\n bgVNode = createVNode(\n 'rect',\n 'bg',\n {\n width,\n height,\n x: '0',\n y: '0'\n }\n );\n if (isGradient(backgroundColor)) {\n setGradient({ fill: backgroundColor as any }, bgVNode.attrs, 'fill', scope);\n }\n else if (isPattern(backgroundColor)) {\n setPattern({\n style: {\n fill: backgroundColor\n },\n dirty: noop,\n getBoundingRect: () => ({ width, height })\n } as any, bgVNode.attrs, 'fill', scope);\n }\n else {\n const { color, opacity } = normalizeColor(backgroundColor);\n bgVNode.attrs.fill = color;\n opacity < 1 && (bgVNode.attrs['fill-opacity'] = opacity);\n }\n }\n return bgVNode;\n}\n\nexport default SVGPainter;\n","export * from './zrender';\r\nexport * from './export';\r\n\r\nimport {registerPainter} from './zrender';\r\nimport CanvasPainter from './canvas/Painter';\r\nimport SVGPainter from './svg/Painter';\r\nregisterPainter('canvas', CanvasPainter);\r\nregisterPainter('svg', SVGPainter);\r\n"],"names":["clone","eventUtil.clientToLocal","dist","create","copy","mul","scale","matrix.create","matrix.translate","matrix.scale","eventTool.stop","util.each","vec2.dist","timsort","util.indexOf","v2Create","v2DistSquare","lerp","EPSILON","isAroundZero","color.parse","requestAnimationFrame","zrUtil.map","zrUtil.noop","zrUtil.each","matrix.identity","isNotAroundZero","matrix.mul","matrix.copy","matrix.invert","vector.applyTransform","matrix.rotate","adjustTextY","zrUtil.indexOf","zrUtil.keys","HandlerProxy","zrUtil.retrieve2","zrUtil.guid","PRIMARY_STATES_KEYS","tmpRect","mathMin","mathMax","vec2.create","cubicExtrema","curve.cubicExtrema","cubicAt","curve.cubicAt","quadraticExtremum","curve.quadraticExtremum","quadraticAt","curve.quadraticAt","min","max","vec2.min","vec2.max","mathCos","mathSin","PI2","dpr","containStroke","curve.cubicProjectPoint","CMD","curve.cubicRootAt","curve.quadraticRootAt","line.containStroke","cubic.containStroke","quadratic.containStroke","arc.containStroke","pathContain.containStroke","pathContain.contain","mathSqrt","v2ApplyTransform","PI","roundRectHelper.buildPath","subPixelOptimizeOutputShape","v2Min","v2Max","v2Clone","v2Sub","v2Scale","v2Distance","v2Add","buildPath","polyHelper.buildPath","numberReg","mathAbs","roundSectorHelper.buildPath","Displayble","imageHelper.findExistImage","imageHelper.isImageReady","vec2.normalize","sin","cos","minTv","maxTv","util.isObject","util.disableUserSelect","util.isGradientObject","util.isImagePatternObject","util.extend","util.merge","util.logError","mathRound","round","isImageLike","brush","api.appendChild","api.createTextNode","api.insertBefore","api.parentNode","api.removeChild","api.nextSibling","api.setTextContent"],"mappings":";;;;;;IAIA;QAAA;YACI,YAAO,GAAG,KAAK,CAAA;YACf,OAAE,GAAG,KAAK,CAAA;YACV,SAAI,GAAG,KAAK,CAAA;YACZ,YAAO,GAAG,KAAK,CAAA;YACf,WAAM,GAAG,KAAK,CAAA;SAEjB;QAAD,cAAC;IAAD,CAAC,IAAA;IAED;QAAA;YACI,YAAO,GAAG,IAAI,OAAO,EAAE,CAAA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BACjC,UAAU,CAAC;oBACP,KAAK,EAAE;wBACH,IAAI,EAAE,eAAe;qBACxB;oBACD,KAAK,EAAE,IAAI;oBACX,eAAe,EAAE,cAAM,QAAC,EAAE,KAAK,OAAA,EAAE,MAAM,QAAA,EAAE,IAAC;iBACtC,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;aAC3C;iBACI;gBACK,IAAA,KAAqB,cAAc,CAAC,eAAe,CAAC,EAAlD,KAAK,WAAA,EAAE,OAAO,aAAoC,CAAC;gBAC3D,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;gBAC3B,OAAO,GAAG,CAAC,KAAK,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,CAAC;aAC5D;SACJ;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;;ICjZD,eAAe,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IACzC,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/zrender.min.js b/dist/zrender.min.js index 95f2d43e..23acf925 100644 --- a/dist/zrender.min.js +++ b/dist/zrender.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).zrender={})}(this,function(t){"use strict";var e=function(){this.firefox=!1,this.ie=!1,this.edge=!1,this.newEdge=!1,this.weChat=!1},c=new function(){this.browser=new e,this.node=!1,this.wxa=!1,this.worker=!1,this.svgSupported=!1,this.touchEventsSupported=!1,this.pointerEventsSupported=!1,this.domSupported=!1,this.transformSupported=!1,this.transform3dSupported=!1,this.hasGlobalWindow="undefined"!=typeof window};"object"==typeof wx&&"function"==typeof wx.getSystemInfoSync?(c.wxa=!0,c.touchEventsSupported=!0):"undefined"==typeof document&&"undefined"!=typeof self?c.worker=!0:!c.hasGlobalWindow||"Deno"in window?(c.node=!0,c.svgSupported=!0):function(t,e){var r=e.browser,i=t.match(/Firefox\/([\d.]+)/),n=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),o=t.match(/Edge?\/([\d.]+)/),a=/micromessenger/i.test(t);i&&(r.firefox=!0,r.version=i[1]);n&&(r.ie=!0,r.version=n[1]);o&&(r.edge=!0,r.version=o[1],r.newEdge=18<+o[1].split(".")[0]);a&&(r.weChat=!0);e.svgSupported="undefined"!=typeof SVGRect,e.touchEventsSupported="ontouchstart"in window&&!r.ie&&!r.edge,e.pointerEventsSupported="onpointerdown"in window&&(r.edge||r.ie&&11<=+r.version),e.domSupported="undefined"!=typeof document;var s=document.documentElement.style;e.transform3dSupported=(r.ie&&"transition"in s||r.edge||"WebKitCSSMatrix"in window&&"m11"in new WebKitCSSMatrix||"MozPerspective"in s)&&!("OTransition"in s),e.transformSupported=e.transform3dSupported||r.ie&&9<=+r.version}(navigator.userAgent,c);var h=12,v="sans-serif",E=h+"px "+v;var l,u,p=function(t){var e={};if("undefined"==typeof JSON)return e;for(var r=0;r>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[h]+":0",n[l]+":0",i[1-h]+":auto",n[1-l]+":auto",""].join("!important;"),t.appendChild(a),r.push(a)}return r}(e,o),o,n);if(a)return a(t,r,i),1}}function qt(t){return"CANVAS"===t.nodeName.toUpperCase()}var Yt=/([&<>"'])/g,jt={"&":"&","<":"<",">":">",'"':""","'":"'"};var Vt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ut=[],Gt=c.browser.firefox&&+c.browser.version.split(".")[0]<39;function Zt(t,e,r,i){return r=r||{},i?Kt(t,e,r):Gt&&null!=e.layerX&&e.layerX!==e.offsetX?(r.zrX=e.layerX,r.zrY=e.layerY):null!=e.offsetX?(r.zrX=e.offsetX,r.zrY=e.offsetY):Kt(t,e,r),r}function Kt(t,e,r){if(c.domSupported&&t.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(qt(t)){var o=t.getBoundingClientRect();return r.zrX=i-o.left,void(r.zrY=n-o.top)}if(Xt(Ut,t,i,n))return r.zrX=Ut[0],void(r.zrY=Ut[1])}r.zrX=r.zrY=0}function Qt(t){return t||window.event}function $t(t,e,r){if(null!=(e=Qt(e)).zrX)return e;var i,n,o=e.type;o&&0<=o.indexOf("touch")?(i="touchend"!==o?e.targetTouches[0]:e.changedTouches[0])&&Zt(t,i,e,r):(Zt(t,e,e,r),n=function(t){var e=t.wheelDelta;if(e)return e;var r=t.deltaX,i=t.deltaY;return null!=r&&null!=i?3*(0!==i?Math.abs(i):Math.abs(r))*(0=r.x&&t<=r.x+r.width&&e>=r.y&&e<=r.y+r.height},ke.prototype.clone=function(){return new ke(this.x,this.y,this.width,this.height)},ke.prototype.copy=function(t){ke.copy(this,t)},ke.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},ke.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},ke.prototype.isZero=function(){return 0===this.width||0===this.height},ke.create=function(t){return new ke(t.x,t.y,t.width,t.height)},ke.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},ke.applyTransform=function(t,e,r){if(r){if(r[1]<1e-5&&-1e-5i.getWidth()||r<0||r>i.getHeight()}O(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(a){Oe.prototype[a]=function(t){var e,r,i=t.zrX,n=t.zrY,o=Be(this,i,n);if("mouseup"===a&&o||(r=(e=this.findHover(i,n)).target),"mousedown"===a)this._downEl=r,this._downPoint=[t.zrX,t.zrY],this._upEl=r;else if("mouseup"===a)this._upEl=r;else if("click"===a){if(this._downEl!==this._upEl||!this._downPoint||4>>1])<0?h=o:s=1+o;var l=i-s;switch(l){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;0>>1);0>>1);o(t,e[r+u])<0?h=u:a=u+1}return h}function Ye(d,y){var a,s,v=He,h=0,g=[];function e(t){var e=a[t],r=s[t],i=a[t+1],n=s[t+1];s[t]=r+n,t===h-3&&(a[t+1]=a[t+2],s[t+1]=s[t+2]),h--;var o=qe(d[i],d,e,r,0,y);e+=o,0!=(r-=o)&&0!==(n=Xe(d[e+r-1],d,i,n,n-1,y))&&(r<=n?function(t,e,r,i){var n=0;for(n=0;ns[t+1])break;e(t)}},forceMergeRuns:function(){for(;1>=1;return t+e}(n);do{(o=Ee(t,r,i,e))=this._maxSize&&0>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,5===o?parseInt(i.slice(4),16)/15:1),Wr(t,e),e):void Br(e,0,0,0,1):7===o||9===o?0<=(n=parseInt(i.slice(1,7),16))&&n<=16777215?(Br(e,(16711680&n)>>16,(65280&n)>>8,255&n,9===o?parseInt(i.slice(7),16)/255:1),Wr(t,e),e):void Br(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var h=i.substr(0,a),l=i.substr(a+1,s-(a+1)).split(","),u=1;switch(h){case"rgba":if(4!==l.length)return 3===l.length?Br(e,+l[0],+l[1],+l[2],1):Br(e,0,0,0,1);u=Or(l.pop());case"rgb":return 3<=l.length?(Br(e,Ir(l[0]),Ir(l[1]),Ir(l[2]),3===l.length?u:Or(l[3])),Wr(t,e),e):void Br(e,0,0,0,1);case"hsla":return 4!==l.length?void Br(e,0,0,0,1):(l[3]=Or(l[3]),qr(l,e),Wr(t,e),e);case"hsl":return 3!==l.length?void Br(e,0,0,0,1):(qr(l,e),Wr(t,e),e);default:return}}Br(e,0,0,0,1)}}function qr(t,e){var r=(parseFloat(t[0])%360+360)%360/360,i=Or(t[1]),n=Or(t[2]),o=n<=.5?n*(i+1):n+i-n*i,a=2*n-o;return Br(e=e||[],Dr(255*Rr(a,o,r+1/3)),Dr(255*Rr(a,o,r)),Dr(255*Rr(a,o,r-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Yr(t,e){var r=Xr(t);if(r){for(var i=0;i<3;i++)r[i]=e<0?r[i]*(1-e)|0:(255-r[i])*e+r[i]|0,255e);x++);x=m(x-1,y-2)}i=d[x+1],r=d[x]}r&&i&&(this._lastFr=x,this._lastFrP=e,n=i.percent-r.percent,o=0==n?1:m((e-r.percent)/n,1),i.easingFunc&&(o=i.easingFunc(o)),a=c?this._additiveValue:g?Ti:t[v],!ki(f)&&!g||a||(a=this._additiveValue=[]),this.discrete?t[v]=o<1?r.rawValue:i.rawValue:ki(f)?(1===f?_i:function(t,e,r,i){for(var n=e.length,o=n&&e[0].length,a=0;athis._sleepAfterStill&&this.animation.stop())},qn.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},qn.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},qn.prototype.refreshHover=function(){this._needsRefreshHover=!0},qn.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},qn.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},qn.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},qn.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},qn.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},qn.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},qn.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},qn.prototype.on=function(t,e,r){return this._disposed||this.handler.on(t,e,r),this},qn.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},qn.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},qn.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;ethis._ux||n>this._uy;return this.addData(vo.L,t,e),this._ctx&&o&&this._ctx.lineTo(t,e),o?(this._xi=t,this._yi=e,this._pendingPtDist=0):(r=i*i+n*n)>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=r),this},Ro.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._drawPendingPt(),this.addData(vo.C,t,e,r,i,n,o),this._ctx&&this._ctx.bezierCurveTo(t,e,r,i,n,o),this._xi=n,this._yi=o,this},Ro.prototype.quadraticCurveTo=function(t,e,r,i){return this._drawPendingPt(),this.addData(vo.Q,t,e,r,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,r,i),this._xi=r,this._yi=i,this},Ro.prototype.arc=function(t,e,r,i,n,o){this._drawPendingPt(),Do[0]=i,Do[1]=n,function(t,e){var r=zo(t[0]);r<0&&(r+=Ao);var i=r-t[0],n=t[1];n+=i,!e&&Ao<=n-r?n=r+Ao:e&&Ao<=r-n?n=r-Ao:!e&&nl.length&&(this._expandData(),l=this.data);for(var u=0;ur||Po(v)>i||c===e-1)&&(d=Math.sqrt(A*A+v*v),n=y,o=m);break;case vo.C:var g=t[c++],_=t[c++],y=t[c++],m=t[c++],x=t[c++],w=t[c++],d=function(t,e,r,i,n,o,a,s,h){for(var l=t,u=e,c=0,p=1/h,f=1;f<=h;f++){var d=f*p,y=pr(t,r,n,a,d),v=pr(e,i,o,s,d),g=y-l,_=v-u;c+=Math.sqrt(g*g+_*_),l=y,u=v}return c}(n,o,g,_,y,m,x,w,10),n=x,o=w;break;case vo.Q:d=function(t,e,r,i,n,o,a){for(var s=t,h=e,l=0,u=1/a,c=1;c<=a;c++){var p=c*u,f=gr(t,r,n,p),d=gr(e,i,o,p),y=f-s,v=d-h;l+=Math.sqrt(y*y+v*v),s=f,h=d}return l}(n,o,g=t[c++],_=t[c++],y=t[c++],m=t[c++],10),n=y,o=m;break;case vo.A:var b=t[c++],S=t[c++],k=t[c++],T=t[c++],C=t[c++],P=t[c++],M=P+C;c+=1,f&&(a=To(C)*k+b,s=Co(C)*T+S),d=ko(k,T)*So(Ao,Math.abs(P)),n=To(M)*k+b,o=Co(M)*T+S;break;case vo.R:a=n=t[c++],s=o=t[c++],d=2*t[c++]+2*t[c++];break;case vo.Z:var A=a-n,v=s-o;d=Math.sqrt(A*A+v*v),n=a,o=s}0<=d&&(l+=h[u++]=d)}return this._pathLen=l},Ro.prototype.rebuildPath=function(t,e){var r,i,n,o,a,s,h,l,u,c,p=this.data,f=this._ux,d=this._uy,y=this._len,v=e<1,g=0,_=0,m=0;if(!v||(this._pathSegLen||this._calculateLength(),h=this._pathSegLen,l=e*this._pathLen))t:for(var x=0;x=Vo[i=0]+t&&a<=Vo[1]+t?c:0}nMath.PI/2&&d<1.5*Math.PI&&(c=-c),p+=c))}return p}(g,_,x,w,w+b,S,C,n);u=Math.cos(w+b)*m+g,c=Math.sin(w+b)*x+_;break;case qo.R:p=u=s[d++],f=c=s[d++];if(k=p+s[d++],T=f+s[d++],r){if(Fo(p,f,k,f,e,i,n)||Fo(k,f,k,T,e,i,n)||Fo(k,T,p,T,e,i,n)||Fo(p,T,p,f,e,i,n))return!0}else l+=Xo(k,f,k,T,i,n),l+=Xo(p,T,p,f,i,n);break;case qo.Z:if(r){if(Fo(u,c,p,f,e,i,n))return!0}else l+=Xo(u,c,p,f,i,n);u=p,c=f}}return r||(o=c,a=f,Math.abs(o-a)Math.abs(l),c=sh([h,l],u?0:1,e),p=(u?s:l)/c.length,f=0;f=r.maxIterations){e+=r.ellipsis;break}var s=0===a?function(t,e,r,i){for(var n=0,o=0,a=t.length;oo){var M=r.lines.length;0i.width&&(o=e.split("\n"),y=!0),i.accumWidth=l):(u=Zh(e,d,i.width,i.breakAll,i.accumWidth),i.accumWidth=u.accumWidth+h,a=u.linesWidths,o=u.lines)):o=e.split("\n");for(var v=0;vr,i=i.slice(0,r)),t&&s&&null!=f)for(var v=Wh(f,a,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),g={},_=0;_i.len()&&(l=p}}for(var o,a=this.__startIndex;an[0]){for(h=0;ht);h++);s=i[n[h]]}n.splice(h+1,0,t),(i[t]=e).virtual||(s?(r=s.dom).nextSibling?a.insertBefore(e.dom,r.nextSibling):a.appendChild(e.dom):a.firstChild?a.insertBefore(e.dom,a.firstChild):a.appendChild(e.dom)),e.painter||(e.painter=this)}},Uu.prototype.eachLayer=function(t,e){for(var r=this._zlevelList,i=0;i"}(n,o)+("style"!==n?null==(r=a)?"":(r+"").replace(Yt,function(t,e){return jt[e]}):a||"")+(i?""+s+L(i,t).join(s)+s:"")+""}(t)}function dc(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function yc(t,e,r,i){return pc("svg","root",{width:t,height:e,xmlns:ac,"xmlns:xlink":sc,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},r)}var vc=0;function gc(){return vc++}var _c={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},mc="transform-origin";var xc={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function wc(t,e){var r=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[r]=t,r}function bc(t){return N(t)?_c[t]?"cubic-bezier("+_c[t]+")":br(t)?t:"":""}function Sc(A,L,D,z){var t=A.animators,e=t.length,r=[];if(A instanceof Lh){if(i=function(t,e,c){var p,f,r=t.shape.paths,d={};if(O(r,function(t){var e=dc(c.zrId);e.animation=!0,Sc(t,{},e,!0);var r=e.cssAnims,i=e.cssNodes,n=F(r),o=n.length;if(o){var a=r[f=n[o-1]];for(var s in a){var h=a[s];d[s]=d[s]||{d:""},d[s].d+=h.d||""}for(var l in i){var u=i[l].animation;0<=u.indexOf(f)&&(p=u)}}}),p){e.d=!1;var i=wc(d,c);return p.replace(f,i)}}(A,L,D))r.push(i);else if(!e)return}else if(!e)return;for(var i,n,o={},a=0;a"].join(p):"")&&(l=pc("style","stl",{},[],h),o.push(l))),yc(r,i,o,t.useViewBox)},sp.prototype.renderToString=function(t){return t=t||{},fc(this.renderToVNode({animation:Z(t.cssAnimation,!0),emphasis:Z(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Z(t.useViewBox,!0)}),{newline:!0})},sp.prototype.setBackgroundColor=function(t){this._backgroundColor=t},sp.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},sp.prototype._paintList=function(t,e,r){for(var i,n,o,a,s,h,l,u,c,p=t.length,f=[],d=0,y=0,v=0;v>1)%2;s.cssText=["position: absolute","visibility: hidden","padding: 0","margin: 0","border-width: 0","user-select: none","width:0","height:0",i[h]+":0",n[l]+":0",i[1-h]+":auto",n[1-l]+":auto",""].join("!important;"),t.appendChild(a),r.push(a)}return r}(e,o),o,n);if(a)return a(t,r,i),1}}function qt(t){return"CANVAS"===t.nodeName.toUpperCase()}var Yt=/([&<>"'])/g,jt={"&":"&","<":"<",">":">",'"':""","'":"'"};var Vt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ut=[],Gt=c.browser.firefox&&+c.browser.version.split(".")[0]<39;function Zt(t,e,r,i){return r=r||{},i?Kt(t,e,r):Gt&&null!=e.layerX&&e.layerX!==e.offsetX?(r.zrX=e.layerX,r.zrY=e.layerY):null!=e.offsetX?(r.zrX=e.offsetX,r.zrY=e.offsetY):Kt(t,e,r),r}function Kt(t,e,r){if(c.domSupported&&t.getBoundingClientRect){var i=e.clientX,n=e.clientY;if(qt(t)){var o=t.getBoundingClientRect();return r.zrX=i-o.left,void(r.zrY=n-o.top)}if(Xt(Ut,t,i,n))return r.zrX=Ut[0],void(r.zrY=Ut[1])}r.zrX=r.zrY=0}function Qt(t){return t||window.event}function $t(t,e,r){if(null!=(e=Qt(e)).zrX)return e;var i,n,o=e.type;o&&0<=o.indexOf("touch")?(i="touchend"!==o?e.targetTouches[0]:e.changedTouches[0])&&Zt(t,i,e,r):(Zt(t,e,e,r),n=function(t){var e=t.wheelDelta;if(e)return e;var r=t.deltaX,i=t.deltaY;return null!=r&&null!=i?3*(0!==i?Math.abs(i):Math.abs(r))*(0=r.x&&t<=r.x+r.width&&e>=r.y&&e<=r.y+r.height},ke.prototype.clone=function(){return new ke(this.x,this.y,this.width,this.height)},ke.prototype.copy=function(t){ke.copy(this,t)},ke.prototype.plain=function(){return{x:this.x,y:this.y,width:this.width,height:this.height}},ke.prototype.isFinite=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)},ke.prototype.isZero=function(){return 0===this.width||0===this.height},ke.create=function(t){return new ke(t.x,t.y,t.width,t.height)},ke.copy=function(t,e){t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height},ke.applyTransform=function(t,e,r){if(r){if(r[1]<1e-5&&-1e-5i.getWidth()||r<0||r>i.getHeight()}O(["click","mousedown","mouseup","mousewheel","dblclick","contextmenu"],function(a){Oe.prototype[a]=function(t){var e,r,i=t.zrX,n=t.zrY,o=Be(this,i,n);if("mouseup"===a&&o||(r=(e=this.findHover(i,n)).target),"mousedown"===a)this._downEl=r,this._downPoint=[t.zrX,t.zrY],this._upEl=r;else if("mouseup"===a)this._upEl=r;else if("click"===a){if(this._downEl!==this._upEl||!this._downPoint||4>>1])<0?h=o:s=1+o;var l=i-s;switch(l){case 3:t[s+3]=t[s+2];case 2:t[s+2]=t[s+1];case 1:t[s+1]=t[s];break;default:for(;0>>1);0>>1);o(t,e[r+u])<0?h=u:a=u+1}return h}function Ye(d,y){var a,s,v=He,h=0,g=[];function e(t){var e=a[t],r=s[t],i=a[t+1],n=s[t+1];s[t]=r+n,t===h-3&&(a[t+1]=a[t+2],s[t+1]=s[t+2]),h--;var o=qe(d[i],d,e,r,0,y);e+=o,0!=(r-=o)&&0!==(n=Xe(d[e+r-1],d,i,n,n-1,y))&&(r<=n?function(t,e,r,i){var n=0;for(n=0;ns[t+1])break;e(t)}},forceMergeRuns:function(){for(;1>=1;return t+e}(n);do{(o=Ee(t,r,i,e))=this._maxSize&&0>4|(3840&n)>>8,240&n|(240&n)>>4,15&n|(15&n)<<4,5===o?parseInt(i.slice(4),16)/15:1),Wr(t,e),e):void Br(e,0,0,0,1):7===o||9===o?0<=(n=parseInt(i.slice(1,7),16))&&n<=16777215?(Br(e,(16711680&n)>>16,(65280&n)>>8,255&n,9===o?parseInt(i.slice(7),16)/255:1),Wr(t,e),e):void Br(e,0,0,0,1):void 0;var a=i.indexOf("("),s=i.indexOf(")");if(-1!==a&&s+1===o){var h=i.substr(0,a),l=i.substr(a+1,s-(a+1)).split(","),u=1;switch(h){case"rgba":if(4!==l.length)return 3===l.length?Br(e,+l[0],+l[1],+l[2],1):Br(e,0,0,0,1);u=Or(l.pop());case"rgb":return 3<=l.length?(Br(e,Ir(l[0]),Ir(l[1]),Ir(l[2]),3===l.length?u:Or(l[3])),Wr(t,e),e):void Br(e,0,0,0,1);case"hsla":return 4!==l.length?void Br(e,0,0,0,1):(l[3]=Or(l[3]),qr(l,e),Wr(t,e),e);case"hsl":return 3!==l.length?void Br(e,0,0,0,1):(qr(l,e),Wr(t,e),e);default:return}}Br(e,0,0,0,1)}}function qr(t,e){var r=(parseFloat(t[0])%360+360)%360/360,i=Or(t[1]),n=Or(t[2]),o=n<=.5?n*(i+1):n+i-n*i,a=2*n-o;return Br(e=e||[],Dr(255*Rr(a,o,r+1/3)),Dr(255*Rr(a,o,r)),Dr(255*Rr(a,o,r-1/3)),1),4===t.length&&(e[3]=t[3]),e}function Yr(t,e){var r=Xr(t);if(r){for(var i=0;i<3;i++)r[i]=e<0?r[i]*(1-e)|0:(255-r[i])*e+r[i]|0,255e);x++);x=m(x-1,y-2)}i=d[x+1],r=d[x]}r&&i&&(this._lastFr=x,this._lastFrP=e,n=i.percent-r.percent,o=0==n?1:m((e-r.percent)/n,1),i.easingFunc&&(o=i.easingFunc(o)),a=c?this._additiveValue:g?Ti:t[v],!ki(f)&&!g||a||(a=this._additiveValue=[]),this.discrete?t[v]=o<1?r.rawValue:i.rawValue:ki(f)?(1===f?_i:function(t,e,r,i){for(var n=e.length,o=n&&e[0].length,a=0;athis._sleepAfterStill&&this.animation.stop())},qn.prototype.setSleepAfterStill=function(t){this._sleepAfterStill=t},qn.prototype.wakeUp=function(){this._disposed||(this.animation.start(),this._stillFrameAccum=0)},qn.prototype.refreshHover=function(){this._needsRefreshHover=!0},qn.prototype.refreshHoverImmediately=function(){this._disposed||(this._needsRefreshHover=!1,this.painter.refreshHover&&"canvas"===this.painter.getType()&&this.painter.refreshHover())},qn.prototype.resize=function(t){this._disposed||(t=t||{},this.painter.resize(t.width,t.height),this.handler.resize())},qn.prototype.clearAnimation=function(){this._disposed||this.animation.clear()},qn.prototype.getWidth=function(){if(!this._disposed)return this.painter.getWidth()},qn.prototype.getHeight=function(){if(!this._disposed)return this.painter.getHeight()},qn.prototype.setCursorStyle=function(t){this._disposed||this.handler.setCursorStyle(t)},qn.prototype.findHover=function(t,e){if(!this._disposed)return this.handler.findHover(t,e)},qn.prototype.on=function(t,e,r){return this._disposed||this.handler.on(t,e,r),this},qn.prototype.off=function(t,e){this._disposed||this.handler.off(t,e)},qn.prototype.trigger=function(t,e){this._disposed||this.handler.trigger(t,e)},qn.prototype.clear=function(){if(!this._disposed){for(var t=this.storage.getRoots(),e=0;ethis._ux||n>this._uy;return this.addData(vo.L,t,e),this._ctx&&o&&this._ctx.lineTo(t,e),o?(this._xi=t,this._yi=e,this._pendingPtDist=0):(r=i*i+n*n)>this._pendingPtDist&&(this._pendingPtX=t,this._pendingPtY=e,this._pendingPtDist=r),this},Ro.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._drawPendingPt(),this.addData(vo.C,t,e,r,i,n,o),this._ctx&&this._ctx.bezierCurveTo(t,e,r,i,n,o),this._xi=n,this._yi=o,this},Ro.prototype.quadraticCurveTo=function(t,e,r,i){return this._drawPendingPt(),this.addData(vo.Q,t,e,r,i),this._ctx&&this._ctx.quadraticCurveTo(t,e,r,i),this._xi=r,this._yi=i,this},Ro.prototype.arc=function(t,e,r,i,n,o){this._drawPendingPt(),Do[0]=i,Do[1]=n,function(t,e){var r=zo(t[0]);r<0&&(r+=Ao);var i=r-t[0],n=t[1];n+=i,!e&&Ao<=n-r?n=r+Ao:e&&Ao<=r-n?n=r-Ao:!e&&nl.length&&(this._expandData(),l=this.data);for(var u=0;ur||Po(v)>i||c===e-1)&&(d=Math.sqrt(A*A+v*v),n=y,o=m);break;case vo.C:var g=t[c++],_=t[c++],y=t[c++],m=t[c++],x=t[c++],w=t[c++],d=function(t,e,r,i,n,o,a,s,h){for(var l=t,u=e,c=0,p=1/h,f=1;f<=h;f++){var d=f*p,y=pr(t,r,n,a,d),v=pr(e,i,o,s,d),g=y-l,_=v-u;c+=Math.sqrt(g*g+_*_),l=y,u=v}return c}(n,o,g,_,y,m,x,w,10),n=x,o=w;break;case vo.Q:d=function(t,e,r,i,n,o,a){for(var s=t,h=e,l=0,u=1/a,c=1;c<=a;c++){var p=c*u,f=gr(t,r,n,p),d=gr(e,i,o,p),y=f-s,v=d-h;l+=Math.sqrt(y*y+v*v),s=f,h=d}return l}(n,o,g=t[c++],_=t[c++],y=t[c++],m=t[c++],10),n=y,o=m;break;case vo.A:var b=t[c++],S=t[c++],k=t[c++],T=t[c++],C=t[c++],P=t[c++],M=P+C;c+=1,f&&(a=To(C)*k+b,s=Co(C)*T+S),d=ko(k,T)*So(Ao,Math.abs(P)),n=To(M)*k+b,o=Co(M)*T+S;break;case vo.R:a=n=t[c++],s=o=t[c++],d=2*t[c++]+2*t[c++];break;case vo.Z:var A=a-n,v=s-o;d=Math.sqrt(A*A+v*v),n=a,o=s}0<=d&&(l+=h[u++]=d)}return this._pathLen=l},Ro.prototype.rebuildPath=function(t,e){var r,i,n,o,a,s,h,l,u,c,p=this.data,f=this._ux,d=this._uy,y=this._len,v=e<1,g=0,_=0,m=0;if(!v||(this._pathSegLen||this._calculateLength(),h=this._pathSegLen,l=e*this._pathLen))t:for(var x=0;x=Vo[i=0]+t&&a<=Vo[1]+t?c:0}nMath.PI/2&&d<1.5*Math.PI&&(c=-c),p+=c))}return p}(g,_,x,w,w+b,S,C,n);u=Math.cos(w+b)*m+g,c=Math.sin(w+b)*x+_;break;case qo.R:p=u=s[d++],f=c=s[d++];if(k=p+s[d++],T=f+s[d++],r){if(Fo(p,f,k,f,e,i,n)||Fo(k,f,k,T,e,i,n)||Fo(k,T,p,T,e,i,n)||Fo(p,T,p,f,e,i,n))return!0}else l+=Xo(k,f,k,T,i,n),l+=Xo(p,T,p,f,i,n);break;case qo.Z:if(r){if(Fo(u,c,p,f,e,i,n))return!0}else l+=Xo(u,c,p,f,i,n);u=p,c=f}}return r||(o=c,a=f,Math.abs(o-a)Math.abs(l),c=sh([h,l],u?0:1,e),p=(u?s:l)/c.length,f=0;f=r.maxIterations){e+=r.ellipsis;break}var s=0===a?function(t,e,r,i){for(var n=0,o=0,a=t.length;oo){var M=r.lines.length;0i.width&&(o=e.split("\n"),y=!0),i.accumWidth=l):(u=Zh(e,d,i.width,i.breakAll,i.accumWidth),i.accumWidth=u.accumWidth+h,a=u.linesWidths,o=u.lines)):o=e.split("\n");for(var v=0;vr,i=i.slice(0,r)),t&&s&&null!=f)for(var v=Wh(f,a,e.ellipsis,{minChar:e.truncateMinChar,placeholder:e.placeholder}),g={},_=0;_i.len()&&(l=p}}for(var o,a=this.__startIndex;an[0]){for(h=0;ht);h++);s=i[n[h]]}n.splice(h+1,0,t),(i[t]=e).virtual||(s?(r=s.dom).nextSibling?a.insertBefore(e.dom,r.nextSibling):a.appendChild(e.dom):a.firstChild?a.insertBefore(e.dom,a.firstChild):a.appendChild(e.dom)),e.painter||(e.painter=this)}},Uu.prototype.eachLayer=function(t,e){for(var r=this._zlevelList,i=0;i"}(n,o)+("style"!==n?null==(r=a)?"":(r+"").replace(Yt,function(t,e){return jt[e]}):a||"")+(i?""+s+L(i,t).join(s)+s:"")+""}(t)}function dc(t){return{zrId:t,shadowCache:{},patternCache:{},gradientCache:{},clipPathCache:{},defs:{},cssNodes:{},cssAnims:{},cssStyleCache:{},cssAnimIdx:0,shadowIdx:0,gradientIdx:0,patternIdx:0,clipPathIdx:0}}function yc(t,e,r,i){return pc("svg","root",{width:t,height:e,xmlns:ac,"xmlns:xlink":sc,version:"1.1",baseProfile:"full",viewBox:!!i&&"0 0 "+t+" "+e},r)}var vc=0;function gc(){return vc++}var _c={cubicIn:"0.32,0,0.67,0",cubicOut:"0.33,1,0.68,1",cubicInOut:"0.65,0,0.35,1",quadraticIn:"0.11,0,0.5,0",quadraticOut:"0.5,1,0.89,1",quadraticInOut:"0.45,0,0.55,1",quarticIn:"0.5,0,0.75,0",quarticOut:"0.25,1,0.5,1",quarticInOut:"0.76,0,0.24,1",quinticIn:"0.64,0,0.78,0",quinticOut:"0.22,1,0.36,1",quinticInOut:"0.83,0,0.17,1",sinusoidalIn:"0.12,0,0.39,0",sinusoidalOut:"0.61,1,0.88,1",sinusoidalInOut:"0.37,0,0.63,1",exponentialIn:"0.7,0,0.84,0",exponentialOut:"0.16,1,0.3,1",exponentialInOut:"0.87,0,0.13,1",circularIn:"0.55,0,1,0.45",circularOut:"0,0.55,0.45,1",circularInOut:"0.85,0,0.15,1"},mc="transform-origin";var xc={fill:"fill",opacity:"opacity",lineWidth:"stroke-width",lineDashOffset:"stroke-dashoffset"};function wc(t,e){var r=e.zrId+"-ani-"+e.cssAnimIdx++;return e.cssAnims[r]=t,r}function bc(t){return N(t)?_c[t]?"cubic-bezier("+_c[t]+")":br(t)?t:"":""}function Sc(A,L,D,z){var t=A.animators,e=t.length,r=[];if(A instanceof Lh){if(i=function(t,e,c){var p,f,r=t.shape.paths,d={};if(O(r,function(t){var e=dc(c.zrId);e.animation=!0,Sc(t,{},e,!0);var r=e.cssAnims,i=e.cssNodes,n=F(r),o=n.length;if(o){var a=r[f=n[o-1]];for(var s in a){var h=a[s];d[s]=d[s]||{d:""},d[s].d+=h.d||""}for(var l in i){var u=i[l].animation;0<=u.indexOf(f)&&(p=u)}}}),p){e.d=!1;var i=wc(d,c);return p.replace(f,i)}}(A,L,D))r.push(i);else if(!e)return}else if(!e)return;for(var i,n,o={},a=0;a"].join(p):"")&&(l=pc("style","stl",{},[],h),o.push(l))),yc(r,i,o,t.useViewBox)},sp.prototype.renderToString=function(t){return t=t||{},fc(this.renderToVNode({animation:Z(t.cssAnimation,!0),emphasis:Z(t.cssEmphasis,!0),willUpdate:!1,compress:!0,useViewBox:Z(t.useViewBox,!0)}),{newline:!0})},sp.prototype.setBackgroundColor=function(t){this._backgroundColor=t},sp.prototype.getSvgRoot=function(){return this._mainVNode&&this._mainVNode.elm},sp.prototype._paintList=function(t,e,r){for(var i,n,o,a,s,h,l,u,c,p=t.length,f=[],d=0,y=0,v=0;v