@pyreon/charts 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/analysis/index.js.html +1 -1
- package/lib/analysis/manual.js.html +1 -1
- package/lib/index.js +7 -7
- package/lib/index.js.map +1 -1
- package/lib/manual.js +7 -7
- package/lib/manual.js.map +1 -1
- package/lib/types/index.d.ts +2204 -238
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/manual.d.ts +2217 -258
- package/lib/types/manual.d.ts.map +1 -1
- package/package.json +3 -9
- package/src/chart-component.tsx +2 -2
- package/src/use-chart.ts +6 -4
- package/lib/types/charts.d.ts +0 -7968
- package/lib/types/charts.d.ts.map +0 -1
- package/lib/types/components.d.ts +0 -4074
- package/lib/types/components.d.ts.map +0 -1
- package/lib/types/core.d.ts +0 -98
- package/lib/types/core.d.ts.map +0 -1
- package/lib/types/createSeriesData.d.ts +0 -325
- package/lib/types/createSeriesData.d.ts.map +0 -1
- package/lib/types/customGraphicKeyframeAnimation.d.ts +0 -3531
- package/lib/types/customGraphicKeyframeAnimation.d.ts.map +0 -1
- package/lib/types/graphic.d.ts +0 -4043
- package/lib/types/graphic.d.ts.map +0 -1
- package/lib/types/index2.d.ts +0 -2221
- package/lib/types/index2.d.ts.map +0 -1
- package/lib/types/manual2.d.ts +0 -2238
- package/lib/types/manual2.d.ts.map +0 -1
- package/lib/types/parseGeoJson.d.ts +0 -8695
- package/lib/types/parseGeoJson.d.ts.map +0 -1
- package/lib/types/renderers.d.ts +0 -995
- package/lib/types/renderers.d.ts.map +0 -1
package/lib/types/graphic.d.ts
DELETED
|
@@ -1,4043 +0,0 @@
|
|
|
1
|
-
function __extends(d, b) {
|
|
2
|
-
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
3
|
-
extendStatics(d, b);
|
|
4
|
-
function __() {
|
|
5
|
-
this.constructor = d;
|
|
6
|
-
}
|
|
7
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/platform.js
|
|
12
|
-
|
|
13
|
-
function getTextWidthMap(mapStr) {
|
|
14
|
-
var map = {};
|
|
15
|
-
if (typeof JSON === "undefined") return map;
|
|
16
|
-
for (var i = 0; i < mapStr.length; i++) {
|
|
17
|
-
var char = String.fromCharCode(i + 32);
|
|
18
|
-
map[char] = (mapStr.charCodeAt(i) - OFFSET) / SCALE;
|
|
19
|
-
}
|
|
20
|
-
return map;
|
|
21
|
-
}
|
|
22
|
-
function setPlatformAPI(newPlatformApis) {
|
|
23
|
-
for (var key in platformApi) if (newPlatformApis[key]) platformApi[key] = newPlatformApis[key];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/util.js
|
|
28
|
-
declare namespace util_exports {
|
|
29
|
-
export { EPSILON$4 as EPSILON, HashMap, RADIAN_TO_DEGREE, assert, bind, clone$2 as clone, concatArray, createCanvas, createHashMap, createObject, curry, defaults, disableUserSelect, each, eqNaN, extend, filter, find, guid, hasOwn, indexOf, inherits, isArray, isArrayLike, isBuiltInObject, isDom, isFunction, isGradientObject, isImagePatternObject, isNumber, isObject, isPrimitive, isRegExp, isString, isStringSafe, isTypedArray, keys, logError, map, merge, mergeAll, mixin, noop, normalizeCssArray, reduce, retrieve, retrieve2, retrieve3, setAsPrimitive, slice, trim };
|
|
30
|
-
}
|
|
31
|
-
function guid() {
|
|
32
|
-
return idStart++;
|
|
33
|
-
}
|
|
34
|
-
function logError() {
|
|
35
|
-
var args = [];
|
|
36
|
-
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
37
|
-
if (typeof console !== "undefined") console.error.apply(console, args);
|
|
38
|
-
}
|
|
39
|
-
function clone$2(source) {
|
|
40
|
-
if (source == null || typeof source !== "object") return source;
|
|
41
|
-
var result = source;
|
|
42
|
-
var typeStr = objToString.call(source);
|
|
43
|
-
if (typeStr === "[object Array]") {
|
|
44
|
-
if (!isPrimitive(source)) {
|
|
45
|
-
result = [];
|
|
46
|
-
for (var i = 0, len = source.length; i < len; i++) result[i] = clone$2(source[i]);
|
|
47
|
-
}
|
|
48
|
-
} else if (TYPED_ARRAY[typeStr]) {
|
|
49
|
-
if (!isPrimitive(source)) {
|
|
50
|
-
var Ctor = source.constructor;
|
|
51
|
-
if (Ctor.from) result = Ctor.from(source);else {
|
|
52
|
-
result = new Ctor(source.length);
|
|
53
|
-
for (var i = 0, len = source.length; i < len; i++) result[i] = source[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
} else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
|
|
57
|
-
result = {};
|
|
58
|
-
for (var key in source) if (source.hasOwnProperty(key) && key !== protoKey) result[key] = clone$2(source[key]);
|
|
59
|
-
}
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
function merge(target, source, overwrite) {
|
|
63
|
-
if (!isObject(source) || !isObject(target)) return overwrite ? clone$2(source) : target;
|
|
64
|
-
for (var key in source) if (source.hasOwnProperty(key) && key !== protoKey) {
|
|
65
|
-
var targetProp = target[key];
|
|
66
|
-
var sourceProp = source[key];
|
|
67
|
-
if (isObject(sourceProp) && isObject(targetProp) && !isArray(sourceProp) && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) && !isBuiltInObject(sourceProp) && !isBuiltInObject(targetProp) && !isPrimitive(sourceProp) && !isPrimitive(targetProp)) merge(targetProp, sourceProp, overwrite);else if (overwrite || !(key in target)) target[key] = clone$2(source[key]);
|
|
68
|
-
}
|
|
69
|
-
return target;
|
|
70
|
-
}
|
|
71
|
-
function mergeAll(targetAndSources, overwrite) {
|
|
72
|
-
var result = targetAndSources[0];
|
|
73
|
-
for (var i = 1, len = targetAndSources.length; i < len; i++) result = merge(result, targetAndSources[i], overwrite);
|
|
74
|
-
return result;
|
|
75
|
-
}
|
|
76
|
-
function extend(target, source) {
|
|
77
|
-
if (Object.assign) Object.assign(target, source);else for (var key in source) if (source.hasOwnProperty(key) && key !== protoKey) target[key] = source[key];
|
|
78
|
-
return target;
|
|
79
|
-
}
|
|
80
|
-
function defaults(target, source, overlay) {
|
|
81
|
-
var keysArr = keys(source);
|
|
82
|
-
for (var i = 0, len = keysArr.length; i < len; i++) {
|
|
83
|
-
var key = keysArr[i];
|
|
84
|
-
if (overlay ? source[key] != null : target[key] == null) target[key] = source[key];
|
|
85
|
-
}
|
|
86
|
-
return target;
|
|
87
|
-
}
|
|
88
|
-
function indexOf(array, value) {
|
|
89
|
-
if (array) {
|
|
90
|
-
if (array.indexOf) return array.indexOf(value);
|
|
91
|
-
for (var i = 0, len = array.length; i < len; i++) if (array[i] === value) return i;
|
|
92
|
-
}
|
|
93
|
-
return -1;
|
|
94
|
-
}
|
|
95
|
-
function inherits(clazz, baseClazz) {
|
|
96
|
-
var clazzPrototype = clazz.prototype;
|
|
97
|
-
function F() {}
|
|
98
|
-
F.prototype = baseClazz.prototype;
|
|
99
|
-
clazz.prototype = new F();
|
|
100
|
-
for (var prop in clazzPrototype) if (clazzPrototype.hasOwnProperty(prop)) clazz.prototype[prop] = clazzPrototype[prop];
|
|
101
|
-
clazz.prototype.constructor = clazz;
|
|
102
|
-
clazz.superClass = baseClazz;
|
|
103
|
-
}
|
|
104
|
-
function mixin(target, source, override) {
|
|
105
|
-
target = "prototype" in target ? target.prototype : target;
|
|
106
|
-
source = "prototype" in source ? source.prototype : source;
|
|
107
|
-
if (Object.getOwnPropertyNames) {
|
|
108
|
-
var keyList = Object.getOwnPropertyNames(source);
|
|
109
|
-
for (var i = 0; i < keyList.length; i++) {
|
|
110
|
-
var key = keyList[i];
|
|
111
|
-
if (key !== "constructor") {
|
|
112
|
-
if (override ? source[key] != null : target[key] == null) target[key] = source[key];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
} else defaults(target, source, override);
|
|
116
|
-
}
|
|
117
|
-
function isArrayLike(data) {
|
|
118
|
-
if (!data) return false;
|
|
119
|
-
if (typeof data === "string") return false;
|
|
120
|
-
return typeof data.length === "number";
|
|
121
|
-
}
|
|
122
|
-
function each(arr, cb, context) {
|
|
123
|
-
if (!(arr && cb)) return;
|
|
124
|
-
if (arr.forEach && arr.forEach === nativeForEach) arr.forEach(cb, context);else if (arr.length === +arr.length) for (var i = 0, len = arr.length; i < len; i++) cb.call(context, arr[i], i, arr);else for (var key in arr) if (arr.hasOwnProperty(key)) cb.call(context, arr[key], key, arr);
|
|
125
|
-
}
|
|
126
|
-
function map(arr, cb, context) {
|
|
127
|
-
if (!arr) return [];
|
|
128
|
-
if (!cb) return slice(arr);
|
|
129
|
-
if (arr.map && arr.map === nativeMap) return arr.map(cb, context);else {
|
|
130
|
-
var result = [];
|
|
131
|
-
for (var i = 0, len = arr.length; i < len; i++) result.push(cb.call(context, arr[i], i, arr));
|
|
132
|
-
return result;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
function reduce(arr, cb, memo, context) {
|
|
136
|
-
if (!(arr && cb)) return;
|
|
137
|
-
for (var i = 0, len = arr.length; i < len; i++) memo = cb.call(context, memo, arr[i], i, arr);
|
|
138
|
-
return memo;
|
|
139
|
-
}
|
|
140
|
-
function filter(arr, cb, context) {
|
|
141
|
-
if (!arr) return [];
|
|
142
|
-
if (!cb) return slice(arr);
|
|
143
|
-
if (arr.filter && arr.filter === nativeFilter) return arr.filter(cb, context);else {
|
|
144
|
-
var result = [];
|
|
145
|
-
for (var i = 0, len = arr.length; i < len; i++) if (cb.call(context, arr[i], i, arr)) result.push(arr[i]);
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function find(arr, cb, context) {
|
|
150
|
-
if (!(arr && cb)) return;
|
|
151
|
-
for (var i = 0, len = arr.length; i < len; i++) if (cb.call(context, arr[i], i, arr)) return arr[i];
|
|
152
|
-
}
|
|
153
|
-
function keys(obj) {
|
|
154
|
-
if (!obj) return [];
|
|
155
|
-
if (Object.keys) return Object.keys(obj);
|
|
156
|
-
var keyList = [];
|
|
157
|
-
for (var key in obj) if (obj.hasOwnProperty(key)) keyList.push(key);
|
|
158
|
-
return keyList;
|
|
159
|
-
}
|
|
160
|
-
function bindPolyfill(func, context) {
|
|
161
|
-
var args = [];
|
|
162
|
-
for (var _i = 2; _i < arguments.length; _i++) args[_i - 2] = arguments[_i];
|
|
163
|
-
return function () {
|
|
164
|
-
return func.apply(context, args.concat(nativeSlice.call(arguments)));
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function curry(func) {
|
|
168
|
-
var args = [];
|
|
169
|
-
for (var _i = 1; _i < arguments.length; _i++) args[_i - 1] = arguments[_i];
|
|
170
|
-
return function () {
|
|
171
|
-
return func.apply(this, args.concat(nativeSlice.call(arguments)));
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
function isArray(value) {
|
|
175
|
-
if (Array.isArray) return Array.isArray(value);
|
|
176
|
-
return objToString.call(value) === "[object Array]";
|
|
177
|
-
}
|
|
178
|
-
function isFunction(value) {
|
|
179
|
-
return typeof value === "function";
|
|
180
|
-
}
|
|
181
|
-
function isString(value) {
|
|
182
|
-
return typeof value === "string";
|
|
183
|
-
}
|
|
184
|
-
function isStringSafe(value) {
|
|
185
|
-
return objToString.call(value) === "[object String]";
|
|
186
|
-
}
|
|
187
|
-
function isNumber(value) {
|
|
188
|
-
return typeof value === "number";
|
|
189
|
-
}
|
|
190
|
-
function isObject(value) {
|
|
191
|
-
var type = typeof value;
|
|
192
|
-
return type === "function" || !!value && type === "object";
|
|
193
|
-
}
|
|
194
|
-
function isBuiltInObject(value) {
|
|
195
|
-
return !!BUILTIN_OBJECT[objToString.call(value)];
|
|
196
|
-
}
|
|
197
|
-
function isTypedArray(value) {
|
|
198
|
-
return !!TYPED_ARRAY[objToString.call(value)];
|
|
199
|
-
}
|
|
200
|
-
function isDom(value) {
|
|
201
|
-
return typeof value === "object" && typeof value.nodeType === "number" && typeof value.ownerDocument === "object";
|
|
202
|
-
}
|
|
203
|
-
function isGradientObject(value) {
|
|
204
|
-
return value.colorStops != null;
|
|
205
|
-
}
|
|
206
|
-
function isImagePatternObject(value) {
|
|
207
|
-
return value.image != null;
|
|
208
|
-
}
|
|
209
|
-
function isRegExp(value) {
|
|
210
|
-
return objToString.call(value) === "[object RegExp]";
|
|
211
|
-
}
|
|
212
|
-
function eqNaN(value) {
|
|
213
|
-
return value !== value;
|
|
214
|
-
}
|
|
215
|
-
function retrieve() {
|
|
216
|
-
var args = [];
|
|
217
|
-
for (var _i = 0; _i < arguments.length; _i++) args[_i] = arguments[_i];
|
|
218
|
-
for (var i = 0, len = args.length; i < len; i++) if (args[i] != null) return args[i];
|
|
219
|
-
}
|
|
220
|
-
function retrieve2(value0, value1) {
|
|
221
|
-
return value0 != null ? value0 : value1;
|
|
222
|
-
}
|
|
223
|
-
function retrieve3(value0, value1, value2) {
|
|
224
|
-
return value0 != null ? value0 : value1 != null ? value1 : value2;
|
|
225
|
-
}
|
|
226
|
-
function slice(arr) {
|
|
227
|
-
var args = [];
|
|
228
|
-
for (var _i = 1; _i < arguments.length; _i++) args[_i - 1] = arguments[_i];
|
|
229
|
-
return nativeSlice.apply(arr, args);
|
|
230
|
-
}
|
|
231
|
-
function normalizeCssArray(val) {
|
|
232
|
-
if (typeof val === "number") return [val, val, val, val];
|
|
233
|
-
var len = val.length;
|
|
234
|
-
if (len === 2) return [val[0], val[1], val[0], val[1]];else if (len === 3) return [val[0], val[1], val[2], val[1]];
|
|
235
|
-
return val;
|
|
236
|
-
}
|
|
237
|
-
function assert(condition, message) {
|
|
238
|
-
if (!condition) throw new Error(message);
|
|
239
|
-
}
|
|
240
|
-
function trim(str) {
|
|
241
|
-
if (str == null) return null;else if (typeof str.trim === "function") return str.trim();else return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
242
|
-
}
|
|
243
|
-
function setAsPrimitive(obj) {
|
|
244
|
-
obj[primitiveKey] = true;
|
|
245
|
-
}
|
|
246
|
-
function isPrimitive(obj) {
|
|
247
|
-
return obj[primitiveKey];
|
|
248
|
-
}
|
|
249
|
-
function maybeNativeMap() {
|
|
250
|
-
return isNativeMapSupported ? /* @__PURE__ */new Map() : new MapPolyfill();
|
|
251
|
-
}
|
|
252
|
-
function createHashMap(obj) {
|
|
253
|
-
return new HashMap(obj);
|
|
254
|
-
}
|
|
255
|
-
function concatArray(a, b) {
|
|
256
|
-
var newArray = new a.constructor(a.length + b.length);
|
|
257
|
-
for (var i = 0; i < a.length; i++) newArray[i] = a[i];
|
|
258
|
-
var offset = a.length;
|
|
259
|
-
for (var i = 0; i < b.length; i++) newArray[i + offset] = b[i];
|
|
260
|
-
return newArray;
|
|
261
|
-
}
|
|
262
|
-
function createObject(proto, properties) {
|
|
263
|
-
var obj;
|
|
264
|
-
if (Object.create) obj = Object.create(proto);else {
|
|
265
|
-
var StyleCtor = function () {};
|
|
266
|
-
StyleCtor.prototype = proto;
|
|
267
|
-
obj = new StyleCtor();
|
|
268
|
-
}
|
|
269
|
-
if (properties) extend(obj, properties);
|
|
270
|
-
return obj;
|
|
271
|
-
}
|
|
272
|
-
function disableUserSelect(dom) {
|
|
273
|
-
var domStyle = dom.style;
|
|
274
|
-
domStyle.webkitUserSelect = "none";
|
|
275
|
-
domStyle.userSelect = "none";
|
|
276
|
-
domStyle.webkitTapHighlightColor = "rgba(0,0,0,0)";
|
|
277
|
-
domStyle["-webkit-touch-callout"] = "none";
|
|
278
|
-
}
|
|
279
|
-
function hasOwn(own, prop) {
|
|
280
|
-
return own.hasOwnProperty(prop);
|
|
281
|
-
}
|
|
282
|
-
function noop() {}
|
|
283
|
-
if (typeof wx === "object" && typeof wx.getSystemInfoSync === "function") {
|
|
284
|
-
env.wxa = true;
|
|
285
|
-
env.touchEventsSupported = true;
|
|
286
|
-
} else if (typeof document === "undefined" && typeof self !== "undefined") env.worker = true;else if (!env.hasGlobalWindow || "Deno" in window || typeof navigator !== "undefined" && typeof navigator.userAgent === "string" && navigator.userAgent.indexOf("Node.js") > -1) {
|
|
287
|
-
env.node = true;
|
|
288
|
-
env.svgSupported = true;
|
|
289
|
-
} else detect(navigator.userAgent, env);
|
|
290
|
-
function detect(ua, env) {
|
|
291
|
-
var browser = env.browser;
|
|
292
|
-
var firefox = ua.match(/Firefox\/([\d.]+)/);
|
|
293
|
-
var ie = ua.match(/MSIE\s([\d.]+)/) || ua.match(/Trident\/.+?rv:(([\d.]+))/);
|
|
294
|
-
var edge = ua.match(/Edge?\/([\d.]+)/);
|
|
295
|
-
var weChat = /micromessenger/i.test(ua);
|
|
296
|
-
if (firefox) {
|
|
297
|
-
browser.firefox = true;
|
|
298
|
-
browser.version = firefox[1];
|
|
299
|
-
}
|
|
300
|
-
if (ie) {
|
|
301
|
-
browser.ie = true;
|
|
302
|
-
browser.version = ie[1];
|
|
303
|
-
}
|
|
304
|
-
if (edge) {
|
|
305
|
-
browser.edge = true;
|
|
306
|
-
browser.version = edge[1];
|
|
307
|
-
browser.newEdge = +edge[1].split(".")[0] > 18;
|
|
308
|
-
}
|
|
309
|
-
if (weChat) browser.weChat = true;
|
|
310
|
-
env.svgSupported = typeof SVGRect !== "undefined";
|
|
311
|
-
env.touchEventsSupported = "ontouchstart" in window && !browser.ie && !browser.edge;
|
|
312
|
-
env.pointerEventsSupported = "onpointerdown" in window && (browser.edge || browser.ie && +browser.version >= 11);
|
|
313
|
-
if (env.domSupported = typeof document !== "undefined") {
|
|
314
|
-
var style = document.documentElement.style;
|
|
315
|
-
env.transform3dSupported = (browser.ie && "transition" in style || browser.edge || "WebKitCSSMatrix" in window && "m11" in new WebKitCSSMatrix() || "MozPerspective" in style) && !("OTransition" in style);
|
|
316
|
-
env.transformSupported = env.transform3dSupported || browser.ie && +browser.version >= 9;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
//#endregion
|
|
321
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/LRU.js
|
|
322
|
-
|
|
323
|
-
function findExistImage(newImageOrSrc) {
|
|
324
|
-
if (typeof newImageOrSrc === "string") {
|
|
325
|
-
var cachedImgObj = globalImageCache.get(newImageOrSrc);
|
|
326
|
-
return cachedImgObj && cachedImgObj.image;
|
|
327
|
-
} else return newImageOrSrc;
|
|
328
|
-
}
|
|
329
|
-
function createOrUpdateImage(newImageOrSrc, image, hostEl, onload, cbPayload) {
|
|
330
|
-
if (!newImageOrSrc) return image;else if (typeof newImageOrSrc === "string") {
|
|
331
|
-
if (image && image.__zrImageSrc === newImageOrSrc || !hostEl) return image;
|
|
332
|
-
var cachedImgObj = globalImageCache.get(newImageOrSrc);
|
|
333
|
-
var pendingWrap = {
|
|
334
|
-
hostEl,
|
|
335
|
-
cb: onload,
|
|
336
|
-
cbPayload
|
|
337
|
-
};
|
|
338
|
-
if (cachedImgObj) {
|
|
339
|
-
image = cachedImgObj.image;
|
|
340
|
-
!isImageReady(image) && cachedImgObj.pending.push(pendingWrap);
|
|
341
|
-
} else {
|
|
342
|
-
image = platformApi.loadImage(newImageOrSrc, imageOnLoad, imageOnLoad);
|
|
343
|
-
image.__zrImageSrc = newImageOrSrc;
|
|
344
|
-
globalImageCache.put(newImageOrSrc, image.__cachedImgObj = {
|
|
345
|
-
image,
|
|
346
|
-
pending: [pendingWrap]
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
return image;
|
|
350
|
-
} else return newImageOrSrc;
|
|
351
|
-
}
|
|
352
|
-
function imageOnLoad() {
|
|
353
|
-
var cachedImgObj = this.__cachedImgObj;
|
|
354
|
-
this.onload = this.onerror = this.__cachedImgObj = null;
|
|
355
|
-
for (var i = 0; i < cachedImgObj.pending.length; i++) {
|
|
356
|
-
var pendingWrap = cachedImgObj.pending[i];
|
|
357
|
-
var cb = pendingWrap.cb;
|
|
358
|
-
cb && cb(this, pendingWrap.cbPayload);
|
|
359
|
-
pendingWrap.hostEl.dirty();
|
|
360
|
-
}
|
|
361
|
-
cachedImgObj.pending.length = 0;
|
|
362
|
-
}
|
|
363
|
-
function isImageReady(image) {
|
|
364
|
-
return image && image.width && image.height;
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
//#endregion
|
|
368
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/matrix.js
|
|
369
|
-
declare namespace matrix_exports {
|
|
370
|
-
export { clone$1 as clone, copy$1 as copy, create$1 as create, identity, invert, mul$1 as mul, rotate, scale$1 as scale, translate };
|
|
371
|
-
}
|
|
372
|
-
function create$1() {
|
|
373
|
-
return [1, 0, 0, 1, 0, 0];
|
|
374
|
-
}
|
|
375
|
-
function identity(out) {
|
|
376
|
-
out[0] = 1;
|
|
377
|
-
out[1] = 0;
|
|
378
|
-
out[2] = 0;
|
|
379
|
-
out[3] = 1;
|
|
380
|
-
out[4] = 0;
|
|
381
|
-
out[5] = 0;
|
|
382
|
-
return out;
|
|
383
|
-
}
|
|
384
|
-
function copy$1(out, m) {
|
|
385
|
-
out[0] = m[0];
|
|
386
|
-
out[1] = m[1];
|
|
387
|
-
out[2] = m[2];
|
|
388
|
-
out[3] = m[3];
|
|
389
|
-
out[4] = m[4];
|
|
390
|
-
out[5] = m[5];
|
|
391
|
-
return out;
|
|
392
|
-
}
|
|
393
|
-
function mul$1(out, m1, m2) {
|
|
394
|
-
var out0 = m1[0] * m2[0] + m1[2] * m2[1];
|
|
395
|
-
var out1 = m1[1] * m2[0] + m1[3] * m2[1];
|
|
396
|
-
var out2 = m1[0] * m2[2] + m1[2] * m2[3];
|
|
397
|
-
var out3 = m1[1] * m2[2] + m1[3] * m2[3];
|
|
398
|
-
var out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
|
|
399
|
-
var out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
|
|
400
|
-
out[0] = out0;
|
|
401
|
-
out[1] = out1;
|
|
402
|
-
out[2] = out2;
|
|
403
|
-
out[3] = out3;
|
|
404
|
-
out[4] = out4;
|
|
405
|
-
out[5] = out5;
|
|
406
|
-
return out;
|
|
407
|
-
}
|
|
408
|
-
function translate(out, a, v) {
|
|
409
|
-
out[0] = a[0];
|
|
410
|
-
out[1] = a[1];
|
|
411
|
-
out[2] = a[2];
|
|
412
|
-
out[3] = a[3];
|
|
413
|
-
out[4] = a[4] + v[0];
|
|
414
|
-
out[5] = a[5] + v[1];
|
|
415
|
-
return out;
|
|
416
|
-
}
|
|
417
|
-
function rotate(out, a, rad, pivot) {
|
|
418
|
-
if (pivot === void 0) pivot = [0, 0];
|
|
419
|
-
var aa = a[0];
|
|
420
|
-
var ac = a[2];
|
|
421
|
-
var atx = a[4];
|
|
422
|
-
var ab = a[1];
|
|
423
|
-
var ad = a[3];
|
|
424
|
-
var aty = a[5];
|
|
425
|
-
var st = Math.sin(rad);
|
|
426
|
-
var ct = Math.cos(rad);
|
|
427
|
-
out[0] = aa * ct + ab * st;
|
|
428
|
-
out[1] = -aa * st + ab * ct;
|
|
429
|
-
out[2] = ac * ct + ad * st;
|
|
430
|
-
out[3] = -ac * st + ct * ad;
|
|
431
|
-
out[4] = ct * (atx - pivot[0]) + st * (aty - pivot[1]) + pivot[0];
|
|
432
|
-
out[5] = ct * (aty - pivot[1]) - st * (atx - pivot[0]) + pivot[1];
|
|
433
|
-
return out;
|
|
434
|
-
}
|
|
435
|
-
function scale$1(out, a, v) {
|
|
436
|
-
var vx = v[0];
|
|
437
|
-
var vy = v[1];
|
|
438
|
-
out[0] = a[0] * vx;
|
|
439
|
-
out[1] = a[1] * vy;
|
|
440
|
-
out[2] = a[2] * vx;
|
|
441
|
-
out[3] = a[3] * vy;
|
|
442
|
-
out[4] = a[4] * vx;
|
|
443
|
-
out[5] = a[5] * vy;
|
|
444
|
-
return out;
|
|
445
|
-
}
|
|
446
|
-
function invert(out, a) {
|
|
447
|
-
var aa = a[0];
|
|
448
|
-
var ac = a[2];
|
|
449
|
-
var atx = a[4];
|
|
450
|
-
var ab = a[1];
|
|
451
|
-
var ad = a[3];
|
|
452
|
-
var aty = a[5];
|
|
453
|
-
var det = aa * ad - ab * ac;
|
|
454
|
-
if (!det) return null;
|
|
455
|
-
det = 1 / det;
|
|
456
|
-
out[0] = ad * det;
|
|
457
|
-
out[1] = -ab * det;
|
|
458
|
-
out[2] = -ac * det;
|
|
459
|
-
out[3] = aa * det;
|
|
460
|
-
out[4] = (ac * aty - ad * atx) * det;
|
|
461
|
-
out[5] = (ab * atx - aa * aty) * det;
|
|
462
|
-
return out;
|
|
463
|
-
}
|
|
464
|
-
function clone$1(a) {
|
|
465
|
-
var b = create$1();
|
|
466
|
-
copy$1(b, a);
|
|
467
|
-
return b;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
//#endregion
|
|
471
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/Point.js
|
|
472
|
-
|
|
473
|
-
function intersectOneDim(a0, a1, b0, b1, updateDimIdx, useMTV, outIntersectRect, clamp) {
|
|
474
|
-
var d0 = mathAbs$1(a1 - b0);
|
|
475
|
-
var d1 = mathAbs$1(b1 - a0);
|
|
476
|
-
var d01min = mathMin$2(d0, d1);
|
|
477
|
-
var updateDim = XY[updateDimIdx];
|
|
478
|
-
var zeroDim = XY[1 - updateDimIdx];
|
|
479
|
-
var wh = WH[updateDimIdx];
|
|
480
|
-
if (a1 < b0 || b1 < a0) {
|
|
481
|
-
if (d0 < d1) {
|
|
482
|
-
if (useMTV) _maxTv[updateDim] = -d0;
|
|
483
|
-
if (clamp) {
|
|
484
|
-
outIntersectRect[updateDim] = a1;
|
|
485
|
-
outIntersectRect[wh] = 0;
|
|
486
|
-
}
|
|
487
|
-
} else {
|
|
488
|
-
if (useMTV) _maxTv[updateDim] = d1;
|
|
489
|
-
if (clamp) {
|
|
490
|
-
outIntersectRect[updateDim] = a0;
|
|
491
|
-
outIntersectRect[wh] = 0;
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
} else {
|
|
495
|
-
if (outIntersectRect) {
|
|
496
|
-
outIntersectRect[updateDim] = mathMax$2(a0, b0);
|
|
497
|
-
outIntersectRect[wh] = mathMin$2(a1, b1) - outIntersectRect[updateDim];
|
|
498
|
-
}
|
|
499
|
-
if (useMTV) {
|
|
500
|
-
if (d01min < _lenMinMax[0] || _intersectCtx.useDir) {
|
|
501
|
-
_lenMinMax[0] = mathMin$2(d01min, _lenMinMax[0]);
|
|
502
|
-
if (d0 < d1 || !_intersectCtx.bidirectional) {
|
|
503
|
-
_minTv[updateDim] = d0;
|
|
504
|
-
_minTv[zeroDim] = 0;
|
|
505
|
-
if (_intersectCtx.useDir) _intersectCtx.calcDirMTV();
|
|
506
|
-
}
|
|
507
|
-
if (d0 >= d1 || !_intersectCtx.bidirectional) {
|
|
508
|
-
_minTv[updateDim] = -d1;
|
|
509
|
-
_minTv[zeroDim] = 0;
|
|
510
|
-
if (_intersectCtx.useDir) _intersectCtx.calcDirMTV();
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function createIntersectContext() {
|
|
517
|
-
var _direction = 0;
|
|
518
|
-
var _dirCheckVec = new Point();
|
|
519
|
-
var _dirTmp = new Point();
|
|
520
|
-
var _ctx = {
|
|
521
|
-
minTv: new Point(),
|
|
522
|
-
maxTv: new Point(),
|
|
523
|
-
useDir: false,
|
|
524
|
-
dirMinTv: new Point(),
|
|
525
|
-
touchThreshold: 0,
|
|
526
|
-
bidirectional: true,
|
|
527
|
-
negativeSize: false,
|
|
528
|
-
reset: function (opt, useMTV) {
|
|
529
|
-
_ctx.touchThreshold = 0;
|
|
530
|
-
if (opt && opt.touchThreshold != null) _ctx.touchThreshold = mathMax$2(0, opt.touchThreshold);
|
|
531
|
-
_ctx.negativeSize = false;
|
|
532
|
-
if (!useMTV) return;
|
|
533
|
-
_ctx.minTv.set(Infinity, Infinity);
|
|
534
|
-
_ctx.maxTv.set(0, 0);
|
|
535
|
-
_ctx.useDir = false;
|
|
536
|
-
if (opt && opt.direction != null) {
|
|
537
|
-
_ctx.useDir = true;
|
|
538
|
-
_ctx.dirMinTv.copy(_ctx.minTv);
|
|
539
|
-
_dirTmp.copy(_ctx.minTv);
|
|
540
|
-
_direction = opt.direction;
|
|
541
|
-
_ctx.bidirectional = opt.bidirectional == null || !!opt.bidirectional;
|
|
542
|
-
if (!_ctx.bidirectional) _dirCheckVec.set(Math.cos(_direction), Math.sin(_direction));
|
|
543
|
-
}
|
|
544
|
-
},
|
|
545
|
-
calcDirMTV: function () {
|
|
546
|
-
var minTv = _ctx.minTv;
|
|
547
|
-
var dirMinTv = _ctx.dirMinTv;
|
|
548
|
-
var squareMag = minTv.y * minTv.y + minTv.x * minTv.x;
|
|
549
|
-
var dirSin = Math.sin(_direction);
|
|
550
|
-
var dirCos = Math.cos(_direction);
|
|
551
|
-
var dotProd = dirSin * minTv.y + dirCos * minTv.x;
|
|
552
|
-
if (nearZero(dotProd)) {
|
|
553
|
-
if (nearZero(minTv.x) && nearZero(minTv.y)) dirMinTv.set(0, 0);
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
_dirTmp.x = squareMag * dirCos / dotProd;
|
|
557
|
-
_dirTmp.y = squareMag * dirSin / dotProd;
|
|
558
|
-
if (nearZero(_dirTmp.x) && nearZero(_dirTmp.y)) {
|
|
559
|
-
dirMinTv.set(0, 0);
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
if ((_ctx.bidirectional || _dirCheckVec.dot(_dirTmp) > 0) && _dirTmp.len() < dirMinTv.len()) dirMinTv.copy(_dirTmp);
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
function nearZero(val) {
|
|
566
|
-
return mathAbs$1(val) < 1e-10;
|
|
567
|
-
}
|
|
568
|
-
return _ctx;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
//#endregion
|
|
572
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/text.js
|
|
573
|
-
function ensureFontMeasureInfo(font) {
|
|
574
|
-
if (!_fontMeasureInfoCache) _fontMeasureInfoCache = new LRU(100);
|
|
575
|
-
font = font || "12px sans-serif";
|
|
576
|
-
var measureInfo = _fontMeasureInfoCache.get(font);
|
|
577
|
-
if (!measureInfo) {
|
|
578
|
-
measureInfo = {
|
|
579
|
-
font,
|
|
580
|
-
strWidthCache: new LRU(500),
|
|
581
|
-
asciiWidthMap: null,
|
|
582
|
-
asciiWidthMapTried: false,
|
|
583
|
-
stWideCharWidth: platformApi.measureText("国", font).width,
|
|
584
|
-
asciiCharWidth: platformApi.measureText("a", font).width
|
|
585
|
-
};
|
|
586
|
-
_fontMeasureInfoCache.put(font, measureInfo);
|
|
587
|
-
}
|
|
588
|
-
return measureInfo;
|
|
589
|
-
}
|
|
590
|
-
function tryCreateASCIIWidthMap(font) {
|
|
591
|
-
if (_getASCIIWidthMapLongCount >= GET_ASCII_WIDTH_LONG_COUNT_MAX) return;
|
|
592
|
-
font = font || "12px sans-serif";
|
|
593
|
-
var asciiWidthMap = [];
|
|
594
|
-
var start = + /* @__PURE__ */new Date();
|
|
595
|
-
for (var code = 0; code <= 127; code++) asciiWidthMap[code] = platformApi.measureText(String.fromCharCode(code), font).width;
|
|
596
|
-
var cost = + /* @__PURE__ */new Date() - start;
|
|
597
|
-
if (cost > 16) _getASCIIWidthMapLongCount = GET_ASCII_WIDTH_LONG_COUNT_MAX;else if (cost > 2) _getASCIIWidthMapLongCount++;
|
|
598
|
-
return asciiWidthMap;
|
|
599
|
-
}
|
|
600
|
-
function measureCharWidth(fontMeasureInfo, charCode) {
|
|
601
|
-
if (!fontMeasureInfo.asciiWidthMapTried) {
|
|
602
|
-
fontMeasureInfo.asciiWidthMap = tryCreateASCIIWidthMap(fontMeasureInfo.font);
|
|
603
|
-
fontMeasureInfo.asciiWidthMapTried = true;
|
|
604
|
-
}
|
|
605
|
-
return 0 <= charCode && charCode <= 127 ? fontMeasureInfo.asciiWidthMap != null ? fontMeasureInfo.asciiWidthMap[charCode] : fontMeasureInfo.asciiCharWidth : fontMeasureInfo.stWideCharWidth;
|
|
606
|
-
}
|
|
607
|
-
function measureWidth(fontMeasureInfo, text) {
|
|
608
|
-
var strWidthCache = fontMeasureInfo.strWidthCache;
|
|
609
|
-
var width = strWidthCache.get(text);
|
|
610
|
-
if (width == null) {
|
|
611
|
-
width = platformApi.measureText(text, fontMeasureInfo.font).width;
|
|
612
|
-
strWidthCache.put(text, width);
|
|
613
|
-
}
|
|
614
|
-
return width;
|
|
615
|
-
}
|
|
616
|
-
function innerGetBoundingRect(text, font, textAlign, textBaseline) {
|
|
617
|
-
var width = measureWidth(ensureFontMeasureInfo(font), text);
|
|
618
|
-
var height = getLineHeight(font);
|
|
619
|
-
return new BoundingRect(adjustTextX(0, width, textAlign), adjustTextY$1(0, height, textBaseline), width, height);
|
|
620
|
-
}
|
|
621
|
-
function getBoundingRect(text, font, textAlign, textBaseline) {
|
|
622
|
-
var textLines = ((text || "") + "").split("\n");
|
|
623
|
-
if (textLines.length === 1) return innerGetBoundingRect(textLines[0], font, textAlign, textBaseline);else {
|
|
624
|
-
var uniondRect = new BoundingRect(0, 0, 0, 0);
|
|
625
|
-
for (var i = 0; i < textLines.length; i++) {
|
|
626
|
-
var rect = innerGetBoundingRect(textLines[i], font, textAlign, textBaseline);
|
|
627
|
-
i === 0 ? uniondRect.copy(rect) : uniondRect.union(rect);
|
|
628
|
-
}
|
|
629
|
-
return uniondRect;
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
function adjustTextX(x, width, textAlign, inverse) {
|
|
633
|
-
if (textAlign === "right") !inverse ? x -= width : x += width;else if (textAlign === "center") !inverse ? x -= width / 2 : x += width / 2;
|
|
634
|
-
return x;
|
|
635
|
-
}
|
|
636
|
-
function adjustTextY$1(y, height, verticalAlign, inverse) {
|
|
637
|
-
if (verticalAlign === "middle") !inverse ? y -= height / 2 : y += height / 2;else if (verticalAlign === "bottom") !inverse ? y -= height : y += height;
|
|
638
|
-
return y;
|
|
639
|
-
}
|
|
640
|
-
function getLineHeight(font) {
|
|
641
|
-
return ensureFontMeasureInfo(font).stWideCharWidth;
|
|
642
|
-
}
|
|
643
|
-
function parsePercent(value, maxValue) {
|
|
644
|
-
if (typeof value === "string") {
|
|
645
|
-
if (value.lastIndexOf("%") >= 0) return parseFloat(value) / 100 * maxValue;
|
|
646
|
-
return parseFloat(value);
|
|
647
|
-
}
|
|
648
|
-
return value;
|
|
649
|
-
}
|
|
650
|
-
function calculateTextPosition(out, opts, rect) {
|
|
651
|
-
var textPosition = opts.position || "inside";
|
|
652
|
-
var distance = opts.distance != null ? opts.distance : 5;
|
|
653
|
-
var height = rect.height;
|
|
654
|
-
var width = rect.width;
|
|
655
|
-
var halfHeight = height / 2;
|
|
656
|
-
var x = rect.x;
|
|
657
|
-
var y = rect.y;
|
|
658
|
-
var textAlign = "left";
|
|
659
|
-
var textVerticalAlign = "top";
|
|
660
|
-
if (textPosition instanceof Array) {
|
|
661
|
-
x += parsePercent(textPosition[0], rect.width);
|
|
662
|
-
y += parsePercent(textPosition[1], rect.height);
|
|
663
|
-
textAlign = null;
|
|
664
|
-
textVerticalAlign = null;
|
|
665
|
-
} else switch (textPosition) {
|
|
666
|
-
case "left":
|
|
667
|
-
x -= distance;
|
|
668
|
-
y += halfHeight;
|
|
669
|
-
textAlign = "right";
|
|
670
|
-
textVerticalAlign = "middle";
|
|
671
|
-
break;
|
|
672
|
-
case "right":
|
|
673
|
-
x += distance + width;
|
|
674
|
-
y += halfHeight;
|
|
675
|
-
textVerticalAlign = "middle";
|
|
676
|
-
break;
|
|
677
|
-
case "top":
|
|
678
|
-
x += width / 2;
|
|
679
|
-
y -= distance;
|
|
680
|
-
textAlign = "center";
|
|
681
|
-
textVerticalAlign = "bottom";
|
|
682
|
-
break;
|
|
683
|
-
case "bottom":
|
|
684
|
-
x += width / 2;
|
|
685
|
-
y += height + distance;
|
|
686
|
-
textAlign = "center";
|
|
687
|
-
break;
|
|
688
|
-
case "inside":
|
|
689
|
-
x += width / 2;
|
|
690
|
-
y += halfHeight;
|
|
691
|
-
textAlign = "center";
|
|
692
|
-
textVerticalAlign = "middle";
|
|
693
|
-
break;
|
|
694
|
-
case "insideLeft":
|
|
695
|
-
x += distance;
|
|
696
|
-
y += halfHeight;
|
|
697
|
-
textVerticalAlign = "middle";
|
|
698
|
-
break;
|
|
699
|
-
case "insideRight":
|
|
700
|
-
x += width - distance;
|
|
701
|
-
y += halfHeight;
|
|
702
|
-
textAlign = "right";
|
|
703
|
-
textVerticalAlign = "middle";
|
|
704
|
-
break;
|
|
705
|
-
case "insideTop":
|
|
706
|
-
x += width / 2;
|
|
707
|
-
y += distance;
|
|
708
|
-
textAlign = "center";
|
|
709
|
-
break;
|
|
710
|
-
case "insideBottom":
|
|
711
|
-
x += width / 2;
|
|
712
|
-
y += height - distance;
|
|
713
|
-
textAlign = "center";
|
|
714
|
-
textVerticalAlign = "bottom";
|
|
715
|
-
break;
|
|
716
|
-
case "insideTopLeft":
|
|
717
|
-
x += distance;
|
|
718
|
-
y += distance;
|
|
719
|
-
break;
|
|
720
|
-
case "insideTopRight":
|
|
721
|
-
x += width - distance;
|
|
722
|
-
y += distance;
|
|
723
|
-
textAlign = "right";
|
|
724
|
-
break;
|
|
725
|
-
case "insideBottomLeft":
|
|
726
|
-
x += distance;
|
|
727
|
-
y += height - distance;
|
|
728
|
-
textVerticalAlign = "bottom";
|
|
729
|
-
break;
|
|
730
|
-
case "insideBottomRight":
|
|
731
|
-
x += width - distance;
|
|
732
|
-
y += height - distance;
|
|
733
|
-
textAlign = "right";
|
|
734
|
-
textVerticalAlign = "bottom";
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
out = out || {};
|
|
738
|
-
out.x = x;
|
|
739
|
-
out.y = y;
|
|
740
|
-
out.align = textAlign;
|
|
741
|
-
out.verticalAlign = textVerticalAlign;
|
|
742
|
-
return out;
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
//#endregion
|
|
746
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/helper/parseText.js
|
|
747
|
-
|
|
748
|
-
function truncateText(text, containerWidth, font, ellipsis, options) {
|
|
749
|
-
var out = {};
|
|
750
|
-
truncateText2(out, text, containerWidth, font, ellipsis, options);
|
|
751
|
-
return out.text;
|
|
752
|
-
}
|
|
753
|
-
function truncateText2(out, text, containerWidth, font, ellipsis, options) {
|
|
754
|
-
if (!containerWidth) {
|
|
755
|
-
out.text = "";
|
|
756
|
-
out.isTruncated = false;
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
var textLines = (text + "").split("\n");
|
|
760
|
-
options = prepareTruncateOptions(containerWidth, font, ellipsis, options);
|
|
761
|
-
var isTruncated = false;
|
|
762
|
-
var truncateOut = {};
|
|
763
|
-
for (var i = 0, len = textLines.length; i < len; i++) {
|
|
764
|
-
truncateSingleLine(truncateOut, textLines[i], options);
|
|
765
|
-
textLines[i] = truncateOut.textLine;
|
|
766
|
-
isTruncated = isTruncated || truncateOut.isTruncated;
|
|
767
|
-
}
|
|
768
|
-
out.text = textLines.join("\n");
|
|
769
|
-
out.isTruncated = isTruncated;
|
|
770
|
-
}
|
|
771
|
-
function prepareTruncateOptions(containerWidth, font, ellipsis, options) {
|
|
772
|
-
options = options || {};
|
|
773
|
-
var preparedOpts = extend({}, options);
|
|
774
|
-
ellipsis = retrieve2(ellipsis, "...");
|
|
775
|
-
preparedOpts.maxIterations = retrieve2(options.maxIterations, 2);
|
|
776
|
-
var minChar = preparedOpts.minChar = retrieve2(options.minChar, 0);
|
|
777
|
-
var fontMeasureInfo = preparedOpts.fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
778
|
-
var ascCharWidth = fontMeasureInfo.asciiCharWidth;
|
|
779
|
-
preparedOpts.placeholder = retrieve2(options.placeholder, "");
|
|
780
|
-
var contentWidth = containerWidth = Math.max(0, containerWidth - 1);
|
|
781
|
-
for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) contentWidth -= ascCharWidth;
|
|
782
|
-
var ellipsisWidth = measureWidth(fontMeasureInfo, ellipsis);
|
|
783
|
-
if (ellipsisWidth > contentWidth) {
|
|
784
|
-
ellipsis = "";
|
|
785
|
-
ellipsisWidth = 0;
|
|
786
|
-
}
|
|
787
|
-
contentWidth = containerWidth - ellipsisWidth;
|
|
788
|
-
preparedOpts.ellipsis = ellipsis;
|
|
789
|
-
preparedOpts.ellipsisWidth = ellipsisWidth;
|
|
790
|
-
preparedOpts.contentWidth = contentWidth;
|
|
791
|
-
preparedOpts.containerWidth = containerWidth;
|
|
792
|
-
return preparedOpts;
|
|
793
|
-
}
|
|
794
|
-
function truncateSingleLine(out, textLine, options) {
|
|
795
|
-
var containerWidth = options.containerWidth;
|
|
796
|
-
var contentWidth = options.contentWidth;
|
|
797
|
-
var fontMeasureInfo = options.fontMeasureInfo;
|
|
798
|
-
if (!containerWidth) {
|
|
799
|
-
out.textLine = "";
|
|
800
|
-
out.isTruncated = false;
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
var lineWidth = measureWidth(fontMeasureInfo, textLine);
|
|
804
|
-
if (lineWidth <= containerWidth) {
|
|
805
|
-
out.textLine = textLine;
|
|
806
|
-
out.isTruncated = false;
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
809
|
-
for (var j = 0;; j++) {
|
|
810
|
-
if (lineWidth <= contentWidth || j >= options.maxIterations) {
|
|
811
|
-
textLine += options.ellipsis;
|
|
812
|
-
break;
|
|
813
|
-
}
|
|
814
|
-
var subLength = j === 0 ? estimateLength(textLine, contentWidth, fontMeasureInfo) : lineWidth > 0 ? Math.floor(textLine.length * contentWidth / lineWidth) : 0;
|
|
815
|
-
textLine = textLine.substr(0, subLength);
|
|
816
|
-
lineWidth = measureWidth(fontMeasureInfo, textLine);
|
|
817
|
-
}
|
|
818
|
-
if (textLine === "") textLine = options.placeholder;
|
|
819
|
-
out.textLine = textLine;
|
|
820
|
-
out.isTruncated = true;
|
|
821
|
-
}
|
|
822
|
-
function estimateLength(text, contentWidth, fontMeasureInfo) {
|
|
823
|
-
var width = 0;
|
|
824
|
-
var i = 0;
|
|
825
|
-
for (var len = text.length; i < len && width < contentWidth; i++) width += measureCharWidth(fontMeasureInfo, text.charCodeAt(i));
|
|
826
|
-
return i;
|
|
827
|
-
}
|
|
828
|
-
function parsePlainText(rawText, style, defaultOuterWidth, defaultOuterHeight) {
|
|
829
|
-
var text = formatText(rawText);
|
|
830
|
-
var overflow = style.overflow;
|
|
831
|
-
var padding = style.padding;
|
|
832
|
-
var paddingH = padding ? padding[1] + padding[3] : 0;
|
|
833
|
-
var paddingV = padding ? padding[0] + padding[2] : 0;
|
|
834
|
-
var font = style.font;
|
|
835
|
-
var truncate = overflow === "truncate";
|
|
836
|
-
var calculatedLineHeight = getLineHeight(font);
|
|
837
|
-
var lineHeight = retrieve2(style.lineHeight, calculatedLineHeight);
|
|
838
|
-
var truncateLineOverflow = style.lineOverflow === "truncate";
|
|
839
|
-
var isTruncated = false;
|
|
840
|
-
var width = style.width;
|
|
841
|
-
if (width == null && defaultOuterWidth != null) width = defaultOuterWidth - paddingH;
|
|
842
|
-
var height = style.height;
|
|
843
|
-
if (height == null && defaultOuterHeight != null) height = defaultOuterHeight - paddingV;
|
|
844
|
-
var lines;
|
|
845
|
-
if (width != null && (overflow === "break" || overflow === "breakAll")) lines = text ? wrapText(text, style.font, width, overflow === "breakAll", 0).lines : [];else lines = text ? text.split("\n") : [];
|
|
846
|
-
var contentHeight = lines.length * lineHeight;
|
|
847
|
-
if (height == null) height = contentHeight;
|
|
848
|
-
if (contentHeight > height && truncateLineOverflow) {
|
|
849
|
-
var lineCount = Math.floor(height / lineHeight);
|
|
850
|
-
isTruncated = isTruncated || lines.length > lineCount;
|
|
851
|
-
lines = lines.slice(0, lineCount);
|
|
852
|
-
contentHeight = lines.length * lineHeight;
|
|
853
|
-
}
|
|
854
|
-
if (text && truncate && width != null) {
|
|
855
|
-
var options = prepareTruncateOptions(width, font, style.ellipsis, {
|
|
856
|
-
minChar: style.truncateMinChar,
|
|
857
|
-
placeholder: style.placeholder
|
|
858
|
-
});
|
|
859
|
-
var singleOut = {};
|
|
860
|
-
for (var i = 0; i < lines.length; i++) {
|
|
861
|
-
truncateSingleLine(singleOut, lines[i], options);
|
|
862
|
-
lines[i] = singleOut.textLine;
|
|
863
|
-
isTruncated = isTruncated || singleOut.isTruncated;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
var outerHeight = height;
|
|
867
|
-
var contentWidth = 0;
|
|
868
|
-
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
869
|
-
for (var i = 0; i < lines.length; i++) contentWidth = Math.max(measureWidth(fontMeasureInfo, lines[i]), contentWidth);
|
|
870
|
-
if (width == null) width = contentWidth;
|
|
871
|
-
var outerWidth = width;
|
|
872
|
-
outerHeight += paddingV;
|
|
873
|
-
outerWidth += paddingH;
|
|
874
|
-
return {
|
|
875
|
-
lines,
|
|
876
|
-
height,
|
|
877
|
-
outerWidth,
|
|
878
|
-
outerHeight,
|
|
879
|
-
lineHeight,
|
|
880
|
-
calculatedLineHeight,
|
|
881
|
-
contentWidth,
|
|
882
|
-
contentHeight,
|
|
883
|
-
width,
|
|
884
|
-
isTruncated
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
function parseRichText(rawText, style, defaultOuterWidth, defaultOuterHeight, topTextAlign) {
|
|
888
|
-
var contentBlock = new RichTextContentBlock();
|
|
889
|
-
var text = formatText(rawText);
|
|
890
|
-
if (!text) return contentBlock;
|
|
891
|
-
var stlPadding = style.padding;
|
|
892
|
-
var stlPaddingH = stlPadding ? stlPadding[1] + stlPadding[3] : 0;
|
|
893
|
-
var stlPaddingV = stlPadding ? stlPadding[0] + stlPadding[2] : 0;
|
|
894
|
-
var topWidth = style.width;
|
|
895
|
-
if (topWidth == null && defaultOuterWidth != null) topWidth = defaultOuterWidth - stlPaddingH;
|
|
896
|
-
var topHeight = style.height;
|
|
897
|
-
if (topHeight == null && defaultOuterHeight != null) topHeight = defaultOuterHeight - stlPaddingV;
|
|
898
|
-
var overflow = style.overflow;
|
|
899
|
-
var wrapInfo = (overflow === "break" || overflow === "breakAll") && topWidth != null ? {
|
|
900
|
-
width: topWidth,
|
|
901
|
-
accumWidth: 0,
|
|
902
|
-
breakAll: overflow === "breakAll"
|
|
903
|
-
} : null;
|
|
904
|
-
var lastIndex = STYLE_REG.lastIndex = 0;
|
|
905
|
-
var result;
|
|
906
|
-
while ((result = STYLE_REG.exec(text)) != null) {
|
|
907
|
-
var matchedIndex = result.index;
|
|
908
|
-
if (matchedIndex > lastIndex) pushTokens(contentBlock, text.substring(lastIndex, matchedIndex), style, wrapInfo);
|
|
909
|
-
pushTokens(contentBlock, result[2], style, wrapInfo, result[1]);
|
|
910
|
-
lastIndex = STYLE_REG.lastIndex;
|
|
911
|
-
}
|
|
912
|
-
if (lastIndex < text.length) pushTokens(contentBlock, text.substring(lastIndex, text.length), style, wrapInfo);
|
|
913
|
-
var pendingList = [];
|
|
914
|
-
var calculatedHeight = 0;
|
|
915
|
-
var calculatedWidth = 0;
|
|
916
|
-
var truncate = overflow === "truncate";
|
|
917
|
-
var truncateLine = style.lineOverflow === "truncate";
|
|
918
|
-
var tmpTruncateOut = {};
|
|
919
|
-
function finishLine(line, lineWidth, lineHeight) {
|
|
920
|
-
line.width = lineWidth;
|
|
921
|
-
line.lineHeight = lineHeight;
|
|
922
|
-
calculatedHeight += lineHeight;
|
|
923
|
-
calculatedWidth = Math.max(calculatedWidth, lineWidth);
|
|
924
|
-
}
|
|
925
|
-
outer: for (var i = 0; i < contentBlock.lines.length; i++) {
|
|
926
|
-
var line = contentBlock.lines[i];
|
|
927
|
-
var lineHeight = 0;
|
|
928
|
-
var lineWidth = 0;
|
|
929
|
-
for (var j = 0; j < line.tokens.length; j++) {
|
|
930
|
-
var token = line.tokens[j];
|
|
931
|
-
var tokenStyle = token.styleName && style.rich[token.styleName] || {};
|
|
932
|
-
var textPadding = token.textPadding = tokenStyle.padding;
|
|
933
|
-
var paddingH = textPadding ? textPadding[1] + textPadding[3] : 0;
|
|
934
|
-
var font = token.font = tokenStyle.font || style.font;
|
|
935
|
-
token.contentHeight = getLineHeight(font);
|
|
936
|
-
var tokenHeight = retrieve2(tokenStyle.height, token.contentHeight);
|
|
937
|
-
token.innerHeight = tokenHeight;
|
|
938
|
-
textPadding && (tokenHeight += textPadding[0] + textPadding[2]);
|
|
939
|
-
token.height = tokenHeight;
|
|
940
|
-
token.lineHeight = retrieve3(tokenStyle.lineHeight, style.lineHeight, tokenHeight);
|
|
941
|
-
token.align = tokenStyle && tokenStyle.align || topTextAlign;
|
|
942
|
-
token.verticalAlign = tokenStyle && tokenStyle.verticalAlign || "middle";
|
|
943
|
-
if (truncateLine && topHeight != null && calculatedHeight + token.lineHeight > topHeight) {
|
|
944
|
-
var originalLength = contentBlock.lines.length;
|
|
945
|
-
if (j > 0) {
|
|
946
|
-
line.tokens = line.tokens.slice(0, j);
|
|
947
|
-
finishLine(line, lineWidth, lineHeight);
|
|
948
|
-
contentBlock.lines = contentBlock.lines.slice(0, i + 1);
|
|
949
|
-
} else contentBlock.lines = contentBlock.lines.slice(0, i);
|
|
950
|
-
contentBlock.isTruncated = contentBlock.isTruncated || contentBlock.lines.length < originalLength;
|
|
951
|
-
break outer;
|
|
952
|
-
}
|
|
953
|
-
var styleTokenWidth = tokenStyle.width;
|
|
954
|
-
var tokenWidthNotSpecified = styleTokenWidth == null || styleTokenWidth === "auto";
|
|
955
|
-
if (typeof styleTokenWidth === "string" && styleTokenWidth.charAt(styleTokenWidth.length - 1) === "%") {
|
|
956
|
-
token.percentWidth = styleTokenWidth;
|
|
957
|
-
pendingList.push(token);
|
|
958
|
-
token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
959
|
-
} else {
|
|
960
|
-
if (tokenWidthNotSpecified) {
|
|
961
|
-
var textBackgroundColor = tokenStyle.backgroundColor;
|
|
962
|
-
var bgImg = textBackgroundColor && textBackgroundColor.image;
|
|
963
|
-
if (bgImg) {
|
|
964
|
-
bgImg = findExistImage(bgImg);
|
|
965
|
-
if (isImageReady(bgImg)) token.width = Math.max(token.width, bgImg.width * tokenHeight / bgImg.height);
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
var remainTruncWidth = truncate && topWidth != null ? topWidth - lineWidth : null;
|
|
969
|
-
if (remainTruncWidth != null && remainTruncWidth < token.width) {
|
|
970
|
-
if (!tokenWidthNotSpecified || remainTruncWidth < paddingH) {
|
|
971
|
-
token.text = "";
|
|
972
|
-
token.width = token.contentWidth = 0;
|
|
973
|
-
} else {
|
|
974
|
-
truncateText2(tmpTruncateOut, token.text, remainTruncWidth - paddingH, font, style.ellipsis, {
|
|
975
|
-
minChar: style.truncateMinChar
|
|
976
|
-
});
|
|
977
|
-
token.text = tmpTruncateOut.text;
|
|
978
|
-
contentBlock.isTruncated = contentBlock.isTruncated || tmpTruncateOut.isTruncated;
|
|
979
|
-
token.width = token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
980
|
-
}
|
|
981
|
-
} else token.contentWidth = measureWidth(ensureFontMeasureInfo(font), token.text);
|
|
982
|
-
}
|
|
983
|
-
token.width += paddingH;
|
|
984
|
-
lineWidth += token.width;
|
|
985
|
-
tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight));
|
|
986
|
-
}
|
|
987
|
-
finishLine(line, lineWidth, lineHeight);
|
|
988
|
-
}
|
|
989
|
-
contentBlock.outerWidth = contentBlock.width = retrieve2(topWidth, calculatedWidth);
|
|
990
|
-
contentBlock.outerHeight = contentBlock.height = retrieve2(topHeight, calculatedHeight);
|
|
991
|
-
contentBlock.contentHeight = calculatedHeight;
|
|
992
|
-
contentBlock.contentWidth = calculatedWidth;
|
|
993
|
-
contentBlock.outerWidth += stlPaddingH;
|
|
994
|
-
contentBlock.outerHeight += stlPaddingV;
|
|
995
|
-
for (var i = 0; i < pendingList.length; i++) {
|
|
996
|
-
var token = pendingList[i];
|
|
997
|
-
var percentWidth = token.percentWidth;
|
|
998
|
-
token.width = parseInt(percentWidth, 10) / 100 * contentBlock.width;
|
|
999
|
-
}
|
|
1000
|
-
return contentBlock;
|
|
1001
|
-
}
|
|
1002
|
-
function pushTokens(block, str, style, wrapInfo, styleName) {
|
|
1003
|
-
var isEmptyStr = str === "";
|
|
1004
|
-
var tokenStyle = styleName && style.rich[styleName] || {};
|
|
1005
|
-
var lines = block.lines;
|
|
1006
|
-
var font = tokenStyle.font || style.font;
|
|
1007
|
-
var newLine = false;
|
|
1008
|
-
var strLines;
|
|
1009
|
-
var linesWidths;
|
|
1010
|
-
if (wrapInfo) {
|
|
1011
|
-
var tokenPadding = tokenStyle.padding;
|
|
1012
|
-
var tokenPaddingH = tokenPadding ? tokenPadding[1] + tokenPadding[3] : 0;
|
|
1013
|
-
if (tokenStyle.width != null && tokenStyle.width !== "auto") {
|
|
1014
|
-
var outerWidth_1 = parsePercent(tokenStyle.width, wrapInfo.width) + tokenPaddingH;
|
|
1015
|
-
if (lines.length > 0) {
|
|
1016
|
-
if (outerWidth_1 + wrapInfo.accumWidth > wrapInfo.width) {
|
|
1017
|
-
strLines = str.split("\n");
|
|
1018
|
-
newLine = true;
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
wrapInfo.accumWidth = outerWidth_1;
|
|
1022
|
-
} else {
|
|
1023
|
-
var res = wrapText(str, font, wrapInfo.width, wrapInfo.breakAll, wrapInfo.accumWidth);
|
|
1024
|
-
wrapInfo.accumWidth = res.accumWidth + tokenPaddingH;
|
|
1025
|
-
linesWidths = res.linesWidths;
|
|
1026
|
-
strLines = res.lines;
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
if (!strLines) strLines = str.split("\n");
|
|
1030
|
-
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
1031
|
-
for (var i = 0; i < strLines.length; i++) {
|
|
1032
|
-
var text = strLines[i];
|
|
1033
|
-
var token = new RichTextToken();
|
|
1034
|
-
token.styleName = styleName;
|
|
1035
|
-
token.text = text;
|
|
1036
|
-
token.isLineHolder = !text && !isEmptyStr;
|
|
1037
|
-
if (typeof tokenStyle.width === "number") token.width = tokenStyle.width;else token.width = linesWidths ? linesWidths[i] : measureWidth(fontMeasureInfo, text);
|
|
1038
|
-
if (!i && !newLine) {
|
|
1039
|
-
var tokens = (lines[lines.length - 1] || (lines[0] = new RichTextLine())).tokens;
|
|
1040
|
-
var tokensLen = tokens.length;
|
|
1041
|
-
tokensLen === 1 && tokens[0].isLineHolder ? tokens[0] = token : (text || !tokensLen || isEmptyStr) && tokens.push(token);
|
|
1042
|
-
} else lines.push(new RichTextLine([token]));
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
function isAlphabeticLetter(ch) {
|
|
1046
|
-
var code = ch.charCodeAt(0);
|
|
1047
|
-
return code >= 32 && code <= 591 || code >= 880 && code <= 4351 || code >= 4608 && code <= 5119 || code >= 7680 && code <= 8303;
|
|
1048
|
-
}
|
|
1049
|
-
function isWordBreakChar(ch) {
|
|
1050
|
-
if (isAlphabeticLetter(ch)) {
|
|
1051
|
-
if (breakCharMap[ch]) return true;
|
|
1052
|
-
return false;
|
|
1053
|
-
}
|
|
1054
|
-
return true;
|
|
1055
|
-
}
|
|
1056
|
-
function wrapText(text, font, lineWidth, isBreakAll, lastAccumWidth) {
|
|
1057
|
-
var lines = [];
|
|
1058
|
-
var linesWidths = [];
|
|
1059
|
-
var line = "";
|
|
1060
|
-
var currentWord = "";
|
|
1061
|
-
var currentWordWidth = 0;
|
|
1062
|
-
var accumWidth = 0;
|
|
1063
|
-
var fontMeasureInfo = ensureFontMeasureInfo(font);
|
|
1064
|
-
for (var i = 0; i < text.length; i++) {
|
|
1065
|
-
var ch = text.charAt(i);
|
|
1066
|
-
if (ch === "\n") {
|
|
1067
|
-
if (currentWord) {
|
|
1068
|
-
line += currentWord;
|
|
1069
|
-
accumWidth += currentWordWidth;
|
|
1070
|
-
}
|
|
1071
|
-
lines.push(line);
|
|
1072
|
-
linesWidths.push(accumWidth);
|
|
1073
|
-
line = "";
|
|
1074
|
-
currentWord = "";
|
|
1075
|
-
currentWordWidth = 0;
|
|
1076
|
-
accumWidth = 0;
|
|
1077
|
-
continue;
|
|
1078
|
-
}
|
|
1079
|
-
var chWidth = measureCharWidth(fontMeasureInfo, ch.charCodeAt(0));
|
|
1080
|
-
var inWord = isBreakAll ? false : !isWordBreakChar(ch);
|
|
1081
|
-
if (!lines.length ? lastAccumWidth + accumWidth + chWidth > lineWidth : accumWidth + chWidth > lineWidth) {
|
|
1082
|
-
if (!accumWidth) {
|
|
1083
|
-
if (inWord) {
|
|
1084
|
-
lines.push(currentWord);
|
|
1085
|
-
linesWidths.push(currentWordWidth);
|
|
1086
|
-
currentWord = ch;
|
|
1087
|
-
currentWordWidth = chWidth;
|
|
1088
|
-
} else {
|
|
1089
|
-
lines.push(ch);
|
|
1090
|
-
linesWidths.push(chWidth);
|
|
1091
|
-
}
|
|
1092
|
-
} else if (line || currentWord) if (inWord) {
|
|
1093
|
-
if (!line) {
|
|
1094
|
-
line = currentWord;
|
|
1095
|
-
currentWord = "";
|
|
1096
|
-
currentWordWidth = 0;
|
|
1097
|
-
accumWidth = currentWordWidth;
|
|
1098
|
-
}
|
|
1099
|
-
lines.push(line);
|
|
1100
|
-
linesWidths.push(accumWidth - currentWordWidth);
|
|
1101
|
-
currentWord += ch;
|
|
1102
|
-
currentWordWidth += chWidth;
|
|
1103
|
-
line = "";
|
|
1104
|
-
accumWidth = currentWordWidth;
|
|
1105
|
-
} else {
|
|
1106
|
-
if (currentWord) {
|
|
1107
|
-
line += currentWord;
|
|
1108
|
-
currentWord = "";
|
|
1109
|
-
currentWordWidth = 0;
|
|
1110
|
-
}
|
|
1111
|
-
lines.push(line);
|
|
1112
|
-
linesWidths.push(accumWidth);
|
|
1113
|
-
line = ch;
|
|
1114
|
-
accumWidth = chWidth;
|
|
1115
|
-
}
|
|
1116
|
-
continue;
|
|
1117
|
-
}
|
|
1118
|
-
accumWidth += chWidth;
|
|
1119
|
-
if (inWord) {
|
|
1120
|
-
currentWord += ch;
|
|
1121
|
-
currentWordWidth += chWidth;
|
|
1122
|
-
} else {
|
|
1123
|
-
if (currentWord) {
|
|
1124
|
-
line += currentWord;
|
|
1125
|
-
currentWord = "";
|
|
1126
|
-
currentWordWidth = 0;
|
|
1127
|
-
}
|
|
1128
|
-
line += ch;
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
if (currentWord) line += currentWord;
|
|
1132
|
-
if (line) {
|
|
1133
|
-
lines.push(line);
|
|
1134
|
-
linesWidths.push(accumWidth);
|
|
1135
|
-
}
|
|
1136
|
-
if (lines.length === 1) accumWidth += lastAccumWidth;
|
|
1137
|
-
return {
|
|
1138
|
-
accumWidth,
|
|
1139
|
-
lines,
|
|
1140
|
-
linesWidths
|
|
1141
|
-
};
|
|
1142
|
-
}
|
|
1143
|
-
function calcInnerTextOverflowArea(out, overflowRect, baseX, baseY, textAlign, textVerticalAlign) {
|
|
1144
|
-
out.baseX = baseX;
|
|
1145
|
-
out.baseY = baseY;
|
|
1146
|
-
out.outerWidth = out.outerHeight = null;
|
|
1147
|
-
if (!overflowRect) return;
|
|
1148
|
-
var textWidth = overflowRect.width * 2;
|
|
1149
|
-
var textHeight = overflowRect.height * 2;
|
|
1150
|
-
BoundingRect.set(tmpCITCTextRect, adjustTextX(baseX, textWidth, textAlign), adjustTextY$1(baseY, textHeight, textVerticalAlign), textWidth, textHeight);
|
|
1151
|
-
BoundingRect.intersect(overflowRect, tmpCITCTextRect, null, tmpCITCIntersectRectOpt);
|
|
1152
|
-
var outIntersectRect = tmpCITCIntersectRectOpt.outIntersectRect;
|
|
1153
|
-
out.outerWidth = outIntersectRect.width;
|
|
1154
|
-
out.outerHeight = outIntersectRect.height;
|
|
1155
|
-
out.baseX = adjustTextX(outIntersectRect.x, outIntersectRect.width, textAlign, true);
|
|
1156
|
-
out.baseY = adjustTextY$1(outIntersectRect.y, outIntersectRect.height, textVerticalAlign, true);
|
|
1157
|
-
}
|
|
1158
|
-
function formatText(text) {
|
|
1159
|
-
return text != null ? text += "" : text = "";
|
|
1160
|
-
}
|
|
1161
|
-
function tSpanCreateBoundingRect(style) {
|
|
1162
|
-
var text = formatText(style.text);
|
|
1163
|
-
var font = style.font;
|
|
1164
|
-
return tSpanCreateBoundingRect2(style, measureWidth(ensureFontMeasureInfo(font), text), getLineHeight(font), null);
|
|
1165
|
-
}
|
|
1166
|
-
function tSpanCreateBoundingRect2(style, contentWidth, contentHeight, forceLineWidth) {
|
|
1167
|
-
var rect = new BoundingRect(adjustTextX(style.x || 0, contentWidth, style.textAlign), adjustTextY$1(style.y || 0, contentHeight, style.textBaseline), contentWidth, contentHeight);
|
|
1168
|
-
var lineWidth = forceLineWidth != null ? forceLineWidth : tSpanHasStroke(style) ? style.lineWidth : 0;
|
|
1169
|
-
if (lineWidth > 0) {
|
|
1170
|
-
rect.x -= lineWidth / 2;
|
|
1171
|
-
rect.y -= lineWidth / 2;
|
|
1172
|
-
rect.width += lineWidth;
|
|
1173
|
-
rect.height += lineWidth;
|
|
1174
|
-
}
|
|
1175
|
-
return rect;
|
|
1176
|
-
}
|
|
1177
|
-
function tSpanHasStroke(style) {
|
|
1178
|
-
var stroke = style.stroke;
|
|
1179
|
-
return stroke != null && stroke !== "none" && style.lineWidth > 0;
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
//#endregion
|
|
1183
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/vector.js
|
|
1184
|
-
declare namespace vector_exports {
|
|
1185
|
-
export { add, applyTransform, clone, copy, create, dist$1 as dist, distSquare, distance, distanceSquare, div, dot, len, lenSquare, length, lengthSquare, lerp$1 as lerp, max$1 as max, min$1 as min, mul, negate, normalize, scale, scaleAndAdd, set, sub };
|
|
1186
|
-
}
|
|
1187
|
-
function create(x, y) {
|
|
1188
|
-
if (x == null) x = 0;
|
|
1189
|
-
if (y == null) y = 0;
|
|
1190
|
-
return [x, y];
|
|
1191
|
-
}
|
|
1192
|
-
function copy(out, v) {
|
|
1193
|
-
out[0] = v[0];
|
|
1194
|
-
out[1] = v[1];
|
|
1195
|
-
return out;
|
|
1196
|
-
}
|
|
1197
|
-
function clone(v) {
|
|
1198
|
-
return [v[0], v[1]];
|
|
1199
|
-
}
|
|
1200
|
-
function set(out, a, b) {
|
|
1201
|
-
out[0] = a;
|
|
1202
|
-
out[1] = b;
|
|
1203
|
-
return out;
|
|
1204
|
-
}
|
|
1205
|
-
function add(out, v1, v2) {
|
|
1206
|
-
out[0] = v1[0] + v2[0];
|
|
1207
|
-
out[1] = v1[1] + v2[1];
|
|
1208
|
-
return out;
|
|
1209
|
-
}
|
|
1210
|
-
function scaleAndAdd(out, v1, v2, a) {
|
|
1211
|
-
out[0] = v1[0] + v2[0] * a;
|
|
1212
|
-
out[1] = v1[1] + v2[1] * a;
|
|
1213
|
-
return out;
|
|
1214
|
-
}
|
|
1215
|
-
function sub(out, v1, v2) {
|
|
1216
|
-
out[0] = v1[0] - v2[0];
|
|
1217
|
-
out[1] = v1[1] - v2[1];
|
|
1218
|
-
return out;
|
|
1219
|
-
}
|
|
1220
|
-
function len(v) {
|
|
1221
|
-
return Math.sqrt(lenSquare(v));
|
|
1222
|
-
}
|
|
1223
|
-
function lenSquare(v) {
|
|
1224
|
-
return v[0] * v[0] + v[1] * v[1];
|
|
1225
|
-
}
|
|
1226
|
-
function mul(out, v1, v2) {
|
|
1227
|
-
out[0] = v1[0] * v2[0];
|
|
1228
|
-
out[1] = v1[1] * v2[1];
|
|
1229
|
-
return out;
|
|
1230
|
-
}
|
|
1231
|
-
function div(out, v1, v2) {
|
|
1232
|
-
out[0] = v1[0] / v2[0];
|
|
1233
|
-
out[1] = v1[1] / v2[1];
|
|
1234
|
-
return out;
|
|
1235
|
-
}
|
|
1236
|
-
function dot(v1, v2) {
|
|
1237
|
-
return v1[0] * v2[0] + v1[1] * v2[1];
|
|
1238
|
-
}
|
|
1239
|
-
function scale(out, v, s) {
|
|
1240
|
-
out[0] = v[0] * s;
|
|
1241
|
-
out[1] = v[1] * s;
|
|
1242
|
-
return out;
|
|
1243
|
-
}
|
|
1244
|
-
function normalize(out, v) {
|
|
1245
|
-
var d = len(v);
|
|
1246
|
-
if (d === 0) {
|
|
1247
|
-
out[0] = 0;
|
|
1248
|
-
out[1] = 0;
|
|
1249
|
-
} else {
|
|
1250
|
-
out[0] = v[0] / d;
|
|
1251
|
-
out[1] = v[1] / d;
|
|
1252
|
-
}
|
|
1253
|
-
return out;
|
|
1254
|
-
}
|
|
1255
|
-
function distance(v1, v2) {
|
|
1256
|
-
return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]));
|
|
1257
|
-
}
|
|
1258
|
-
function distanceSquare(v1, v2) {
|
|
1259
|
-
return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]);
|
|
1260
|
-
}
|
|
1261
|
-
function negate(out, v) {
|
|
1262
|
-
out[0] = -v[0];
|
|
1263
|
-
out[1] = -v[1];
|
|
1264
|
-
return out;
|
|
1265
|
-
}
|
|
1266
|
-
function lerp$1(out, v1, v2, t) {
|
|
1267
|
-
out[0] = v1[0] + t * (v2[0] - v1[0]);
|
|
1268
|
-
out[1] = v1[1] + t * (v2[1] - v1[1]);
|
|
1269
|
-
return out;
|
|
1270
|
-
}
|
|
1271
|
-
function applyTransform(out, v, m) {
|
|
1272
|
-
var x = v[0];
|
|
1273
|
-
var y = v[1];
|
|
1274
|
-
out[0] = m[0] * x + m[2] * y + m[4];
|
|
1275
|
-
out[1] = m[1] * x + m[3] * y + m[5];
|
|
1276
|
-
return out;
|
|
1277
|
-
}
|
|
1278
|
-
function min$1(out, v1, v2) {
|
|
1279
|
-
out[0] = Math.min(v1[0], v2[0]);
|
|
1280
|
-
out[1] = Math.min(v1[1], v2[1]);
|
|
1281
|
-
return out;
|
|
1282
|
-
}
|
|
1283
|
-
function max$1(out, v1, v2) {
|
|
1284
|
-
out[0] = Math.max(v1[0], v2[0]);
|
|
1285
|
-
out[1] = Math.max(v1[1], v2[1]);
|
|
1286
|
-
return out;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
//#endregion
|
|
1290
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/Transformable.js
|
|
1291
|
-
|
|
1292
|
-
function isNotAroundZero$1(val) {
|
|
1293
|
-
return val > EPSILON$3 || val < -EPSILON$3;
|
|
1294
|
-
}
|
|
1295
|
-
function copyTransform(target, source) {
|
|
1296
|
-
for (var i = 0; i < TRANSFORMABLE_PROPS.length; i++) {
|
|
1297
|
-
var propName = TRANSFORMABLE_PROPS[i];
|
|
1298
|
-
target[propName] = source[propName];
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
//#endregion
|
|
1303
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/animation/easing.js
|
|
1304
|
-
|
|
1305
|
-
function isAroundZero$1(val) {
|
|
1306
|
-
return val > -EPSILON$2 && val < EPSILON$2;
|
|
1307
|
-
}
|
|
1308
|
-
function isNotAroundZero(val) {
|
|
1309
|
-
return val > EPSILON$2 || val < -EPSILON$2;
|
|
1310
|
-
}
|
|
1311
|
-
function cubicAt(p0, p1, p2, p3, t) {
|
|
1312
|
-
var onet = 1 - t;
|
|
1313
|
-
return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
|
|
1314
|
-
}
|
|
1315
|
-
function cubicDerivativeAt(p0, p1, p2, p3, t) {
|
|
1316
|
-
var onet = 1 - t;
|
|
1317
|
-
return 3 * (((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet + (p3 - p2) * t * t);
|
|
1318
|
-
}
|
|
1319
|
-
function cubicRootAt(p0, p1, p2, p3, val, roots) {
|
|
1320
|
-
var a = p3 + 3 * (p1 - p2) - p0;
|
|
1321
|
-
var b = 3 * (p2 - p1 * 2 + p0);
|
|
1322
|
-
var c = 3 * (p1 - p0);
|
|
1323
|
-
var d = p0 - val;
|
|
1324
|
-
var A = b * b - 3 * a * c;
|
|
1325
|
-
var B = b * c - 9 * a * d;
|
|
1326
|
-
var C = c * c - 3 * b * d;
|
|
1327
|
-
var n = 0;
|
|
1328
|
-
if (isAroundZero$1(A) && isAroundZero$1(B)) {
|
|
1329
|
-
if (isAroundZero$1(b)) roots[0] = 0;else {
|
|
1330
|
-
var t1 = -c / b;
|
|
1331
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1332
|
-
}
|
|
1333
|
-
} else {
|
|
1334
|
-
var disc = B * B - 4 * A * C;
|
|
1335
|
-
if (isAroundZero$1(disc)) {
|
|
1336
|
-
var K = B / A;
|
|
1337
|
-
var t1 = -b / a + K;
|
|
1338
|
-
var t2 = -K / 2;
|
|
1339
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1340
|
-
if (t2 >= 0 && t2 <= 1) roots[n++] = t2;
|
|
1341
|
-
} else if (disc > 0) {
|
|
1342
|
-
var discSqrt = mathSqrt(disc);
|
|
1343
|
-
var Y1 = A * b + 1.5 * a * (-B + discSqrt);
|
|
1344
|
-
var Y2 = A * b + 1.5 * a * (-B - discSqrt);
|
|
1345
|
-
if (Y1 < 0) Y1 = -mathPow(-Y1, ONE_THIRD);else Y1 = mathPow(Y1, ONE_THIRD);
|
|
1346
|
-
if (Y2 < 0) Y2 = -mathPow(-Y2, ONE_THIRD);else Y2 = mathPow(Y2, ONE_THIRD);
|
|
1347
|
-
var t1 = (-b - (Y1 + Y2)) / (3 * a);
|
|
1348
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1349
|
-
} else {
|
|
1350
|
-
var T = (2 * A * b - 3 * a * B) / (2 * mathSqrt(A * A * A));
|
|
1351
|
-
var theta = Math.acos(T) / 3;
|
|
1352
|
-
var ASqrt = mathSqrt(A);
|
|
1353
|
-
var tmp = Math.cos(theta);
|
|
1354
|
-
var t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
|
|
1355
|
-
var t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a);
|
|
1356
|
-
var t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
|
|
1357
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1358
|
-
if (t2 >= 0 && t2 <= 1) roots[n++] = t2;
|
|
1359
|
-
if (t3 >= 0 && t3 <= 1) roots[n++] = t3;
|
|
1360
|
-
}
|
|
1361
|
-
}
|
|
1362
|
-
return n;
|
|
1363
|
-
}
|
|
1364
|
-
function cubicExtrema(p0, p1, p2, p3, extrema) {
|
|
1365
|
-
var b = 6 * p2 - 12 * p1 + 6 * p0;
|
|
1366
|
-
var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
|
|
1367
|
-
var c = 3 * p1 - 3 * p0;
|
|
1368
|
-
var n = 0;
|
|
1369
|
-
if (isAroundZero$1(a)) {
|
|
1370
|
-
if (isNotAroundZero(b)) {
|
|
1371
|
-
var t1 = -c / b;
|
|
1372
|
-
if (t1 >= 0 && t1 <= 1) extrema[n++] = t1;
|
|
1373
|
-
}
|
|
1374
|
-
} else {
|
|
1375
|
-
var disc = b * b - 4 * a * c;
|
|
1376
|
-
if (isAroundZero$1(disc)) extrema[0] = -b / (2 * a);else if (disc > 0) {
|
|
1377
|
-
var discSqrt = mathSqrt(disc);
|
|
1378
|
-
var t1 = (-b + discSqrt) / (2 * a);
|
|
1379
|
-
var t2 = (-b - discSqrt) / (2 * a);
|
|
1380
|
-
if (t1 >= 0 && t1 <= 1) extrema[n++] = t1;
|
|
1381
|
-
if (t2 >= 0 && t2 <= 1) extrema[n++] = t2;
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
return n;
|
|
1385
|
-
}
|
|
1386
|
-
function cubicSubdivide(p0, p1, p2, p3, t, out) {
|
|
1387
|
-
var p01 = (p1 - p0) * t + p0;
|
|
1388
|
-
var p12 = (p2 - p1) * t + p1;
|
|
1389
|
-
var p23 = (p3 - p2) * t + p2;
|
|
1390
|
-
var p012 = (p12 - p01) * t + p01;
|
|
1391
|
-
var p123 = (p23 - p12) * t + p12;
|
|
1392
|
-
var p0123 = (p123 - p012) * t + p012;
|
|
1393
|
-
out[0] = p0;
|
|
1394
|
-
out[1] = p01;
|
|
1395
|
-
out[2] = p012;
|
|
1396
|
-
out[3] = p0123;
|
|
1397
|
-
out[4] = p0123;
|
|
1398
|
-
out[5] = p123;
|
|
1399
|
-
out[6] = p23;
|
|
1400
|
-
out[7] = p3;
|
|
1401
|
-
}
|
|
1402
|
-
function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
|
|
1403
|
-
var t;
|
|
1404
|
-
var interval = .005;
|
|
1405
|
-
var d = Infinity;
|
|
1406
|
-
var prev;
|
|
1407
|
-
var next;
|
|
1408
|
-
var d1;
|
|
1409
|
-
var d2;
|
|
1410
|
-
_v0[0] = x;
|
|
1411
|
-
_v0[1] = y;
|
|
1412
|
-
for (var _t = 0; _t < 1; _t += .05) {
|
|
1413
|
-
_v1[0] = cubicAt(x0, x1, x2, x3, _t);
|
|
1414
|
-
_v1[1] = cubicAt(y0, y1, y2, y3, _t);
|
|
1415
|
-
d1 = distSquare(_v0, _v1);
|
|
1416
|
-
if (d1 < d) {
|
|
1417
|
-
t = _t;
|
|
1418
|
-
d = d1;
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
d = Infinity;
|
|
1422
|
-
for (var i = 0; i < 32; i++) {
|
|
1423
|
-
if (interval < EPSILON_NUMERIC) break;
|
|
1424
|
-
prev = t - interval;
|
|
1425
|
-
next = t + interval;
|
|
1426
|
-
_v1[0] = cubicAt(x0, x1, x2, x3, prev);
|
|
1427
|
-
_v1[1] = cubicAt(y0, y1, y2, y3, prev);
|
|
1428
|
-
d1 = distSquare(_v1, _v0);
|
|
1429
|
-
if (prev >= 0 && d1 < d) {
|
|
1430
|
-
t = prev;
|
|
1431
|
-
d = d1;
|
|
1432
|
-
} else {
|
|
1433
|
-
_v2[0] = cubicAt(x0, x1, x2, x3, next);
|
|
1434
|
-
_v2[1] = cubicAt(y0, y1, y2, y3, next);
|
|
1435
|
-
d2 = distSquare(_v2, _v0);
|
|
1436
|
-
if (next <= 1 && d2 < d) {
|
|
1437
|
-
t = next;
|
|
1438
|
-
d = d2;
|
|
1439
|
-
} else interval *= .5;
|
|
1440
|
-
}
|
|
1441
|
-
}
|
|
1442
|
-
if (out) {
|
|
1443
|
-
out[0] = cubicAt(x0, x1, x2, x3, t);
|
|
1444
|
-
out[1] = cubicAt(y0, y1, y2, y3, t);
|
|
1445
|
-
}
|
|
1446
|
-
return mathSqrt(d);
|
|
1447
|
-
}
|
|
1448
|
-
function cubicLength(x0, y0, x1, y1, x2, y2, x3, y3, iteration) {
|
|
1449
|
-
var px = x0;
|
|
1450
|
-
var py = y0;
|
|
1451
|
-
var d = 0;
|
|
1452
|
-
var step = 1 / iteration;
|
|
1453
|
-
for (var i = 1; i <= iteration; i++) {
|
|
1454
|
-
var t = i * step;
|
|
1455
|
-
var x = cubicAt(x0, x1, x2, x3, t);
|
|
1456
|
-
var y = cubicAt(y0, y1, y2, y3, t);
|
|
1457
|
-
var dx = x - px;
|
|
1458
|
-
var dy = y - py;
|
|
1459
|
-
d += Math.sqrt(dx * dx + dy * dy);
|
|
1460
|
-
px = x;
|
|
1461
|
-
py = y;
|
|
1462
|
-
}
|
|
1463
|
-
return d;
|
|
1464
|
-
}
|
|
1465
|
-
function quadraticAt(p0, p1, p2, t) {
|
|
1466
|
-
var onet = 1 - t;
|
|
1467
|
-
return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
|
|
1468
|
-
}
|
|
1469
|
-
function quadraticDerivativeAt(p0, p1, p2, t) {
|
|
1470
|
-
return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
|
|
1471
|
-
}
|
|
1472
|
-
function quadraticRootAt(p0, p1, p2, val, roots) {
|
|
1473
|
-
var a = p0 - 2 * p1 + p2;
|
|
1474
|
-
var b = 2 * (p1 - p0);
|
|
1475
|
-
var c = p0 - val;
|
|
1476
|
-
var n = 0;
|
|
1477
|
-
if (isAroundZero$1(a)) {
|
|
1478
|
-
if (isNotAroundZero(b)) {
|
|
1479
|
-
var t1 = -c / b;
|
|
1480
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1481
|
-
}
|
|
1482
|
-
} else {
|
|
1483
|
-
var disc = b * b - 4 * a * c;
|
|
1484
|
-
if (isAroundZero$1(disc)) {
|
|
1485
|
-
var t1 = -b / (2 * a);
|
|
1486
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1487
|
-
} else if (disc > 0) {
|
|
1488
|
-
var discSqrt = mathSqrt(disc);
|
|
1489
|
-
var t1 = (-b + discSqrt) / (2 * a);
|
|
1490
|
-
var t2 = (-b - discSqrt) / (2 * a);
|
|
1491
|
-
if (t1 >= 0 && t1 <= 1) roots[n++] = t1;
|
|
1492
|
-
if (t2 >= 0 && t2 <= 1) roots[n++] = t2;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
return n;
|
|
1496
|
-
}
|
|
1497
|
-
function quadraticExtremum(p0, p1, p2) {
|
|
1498
|
-
var divider = p0 + p2 - 2 * p1;
|
|
1499
|
-
if (divider === 0) return .5;else return (p0 - p1) / divider;
|
|
1500
|
-
}
|
|
1501
|
-
function quadraticSubdivide(p0, p1, p2, t, out) {
|
|
1502
|
-
var p01 = (p1 - p0) * t + p0;
|
|
1503
|
-
var p12 = (p2 - p1) * t + p1;
|
|
1504
|
-
var p012 = (p12 - p01) * t + p01;
|
|
1505
|
-
out[0] = p0;
|
|
1506
|
-
out[1] = p01;
|
|
1507
|
-
out[2] = p012;
|
|
1508
|
-
out[3] = p012;
|
|
1509
|
-
out[4] = p12;
|
|
1510
|
-
out[5] = p2;
|
|
1511
|
-
}
|
|
1512
|
-
function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
|
|
1513
|
-
var t;
|
|
1514
|
-
var interval = .005;
|
|
1515
|
-
var d = Infinity;
|
|
1516
|
-
_v0[0] = x;
|
|
1517
|
-
_v0[1] = y;
|
|
1518
|
-
for (var _t = 0; _t < 1; _t += .05) {
|
|
1519
|
-
_v1[0] = quadraticAt(x0, x1, x2, _t);
|
|
1520
|
-
_v1[1] = quadraticAt(y0, y1, y2, _t);
|
|
1521
|
-
var d1 = distSquare(_v0, _v1);
|
|
1522
|
-
if (d1 < d) {
|
|
1523
|
-
t = _t;
|
|
1524
|
-
d = d1;
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
d = Infinity;
|
|
1528
|
-
for (var i = 0; i < 32; i++) {
|
|
1529
|
-
if (interval < EPSILON_NUMERIC) break;
|
|
1530
|
-
var prev = t - interval;
|
|
1531
|
-
var next = t + interval;
|
|
1532
|
-
_v1[0] = quadraticAt(x0, x1, x2, prev);
|
|
1533
|
-
_v1[1] = quadraticAt(y0, y1, y2, prev);
|
|
1534
|
-
var d1 = distSquare(_v1, _v0);
|
|
1535
|
-
if (prev >= 0 && d1 < d) {
|
|
1536
|
-
t = prev;
|
|
1537
|
-
d = d1;
|
|
1538
|
-
} else {
|
|
1539
|
-
_v2[0] = quadraticAt(x0, x1, x2, next);
|
|
1540
|
-
_v2[1] = quadraticAt(y0, y1, y2, next);
|
|
1541
|
-
var d2 = distSquare(_v2, _v0);
|
|
1542
|
-
if (next <= 1 && d2 < d) {
|
|
1543
|
-
t = next;
|
|
1544
|
-
d = d2;
|
|
1545
|
-
} else interval *= .5;
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
if (out) {
|
|
1549
|
-
out[0] = quadraticAt(x0, x1, x2, t);
|
|
1550
|
-
out[1] = quadraticAt(y0, y1, y2, t);
|
|
1551
|
-
}
|
|
1552
|
-
return mathSqrt(d);
|
|
1553
|
-
}
|
|
1554
|
-
function quadraticLength(x0, y0, x1, y1, x2, y2, iteration) {
|
|
1555
|
-
var px = x0;
|
|
1556
|
-
var py = y0;
|
|
1557
|
-
var d = 0;
|
|
1558
|
-
var step = 1 / iteration;
|
|
1559
|
-
for (var i = 1; i <= iteration; i++) {
|
|
1560
|
-
var t = i * step;
|
|
1561
|
-
var x = quadraticAt(x0, x1, x2, t);
|
|
1562
|
-
var y = quadraticAt(y0, y1, y2, t);
|
|
1563
|
-
var dx = x - px;
|
|
1564
|
-
var dy = y - py;
|
|
1565
|
-
d += Math.sqrt(dx * dx + dy * dy);
|
|
1566
|
-
px = x;
|
|
1567
|
-
py = y;
|
|
1568
|
-
}
|
|
1569
|
-
return d;
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
//#endregion
|
|
1573
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/animation/cubicEasing.js
|
|
1574
|
-
|
|
1575
|
-
function createCubicEasingFunc(cubicEasingStr) {
|
|
1576
|
-
var cubic = cubicEasingStr && regexp.exec(cubicEasingStr);
|
|
1577
|
-
if (cubic) {
|
|
1578
|
-
var points = cubic[1].split(",");
|
|
1579
|
-
var a_1 = +trim(points[0]);
|
|
1580
|
-
var b_1 = +trim(points[1]);
|
|
1581
|
-
var c_1 = +trim(points[2]);
|
|
1582
|
-
var d_1 = +trim(points[3]);
|
|
1583
|
-
if (isNaN(a_1 + b_1 + c_1 + d_1)) return;
|
|
1584
|
-
var roots_1 = [];
|
|
1585
|
-
return function (p) {
|
|
1586
|
-
return p <= 0 ? 0 : p >= 1 ? 1 : cubicRootAt(0, a_1, c_1, 1, p, roots_1) && cubicAt(0, b_1, d_1, 1, roots_1[0]);
|
|
1587
|
-
};
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
|
|
1591
|
-
//#endregion
|
|
1592
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/animation/Clip.js
|
|
1593
|
-
declare namespace color_exports {
|
|
1594
|
-
export { fastLerp, fastMapToColor, lerp, lift, liftColor, lum, mapToColor, modifyAlpha, modifyHSL, parse, parseCssFloat, parseCssInt, random, stringify, toHex };
|
|
1595
|
-
}
|
|
1596
|
-
function clampCssByte(i) {
|
|
1597
|
-
i = Math.round(i);
|
|
1598
|
-
return i < 0 ? 0 : i > 255 ? 255 : i;
|
|
1599
|
-
}
|
|
1600
|
-
function clampCssAngle(i) {
|
|
1601
|
-
i = Math.round(i);
|
|
1602
|
-
return i < 0 ? 0 : i > 360 ? 360 : i;
|
|
1603
|
-
}
|
|
1604
|
-
function clampCssFloat(f) {
|
|
1605
|
-
return f < 0 ? 0 : f > 1 ? 1 : f;
|
|
1606
|
-
}
|
|
1607
|
-
function parseCssInt(val) {
|
|
1608
|
-
var str = val;
|
|
1609
|
-
if (str.length && str.charAt(str.length - 1) === "%") return clampCssByte(parseFloat(str) / 100 * 255);
|
|
1610
|
-
return clampCssByte(parseInt(str, 10));
|
|
1611
|
-
}
|
|
1612
|
-
function parseCssFloat(val) {
|
|
1613
|
-
var str = val;
|
|
1614
|
-
if (str.length && str.charAt(str.length - 1) === "%") return clampCssFloat(parseFloat(str) / 100);
|
|
1615
|
-
return clampCssFloat(parseFloat(str));
|
|
1616
|
-
}
|
|
1617
|
-
function cssHueToRgb(m1, m2, h) {
|
|
1618
|
-
if (h < 0) h += 1;else if (h > 1) h -= 1;
|
|
1619
|
-
if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
|
|
1620
|
-
if (h * 2 < 1) return m2;
|
|
1621
|
-
if (h * 3 < 2) return m1 + (m2 - m1) * (2 / 3 - h) * 6;
|
|
1622
|
-
return m1;
|
|
1623
|
-
}
|
|
1624
|
-
function lerpNumber(a, b, p) {
|
|
1625
|
-
return a + (b - a) * p;
|
|
1626
|
-
}
|
|
1627
|
-
function setRgba(out, r, g, b, a) {
|
|
1628
|
-
out[0] = r;
|
|
1629
|
-
out[1] = g;
|
|
1630
|
-
out[2] = b;
|
|
1631
|
-
out[3] = a;
|
|
1632
|
-
return out;
|
|
1633
|
-
}
|
|
1634
|
-
function copyRgba(out, a) {
|
|
1635
|
-
out[0] = a[0];
|
|
1636
|
-
out[1] = a[1];
|
|
1637
|
-
out[2] = a[2];
|
|
1638
|
-
out[3] = a[3];
|
|
1639
|
-
return out;
|
|
1640
|
-
}
|
|
1641
|
-
function putToCache(colorStr, rgbaArr) {
|
|
1642
|
-
if (lastRemovedArr) copyRgba(lastRemovedArr, rgbaArr);
|
|
1643
|
-
lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || rgbaArr.slice());
|
|
1644
|
-
}
|
|
1645
|
-
function parse(colorStr, rgbaArr) {
|
|
1646
|
-
if (!colorStr) return;
|
|
1647
|
-
rgbaArr = rgbaArr || [];
|
|
1648
|
-
var cached = colorCache.get(colorStr);
|
|
1649
|
-
if (cached) return copyRgba(rgbaArr, cached);
|
|
1650
|
-
colorStr = colorStr + "";
|
|
1651
|
-
var str = colorStr.replace(/ /g, "").toLowerCase();
|
|
1652
|
-
if (str in kCSSColorTable) {
|
|
1653
|
-
copyRgba(rgbaArr, kCSSColorTable[str]);
|
|
1654
|
-
putToCache(colorStr, rgbaArr);
|
|
1655
|
-
return rgbaArr;
|
|
1656
|
-
}
|
|
1657
|
-
var strLen = str.length;
|
|
1658
|
-
if (str.charAt(0) === "#") {
|
|
1659
|
-
if (strLen === 4 || strLen === 5) {
|
|
1660
|
-
var iv = parseInt(str.slice(1, 4), 16);
|
|
1661
|
-
if (!(iv >= 0 && iv <= 4095)) {
|
|
1662
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
setRgba(rgbaArr, (iv & 3840) >> 4 | (iv & 3840) >> 8, iv & 240 | (iv & 240) >> 4, iv & 15 | (iv & 15) << 4, strLen === 5 ? parseInt(str.slice(4), 16) / 15 : 1);
|
|
1666
|
-
putToCache(colorStr, rgbaArr);
|
|
1667
|
-
return rgbaArr;
|
|
1668
|
-
} else if (strLen === 7 || strLen === 9) {
|
|
1669
|
-
var iv = parseInt(str.slice(1, 7), 16);
|
|
1670
|
-
if (!(iv >= 0 && iv <= 16777215)) {
|
|
1671
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
setRgba(rgbaArr, (iv & 16711680) >> 16, (iv & 65280) >> 8, iv & 255, strLen === 9 ? parseInt(str.slice(7), 16) / 255 : 1);
|
|
1675
|
-
putToCache(colorStr, rgbaArr);
|
|
1676
|
-
return rgbaArr;
|
|
1677
|
-
}
|
|
1678
|
-
return;
|
|
1679
|
-
}
|
|
1680
|
-
var op = str.indexOf("(");
|
|
1681
|
-
var ep = str.indexOf(")");
|
|
1682
|
-
if (op !== -1 && ep + 1 === strLen) {
|
|
1683
|
-
var fname = str.substr(0, op);
|
|
1684
|
-
var params = str.substr(op + 1, ep - (op + 1)).split(",");
|
|
1685
|
-
var alpha = 1;
|
|
1686
|
-
switch (fname) {
|
|
1687
|
-
case "rgba":
|
|
1688
|
-
if (params.length !== 4) return params.length === 3 ? setRgba(rgbaArr, +params[0], +params[1], +params[2], 1) : setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1689
|
-
alpha = parseCssFloat(params.pop());
|
|
1690
|
-
case "rgb":
|
|
1691
|
-
if (params.length >= 3) {
|
|
1692
|
-
setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), params.length === 3 ? alpha : parseCssFloat(params[3]));
|
|
1693
|
-
putToCache(colorStr, rgbaArr);
|
|
1694
|
-
return rgbaArr;
|
|
1695
|
-
} else {
|
|
1696
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
case "hsla":
|
|
1700
|
-
if (params.length !== 4) {
|
|
1701
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1702
|
-
return;
|
|
1703
|
-
}
|
|
1704
|
-
params[3] = parseCssFloat(params[3]);
|
|
1705
|
-
hsla2rgba(params, rgbaArr);
|
|
1706
|
-
putToCache(colorStr, rgbaArr);
|
|
1707
|
-
return rgbaArr;
|
|
1708
|
-
case "hsl":
|
|
1709
|
-
if (params.length !== 3) {
|
|
1710
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
hsla2rgba(params, rgbaArr);
|
|
1714
|
-
putToCache(colorStr, rgbaArr);
|
|
1715
|
-
return rgbaArr;
|
|
1716
|
-
default:
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
setRgba(rgbaArr, 0, 0, 0, 1);
|
|
1721
|
-
}
|
|
1722
|
-
function hsla2rgba(hsla, rgba) {
|
|
1723
|
-
var h = (parseFloat(hsla[0]) % 360 + 360) % 360 / 360;
|
|
1724
|
-
var s = parseCssFloat(hsla[1]);
|
|
1725
|
-
var l = parseCssFloat(hsla[2]);
|
|
1726
|
-
var m2 = l <= .5 ? l * (s + 1) : l + s - l * s;
|
|
1727
|
-
var m1 = l * 2 - m2;
|
|
1728
|
-
rgba = rgba || [];
|
|
1729
|
-
setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1);
|
|
1730
|
-
if (hsla.length === 4) rgba[3] = hsla[3];
|
|
1731
|
-
return rgba;
|
|
1732
|
-
}
|
|
1733
|
-
function rgba2hsla(rgba) {
|
|
1734
|
-
if (!rgba) return;
|
|
1735
|
-
var R = rgba[0] / 255;
|
|
1736
|
-
var G = rgba[1] / 255;
|
|
1737
|
-
var B = rgba[2] / 255;
|
|
1738
|
-
var vMin = Math.min(R, G, B);
|
|
1739
|
-
var vMax = Math.max(R, G, B);
|
|
1740
|
-
var delta = vMax - vMin;
|
|
1741
|
-
var L = (vMax + vMin) / 2;
|
|
1742
|
-
var H;
|
|
1743
|
-
var S;
|
|
1744
|
-
if (delta === 0) {
|
|
1745
|
-
H = 0;
|
|
1746
|
-
S = 0;
|
|
1747
|
-
} else {
|
|
1748
|
-
if (L < .5) S = delta / (vMax + vMin);else S = delta / (2 - vMax - vMin);
|
|
1749
|
-
var deltaR = ((vMax - R) / 6 + delta / 2) / delta;
|
|
1750
|
-
var deltaG = ((vMax - G) / 6 + delta / 2) / delta;
|
|
1751
|
-
var deltaB = ((vMax - B) / 6 + delta / 2) / delta;
|
|
1752
|
-
if (R === vMax) H = deltaB - deltaG;else if (G === vMax) H = 1 / 3 + deltaR - deltaB;else if (B === vMax) H = 2 / 3 + deltaG - deltaR;
|
|
1753
|
-
if (H < 0) H += 1;
|
|
1754
|
-
if (H > 1) H -= 1;
|
|
1755
|
-
}
|
|
1756
|
-
var hsla = [H * 360, S, L];
|
|
1757
|
-
if (rgba[3] != null) hsla.push(rgba[3]);
|
|
1758
|
-
return hsla;
|
|
1759
|
-
}
|
|
1760
|
-
function lift(color, level) {
|
|
1761
|
-
var colorArr = parse(color);
|
|
1762
|
-
if (colorArr) {
|
|
1763
|
-
for (var i = 0; i < 3; i++) {
|
|
1764
|
-
if (level < 0) colorArr[i] = colorArr[i] * (1 - level) | 0;else colorArr[i] = (255 - colorArr[i]) * level + colorArr[i] | 0;
|
|
1765
|
-
if (colorArr[i] > 255) colorArr[i] = 255;else if (colorArr[i] < 0) colorArr[i] = 0;
|
|
1766
|
-
}
|
|
1767
|
-
return stringify(colorArr, colorArr.length === 4 ? "rgba" : "rgb");
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
function toHex(color) {
|
|
1771
|
-
var colorArr = parse(color);
|
|
1772
|
-
if (colorArr) return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + +colorArr[2]).toString(16).slice(1);
|
|
1773
|
-
}
|
|
1774
|
-
function fastLerp(normalizedValue, colors, out) {
|
|
1775
|
-
if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) return;
|
|
1776
|
-
out = out || [];
|
|
1777
|
-
var value = normalizedValue * (colors.length - 1);
|
|
1778
|
-
var leftIndex = Math.floor(value);
|
|
1779
|
-
var rightIndex = Math.ceil(value);
|
|
1780
|
-
var leftColor = colors[leftIndex];
|
|
1781
|
-
var rightColor = colors[rightIndex];
|
|
1782
|
-
var dv = value - leftIndex;
|
|
1783
|
-
out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));
|
|
1784
|
-
out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));
|
|
1785
|
-
out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));
|
|
1786
|
-
out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));
|
|
1787
|
-
return out;
|
|
1788
|
-
}
|
|
1789
|
-
function lerp(normalizedValue, colors, fullOutput) {
|
|
1790
|
-
if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) return;
|
|
1791
|
-
var value = normalizedValue * (colors.length - 1);
|
|
1792
|
-
var leftIndex = Math.floor(value);
|
|
1793
|
-
var rightIndex = Math.ceil(value);
|
|
1794
|
-
var leftColor = parse(colors[leftIndex]);
|
|
1795
|
-
var rightColor = parse(colors[rightIndex]);
|
|
1796
|
-
var dv = value - leftIndex;
|
|
1797
|
-
var color = stringify([clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)), clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)), clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)), clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))], "rgba");
|
|
1798
|
-
return fullOutput ? {
|
|
1799
|
-
color,
|
|
1800
|
-
leftIndex,
|
|
1801
|
-
rightIndex,
|
|
1802
|
-
value
|
|
1803
|
-
} : color;
|
|
1804
|
-
}
|
|
1805
|
-
function modifyHSL(color, h, s, l) {
|
|
1806
|
-
var colorArr = parse(color);
|
|
1807
|
-
if (color) {
|
|
1808
|
-
colorArr = rgba2hsla(colorArr);
|
|
1809
|
-
h != null && (colorArr[0] = clampCssAngle(isFunction(h) ? h(colorArr[0]) : h));
|
|
1810
|
-
s != null && (colorArr[1] = parseCssFloat(isFunction(s) ? s(colorArr[1]) : s));
|
|
1811
|
-
l != null && (colorArr[2] = parseCssFloat(isFunction(l) ? l(colorArr[2]) : l));
|
|
1812
|
-
return stringify(hsla2rgba(colorArr), "rgba");
|
|
1813
|
-
}
|
|
1814
|
-
}
|
|
1815
|
-
function modifyAlpha(color, alpha) {
|
|
1816
|
-
var colorArr = parse(color);
|
|
1817
|
-
if (colorArr && alpha != null) {
|
|
1818
|
-
colorArr[3] = clampCssFloat(alpha);
|
|
1819
|
-
return stringify(colorArr, "rgba");
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
function stringify(arrColor, type) {
|
|
1823
|
-
if (!arrColor || !arrColor.length) return;
|
|
1824
|
-
var colorStr = arrColor[0] + "," + arrColor[1] + "," + arrColor[2];
|
|
1825
|
-
if (type === "rgba" || type === "hsva" || type === "hsla") colorStr += "," + arrColor[3];
|
|
1826
|
-
return type + "(" + colorStr + ")";
|
|
1827
|
-
}
|
|
1828
|
-
function lum(color, backgroundLum) {
|
|
1829
|
-
var arr = parse(color);
|
|
1830
|
-
return arr ? (.299 * arr[0] + .587 * arr[1] + .114 * arr[2]) * arr[3] / 255 + (1 - arr[3]) * backgroundLum : 0;
|
|
1831
|
-
}
|
|
1832
|
-
function random() {
|
|
1833
|
-
return stringify([Math.round(Math.random() * 255), Math.round(Math.random() * 255), Math.round(Math.random() * 255)], "rgb");
|
|
1834
|
-
}
|
|
1835
|
-
function liftColor(color) {
|
|
1836
|
-
if (isString(color)) {
|
|
1837
|
-
var liftedColor = liftedColorCache.get(color);
|
|
1838
|
-
if (!liftedColor) {
|
|
1839
|
-
liftedColor = lift(color, -.1);
|
|
1840
|
-
liftedColorCache.put(color, liftedColor);
|
|
1841
|
-
}
|
|
1842
|
-
return liftedColor;
|
|
1843
|
-
} else if (isGradientObject(color)) {
|
|
1844
|
-
var ret = extend({}, color);
|
|
1845
|
-
ret.colorStops = map(color.colorStops, function (stop) {
|
|
1846
|
-
return {
|
|
1847
|
-
offset: stop.offset,
|
|
1848
|
-
color: lift(stop.color, -.1)
|
|
1849
|
-
};
|
|
1850
|
-
});
|
|
1851
|
-
return ret;
|
|
1852
|
-
}
|
|
1853
|
-
return color;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
//#endregion
|
|
1857
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/svg/helper.js
|
|
1858
|
-
|
|
1859
|
-
function normalizeColor(color) {
|
|
1860
|
-
var opacity;
|
|
1861
|
-
if (!color || color === "transparent") color = "none";else if (typeof color === "string" && color.indexOf("rgba") > -1) {
|
|
1862
|
-
var arr = parse(color);
|
|
1863
|
-
if (arr) {
|
|
1864
|
-
color = "rgb(" + arr[0] + "," + arr[1] + "," + arr[2] + ")";
|
|
1865
|
-
opacity = arr[3];
|
|
1866
|
-
}
|
|
1867
|
-
}
|
|
1868
|
-
return {
|
|
1869
|
-
color,
|
|
1870
|
-
opacity: opacity == null ? 1 : opacity
|
|
1871
|
-
};
|
|
1872
|
-
}
|
|
1873
|
-
function isAroundZero(transform) {
|
|
1874
|
-
return transform < EPSILON$1 && transform > -EPSILON$1;
|
|
1875
|
-
}
|
|
1876
|
-
function round3(transform) {
|
|
1877
|
-
return mathRound(transform * 1e3) / 1e3;
|
|
1878
|
-
}
|
|
1879
|
-
function round4(transform) {
|
|
1880
|
-
return mathRound(transform * 1e4) / 1e4;
|
|
1881
|
-
}
|
|
1882
|
-
function getMatrixStr(m) {
|
|
1883
|
-
return "matrix(" + round3(m[0]) + "," + round3(m[1]) + "," + round3(m[2]) + "," + round3(m[3]) + "," + round4(m[4]) + "," + round4(m[5]) + ")";
|
|
1884
|
-
}
|
|
1885
|
-
function adjustTextY(y, lineHeight, textBaseline) {
|
|
1886
|
-
if (textBaseline === "top") y += lineHeight / 2;else if (textBaseline === "bottom") y -= lineHeight / 2;
|
|
1887
|
-
return y;
|
|
1888
|
-
}
|
|
1889
|
-
function hasShadow(style) {
|
|
1890
|
-
return style && (style.shadowBlur || style.shadowOffsetX || style.shadowOffsetY);
|
|
1891
|
-
}
|
|
1892
|
-
function getShadowKey(displayable) {
|
|
1893
|
-
var style = displayable.style;
|
|
1894
|
-
var globalScale = displayable.getGlobalScale();
|
|
1895
|
-
return [style.shadowColor, (style.shadowBlur || 0).toFixed(2), (style.shadowOffsetX || 0).toFixed(2), (style.shadowOffsetY || 0).toFixed(2), globalScale[0], globalScale[1]].join(",");
|
|
1896
|
-
}
|
|
1897
|
-
function isImagePattern(val) {
|
|
1898
|
-
return val && !!val.image;
|
|
1899
|
-
}
|
|
1900
|
-
function isSVGPattern(val) {
|
|
1901
|
-
return val && !!val.svgElement;
|
|
1902
|
-
}
|
|
1903
|
-
function isPattern(val) {
|
|
1904
|
-
return isImagePattern(val) || isSVGPattern(val);
|
|
1905
|
-
}
|
|
1906
|
-
function isLinearGradient(val) {
|
|
1907
|
-
return val.type === "linear";
|
|
1908
|
-
}
|
|
1909
|
-
function isRadialGradient(val) {
|
|
1910
|
-
return val.type === "radial";
|
|
1911
|
-
}
|
|
1912
|
-
function isGradient(val) {
|
|
1913
|
-
return val && (val.type === "linear" || val.type === "radial");
|
|
1914
|
-
}
|
|
1915
|
-
function getIdURL(id) {
|
|
1916
|
-
return "url(#" + id + ")";
|
|
1917
|
-
}
|
|
1918
|
-
function getPathPrecision(el) {
|
|
1919
|
-
var scale = el.getGlobalScale();
|
|
1920
|
-
var size = Math.max(scale[0], scale[1]);
|
|
1921
|
-
return Math.max(Math.ceil(Math.log(size) / Math.log(10)), 1);
|
|
1922
|
-
}
|
|
1923
|
-
function getSRTTransformString(transform) {
|
|
1924
|
-
var x = transform.x || 0;
|
|
1925
|
-
var y = transform.y || 0;
|
|
1926
|
-
var rotation = (transform.rotation || 0) * RADIAN_TO_DEGREE;
|
|
1927
|
-
var scaleX = retrieve2(transform.scaleX, 1);
|
|
1928
|
-
var scaleY = retrieve2(transform.scaleY, 1);
|
|
1929
|
-
var skewX = transform.skewX || 0;
|
|
1930
|
-
var skewY = transform.skewY || 0;
|
|
1931
|
-
var res = [];
|
|
1932
|
-
if (x || y) res.push("translate(" + x + "px," + y + "px)");
|
|
1933
|
-
if (rotation) res.push("rotate(" + rotation + ")");
|
|
1934
|
-
if (scaleX !== 1 || scaleY !== 1) res.push("scale(" + scaleX + "," + scaleY + ")");
|
|
1935
|
-
if (skewX || skewY) res.push("skew(" + mathRound(skewX * RADIAN_TO_DEGREE) + "deg, " + mathRound(skewY * RADIAN_TO_DEGREE) + "deg)");
|
|
1936
|
-
return res.join(" ");
|
|
1937
|
-
}
|
|
1938
|
-
function interpolateNumber(p0, p1, percent) {
|
|
1939
|
-
return (p1 - p0) * percent + p0;
|
|
1940
|
-
}
|
|
1941
|
-
function interpolate1DArray(out, p0, p1, percent) {
|
|
1942
|
-
var len = p0.length;
|
|
1943
|
-
for (var i = 0; i < len; i++) out[i] = interpolateNumber(p0[i], p1[i], percent);
|
|
1944
|
-
return out;
|
|
1945
|
-
}
|
|
1946
|
-
function interpolate2DArray(out, p0, p1, percent) {
|
|
1947
|
-
var len = p0.length;
|
|
1948
|
-
var len2 = len && p0[0].length;
|
|
1949
|
-
for (var i = 0; i < len; i++) {
|
|
1950
|
-
if (!out[i]) out[i] = [];
|
|
1951
|
-
for (var j = 0; j < len2; j++) out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent);
|
|
1952
|
-
}
|
|
1953
|
-
return out;
|
|
1954
|
-
}
|
|
1955
|
-
function add1DArray(out, p0, p1, sign) {
|
|
1956
|
-
var len = p0.length;
|
|
1957
|
-
for (var i = 0; i < len; i++) out[i] = p0[i] + p1[i] * sign;
|
|
1958
|
-
return out;
|
|
1959
|
-
}
|
|
1960
|
-
function add2DArray(out, p0, p1, sign) {
|
|
1961
|
-
var len = p0.length;
|
|
1962
|
-
var len2 = len && p0[0].length;
|
|
1963
|
-
for (var i = 0; i < len; i++) {
|
|
1964
|
-
if (!out[i]) out[i] = [];
|
|
1965
|
-
for (var j = 0; j < len2; j++) out[i][j] = p0[i][j] + p1[i][j] * sign;
|
|
1966
|
-
}
|
|
1967
|
-
return out;
|
|
1968
|
-
}
|
|
1969
|
-
function fillColorStops(val0, val1) {
|
|
1970
|
-
var len0 = val0.length;
|
|
1971
|
-
var len1 = val1.length;
|
|
1972
|
-
var shorterArr = len0 > len1 ? val1 : val0;
|
|
1973
|
-
var shorterLen = Math.min(len0, len1);
|
|
1974
|
-
var last = shorterArr[shorterLen - 1] || {
|
|
1975
|
-
color: [0, 0, 0, 0],
|
|
1976
|
-
offset: 0
|
|
1977
|
-
};
|
|
1978
|
-
for (var i = shorterLen; i < Math.max(len0, len1); i++) shorterArr.push({
|
|
1979
|
-
offset: last.offset,
|
|
1980
|
-
color: last.color.slice()
|
|
1981
|
-
});
|
|
1982
|
-
}
|
|
1983
|
-
function fillArray(val0, val1, arrDim) {
|
|
1984
|
-
var arr0 = val0;
|
|
1985
|
-
var arr1 = val1;
|
|
1986
|
-
if (!arr0.push || !arr1.push) return;
|
|
1987
|
-
var arr0Len = arr0.length;
|
|
1988
|
-
var arr1Len = arr1.length;
|
|
1989
|
-
if (arr0Len !== arr1Len) if (arr0Len > arr1Len) arr0.length = arr1Len;else for (var i = arr0Len; i < arr1Len; i++) arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i]));
|
|
1990
|
-
var len2 = arr0[0] && arr0[0].length;
|
|
1991
|
-
for (var i = 0; i < arr0.length; i++) if (arrDim === 1) {
|
|
1992
|
-
if (isNaN(arr0[i])) arr0[i] = arr1[i];
|
|
1993
|
-
} else for (var j = 0; j < len2; j++) if (isNaN(arr0[i][j])) arr0[i][j] = arr1[i][j];
|
|
1994
|
-
}
|
|
1995
|
-
function cloneValue(value) {
|
|
1996
|
-
if (isArrayLike(value)) {
|
|
1997
|
-
var len = value.length;
|
|
1998
|
-
if (isArrayLike(value[0])) {
|
|
1999
|
-
var ret = [];
|
|
2000
|
-
for (var i = 0; i < len; i++) ret.push(arraySlice.call(value[i]));
|
|
2001
|
-
return ret;
|
|
2002
|
-
}
|
|
2003
|
-
return arraySlice.call(value);
|
|
2004
|
-
}
|
|
2005
|
-
return value;
|
|
2006
|
-
}
|
|
2007
|
-
function rgba2String(rgba) {
|
|
2008
|
-
rgba[0] = Math.floor(rgba[0]) || 0;
|
|
2009
|
-
rgba[1] = Math.floor(rgba[1]) || 0;
|
|
2010
|
-
rgba[2] = Math.floor(rgba[2]) || 0;
|
|
2011
|
-
rgba[3] = rgba[3] == null ? 1 : rgba[3];
|
|
2012
|
-
return "rgba(" + rgba.join(",") + ")";
|
|
2013
|
-
}
|
|
2014
|
-
function guessArrayDim(value) {
|
|
2015
|
-
return isArrayLike(value && value[0]) ? 2 : 1;
|
|
2016
|
-
}
|
|
2017
|
-
function isGradientValueType(valType) {
|
|
2018
|
-
return valType === VALUE_TYPE_LINEAR_GRADIENT || valType === VALUE_TYPE_RADIAL_GRADIENT;
|
|
2019
|
-
}
|
|
2020
|
-
function isArrayValueType(valType) {
|
|
2021
|
-
return valType === VALUE_TYPE_1D_ARRAY || valType === VALUE_TYPE_2D_ARRAY;
|
|
2022
|
-
}
|
|
2023
|
-
if (env.hasGlobalWindow) dpr = Math.max(window.devicePixelRatio || window.screen && window.screen.deviceXDPI / window.screen.logicalXDPI || 1, 1);
|
|
2024
|
-
function animateTo(animatable, target, cfg, animationProps, reverse) {
|
|
2025
|
-
cfg = cfg || {};
|
|
2026
|
-
var animators = [];
|
|
2027
|
-
animateToShallow(animatable, "", animatable, target, cfg, animationProps, animators, reverse);
|
|
2028
|
-
var finishCount = animators.length;
|
|
2029
|
-
var doneHappened = false;
|
|
2030
|
-
var cfgDone = cfg.done;
|
|
2031
|
-
var cfgAborted = cfg.aborted;
|
|
2032
|
-
var doneCb = function () {
|
|
2033
|
-
doneHappened = true;
|
|
2034
|
-
finishCount--;
|
|
2035
|
-
if (finishCount <= 0) doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
|
|
2036
|
-
};
|
|
2037
|
-
var abortedCb = function () {
|
|
2038
|
-
finishCount--;
|
|
2039
|
-
if (finishCount <= 0) doneHappened ? cfgDone && cfgDone() : cfgAborted && cfgAborted();
|
|
2040
|
-
};
|
|
2041
|
-
if (!finishCount) cfgDone && cfgDone();
|
|
2042
|
-
if (animators.length > 0 && cfg.during) animators[0].during(function (target, percent) {
|
|
2043
|
-
cfg.during(percent);
|
|
2044
|
-
});
|
|
2045
|
-
for (var i = 0; i < animators.length; i++) {
|
|
2046
|
-
var animator = animators[i];
|
|
2047
|
-
if (doneCb) animator.done(doneCb);
|
|
2048
|
-
if (abortedCb) animator.aborted(abortedCb);
|
|
2049
|
-
if (cfg.force) animator.duration(cfg.duration);
|
|
2050
|
-
animator.start(cfg.easing);
|
|
2051
|
-
}
|
|
2052
|
-
return animators;
|
|
2053
|
-
}
|
|
2054
|
-
function copyArrShallow(source, target, len) {
|
|
2055
|
-
for (var i = 0; i < len; i++) source[i] = target[i];
|
|
2056
|
-
}
|
|
2057
|
-
function is2DArray(value) {
|
|
2058
|
-
return isArrayLike(value[0]);
|
|
2059
|
-
}
|
|
2060
|
-
function copyValue(target, source, key) {
|
|
2061
|
-
if (isArrayLike(source[key])) {
|
|
2062
|
-
if (!isArrayLike(target[key])) target[key] = [];
|
|
2063
|
-
if (isTypedArray(source[key])) {
|
|
2064
|
-
var len = source[key].length;
|
|
2065
|
-
if (target[key].length !== len) {
|
|
2066
|
-
target[key] = new source[key].constructor(len);
|
|
2067
|
-
copyArrShallow(target[key], source[key], len);
|
|
2068
|
-
}
|
|
2069
|
-
} else {
|
|
2070
|
-
var sourceArr = source[key];
|
|
2071
|
-
var targetArr = target[key];
|
|
2072
|
-
var len0 = sourceArr.length;
|
|
2073
|
-
if (is2DArray(sourceArr)) {
|
|
2074
|
-
var len1 = sourceArr[0].length;
|
|
2075
|
-
for (var i = 0; i < len0; i++) if (!targetArr[i]) targetArr[i] = Array.prototype.slice.call(sourceArr[i]);else copyArrShallow(targetArr[i], sourceArr[i], len1);
|
|
2076
|
-
} else copyArrShallow(targetArr, sourceArr, len0);
|
|
2077
|
-
targetArr.length = sourceArr.length;
|
|
2078
|
-
}
|
|
2079
|
-
} else target[key] = source[key];
|
|
2080
|
-
}
|
|
2081
|
-
function isValueSame(val1, val2) {
|
|
2082
|
-
return val1 === val2 || isArrayLike(val1) && isArrayLike(val2) && is1DArraySame(val1, val2);
|
|
2083
|
-
}
|
|
2084
|
-
function is1DArraySame(arr0, arr1) {
|
|
2085
|
-
var len = arr0.length;
|
|
2086
|
-
if (len !== arr1.length) return false;
|
|
2087
|
-
for (var i = 0; i < len; i++) if (arr0[i] !== arr1[i]) return false;
|
|
2088
|
-
return true;
|
|
2089
|
-
}
|
|
2090
|
-
function animateToShallow(animatable, topKey, animateObj, target, cfg, animationProps, animators, reverse) {
|
|
2091
|
-
var targetKeys = keys(target);
|
|
2092
|
-
var duration = cfg.duration;
|
|
2093
|
-
var delay = cfg.delay;
|
|
2094
|
-
var additive = cfg.additive;
|
|
2095
|
-
var setToFinal = cfg.setToFinal;
|
|
2096
|
-
var animateAll = !isObject(animationProps);
|
|
2097
|
-
var existsAnimators = animatable.animators;
|
|
2098
|
-
var animationKeys = [];
|
|
2099
|
-
for (var k = 0; k < targetKeys.length; k++) {
|
|
2100
|
-
var innerKey = targetKeys[k];
|
|
2101
|
-
var targetVal = target[innerKey];
|
|
2102
|
-
if (targetVal != null && animateObj[innerKey] != null && (animateAll || animationProps[innerKey])) {
|
|
2103
|
-
if (isObject(targetVal) && !isArrayLike(targetVal) && !isGradientObject(targetVal)) {
|
|
2104
|
-
if (topKey) {
|
|
2105
|
-
if (!reverse) {
|
|
2106
|
-
animateObj[innerKey] = targetVal;
|
|
2107
|
-
animatable.updateDuringAnimation(topKey);
|
|
2108
|
-
}
|
|
2109
|
-
continue;
|
|
2110
|
-
}
|
|
2111
|
-
animateToShallow(animatable, innerKey, animateObj[innerKey], targetVal, cfg, animationProps && animationProps[innerKey], animators, reverse);
|
|
2112
|
-
} else animationKeys.push(innerKey);
|
|
2113
|
-
} else if (!reverse) {
|
|
2114
|
-
animateObj[innerKey] = targetVal;
|
|
2115
|
-
animatable.updateDuringAnimation(topKey);
|
|
2116
|
-
animationKeys.push(innerKey);
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
var keyLen = animationKeys.length;
|
|
2120
|
-
if (!additive && keyLen) for (var i = 0; i < existsAnimators.length; i++) {
|
|
2121
|
-
var animator = existsAnimators[i];
|
|
2122
|
-
if (animator.targetName === topKey) {
|
|
2123
|
-
if (animator.stopTracks(animationKeys)) {
|
|
2124
|
-
var idx = indexOf(existsAnimators, animator);
|
|
2125
|
-
existsAnimators.splice(idx, 1);
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
}
|
|
2129
|
-
if (!cfg.force) {
|
|
2130
|
-
animationKeys = filter(animationKeys, function (key) {
|
|
2131
|
-
return !isValueSame(target[key], animateObj[key]);
|
|
2132
|
-
});
|
|
2133
|
-
keyLen = animationKeys.length;
|
|
2134
|
-
}
|
|
2135
|
-
if (keyLen > 0 || cfg.force && !animators.length) {
|
|
2136
|
-
var revertedSource = void 0;
|
|
2137
|
-
var reversedTarget = void 0;
|
|
2138
|
-
var sourceClone = void 0;
|
|
2139
|
-
if (reverse) {
|
|
2140
|
-
reversedTarget = {};
|
|
2141
|
-
if (setToFinal) revertedSource = {};
|
|
2142
|
-
for (var i = 0; i < keyLen; i++) {
|
|
2143
|
-
var innerKey = animationKeys[i];
|
|
2144
|
-
reversedTarget[innerKey] = animateObj[innerKey];
|
|
2145
|
-
if (setToFinal) revertedSource[innerKey] = target[innerKey];else animateObj[innerKey] = target[innerKey];
|
|
2146
|
-
}
|
|
2147
|
-
} else if (setToFinal) {
|
|
2148
|
-
sourceClone = {};
|
|
2149
|
-
for (var i = 0; i < keyLen; i++) {
|
|
2150
|
-
var innerKey = animationKeys[i];
|
|
2151
|
-
sourceClone[innerKey] = cloneValue(animateObj[innerKey]);
|
|
2152
|
-
copyValue(animateObj, target, innerKey);
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
var animator = new Animator(animateObj, false, false, additive ? filter(existsAnimators, function (animator) {
|
|
2156
|
-
return animator.targetName === topKey;
|
|
2157
|
-
}) : null);
|
|
2158
|
-
animator.targetName = topKey;
|
|
2159
|
-
if (cfg.scope) animator.scope = cfg.scope;
|
|
2160
|
-
if (setToFinal && revertedSource) animator.whenWithKeys(0, revertedSource, animationKeys);
|
|
2161
|
-
if (sourceClone) animator.whenWithKeys(0, sourceClone, animationKeys);
|
|
2162
|
-
animator.whenWithKeys(duration == null ? 500 : duration, reverse ? reversedTarget : target, animationKeys).delay(delay || 0);
|
|
2163
|
-
animatable.addAnimator(animator, topKey);
|
|
2164
|
-
animators.push(animator);
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
//#endregion
|
|
2169
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/Displayable.js
|
|
2170
|
-
|
|
2171
|
-
function isDisplayableCulled(el, width, height) {
|
|
2172
|
-
tmpRect$1.copy(el.getBoundingRect());
|
|
2173
|
-
if (el.transform) tmpRect$1.applyTransform(el.transform);
|
|
2174
|
-
viewRect.width = width;
|
|
2175
|
-
viewRect.height = height;
|
|
2176
|
-
return !tmpRect$1.intersect(viewRect);
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
//#endregion
|
|
2180
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/bbox.js
|
|
2181
|
-
|
|
2182
|
-
function fromPoints(points, min, max) {
|
|
2183
|
-
if (points.length === 0) return;
|
|
2184
|
-
var p = points[0];
|
|
2185
|
-
var left = p[0];
|
|
2186
|
-
var right = p[0];
|
|
2187
|
-
var top = p[1];
|
|
2188
|
-
var bottom = p[1];
|
|
2189
|
-
for (var i = 1; i < points.length; i++) {
|
|
2190
|
-
p = points[i];
|
|
2191
|
-
left = mathMin$1(left, p[0]);
|
|
2192
|
-
right = mathMax$1(right, p[0]);
|
|
2193
|
-
top = mathMin$1(top, p[1]);
|
|
2194
|
-
bottom = mathMax$1(bottom, p[1]);
|
|
2195
|
-
}
|
|
2196
|
-
min[0] = left;
|
|
2197
|
-
min[1] = top;
|
|
2198
|
-
max[0] = right;
|
|
2199
|
-
max[1] = bottom;
|
|
2200
|
-
}
|
|
2201
|
-
function fromLine(x0, y0, x1, y1, min, max) {
|
|
2202
|
-
min[0] = mathMin$1(x0, x1);
|
|
2203
|
-
min[1] = mathMin$1(y0, y1);
|
|
2204
|
-
max[0] = mathMax$1(x0, x1);
|
|
2205
|
-
max[1] = mathMax$1(y0, y1);
|
|
2206
|
-
}
|
|
2207
|
-
function fromCubic(x0, y0, x1, y1, x2, y2, x3, y3, min, max) {
|
|
2208
|
-
var cubicExtrema$1 = cubicExtrema;
|
|
2209
|
-
var cubicAt$1 = cubicAt;
|
|
2210
|
-
var n = cubicExtrema$1(x0, x1, x2, x3, xDim);
|
|
2211
|
-
min[0] = Infinity;
|
|
2212
|
-
min[1] = Infinity;
|
|
2213
|
-
max[0] = -Infinity;
|
|
2214
|
-
max[1] = -Infinity;
|
|
2215
|
-
for (var i = 0; i < n; i++) {
|
|
2216
|
-
var x = cubicAt$1(x0, x1, x2, x3, xDim[i]);
|
|
2217
|
-
min[0] = mathMin$1(x, min[0]);
|
|
2218
|
-
max[0] = mathMax$1(x, max[0]);
|
|
2219
|
-
}
|
|
2220
|
-
n = cubicExtrema$1(y0, y1, y2, y3, yDim);
|
|
2221
|
-
for (var i = 0; i < n; i++) {
|
|
2222
|
-
var y = cubicAt$1(y0, y1, y2, y3, yDim[i]);
|
|
2223
|
-
min[1] = mathMin$1(y, min[1]);
|
|
2224
|
-
max[1] = mathMax$1(y, max[1]);
|
|
2225
|
-
}
|
|
2226
|
-
min[0] = mathMin$1(x0, min[0]);
|
|
2227
|
-
max[0] = mathMax$1(x0, max[0]);
|
|
2228
|
-
min[0] = mathMin$1(x3, min[0]);
|
|
2229
|
-
max[0] = mathMax$1(x3, max[0]);
|
|
2230
|
-
min[1] = mathMin$1(y0, min[1]);
|
|
2231
|
-
max[1] = mathMax$1(y0, max[1]);
|
|
2232
|
-
min[1] = mathMin$1(y3, min[1]);
|
|
2233
|
-
max[1] = mathMax$1(y3, max[1]);
|
|
2234
|
-
}
|
|
2235
|
-
function fromQuadratic(x0, y0, x1, y1, x2, y2, min, max) {
|
|
2236
|
-
var quadraticExtremum$1 = quadraticExtremum;
|
|
2237
|
-
var quadraticAt$1 = quadraticAt;
|
|
2238
|
-
var tx = mathMax$1(mathMin$1(quadraticExtremum$1(x0, x1, x2), 1), 0);
|
|
2239
|
-
var ty = mathMax$1(mathMin$1(quadraticExtremum$1(y0, y1, y2), 1), 0);
|
|
2240
|
-
var x = quadraticAt$1(x0, x1, x2, tx);
|
|
2241
|
-
var y = quadraticAt$1(y0, y1, y2, ty);
|
|
2242
|
-
min[0] = mathMin$1(x0, x2, x);
|
|
2243
|
-
min[1] = mathMin$1(y0, y2, y);
|
|
2244
|
-
max[0] = mathMax$1(x0, x2, x);
|
|
2245
|
-
max[1] = mathMax$1(y0, y2, y);
|
|
2246
|
-
}
|
|
2247
|
-
function fromArc(x, y, rx, ry, startAngle, endAngle, anticlockwise, min, max) {
|
|
2248
|
-
var vec2Min = min$1;
|
|
2249
|
-
var vec2Max = max$1;
|
|
2250
|
-
var diff = Math.abs(startAngle - endAngle);
|
|
2251
|
-
if (diff % PI2$4 < 1e-4 && diff > 1e-4) {
|
|
2252
|
-
min[0] = x - rx;
|
|
2253
|
-
min[1] = y - ry;
|
|
2254
|
-
max[0] = x + rx;
|
|
2255
|
-
max[1] = y + ry;
|
|
2256
|
-
return;
|
|
2257
|
-
}
|
|
2258
|
-
start[0] = mathCos$1(startAngle) * rx + x;
|
|
2259
|
-
start[1] = mathSin$1(startAngle) * ry + y;
|
|
2260
|
-
end[0] = mathCos$1(endAngle) * rx + x;
|
|
2261
|
-
end[1] = mathSin$1(endAngle) * ry + y;
|
|
2262
|
-
vec2Min(min, start, end);
|
|
2263
|
-
vec2Max(max, start, end);
|
|
2264
|
-
startAngle = startAngle % PI2$4;
|
|
2265
|
-
if (startAngle < 0) startAngle = startAngle + PI2$4;
|
|
2266
|
-
endAngle = endAngle % PI2$4;
|
|
2267
|
-
if (endAngle < 0) endAngle = endAngle + PI2$4;
|
|
2268
|
-
if (startAngle > endAngle && !anticlockwise) endAngle += PI2$4;else if (startAngle < endAngle && anticlockwise) startAngle += PI2$4;
|
|
2269
|
-
if (anticlockwise) {
|
|
2270
|
-
var tmp = endAngle;
|
|
2271
|
-
endAngle = startAngle;
|
|
2272
|
-
startAngle = tmp;
|
|
2273
|
-
}
|
|
2274
|
-
for (var angle = 0; angle < endAngle; angle += Math.PI / 2) if (angle > startAngle) {
|
|
2275
|
-
extremity[0] = mathCos$1(angle) * rx + x;
|
|
2276
|
-
extremity[1] = mathSin$1(angle) * ry + y;
|
|
2277
|
-
vec2Min(min, extremity, min);
|
|
2278
|
-
vec2Max(max, extremity, max);
|
|
2279
|
-
}
|
|
2280
|
-
}
|
|
2281
|
-
|
|
2282
|
-
//#endregion
|
|
2283
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/PathProxy.js
|
|
2284
|
-
|
|
2285
|
-
function modPI2(radian) {
|
|
2286
|
-
return Math.round(radian / PI * 1e8) / 1e8 % 2 * PI;
|
|
2287
|
-
}
|
|
2288
|
-
function normalizeArcAngles(angles, anticlockwise) {
|
|
2289
|
-
var newStartAngle = modPI2(angles[0]);
|
|
2290
|
-
if (newStartAngle < 0) newStartAngle += PI2$3;
|
|
2291
|
-
var delta = newStartAngle - angles[0];
|
|
2292
|
-
var newEndAngle = angles[1];
|
|
2293
|
-
newEndAngle += delta;
|
|
2294
|
-
if (!anticlockwise && newEndAngle - newStartAngle >= PI2$3) newEndAngle = newStartAngle + PI2$3;else if (anticlockwise && newStartAngle - newEndAngle >= PI2$3) newEndAngle = newStartAngle - PI2$3;else if (!anticlockwise && newStartAngle > newEndAngle) newEndAngle = newStartAngle + (PI2$3 - modPI2(newStartAngle - newEndAngle));else if (anticlockwise && newStartAngle < newEndAngle) newEndAngle = newStartAngle - (PI2$3 - modPI2(newEndAngle - newStartAngle));
|
|
2295
|
-
angles[0] = newStartAngle;
|
|
2296
|
-
angles[1] = newEndAngle;
|
|
2297
|
-
}
|
|
2298
|
-
//#endregion
|
|
2299
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/line.js
|
|
2300
|
-
function containStroke$4(x0, y0, x1, y1, lineWidth, x, y) {
|
|
2301
|
-
if (lineWidth === 0) return false;
|
|
2302
|
-
var _l = lineWidth;
|
|
2303
|
-
var _a = 0;
|
|
2304
|
-
var _b = x0;
|
|
2305
|
-
if (y > y0 + _l && y > y1 + _l || y < y0 - _l && y < y1 - _l || x > x0 + _l && x > x1 + _l || x < x0 - _l && x < x1 - _l) return false;
|
|
2306
|
-
if (x0 !== x1) {
|
|
2307
|
-
_a = (y0 - y1) / (x0 - x1);
|
|
2308
|
-
_b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
2309
|
-
} else return Math.abs(x - x0) <= _l / 2;
|
|
2310
|
-
var tmp = _a * x - y + _b;
|
|
2311
|
-
return tmp * tmp / (_a * _a + 1) <= _l / 2 * _l / 2;
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
|
-
//#endregion
|
|
2315
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/cubic.js
|
|
2316
|
-
function containStroke$3(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
|
|
2317
|
-
if (lineWidth === 0) return false;
|
|
2318
|
-
var _l = lineWidth;
|
|
2319
|
-
if (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l) return false;
|
|
2320
|
-
return cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null) <= _l / 2;
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
//#endregion
|
|
2324
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/quadratic.js
|
|
2325
|
-
function containStroke$2(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
|
|
2326
|
-
if (lineWidth === 0) return false;
|
|
2327
|
-
var _l = lineWidth;
|
|
2328
|
-
if (y > y0 + _l && y > y1 + _l && y > y2 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l) return false;
|
|
2329
|
-
return quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null) <= _l / 2;
|
|
2330
|
-
}
|
|
2331
|
-
|
|
2332
|
-
//#endregion
|
|
2333
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/util.js
|
|
2334
|
-
|
|
2335
|
-
function normalizeRadian(angle) {
|
|
2336
|
-
angle %= PI2$2;
|
|
2337
|
-
if (angle < 0) angle += PI2$2;
|
|
2338
|
-
return angle;
|
|
2339
|
-
}
|
|
2340
|
-
|
|
2341
|
-
//#endregion
|
|
2342
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/arc.js
|
|
2343
|
-
|
|
2344
|
-
function containStroke$1(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
|
|
2345
|
-
if (lineWidth === 0) return false;
|
|
2346
|
-
var _l = lineWidth;
|
|
2347
|
-
x -= cx;
|
|
2348
|
-
y -= cy;
|
|
2349
|
-
var d = Math.sqrt(x * x + y * y);
|
|
2350
|
-
if (d - _l > r || d + _l < r) return false;
|
|
2351
|
-
if (Math.abs(startAngle - endAngle) % PI2$1 < 1e-4) return true;
|
|
2352
|
-
if (anticlockwise) {
|
|
2353
|
-
var tmp = startAngle;
|
|
2354
|
-
startAngle = normalizeRadian(endAngle);
|
|
2355
|
-
endAngle = normalizeRadian(tmp);
|
|
2356
|
-
} else {
|
|
2357
|
-
startAngle = normalizeRadian(startAngle);
|
|
2358
|
-
endAngle = normalizeRadian(endAngle);
|
|
2359
|
-
}
|
|
2360
|
-
if (startAngle > endAngle) endAngle += PI2$1;
|
|
2361
|
-
var angle = Math.atan2(y, x);
|
|
2362
|
-
if (angle < 0) angle += PI2$1;
|
|
2363
|
-
return angle >= startAngle && angle <= endAngle || angle + PI2$1 >= startAngle && angle + PI2$1 <= endAngle;
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
//#endregion
|
|
2367
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/windingLine.js
|
|
2368
|
-
function windingLine(x0, y0, x1, y1, x, y) {
|
|
2369
|
-
if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
|
|
2370
|
-
if (y1 === y0) return 0;
|
|
2371
|
-
var t = (y - y0) / (y1 - y0);
|
|
2372
|
-
var dir = y1 < y0 ? 1 : -1;
|
|
2373
|
-
if (t === 1 || t === 0) dir = y1 < y0 ? .5 : -.5;
|
|
2374
|
-
var x_ = t * (x1 - x0) + x0;
|
|
2375
|
-
return x_ === x ? Infinity : x_ > x ? dir : 0;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
//#endregion
|
|
2379
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/contain/path.js
|
|
2380
|
-
|
|
2381
|
-
function isAroundEqual(a, b) {
|
|
2382
|
-
return Math.abs(a - b) < EPSILON;
|
|
2383
|
-
}
|
|
2384
|
-
function swapExtrema() {
|
|
2385
|
-
var tmp = extrema[0];
|
|
2386
|
-
extrema[0] = extrema[1];
|
|
2387
|
-
extrema[1] = tmp;
|
|
2388
|
-
}
|
|
2389
|
-
function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
|
|
2390
|
-
if (y > y0 && y > y1 && y > y2 && y > y3 || y < y0 && y < y1 && y < y2 && y < y3) return 0;
|
|
2391
|
-
var nRoots = cubicRootAt(y0, y1, y2, y3, y, roots);
|
|
2392
|
-
if (nRoots === 0) return 0;else {
|
|
2393
|
-
var w = 0;
|
|
2394
|
-
var nExtrema = -1;
|
|
2395
|
-
var y0_ = void 0;
|
|
2396
|
-
var y1_ = void 0;
|
|
2397
|
-
for (var i = 0; i < nRoots; i++) {
|
|
2398
|
-
var t = roots[i];
|
|
2399
|
-
var unit = t === 0 || t === 1 ? .5 : 1;
|
|
2400
|
-
if (cubicAt(x0, x1, x2, x3, t) < x) continue;
|
|
2401
|
-
if (nExtrema < 0) {
|
|
2402
|
-
nExtrema = cubicExtrema(y0, y1, y2, y3, extrema);
|
|
2403
|
-
if (extrema[1] < extrema[0] && nExtrema > 1) swapExtrema();
|
|
2404
|
-
y0_ = cubicAt(y0, y1, y2, y3, extrema[0]);
|
|
2405
|
-
if (nExtrema > 1) y1_ = cubicAt(y0, y1, y2, y3, extrema[1]);
|
|
2406
|
-
}
|
|
2407
|
-
if (nExtrema === 2) {
|
|
2408
|
-
if (t < extrema[0]) w += y0_ < y0 ? unit : -unit;else if (t < extrema[1]) w += y1_ < y0_ ? unit : -unit;else w += y3 < y1_ ? unit : -unit;
|
|
2409
|
-
} else if (t < extrema[0]) w += y0_ < y0 ? unit : -unit;else w += y3 < y0_ ? unit : -unit;
|
|
2410
|
-
}
|
|
2411
|
-
return w;
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
function windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
|
|
2415
|
-
if (y > y0 && y > y1 && y > y2 || y < y0 && y < y1 && y < y2) return 0;
|
|
2416
|
-
var nRoots = quadraticRootAt(y0, y1, y2, y, roots);
|
|
2417
|
-
if (nRoots === 0) return 0;else {
|
|
2418
|
-
var t = quadraticExtremum(y0, y1, y2);
|
|
2419
|
-
if (t >= 0 && t <= 1) {
|
|
2420
|
-
var w = 0;
|
|
2421
|
-
var y_ = quadraticAt(y0, y1, y2, t);
|
|
2422
|
-
for (var i = 0; i < nRoots; i++) {
|
|
2423
|
-
var unit = roots[i] === 0 || roots[i] === 1 ? .5 : 1;
|
|
2424
|
-
var x_ = quadraticAt(x0, x1, x2, roots[i]);
|
|
2425
|
-
if (x_ < x) continue;
|
|
2426
|
-
if (roots[i] < t) w += y_ < y0 ? unit : -unit;else w += y2 < y_ ? unit : -unit;
|
|
2427
|
-
}
|
|
2428
|
-
return w;
|
|
2429
|
-
} else {
|
|
2430
|
-
var unit = roots[0] === 0 || roots[0] === 1 ? .5 : 1;
|
|
2431
|
-
var x_ = quadraticAt(x0, x1, x2, roots[0]);
|
|
2432
|
-
if (x_ < x) return 0;
|
|
2433
|
-
return y2 < y0 ? unit : -unit;
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
}
|
|
2437
|
-
function windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
|
|
2438
|
-
y -= cy;
|
|
2439
|
-
if (y > r || y < -r) return 0;
|
|
2440
|
-
var tmp = Math.sqrt(r * r - y * y);
|
|
2441
|
-
roots[0] = -tmp;
|
|
2442
|
-
roots[1] = tmp;
|
|
2443
|
-
var dTheta = Math.abs(startAngle - endAngle);
|
|
2444
|
-
if (dTheta < 1e-4) return 0;
|
|
2445
|
-
if (dTheta >= PI2 - 1e-4) {
|
|
2446
|
-
startAngle = 0;
|
|
2447
|
-
endAngle = PI2;
|
|
2448
|
-
var dir = anticlockwise ? 1 : -1;
|
|
2449
|
-
if (x >= roots[0] + cx && x <= roots[1] + cx) return dir;else return 0;
|
|
2450
|
-
}
|
|
2451
|
-
if (startAngle > endAngle) {
|
|
2452
|
-
var tmp_1 = startAngle;
|
|
2453
|
-
startAngle = endAngle;
|
|
2454
|
-
endAngle = tmp_1;
|
|
2455
|
-
}
|
|
2456
|
-
if (startAngle < 0) {
|
|
2457
|
-
startAngle += PI2;
|
|
2458
|
-
endAngle += PI2;
|
|
2459
|
-
}
|
|
2460
|
-
var w = 0;
|
|
2461
|
-
for (var i = 0; i < 2; i++) {
|
|
2462
|
-
var x_ = roots[i];
|
|
2463
|
-
if (x_ + cx > x) {
|
|
2464
|
-
var angle = Math.atan2(y, x_);
|
|
2465
|
-
var dir = anticlockwise ? 1 : -1;
|
|
2466
|
-
if (angle < 0) angle = PI2 + angle;
|
|
2467
|
-
if (angle >= startAngle && angle <= endAngle || angle + PI2 >= startAngle && angle + PI2 <= endAngle) {
|
|
2468
|
-
if (angle > Math.PI / 2 && angle < Math.PI * 1.5) dir = -dir;
|
|
2469
|
-
w += dir;
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
return w;
|
|
2474
|
-
}
|
|
2475
|
-
function containPath(path, lineWidth, isStroke, x, y) {
|
|
2476
|
-
var data = path.data;
|
|
2477
|
-
var len = path.len();
|
|
2478
|
-
var w = 0;
|
|
2479
|
-
var xi = 0;
|
|
2480
|
-
var yi = 0;
|
|
2481
|
-
var x0 = 0;
|
|
2482
|
-
var y0 = 0;
|
|
2483
|
-
var x1;
|
|
2484
|
-
var y1;
|
|
2485
|
-
for (var i = 0; i < len;) {
|
|
2486
|
-
var cmd = data[i++];
|
|
2487
|
-
var isFirst = i === 1;
|
|
2488
|
-
if (cmd === CMD.M && i > 1) {
|
|
2489
|
-
if (!isStroke) w += windingLine(xi, yi, x0, y0, x, y);
|
|
2490
|
-
}
|
|
2491
|
-
if (isFirst) {
|
|
2492
|
-
xi = data[i];
|
|
2493
|
-
yi = data[i + 1];
|
|
2494
|
-
x0 = xi;
|
|
2495
|
-
y0 = yi;
|
|
2496
|
-
}
|
|
2497
|
-
switch (cmd) {
|
|
2498
|
-
case CMD.M:
|
|
2499
|
-
x0 = data[i++];
|
|
2500
|
-
y0 = data[i++];
|
|
2501
|
-
xi = x0;
|
|
2502
|
-
yi = y0;
|
|
2503
|
-
break;
|
|
2504
|
-
case CMD.L:
|
|
2505
|
-
if (isStroke) {
|
|
2506
|
-
if (containStroke$4(xi, yi, data[i], data[i + 1], lineWidth, x, y)) return true;
|
|
2507
|
-
} else w += windingLine(xi, yi, data[i], data[i + 1], x, y) || 0;
|
|
2508
|
-
xi = data[i++];
|
|
2509
|
-
yi = data[i++];
|
|
2510
|
-
break;
|
|
2511
|
-
case CMD.C:
|
|
2512
|
-
if (isStroke) {
|
|
2513
|
-
if (containStroke$3(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) return true;
|
|
2514
|
-
} else w += windingCubic(xi, yi, data[i++], data[i++], data[i++], data[i++], data[i], data[i + 1], x, y) || 0;
|
|
2515
|
-
xi = data[i++];
|
|
2516
|
-
yi = data[i++];
|
|
2517
|
-
break;
|
|
2518
|
-
case CMD.Q:
|
|
2519
|
-
if (isStroke) {
|
|
2520
|
-
if (containStroke$2(xi, yi, data[i++], data[i++], data[i], data[i + 1], lineWidth, x, y)) return true;
|
|
2521
|
-
} else w += windingQuadratic(xi, yi, data[i++], data[i++], data[i], data[i + 1], x, y) || 0;
|
|
2522
|
-
xi = data[i++];
|
|
2523
|
-
yi = data[i++];
|
|
2524
|
-
break;
|
|
2525
|
-
case CMD.A:
|
|
2526
|
-
var cx = data[i++];
|
|
2527
|
-
var cy = data[i++];
|
|
2528
|
-
var rx = data[i++];
|
|
2529
|
-
var ry = data[i++];
|
|
2530
|
-
var theta = data[i++];
|
|
2531
|
-
var dTheta = data[i++];
|
|
2532
|
-
i += 1;
|
|
2533
|
-
var anticlockwise = !!(1 - data[i++]);
|
|
2534
|
-
x1 = Math.cos(theta) * rx + cx;
|
|
2535
|
-
y1 = Math.sin(theta) * ry + cy;
|
|
2536
|
-
if (!isFirst) w += windingLine(xi, yi, x1, y1, x, y);else {
|
|
2537
|
-
x0 = x1;
|
|
2538
|
-
y0 = y1;
|
|
2539
|
-
}
|
|
2540
|
-
var _x = (x - cx) * ry / rx + cx;
|
|
2541
|
-
if (isStroke) {
|
|
2542
|
-
if (containStroke$1(cx, cy, ry, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) return true;
|
|
2543
|
-
} else w += windingArc(cx, cy, ry, theta, theta + dTheta, anticlockwise, _x, y);
|
|
2544
|
-
xi = Math.cos(theta + dTheta) * rx + cx;
|
|
2545
|
-
yi = Math.sin(theta + dTheta) * ry + cy;
|
|
2546
|
-
break;
|
|
2547
|
-
case CMD.R:
|
|
2548
|
-
x0 = xi = data[i++];
|
|
2549
|
-
y0 = yi = data[i++];
|
|
2550
|
-
var width = data[i++];
|
|
2551
|
-
var height = data[i++];
|
|
2552
|
-
x1 = x0 + width;
|
|
2553
|
-
y1 = y0 + height;
|
|
2554
|
-
if (isStroke) {
|
|
2555
|
-
if (containStroke$4(x0, y0, x1, y0, lineWidth, x, y) || containStroke$4(x1, y0, x1, y1, lineWidth, x, y) || containStroke$4(x1, y1, x0, y1, lineWidth, x, y) || containStroke$4(x0, y1, x0, y0, lineWidth, x, y)) return true;
|
|
2556
|
-
} else {
|
|
2557
|
-
w += windingLine(x1, y0, x1, y1, x, y);
|
|
2558
|
-
w += windingLine(x0, y1, x0, y0, x, y);
|
|
2559
|
-
}
|
|
2560
|
-
break;
|
|
2561
|
-
case CMD.Z:
|
|
2562
|
-
if (isStroke) {
|
|
2563
|
-
if (containStroke$4(xi, yi, x0, y0, lineWidth, x, y)) return true;
|
|
2564
|
-
} else w += windingLine(xi, yi, x0, y0, x, y);
|
|
2565
|
-
xi = x0;
|
|
2566
|
-
yi = y0;
|
|
2567
|
-
break;
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
if (!isStroke && !isAroundEqual(yi, y0)) w += windingLine(xi, yi, x0, y0, x, y) || 0;
|
|
2571
|
-
return w !== 0;
|
|
2572
|
-
}
|
|
2573
|
-
function contain(pathProxy, x, y) {
|
|
2574
|
-
return containPath(pathProxy, 0, false, x, y);
|
|
2575
|
-
}
|
|
2576
|
-
function containStroke(pathProxy, lineWidth, x, y) {
|
|
2577
|
-
return containPath(pathProxy, lineWidth, true, x, y);
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
//#endregion
|
|
2581
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/Path.js
|
|
2582
|
-
|
|
2583
|
-
function isImageLike(source) {
|
|
2584
|
-
return !!(source && typeof source !== "string" && source.width && source.height);
|
|
2585
|
-
}
|
|
2586
|
-
//#endregion
|
|
2587
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/helper/roundRect.js
|
|
2588
|
-
function buildPath(ctx, shape) {
|
|
2589
|
-
var x = shape.x;
|
|
2590
|
-
var y = shape.y;
|
|
2591
|
-
var width = shape.width;
|
|
2592
|
-
var height = shape.height;
|
|
2593
|
-
var r = shape.r;
|
|
2594
|
-
var r1;
|
|
2595
|
-
var r2;
|
|
2596
|
-
var r3;
|
|
2597
|
-
var r4;
|
|
2598
|
-
if (width < 0) {
|
|
2599
|
-
x = x + width;
|
|
2600
|
-
width = -width;
|
|
2601
|
-
}
|
|
2602
|
-
if (height < 0) {
|
|
2603
|
-
y = y + height;
|
|
2604
|
-
height = -height;
|
|
2605
|
-
}
|
|
2606
|
-
if (typeof r === "number") r1 = r2 = r3 = r4 = r;else if (r instanceof Array) {
|
|
2607
|
-
if (r.length === 1) r1 = r2 = r3 = r4 = r[0];else if (r.length === 2) {
|
|
2608
|
-
r1 = r3 = r[0];
|
|
2609
|
-
r2 = r4 = r[1];
|
|
2610
|
-
} else if (r.length === 3) {
|
|
2611
|
-
r1 = r[0];
|
|
2612
|
-
r2 = r4 = r[1];
|
|
2613
|
-
r3 = r[2];
|
|
2614
|
-
} else {
|
|
2615
|
-
r1 = r[0];
|
|
2616
|
-
r2 = r[1];
|
|
2617
|
-
r3 = r[2];
|
|
2618
|
-
r4 = r[3];
|
|
2619
|
-
}
|
|
2620
|
-
} else r1 = r2 = r3 = r4 = 0;
|
|
2621
|
-
var total;
|
|
2622
|
-
if (r1 + r2 > width) {
|
|
2623
|
-
total = r1 + r2;
|
|
2624
|
-
r1 *= width / total;
|
|
2625
|
-
r2 *= width / total;
|
|
2626
|
-
}
|
|
2627
|
-
if (r3 + r4 > width) {
|
|
2628
|
-
total = r3 + r4;
|
|
2629
|
-
r3 *= width / total;
|
|
2630
|
-
r4 *= width / total;
|
|
2631
|
-
}
|
|
2632
|
-
if (r2 + r3 > height) {
|
|
2633
|
-
total = r2 + r3;
|
|
2634
|
-
r2 *= height / total;
|
|
2635
|
-
r3 *= height / total;
|
|
2636
|
-
}
|
|
2637
|
-
if (r1 + r4 > height) {
|
|
2638
|
-
total = r1 + r4;
|
|
2639
|
-
r1 *= height / total;
|
|
2640
|
-
r4 *= height / total;
|
|
2641
|
-
}
|
|
2642
|
-
ctx.moveTo(x + r1, y);
|
|
2643
|
-
ctx.lineTo(x + width - r2, y);
|
|
2644
|
-
r2 !== 0 && ctx.arc(x + width - r2, y + r2, r2, -Math.PI / 2, 0);
|
|
2645
|
-
ctx.lineTo(x + width, y + height - r3);
|
|
2646
|
-
r3 !== 0 && ctx.arc(x + width - r3, y + height - r3, r3, 0, Math.PI / 2);
|
|
2647
|
-
ctx.lineTo(x + r4, y + height);
|
|
2648
|
-
r4 !== 0 && ctx.arc(x + r4, y + height - r4, r4, Math.PI / 2, Math.PI);
|
|
2649
|
-
ctx.lineTo(x, y + r1);
|
|
2650
|
-
r1 !== 0 && ctx.arc(x + r1, y + r1, r1, Math.PI, Math.PI * 1.5);
|
|
2651
|
-
}
|
|
2652
|
-
|
|
2653
|
-
//#endregion
|
|
2654
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/helper/subPixelOptimize.js
|
|
2655
|
-
|
|
2656
|
-
function subPixelOptimizeLine(outputShape, inputShape, style) {
|
|
2657
|
-
if (!inputShape) return;
|
|
2658
|
-
var x1 = inputShape.x1;
|
|
2659
|
-
var x2 = inputShape.x2;
|
|
2660
|
-
var y1 = inputShape.y1;
|
|
2661
|
-
var y2 = inputShape.y2;
|
|
2662
|
-
outputShape.x1 = x1;
|
|
2663
|
-
outputShape.x2 = x2;
|
|
2664
|
-
outputShape.y1 = y1;
|
|
2665
|
-
outputShape.y2 = y2;
|
|
2666
|
-
var lineWidth = style && style.lineWidth;
|
|
2667
|
-
if (!lineWidth) return outputShape;
|
|
2668
|
-
if (round(x1 * 2) === round(x2 * 2)) outputShape.x1 = outputShape.x2 = subPixelOptimize(x1, lineWidth, true);
|
|
2669
|
-
if (round(y1 * 2) === round(y2 * 2)) outputShape.y1 = outputShape.y2 = subPixelOptimize(y1, lineWidth, true);
|
|
2670
|
-
return outputShape;
|
|
2671
|
-
}
|
|
2672
|
-
function subPixelOptimizeRect(outputShape, inputShape, style) {
|
|
2673
|
-
if (!inputShape) return;
|
|
2674
|
-
var originX = inputShape.x;
|
|
2675
|
-
var originY = inputShape.y;
|
|
2676
|
-
var originWidth = inputShape.width;
|
|
2677
|
-
var originHeight = inputShape.height;
|
|
2678
|
-
outputShape.x = originX;
|
|
2679
|
-
outputShape.y = originY;
|
|
2680
|
-
outputShape.width = originWidth;
|
|
2681
|
-
outputShape.height = originHeight;
|
|
2682
|
-
var lineWidth = style && style.lineWidth;
|
|
2683
|
-
if (!lineWidth) return outputShape;
|
|
2684
|
-
outputShape.x = subPixelOptimize(originX, lineWidth, true);
|
|
2685
|
-
outputShape.y = subPixelOptimize(originY, lineWidth, true);
|
|
2686
|
-
outputShape.width = Math.max(subPixelOptimize(originX + originWidth, lineWidth, false) - outputShape.x, originWidth === 0 ? 0 : 1);
|
|
2687
|
-
outputShape.height = Math.max(subPixelOptimize(originY + originHeight, lineWidth, false) - outputShape.y, originHeight === 0 ? 0 : 1);
|
|
2688
|
-
return outputShape;
|
|
2689
|
-
}
|
|
2690
|
-
function subPixelOptimize(position, lineWidth, positiveOrNegative) {
|
|
2691
|
-
if (!lineWidth) return position;
|
|
2692
|
-
var doubledPosition = round(position * 2);
|
|
2693
|
-
return (doubledPosition + round(lineWidth)) % 2 === 0 ? doubledPosition / 2 : (doubledPosition + (positiveOrNegative ? 1 : -1)) / 2;
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2696
|
-
//#endregion
|
|
2697
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/shape/Rect.js
|
|
2698
|
-
|
|
2699
|
-
function parseFontSize(fontSize) {
|
|
2700
|
-
if (typeof fontSize === "string" && (fontSize.indexOf("px") !== -1 || fontSize.indexOf("rem") !== -1 || fontSize.indexOf("em") !== -1)) return fontSize;else if (!isNaN(+fontSize)) return fontSize + "px";else return 12 + "px";
|
|
2701
|
-
}
|
|
2702
|
-
function setSeparateFont(targetStyle, sourceStyle) {
|
|
2703
|
-
for (var i = 0; i < FONT_PARTS.length; i++) {
|
|
2704
|
-
var fontProp = FONT_PARTS[i];
|
|
2705
|
-
var val = sourceStyle[fontProp];
|
|
2706
|
-
if (val != null) targetStyle[fontProp] = val;
|
|
2707
|
-
}
|
|
2708
|
-
}
|
|
2709
|
-
function hasSeparateFont(style) {
|
|
2710
|
-
return style.fontSize != null || style.fontFamily || style.fontWeight;
|
|
2711
|
-
}
|
|
2712
|
-
function normalizeTextStyle(style) {
|
|
2713
|
-
normalizeStyle(style);
|
|
2714
|
-
each(style.rich, normalizeStyle);
|
|
2715
|
-
return style;
|
|
2716
|
-
}
|
|
2717
|
-
function normalizeStyle(style) {
|
|
2718
|
-
if (style) {
|
|
2719
|
-
style.font = ZRText.makeFont(style);
|
|
2720
|
-
var textAlign = style.align;
|
|
2721
|
-
textAlign === "middle" && (textAlign = "center");
|
|
2722
|
-
style.align = textAlign == null || VALID_TEXT_ALIGN[textAlign] ? textAlign : "left";
|
|
2723
|
-
var verticalAlign = style.verticalAlign;
|
|
2724
|
-
verticalAlign === "center" && (verticalAlign = "middle");
|
|
2725
|
-
style.verticalAlign = verticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[verticalAlign] ? verticalAlign : "top";
|
|
2726
|
-
if (style.padding) style.padding = normalizeCssArray(style.padding);
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
function getStroke(stroke, lineWidth) {
|
|
2730
|
-
return stroke == null || lineWidth <= 0 || stroke === "transparent" || stroke === "none" ? null : stroke.image || stroke.colorStops ? "#000" : stroke;
|
|
2731
|
-
}
|
|
2732
|
-
function getFill(fill) {
|
|
2733
|
-
return fill == null || fill === "none" ? null : fill.image || fill.colorStops ? "#000" : fill;
|
|
2734
|
-
}
|
|
2735
|
-
function getTextXForPadding(x, textAlign, textPadding) {
|
|
2736
|
-
return textAlign === "right" ? x - textPadding[1] : textAlign === "center" ? x + textPadding[3] / 2 - textPadding[1] / 2 : x + textPadding[3];
|
|
2737
|
-
}
|
|
2738
|
-
function getStyleText(style) {
|
|
2739
|
-
var text = style.text;
|
|
2740
|
-
text != null && (text += "");
|
|
2741
|
-
return text;
|
|
2742
|
-
}
|
|
2743
|
-
function needDrawBackground(style) {
|
|
2744
|
-
return !!(style.backgroundColor || style.lineHeight || style.borderWidth && style.borderColor);
|
|
2745
|
-
}
|
|
2746
|
-
|
|
2747
|
-
//#endregion
|
|
2748
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/graphic/Group.js
|
|
2749
|
-
|
|
2750
|
-
function determinant(rows, rank, rowStart, rowMask, colMask, detCache) {
|
|
2751
|
-
var cacheKey = rowMask + "-" + colMask;
|
|
2752
|
-
var fullRank = rows.length;
|
|
2753
|
-
if (detCache.hasOwnProperty(cacheKey)) return detCache[cacheKey];
|
|
2754
|
-
if (rank === 1) {
|
|
2755
|
-
var colStart = Math.round(Math.log((1 << fullRank) - 1 & ~colMask) / LN2);
|
|
2756
|
-
return rows[rowStart][colStart];
|
|
2757
|
-
}
|
|
2758
|
-
var subRowMask = rowMask | 1 << rowStart;
|
|
2759
|
-
var subRowStart = rowStart + 1;
|
|
2760
|
-
while (rowMask & 1 << subRowStart) subRowStart++;
|
|
2761
|
-
var sum = 0;
|
|
2762
|
-
for (var j = 0, colLocalIdx = 0; j < fullRank; j++) {
|
|
2763
|
-
var colTag = 1 << j;
|
|
2764
|
-
if (!(colTag & colMask)) {
|
|
2765
|
-
sum += (colLocalIdx % 2 ? -1 : 1) * rows[rowStart][j] * determinant(rows, rank - 1, subRowStart, subRowMask, colMask | colTag, detCache);
|
|
2766
|
-
colLocalIdx++;
|
|
2767
|
-
}
|
|
2768
|
-
}
|
|
2769
|
-
detCache[cacheKey] = sum;
|
|
2770
|
-
return sum;
|
|
2771
|
-
}
|
|
2772
|
-
function buildTransformer(src, dest) {
|
|
2773
|
-
var mA = [[src[0], src[1], 1, 0, 0, 0, -dest[0] * src[0], -dest[0] * src[1]], [0, 0, 0, src[0], src[1], 1, -dest[1] * src[0], -dest[1] * src[1]], [src[2], src[3], 1, 0, 0, 0, -dest[2] * src[2], -dest[2] * src[3]], [0, 0, 0, src[2], src[3], 1, -dest[3] * src[2], -dest[3] * src[3]], [src[4], src[5], 1, 0, 0, 0, -dest[4] * src[4], -dest[4] * src[5]], [0, 0, 0, src[4], src[5], 1, -dest[5] * src[4], -dest[5] * src[5]], [src[6], src[7], 1, 0, 0, 0, -dest[6] * src[6], -dest[6] * src[7]], [0, 0, 0, src[6], src[7], 1, -dest[7] * src[6], -dest[7] * src[7]]];
|
|
2774
|
-
var detCache = {};
|
|
2775
|
-
var det = determinant(mA, 8, 0, 0, 0, detCache);
|
|
2776
|
-
if (det === 0) return;
|
|
2777
|
-
var vh = [];
|
|
2778
|
-
for (var i = 0; i < 8; i++) for (var j = 0; j < 8; j++) {
|
|
2779
|
-
vh[j] ?? (vh[j] = 0);
|
|
2780
|
-
vh[j] += ((i + j) % 2 ? -1 : 1) * determinant(mA, 7, i === 0 ? 1 : 0, 1 << i, 1 << j, detCache) / det * dest[i];
|
|
2781
|
-
}
|
|
2782
|
-
return function (out, srcPointX, srcPointY) {
|
|
2783
|
-
var pk = srcPointX * vh[6] + srcPointY * vh[7] + 1;
|
|
2784
|
-
out[0] = (srcPointX * vh[0] + srcPointY * vh[1] + vh[2]) / pk;
|
|
2785
|
-
out[1] = (srcPointX * vh[3] + srcPointY * vh[4] + vh[5]) / pk;
|
|
2786
|
-
};
|
|
2787
|
-
}
|
|
2788
|
-
|
|
2789
|
-
//#endregion
|
|
2790
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/dom.js
|
|
2791
|
-
|
|
2792
|
-
function transformLocalCoord(out, elFrom, elTarget, inX, inY) {
|
|
2793
|
-
return transformCoordWithViewport(_calcOut$1, elFrom, inX, inY, true) && transformCoordWithViewport(out, elTarget, _calcOut$1[0], _calcOut$1[1]);
|
|
2794
|
-
}
|
|
2795
|
-
function transformLocalCoordClear(elFrom, elTarget) {
|
|
2796
|
-
elFrom && dealClear(elFrom);
|
|
2797
|
-
elTarget && dealClear(elTarget);
|
|
2798
|
-
function dealClear(el) {
|
|
2799
|
-
var saved = el[EVENT_SAVED_PROP];
|
|
2800
|
-
if (saved) {
|
|
2801
|
-
saved.clearMarkers && saved.clearMarkers();
|
|
2802
|
-
delete el[EVENT_SAVED_PROP];
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
}
|
|
2806
|
-
function transformCoordWithViewport(out, el, inX, inY, inverse) {
|
|
2807
|
-
if (el.getBoundingClientRect && env.domSupported && !isCanvasEl(el)) {
|
|
2808
|
-
var saved = el[EVENT_SAVED_PROP] || (el[EVENT_SAVED_PROP] = {});
|
|
2809
|
-
var transformer = preparePointerTransformer(prepareCoordMarkers(el, saved), saved, inverse);
|
|
2810
|
-
if (transformer) {
|
|
2811
|
-
transformer(out, inX, inY);
|
|
2812
|
-
return true;
|
|
2813
|
-
}
|
|
2814
|
-
}
|
|
2815
|
-
return false;
|
|
2816
|
-
}
|
|
2817
|
-
function prepareCoordMarkers(el, saved) {
|
|
2818
|
-
var markers = saved.markers;
|
|
2819
|
-
if (markers) return markers;
|
|
2820
|
-
markers = saved.markers = [];
|
|
2821
|
-
var propLR = ["left", "right"];
|
|
2822
|
-
var propTB = ["top", "bottom"];
|
|
2823
|
-
for (var i = 0; i < 4; i++) {
|
|
2824
|
-
var marker = document.createElement("div");
|
|
2825
|
-
var stl = marker.style;
|
|
2826
|
-
var idxLR = i % 2;
|
|
2827
|
-
var idxTB = (i >> 1) % 2;
|
|
2828
|
-
stl.cssText = ["position: absolute", "visibility: hidden", "padding: 0", "margin: 0", "border-width: 0", "user-select: none", "width:0", "height:0", propLR[idxLR] + ":0", propTB[idxTB] + ":0", propLR[1 - idxLR] + ":auto", propTB[1 - idxTB] + ":auto", ""].join("!important;");
|
|
2829
|
-
el.appendChild(marker);
|
|
2830
|
-
markers.push(marker);
|
|
2831
|
-
}
|
|
2832
|
-
saved.clearMarkers = function () {
|
|
2833
|
-
each(markers, function (marker) {
|
|
2834
|
-
marker.parentNode && marker.parentNode.removeChild(marker);
|
|
2835
|
-
});
|
|
2836
|
-
};
|
|
2837
|
-
return markers;
|
|
2838
|
-
}
|
|
2839
|
-
function preparePointerTransformer(markers, saved, inverse) {
|
|
2840
|
-
var transformerName = inverse ? "invTrans" : "trans";
|
|
2841
|
-
var transformer = saved[transformerName];
|
|
2842
|
-
var oldSrcCoords = saved.srcCoords;
|
|
2843
|
-
var srcCoords = [];
|
|
2844
|
-
var destCoords = [];
|
|
2845
|
-
var oldCoordTheSame = true;
|
|
2846
|
-
for (var i = 0; i < 4; i++) {
|
|
2847
|
-
var rect = markers[i].getBoundingClientRect();
|
|
2848
|
-
var ii = 2 * i;
|
|
2849
|
-
var x = rect.left;
|
|
2850
|
-
var y = rect.top;
|
|
2851
|
-
srcCoords.push(x, y);
|
|
2852
|
-
oldCoordTheSame = oldCoordTheSame && oldSrcCoords && x === oldSrcCoords[ii] && y === oldSrcCoords[ii + 1];
|
|
2853
|
-
destCoords.push(markers[i].offsetLeft, markers[i].offsetTop);
|
|
2854
|
-
}
|
|
2855
|
-
return oldCoordTheSame && transformer ? transformer : (saved.srcCoords = srcCoords, saved[transformerName] = inverse ? buildTransformer(destCoords, srcCoords) : buildTransformer(srcCoords, destCoords));
|
|
2856
|
-
}
|
|
2857
|
-
function isCanvasEl(el) {
|
|
2858
|
-
return el.nodeName.toUpperCase() === "CANVAS";
|
|
2859
|
-
}
|
|
2860
|
-
function encodeHTML(source) {
|
|
2861
|
-
return source == null ? "" : (source + "").replace(replaceReg, function (str, c) {
|
|
2862
|
-
return replaceMap[c];
|
|
2863
|
-
});
|
|
2864
|
-
}
|
|
2865
|
-
|
|
2866
|
-
//#endregion
|
|
2867
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/mixin/Draggable.js
|
|
2868
|
-
|
|
2869
|
-
function clientToLocal(el, e, out, calculate) {
|
|
2870
|
-
out = out || {};
|
|
2871
|
-
if (calculate) calculateZrXY(el, e, out);else if (firefoxNotSupportOffsetXY && e.layerX != null && e.layerX !== e.offsetX) {
|
|
2872
|
-
out.zrX = e.layerX;
|
|
2873
|
-
out.zrY = e.layerY;
|
|
2874
|
-
} else if (e.offsetX != null) {
|
|
2875
|
-
out.zrX = e.offsetX;
|
|
2876
|
-
out.zrY = e.offsetY;
|
|
2877
|
-
} else calculateZrXY(el, e, out);
|
|
2878
|
-
return out;
|
|
2879
|
-
}
|
|
2880
|
-
function calculateZrXY(el, e, out) {
|
|
2881
|
-
if (env.domSupported && el.getBoundingClientRect) {
|
|
2882
|
-
var ex = e.clientX;
|
|
2883
|
-
var ey = e.clientY;
|
|
2884
|
-
if (isCanvasEl(el)) {
|
|
2885
|
-
var box = el.getBoundingClientRect();
|
|
2886
|
-
out.zrX = ex - box.left;
|
|
2887
|
-
out.zrY = ey - box.top;
|
|
2888
|
-
return;
|
|
2889
|
-
} else if (transformCoordWithViewport(_calcOut, el, ex, ey)) {
|
|
2890
|
-
out.zrX = _calcOut[0];
|
|
2891
|
-
out.zrY = _calcOut[1];
|
|
2892
|
-
return;
|
|
2893
|
-
}
|
|
2894
|
-
}
|
|
2895
|
-
out.zrX = out.zrY = 0;
|
|
2896
|
-
}
|
|
2897
|
-
function getNativeEvent(e) {
|
|
2898
|
-
return e || window.event;
|
|
2899
|
-
}
|
|
2900
|
-
function normalizeEvent(el, e, calculate) {
|
|
2901
|
-
e = getNativeEvent(e);
|
|
2902
|
-
if (e.zrX != null) return e;
|
|
2903
|
-
var eventType = e.type;
|
|
2904
|
-
if (!(eventType && eventType.indexOf("touch") >= 0)) {
|
|
2905
|
-
clientToLocal(el, e, e, calculate);
|
|
2906
|
-
var wheelDelta = getWheelDeltaMayPolyfill(e);
|
|
2907
|
-
e.zrDelta = wheelDelta ? wheelDelta / 120 : -(e.detail || 0) / 3;
|
|
2908
|
-
} else {
|
|
2909
|
-
var touch = eventType !== "touchend" ? e.targetTouches[0] : e.changedTouches[0];
|
|
2910
|
-
touch && clientToLocal(el, touch, e, calculate);
|
|
2911
|
-
}
|
|
2912
|
-
var button = e.button;
|
|
2913
|
-
if (e.which == null && button !== void 0 && MOUSE_EVENT_REG.test(e.type)) e.which = button & 1 ? 1 : button & 2 ? 3 : button & 4 ? 2 : 0;
|
|
2914
|
-
return e;
|
|
2915
|
-
}
|
|
2916
|
-
function getWheelDeltaMayPolyfill(e) {
|
|
2917
|
-
var rawWheelDelta = e.wheelDelta;
|
|
2918
|
-
if (rawWheelDelta) return rawWheelDelta;
|
|
2919
|
-
var deltaX = e.deltaX;
|
|
2920
|
-
var deltaY = e.deltaY;
|
|
2921
|
-
if (deltaX == null || deltaY == null) return rawWheelDelta;
|
|
2922
|
-
var delta = deltaY !== 0 ? Math.abs(deltaY) : Math.abs(deltaX);
|
|
2923
|
-
var sign = deltaY > 0 ? -1 : deltaY < 0 ? 1 : deltaX > 0 ? -1 : 1;
|
|
2924
|
-
return 3 * delta * sign;
|
|
2925
|
-
}
|
|
2926
|
-
function addEventListener(el, name, handler, opt) {
|
|
2927
|
-
el.addEventListener(name, handler, opt);
|
|
2928
|
-
}
|
|
2929
|
-
function removeEventListener(el, name, handler, opt) {
|
|
2930
|
-
el.removeEventListener(name, handler, opt);
|
|
2931
|
-
}
|
|
2932
|
-
function isMiddleOrRightButtonOnMouseUpDown(e) {
|
|
2933
|
-
return e.which === 2 || e.which === 3;
|
|
2934
|
-
}
|
|
2935
|
-
|
|
2936
|
-
//#endregion
|
|
2937
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/GestureMgr.js
|
|
2938
|
-
|
|
2939
|
-
function dist(pointPair) {
|
|
2940
|
-
var dx = pointPair[1][0] - pointPair[0][0];
|
|
2941
|
-
var dy = pointPair[1][1] - pointPair[0][1];
|
|
2942
|
-
return Math.sqrt(dx * dx + dy * dy);
|
|
2943
|
-
}
|
|
2944
|
-
function center(pointPair) {
|
|
2945
|
-
return [(pointPair[0][0] + pointPair[1][0]) / 2, (pointPair[0][1] + pointPair[1][1]) / 2];
|
|
2946
|
-
}
|
|
2947
|
-
function makeEventPacket(eveType, targetInfo, event) {
|
|
2948
|
-
return {
|
|
2949
|
-
type: eveType,
|
|
2950
|
-
event,
|
|
2951
|
-
target: targetInfo.target,
|
|
2952
|
-
topTarget: targetInfo.topTarget,
|
|
2953
|
-
cancelBubble: false,
|
|
2954
|
-
offsetX: event.zrX,
|
|
2955
|
-
offsetY: event.zrY,
|
|
2956
|
-
gestureEvent: event.gestureEvent,
|
|
2957
|
-
pinchX: event.pinchX,
|
|
2958
|
-
pinchY: event.pinchY,
|
|
2959
|
-
pinchScale: event.pinchScale,
|
|
2960
|
-
wheelDelta: event.zrDelta,
|
|
2961
|
-
zrByTouch: event.zrByTouch,
|
|
2962
|
-
which: event.which,
|
|
2963
|
-
stop: stopEvent
|
|
2964
|
-
};
|
|
2965
|
-
}
|
|
2966
|
-
function stopEvent() {
|
|
2967
|
-
stop(this.event);
|
|
2968
|
-
}
|
|
2969
|
-
function isHover(displayable, x, y) {
|
|
2970
|
-
if (displayable[displayable.rectHover ? "rectContain" : "contain"](x, y)) {
|
|
2971
|
-
var el = displayable;
|
|
2972
|
-
var isSilent = void 0;
|
|
2973
|
-
var ignoreClip = false;
|
|
2974
|
-
while (el) {
|
|
2975
|
-
if (el.ignoreClip) ignoreClip = true;
|
|
2976
|
-
if (!ignoreClip) {
|
|
2977
|
-
var clipPath = el.getClipPath();
|
|
2978
|
-
if (clipPath && !clipPath.contain(x, y)) return false;
|
|
2979
|
-
}
|
|
2980
|
-
if (el.silent) isSilent = true;
|
|
2981
|
-
var hostEl = el.__hostTarget;
|
|
2982
|
-
el = hostEl ? el.ignoreHostSilent ? null : hostEl : el.parent;
|
|
2983
|
-
}
|
|
2984
|
-
return isSilent ? SILENT : true;
|
|
2985
|
-
}
|
|
2986
|
-
return false;
|
|
2987
|
-
}
|
|
2988
|
-
function setHoverTarget(list, out, x, y, exclude) {
|
|
2989
|
-
for (var i = list.length - 1; i >= 0; i--) {
|
|
2990
|
-
var el = list[i];
|
|
2991
|
-
var hoverCheckResult = void 0;
|
|
2992
|
-
if (el !== exclude && !el.ignore && (hoverCheckResult = isHover(el, x, y))) {
|
|
2993
|
-
!out.topTarget && (out.topTarget = el);
|
|
2994
|
-
if (hoverCheckResult !== SILENT) {
|
|
2995
|
-
out.target = el;
|
|
2996
|
-
break;
|
|
2997
|
-
}
|
|
2998
|
-
}
|
|
2999
|
-
}
|
|
3000
|
-
}
|
|
3001
|
-
function isOutsideBoundary(handlerInstance, x, y) {
|
|
3002
|
-
var painter = handlerInstance.painter;
|
|
3003
|
-
return x < 0 || x > painter.getWidth() || y < 0 || y > painter.getHeight();
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
|
-
//#endregion
|
|
3007
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/core/timsort.js
|
|
3008
|
-
|
|
3009
|
-
function minRunLength(n) {
|
|
3010
|
-
var r = 0;
|
|
3011
|
-
while (n >= DEFAULT_MIN_MERGE) {
|
|
3012
|
-
r |= n & 1;
|
|
3013
|
-
n >>= 1;
|
|
3014
|
-
}
|
|
3015
|
-
return n + r;
|
|
3016
|
-
}
|
|
3017
|
-
function makeAscendingRun(array, lo, hi, compare) {
|
|
3018
|
-
var runHi = lo + 1;
|
|
3019
|
-
if (runHi === hi) return 1;
|
|
3020
|
-
if (compare(array[runHi++], array[lo]) < 0) {
|
|
3021
|
-
while (runHi < hi && compare(array[runHi], array[runHi - 1]) < 0) runHi++;
|
|
3022
|
-
reverseRun(array, lo, runHi);
|
|
3023
|
-
} else while (runHi < hi && compare(array[runHi], array[runHi - 1]) >= 0) runHi++;
|
|
3024
|
-
return runHi - lo;
|
|
3025
|
-
}
|
|
3026
|
-
function reverseRun(array, lo, hi) {
|
|
3027
|
-
hi--;
|
|
3028
|
-
while (lo < hi) {
|
|
3029
|
-
var t = array[lo];
|
|
3030
|
-
array[lo++] = array[hi];
|
|
3031
|
-
array[hi--] = t;
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
function binaryInsertionSort(array, lo, hi, start, compare) {
|
|
3035
|
-
if (start === lo) start++;
|
|
3036
|
-
for (; start < hi; start++) {
|
|
3037
|
-
var pivot = array[start];
|
|
3038
|
-
var left = lo;
|
|
3039
|
-
var right = start;
|
|
3040
|
-
var mid;
|
|
3041
|
-
while (left < right) {
|
|
3042
|
-
mid = left + right >>> 1;
|
|
3043
|
-
if (compare(pivot, array[mid]) < 0) right = mid;else left = mid + 1;
|
|
3044
|
-
}
|
|
3045
|
-
var n = start - left;
|
|
3046
|
-
switch (n) {
|
|
3047
|
-
case 3:
|
|
3048
|
-
array[left + 3] = array[left + 2];
|
|
3049
|
-
case 2:
|
|
3050
|
-
array[left + 2] = array[left + 1];
|
|
3051
|
-
case 1:
|
|
3052
|
-
array[left + 1] = array[left];
|
|
3053
|
-
break;
|
|
3054
|
-
default:
|
|
3055
|
-
while (n > 0) {
|
|
3056
|
-
array[left + n] = array[left + n - 1];
|
|
3057
|
-
n--;
|
|
3058
|
-
}
|
|
3059
|
-
}
|
|
3060
|
-
array[left] = pivot;
|
|
3061
|
-
}
|
|
3062
|
-
}
|
|
3063
|
-
function gallopLeft(value, array, start, length, hint, compare) {
|
|
3064
|
-
var lastOffset = 0;
|
|
3065
|
-
var maxOffset = 0;
|
|
3066
|
-
var offset = 1;
|
|
3067
|
-
if (compare(value, array[start + hint]) > 0) {
|
|
3068
|
-
maxOffset = length - hint;
|
|
3069
|
-
while (offset < maxOffset && compare(value, array[start + hint + offset]) > 0) {
|
|
3070
|
-
lastOffset = offset;
|
|
3071
|
-
offset = (offset << 1) + 1;
|
|
3072
|
-
if (offset <= 0) offset = maxOffset;
|
|
3073
|
-
}
|
|
3074
|
-
if (offset > maxOffset) offset = maxOffset;
|
|
3075
|
-
lastOffset += hint;
|
|
3076
|
-
offset += hint;
|
|
3077
|
-
} else {
|
|
3078
|
-
maxOffset = hint + 1;
|
|
3079
|
-
while (offset < maxOffset && compare(value, array[start + hint - offset]) <= 0) {
|
|
3080
|
-
lastOffset = offset;
|
|
3081
|
-
offset = (offset << 1) + 1;
|
|
3082
|
-
if (offset <= 0) offset = maxOffset;
|
|
3083
|
-
}
|
|
3084
|
-
if (offset > maxOffset) offset = maxOffset;
|
|
3085
|
-
var tmp = lastOffset;
|
|
3086
|
-
lastOffset = hint - offset;
|
|
3087
|
-
offset = hint - tmp;
|
|
3088
|
-
}
|
|
3089
|
-
lastOffset++;
|
|
3090
|
-
while (lastOffset < offset) {
|
|
3091
|
-
var m = lastOffset + (offset - lastOffset >>> 1);
|
|
3092
|
-
if (compare(value, array[start + m]) > 0) lastOffset = m + 1;else offset = m;
|
|
3093
|
-
}
|
|
3094
|
-
return offset;
|
|
3095
|
-
}
|
|
3096
|
-
function gallopRight(value, array, start, length, hint, compare) {
|
|
3097
|
-
var lastOffset = 0;
|
|
3098
|
-
var maxOffset = 0;
|
|
3099
|
-
var offset = 1;
|
|
3100
|
-
if (compare(value, array[start + hint]) < 0) {
|
|
3101
|
-
maxOffset = hint + 1;
|
|
3102
|
-
while (offset < maxOffset && compare(value, array[start + hint - offset]) < 0) {
|
|
3103
|
-
lastOffset = offset;
|
|
3104
|
-
offset = (offset << 1) + 1;
|
|
3105
|
-
if (offset <= 0) offset = maxOffset;
|
|
3106
|
-
}
|
|
3107
|
-
if (offset > maxOffset) offset = maxOffset;
|
|
3108
|
-
var tmp = lastOffset;
|
|
3109
|
-
lastOffset = hint - offset;
|
|
3110
|
-
offset = hint - tmp;
|
|
3111
|
-
} else {
|
|
3112
|
-
maxOffset = length - hint;
|
|
3113
|
-
while (offset < maxOffset && compare(value, array[start + hint + offset]) >= 0) {
|
|
3114
|
-
lastOffset = offset;
|
|
3115
|
-
offset = (offset << 1) + 1;
|
|
3116
|
-
if (offset <= 0) offset = maxOffset;
|
|
3117
|
-
}
|
|
3118
|
-
if (offset > maxOffset) offset = maxOffset;
|
|
3119
|
-
lastOffset += hint;
|
|
3120
|
-
offset += hint;
|
|
3121
|
-
}
|
|
3122
|
-
lastOffset++;
|
|
3123
|
-
while (lastOffset < offset) {
|
|
3124
|
-
var m = lastOffset + (offset - lastOffset >>> 1);
|
|
3125
|
-
if (compare(value, array[start + m]) < 0) offset = m;else lastOffset = m + 1;
|
|
3126
|
-
}
|
|
3127
|
-
return offset;
|
|
3128
|
-
}
|
|
3129
|
-
function TimSort(array, compare) {
|
|
3130
|
-
var minGallop = DEFAULT_MIN_GALLOPING;
|
|
3131
|
-
var runStart;
|
|
3132
|
-
var runLength;
|
|
3133
|
-
var stackSize = 0;
|
|
3134
|
-
var tmp = [];
|
|
3135
|
-
runStart = [];
|
|
3136
|
-
runLength = [];
|
|
3137
|
-
function pushRun(_runStart, _runLength) {
|
|
3138
|
-
runStart[stackSize] = _runStart;
|
|
3139
|
-
runLength[stackSize] = _runLength;
|
|
3140
|
-
stackSize += 1;
|
|
3141
|
-
}
|
|
3142
|
-
function mergeRuns() {
|
|
3143
|
-
while (stackSize > 1) {
|
|
3144
|
-
var n = stackSize - 2;
|
|
3145
|
-
if (n >= 1 && runLength[n - 1] <= runLength[n] + runLength[n + 1] || n >= 2 && runLength[n - 2] <= runLength[n] + runLength[n - 1]) {
|
|
3146
|
-
if (runLength[n - 1] < runLength[n + 1]) n--;
|
|
3147
|
-
} else if (runLength[n] > runLength[n + 1]) break;
|
|
3148
|
-
mergeAt(n);
|
|
3149
|
-
}
|
|
3150
|
-
}
|
|
3151
|
-
function forceMergeRuns() {
|
|
3152
|
-
while (stackSize > 1) {
|
|
3153
|
-
var n = stackSize - 2;
|
|
3154
|
-
if (n > 0 && runLength[n - 1] < runLength[n + 1]) n--;
|
|
3155
|
-
mergeAt(n);
|
|
3156
|
-
}
|
|
3157
|
-
}
|
|
3158
|
-
function mergeAt(i) {
|
|
3159
|
-
var start1 = runStart[i];
|
|
3160
|
-
var length1 = runLength[i];
|
|
3161
|
-
var start2 = runStart[i + 1];
|
|
3162
|
-
var length2 = runLength[i + 1];
|
|
3163
|
-
runLength[i] = length1 + length2;
|
|
3164
|
-
if (i === stackSize - 3) {
|
|
3165
|
-
runStart[i + 1] = runStart[i + 2];
|
|
3166
|
-
runLength[i + 1] = runLength[i + 2];
|
|
3167
|
-
}
|
|
3168
|
-
stackSize--;
|
|
3169
|
-
var k = gallopRight(array[start2], array, start1, length1, 0, compare);
|
|
3170
|
-
start1 += k;
|
|
3171
|
-
length1 -= k;
|
|
3172
|
-
if (length1 === 0) return;
|
|
3173
|
-
length2 = gallopLeft(array[start1 + length1 - 1], array, start2, length2, length2 - 1, compare);
|
|
3174
|
-
if (length2 === 0) return;
|
|
3175
|
-
if (length1 <= length2) mergeLow(start1, length1, start2, length2);else mergeHigh(start1, length1, start2, length2);
|
|
3176
|
-
}
|
|
3177
|
-
function mergeLow(start1, length1, start2, length2) {
|
|
3178
|
-
var i = 0;
|
|
3179
|
-
for (i = 0; i < length1; i++) tmp[i] = array[start1 + i];
|
|
3180
|
-
var cursor1 = 0;
|
|
3181
|
-
var cursor2 = start2;
|
|
3182
|
-
var dest = start1;
|
|
3183
|
-
array[dest++] = array[cursor2++];
|
|
3184
|
-
if (--length2 === 0) {
|
|
3185
|
-
for (i = 0; i < length1; i++) array[dest + i] = tmp[cursor1 + i];
|
|
3186
|
-
return;
|
|
3187
|
-
}
|
|
3188
|
-
if (length1 === 1) {
|
|
3189
|
-
for (i = 0; i < length2; i++) array[dest + i] = array[cursor2 + i];
|
|
3190
|
-
array[dest + length2] = tmp[cursor1];
|
|
3191
|
-
return;
|
|
3192
|
-
}
|
|
3193
|
-
var _minGallop = minGallop;
|
|
3194
|
-
var count1;
|
|
3195
|
-
var count2;
|
|
3196
|
-
var exit;
|
|
3197
|
-
while (1) {
|
|
3198
|
-
count1 = 0;
|
|
3199
|
-
count2 = 0;
|
|
3200
|
-
exit = false;
|
|
3201
|
-
do if (compare(array[cursor2], tmp[cursor1]) < 0) {
|
|
3202
|
-
array[dest++] = array[cursor2++];
|
|
3203
|
-
count2++;
|
|
3204
|
-
count1 = 0;
|
|
3205
|
-
if (--length2 === 0) {
|
|
3206
|
-
exit = true;
|
|
3207
|
-
break;
|
|
3208
|
-
}
|
|
3209
|
-
} else {
|
|
3210
|
-
array[dest++] = tmp[cursor1++];
|
|
3211
|
-
count1++;
|
|
3212
|
-
count2 = 0;
|
|
3213
|
-
if (--length1 === 1) {
|
|
3214
|
-
exit = true;
|
|
3215
|
-
break;
|
|
3216
|
-
}
|
|
3217
|
-
} while ((count1 | count2) < _minGallop);
|
|
3218
|
-
if (exit) break;
|
|
3219
|
-
do {
|
|
3220
|
-
count1 = gallopRight(array[cursor2], tmp, cursor1, length1, 0, compare);
|
|
3221
|
-
if (count1 !== 0) {
|
|
3222
|
-
for (i = 0; i < count1; i++) array[dest + i] = tmp[cursor1 + i];
|
|
3223
|
-
dest += count1;
|
|
3224
|
-
cursor1 += count1;
|
|
3225
|
-
length1 -= count1;
|
|
3226
|
-
if (length1 <= 1) {
|
|
3227
|
-
exit = true;
|
|
3228
|
-
break;
|
|
3229
|
-
}
|
|
3230
|
-
}
|
|
3231
|
-
array[dest++] = array[cursor2++];
|
|
3232
|
-
if (--length2 === 0) {
|
|
3233
|
-
exit = true;
|
|
3234
|
-
break;
|
|
3235
|
-
}
|
|
3236
|
-
count2 = gallopLeft(tmp[cursor1], array, cursor2, length2, 0, compare);
|
|
3237
|
-
if (count2 !== 0) {
|
|
3238
|
-
for (i = 0; i < count2; i++) array[dest + i] = array[cursor2 + i];
|
|
3239
|
-
dest += count2;
|
|
3240
|
-
cursor2 += count2;
|
|
3241
|
-
length2 -= count2;
|
|
3242
|
-
if (length2 === 0) {
|
|
3243
|
-
exit = true;
|
|
3244
|
-
break;
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
|
-
array[dest++] = tmp[cursor1++];
|
|
3248
|
-
if (--length1 === 1) {
|
|
3249
|
-
exit = true;
|
|
3250
|
-
break;
|
|
3251
|
-
}
|
|
3252
|
-
_minGallop--;
|
|
3253
|
-
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
|
|
3254
|
-
if (exit) break;
|
|
3255
|
-
if (_minGallop < 0) _minGallop = 0;
|
|
3256
|
-
_minGallop += 2;
|
|
3257
|
-
}
|
|
3258
|
-
minGallop = _minGallop;
|
|
3259
|
-
minGallop < 1 && (minGallop = 1);
|
|
3260
|
-
if (length1 === 1) {
|
|
3261
|
-
for (i = 0; i < length2; i++) array[dest + i] = array[cursor2 + i];
|
|
3262
|
-
array[dest + length2] = tmp[cursor1];
|
|
3263
|
-
} else if (length1 === 0) throw new Error();else for (i = 0; i < length1; i++) array[dest + i] = tmp[cursor1 + i];
|
|
3264
|
-
}
|
|
3265
|
-
function mergeHigh(start1, length1, start2, length2) {
|
|
3266
|
-
var i = 0;
|
|
3267
|
-
for (i = 0; i < length2; i++) tmp[i] = array[start2 + i];
|
|
3268
|
-
var cursor1 = start1 + length1 - 1;
|
|
3269
|
-
var cursor2 = length2 - 1;
|
|
3270
|
-
var dest = start2 + length2 - 1;
|
|
3271
|
-
var customCursor = 0;
|
|
3272
|
-
var customDest = 0;
|
|
3273
|
-
array[dest--] = array[cursor1--];
|
|
3274
|
-
if (--length1 === 0) {
|
|
3275
|
-
customCursor = dest - (length2 - 1);
|
|
3276
|
-
for (i = 0; i < length2; i++) array[customCursor + i] = tmp[i];
|
|
3277
|
-
return;
|
|
3278
|
-
}
|
|
3279
|
-
if (length2 === 1) {
|
|
3280
|
-
dest -= length1;
|
|
3281
|
-
cursor1 -= length1;
|
|
3282
|
-
customDest = dest + 1;
|
|
3283
|
-
customCursor = cursor1 + 1;
|
|
3284
|
-
for (i = length1 - 1; i >= 0; i--) array[customDest + i] = array[customCursor + i];
|
|
3285
|
-
array[dest] = tmp[cursor2];
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
var _minGallop = minGallop;
|
|
3289
|
-
while (true) {
|
|
3290
|
-
var count1 = 0;
|
|
3291
|
-
var count2 = 0;
|
|
3292
|
-
var exit = false;
|
|
3293
|
-
do if (compare(tmp[cursor2], array[cursor1]) < 0) {
|
|
3294
|
-
array[dest--] = array[cursor1--];
|
|
3295
|
-
count1++;
|
|
3296
|
-
count2 = 0;
|
|
3297
|
-
if (--length1 === 0) {
|
|
3298
|
-
exit = true;
|
|
3299
|
-
break;
|
|
3300
|
-
}
|
|
3301
|
-
} else {
|
|
3302
|
-
array[dest--] = tmp[cursor2--];
|
|
3303
|
-
count2++;
|
|
3304
|
-
count1 = 0;
|
|
3305
|
-
if (--length2 === 1) {
|
|
3306
|
-
exit = true;
|
|
3307
|
-
break;
|
|
3308
|
-
}
|
|
3309
|
-
} while ((count1 | count2) < _minGallop);
|
|
3310
|
-
if (exit) break;
|
|
3311
|
-
do {
|
|
3312
|
-
count1 = length1 - gallopRight(tmp[cursor2], array, start1, length1, length1 - 1, compare);
|
|
3313
|
-
if (count1 !== 0) {
|
|
3314
|
-
dest -= count1;
|
|
3315
|
-
cursor1 -= count1;
|
|
3316
|
-
length1 -= count1;
|
|
3317
|
-
customDest = dest + 1;
|
|
3318
|
-
customCursor = cursor1 + 1;
|
|
3319
|
-
for (i = count1 - 1; i >= 0; i--) array[customDest + i] = array[customCursor + i];
|
|
3320
|
-
if (length1 === 0) {
|
|
3321
|
-
exit = true;
|
|
3322
|
-
break;
|
|
3323
|
-
}
|
|
3324
|
-
}
|
|
3325
|
-
array[dest--] = tmp[cursor2--];
|
|
3326
|
-
if (--length2 === 1) {
|
|
3327
|
-
exit = true;
|
|
3328
|
-
break;
|
|
3329
|
-
}
|
|
3330
|
-
count2 = length2 - gallopLeft(array[cursor1], tmp, 0, length2, length2 - 1, compare);
|
|
3331
|
-
if (count2 !== 0) {
|
|
3332
|
-
dest -= count2;
|
|
3333
|
-
cursor2 -= count2;
|
|
3334
|
-
length2 -= count2;
|
|
3335
|
-
customDest = dest + 1;
|
|
3336
|
-
customCursor = cursor2 + 1;
|
|
3337
|
-
for (i = 0; i < count2; i++) array[customDest + i] = tmp[customCursor + i];
|
|
3338
|
-
if (length2 <= 1) {
|
|
3339
|
-
exit = true;
|
|
3340
|
-
break;
|
|
3341
|
-
}
|
|
3342
|
-
}
|
|
3343
|
-
array[dest--] = array[cursor1--];
|
|
3344
|
-
if (--length1 === 0) {
|
|
3345
|
-
exit = true;
|
|
3346
|
-
break;
|
|
3347
|
-
}
|
|
3348
|
-
_minGallop--;
|
|
3349
|
-
} while (count1 >= DEFAULT_MIN_GALLOPING || count2 >= DEFAULT_MIN_GALLOPING);
|
|
3350
|
-
if (exit) break;
|
|
3351
|
-
if (_minGallop < 0) _minGallop = 0;
|
|
3352
|
-
_minGallop += 2;
|
|
3353
|
-
}
|
|
3354
|
-
minGallop = _minGallop;
|
|
3355
|
-
if (minGallop < 1) minGallop = 1;
|
|
3356
|
-
if (length2 === 1) {
|
|
3357
|
-
dest -= length1;
|
|
3358
|
-
cursor1 -= length1;
|
|
3359
|
-
customDest = dest + 1;
|
|
3360
|
-
customCursor = cursor1 + 1;
|
|
3361
|
-
for (i = length1 - 1; i >= 0; i--) array[customDest + i] = array[customCursor + i];
|
|
3362
|
-
array[dest] = tmp[cursor2];
|
|
3363
|
-
} else if (length2 === 0) throw new Error();else {
|
|
3364
|
-
customCursor = dest - (length2 - 1);
|
|
3365
|
-
for (i = 0; i < length2; i++) array[customCursor + i] = tmp[i];
|
|
3366
|
-
}
|
|
3367
|
-
}
|
|
3368
|
-
return {
|
|
3369
|
-
mergeRuns,
|
|
3370
|
-
forceMergeRuns,
|
|
3371
|
-
pushRun
|
|
3372
|
-
};
|
|
3373
|
-
}
|
|
3374
|
-
function sort(array, compare, lo, hi) {
|
|
3375
|
-
if (!lo) lo = 0;
|
|
3376
|
-
if (!hi) hi = array.length;
|
|
3377
|
-
var remaining = hi - lo;
|
|
3378
|
-
if (remaining < 2) return;
|
|
3379
|
-
var runLength = 0;
|
|
3380
|
-
if (remaining < DEFAULT_MIN_MERGE) {
|
|
3381
|
-
runLength = makeAscendingRun(array, lo, hi, compare);
|
|
3382
|
-
binaryInsertionSort(array, lo, hi, lo + runLength, compare);
|
|
3383
|
-
return;
|
|
3384
|
-
}
|
|
3385
|
-
var ts = TimSort(array, compare);
|
|
3386
|
-
var minRun = minRunLength(remaining);
|
|
3387
|
-
do {
|
|
3388
|
-
runLength = makeAscendingRun(array, lo, hi, compare);
|
|
3389
|
-
if (runLength < minRun) {
|
|
3390
|
-
var force = remaining;
|
|
3391
|
-
if (force > minRun) force = minRun;
|
|
3392
|
-
binaryInsertionSort(array, lo, lo + force, lo + runLength, compare);
|
|
3393
|
-
runLength = force;
|
|
3394
|
-
}
|
|
3395
|
-
ts.pushRun(lo, runLength);
|
|
3396
|
-
ts.mergeRuns();
|
|
3397
|
-
remaining -= runLength;
|
|
3398
|
-
lo += runLength;
|
|
3399
|
-
} while (remaining !== 0);
|
|
3400
|
-
ts.forceMergeRuns();
|
|
3401
|
-
}
|
|
3402
|
-
|
|
3403
|
-
//#endregion
|
|
3404
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/Storage.js
|
|
3405
|
-
|
|
3406
|
-
function logInvalidZError() {
|
|
3407
|
-
if (invalidZErrorLogged) return;
|
|
3408
|
-
invalidZErrorLogged = true;
|
|
3409
|
-
console.warn("z / z2 / zlevel of displayable is invalid, which may cause unexpected errors");
|
|
3410
|
-
}
|
|
3411
|
-
function shapeCompareFunc(a, b) {
|
|
3412
|
-
if (a.zlevel === b.zlevel) {
|
|
3413
|
-
if (a.z === b.z) return a.z2 - b.z2;
|
|
3414
|
-
return a.z - b.z;
|
|
3415
|
-
}
|
|
3416
|
-
return a.zlevel - b.zlevel;
|
|
3417
|
-
}
|
|
3418
|
-
//#endregion
|
|
3419
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/animation/Animation.js
|
|
3420
|
-
function getTime() {
|
|
3421
|
-
return (/* @__PURE__ */new Date()).getTime();
|
|
3422
|
-
}
|
|
3423
|
-
function isPointerFromTouch(event) {
|
|
3424
|
-
var pointerType = event.pointerType;
|
|
3425
|
-
return pointerType === "pen" || pointerType === "touch";
|
|
3426
|
-
}
|
|
3427
|
-
function setTouchTimer(scope) {
|
|
3428
|
-
scope.touching = true;
|
|
3429
|
-
if (scope.touchTimer != null) {
|
|
3430
|
-
clearTimeout(scope.touchTimer);
|
|
3431
|
-
scope.touchTimer = null;
|
|
3432
|
-
}
|
|
3433
|
-
scope.touchTimer = setTimeout(function () {
|
|
3434
|
-
scope.touching = false;
|
|
3435
|
-
scope.touchTimer = null;
|
|
3436
|
-
}, 700);
|
|
3437
|
-
}
|
|
3438
|
-
function markTouch(event) {
|
|
3439
|
-
event && (event.zrByTouch = true);
|
|
3440
|
-
}
|
|
3441
|
-
function normalizeGlobalEvent(instance, event) {
|
|
3442
|
-
return normalizeEvent(instance.dom, new FakeGlobalEvent(instance, event), true);
|
|
3443
|
-
}
|
|
3444
|
-
function isLocalEl(instance, el) {
|
|
3445
|
-
var elTmp = el;
|
|
3446
|
-
var isLocal = false;
|
|
3447
|
-
while (elTmp && elTmp.nodeType !== 9 && !(isLocal = elTmp.domBelongToZr || elTmp !== el && elTmp === instance.painterRoot)) elTmp = elTmp.parentNode;
|
|
3448
|
-
return isLocal;
|
|
3449
|
-
}
|
|
3450
|
-
function mountLocalDOMEventListeners(instance, scope) {
|
|
3451
|
-
var domHandlers = scope.domHandlers;
|
|
3452
|
-
if (env.pointerEventsSupported) each(localNativeListenerNames.pointer, function (nativeEventName) {
|
|
3453
|
-
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
|
|
3454
|
-
domHandlers[nativeEventName].call(instance, event);
|
|
3455
|
-
});
|
|
3456
|
-
});else {
|
|
3457
|
-
if (env.touchEventsSupported) each(localNativeListenerNames.touch, function (nativeEventName) {
|
|
3458
|
-
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
|
|
3459
|
-
domHandlers[nativeEventName].call(instance, event);
|
|
3460
|
-
setTouchTimer(scope);
|
|
3461
|
-
});
|
|
3462
|
-
});
|
|
3463
|
-
each(localNativeListenerNames.mouse, function (nativeEventName) {
|
|
3464
|
-
mountSingleDOMEventListener(scope, nativeEventName, function (event) {
|
|
3465
|
-
event = getNativeEvent(event);
|
|
3466
|
-
if (!scope.touching) domHandlers[nativeEventName].call(instance, event);
|
|
3467
|
-
});
|
|
3468
|
-
});
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
function mountGlobalDOMEventListeners(instance, scope) {
|
|
3472
|
-
if (env.pointerEventsSupported) each(globalNativeListenerNames.pointer, mount);else if (!env.touchEventsSupported) each(globalNativeListenerNames.mouse, mount);
|
|
3473
|
-
function mount(nativeEventName) {
|
|
3474
|
-
function nativeEventListener(event) {
|
|
3475
|
-
event = getNativeEvent(event);
|
|
3476
|
-
if (!isLocalEl(instance, event.target)) {
|
|
3477
|
-
event = normalizeGlobalEvent(instance, event);
|
|
3478
|
-
scope.domHandlers[nativeEventName].call(instance, event);
|
|
3479
|
-
}
|
|
3480
|
-
}
|
|
3481
|
-
mountSingleDOMEventListener(scope, nativeEventName, nativeEventListener, {
|
|
3482
|
-
capture: true
|
|
3483
|
-
});
|
|
3484
|
-
}
|
|
3485
|
-
}
|
|
3486
|
-
function mountSingleDOMEventListener(scope, nativeEventName, listener, opt) {
|
|
3487
|
-
scope.mounted[nativeEventName] = listener;
|
|
3488
|
-
scope.listenerOpts[nativeEventName] = opt;
|
|
3489
|
-
addEventListener(scope.domTarget, nativeEventName, listener, opt);
|
|
3490
|
-
}
|
|
3491
|
-
function unmountDOMEventListeners(scope) {
|
|
3492
|
-
var mounted = scope.mounted;
|
|
3493
|
-
for (var nativeEventName in mounted) if (mounted.hasOwnProperty(nativeEventName)) removeEventListener(scope.domTarget, nativeEventName, mounted[nativeEventName], scope.listenerOpts[nativeEventName]);
|
|
3494
|
-
scope.mounted = {};
|
|
3495
|
-
}
|
|
3496
|
-
declare namespace zrender_exports {
|
|
3497
|
-
export { dispose, disposeAll, getElementSSRData, getInstance, init, registerPainter, registerSSRDataGetter, version };
|
|
3498
|
-
}
|
|
3499
|
-
function delInstance(id) {
|
|
3500
|
-
delete instances[id];
|
|
3501
|
-
}
|
|
3502
|
-
function isDarkMode(backgroundColor) {
|
|
3503
|
-
if (!backgroundColor) return false;
|
|
3504
|
-
if (typeof backgroundColor === "string") return lum(backgroundColor, 1) < DARK_MODE_THRESHOLD;else if (backgroundColor.colorStops) {
|
|
3505
|
-
var colorStops = backgroundColor.colorStops;
|
|
3506
|
-
var totalLum = 0;
|
|
3507
|
-
var len = colorStops.length;
|
|
3508
|
-
for (var i = 0; i < len; i++) totalLum += lum(colorStops[i].color, 1);
|
|
3509
|
-
totalLum /= len;
|
|
3510
|
-
return totalLum < DARK_MODE_THRESHOLD;
|
|
3511
|
-
}
|
|
3512
|
-
return false;
|
|
3513
|
-
}
|
|
3514
|
-
function init(dom, opts) {
|
|
3515
|
-
var zr = new ZRender(guid(), dom, opts);
|
|
3516
|
-
instances[zr.id] = zr;
|
|
3517
|
-
return zr;
|
|
3518
|
-
}
|
|
3519
|
-
function dispose(zr) {
|
|
3520
|
-
zr.dispose();
|
|
3521
|
-
}
|
|
3522
|
-
function disposeAll() {
|
|
3523
|
-
for (var key in instances) if (instances.hasOwnProperty(key)) instances[key].dispose();
|
|
3524
|
-
instances = {};
|
|
3525
|
-
}
|
|
3526
|
-
function getInstance(id) {
|
|
3527
|
-
return instances[id];
|
|
3528
|
-
}
|
|
3529
|
-
function registerPainter(name, Ctor) {
|
|
3530
|
-
painterCtors[name] = Ctor;
|
|
3531
|
-
}
|
|
3532
|
-
function getElementSSRData(el) {
|
|
3533
|
-
if (typeof ssrDataGetter === "function") return ssrDataGetter(el);
|
|
3534
|
-
}
|
|
3535
|
-
function registerSSRDataGetter(getter) {
|
|
3536
|
-
ssrDataGetter = getter;
|
|
3537
|
-
}
|
|
3538
|
-
//#endregion
|
|
3539
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/canvas/helper.js
|
|
3540
|
-
function isSafeNum(num) {
|
|
3541
|
-
return isFinite(num);
|
|
3542
|
-
}
|
|
3543
|
-
function createLinearGradient(ctx, obj, rect) {
|
|
3544
|
-
var x = obj.x == null ? 0 : obj.x;
|
|
3545
|
-
var x2 = obj.x2 == null ? 1 : obj.x2;
|
|
3546
|
-
var y = obj.y == null ? 0 : obj.y;
|
|
3547
|
-
var y2 = obj.y2 == null ? 0 : obj.y2;
|
|
3548
|
-
if (!obj.global) {
|
|
3549
|
-
x = x * rect.width + rect.x;
|
|
3550
|
-
x2 = x2 * rect.width + rect.x;
|
|
3551
|
-
y = y * rect.height + rect.y;
|
|
3552
|
-
y2 = y2 * rect.height + rect.y;
|
|
3553
|
-
}
|
|
3554
|
-
x = isSafeNum(x) ? x : 0;
|
|
3555
|
-
x2 = isSafeNum(x2) ? x2 : 1;
|
|
3556
|
-
y = isSafeNum(y) ? y : 0;
|
|
3557
|
-
y2 = isSafeNum(y2) ? y2 : 0;
|
|
3558
|
-
return ctx.createLinearGradient(x, y, x2, y2);
|
|
3559
|
-
}
|
|
3560
|
-
function createRadialGradient(ctx, obj, rect) {
|
|
3561
|
-
var width = rect.width;
|
|
3562
|
-
var height = rect.height;
|
|
3563
|
-
var min = Math.min(width, height);
|
|
3564
|
-
var x = obj.x == null ? .5 : obj.x;
|
|
3565
|
-
var y = obj.y == null ? .5 : obj.y;
|
|
3566
|
-
var r = obj.r == null ? .5 : obj.r;
|
|
3567
|
-
if (!obj.global) {
|
|
3568
|
-
x = x * width + rect.x;
|
|
3569
|
-
y = y * height + rect.y;
|
|
3570
|
-
r = r * min;
|
|
3571
|
-
}
|
|
3572
|
-
x = isSafeNum(x) ? x : .5;
|
|
3573
|
-
y = isSafeNum(y) ? y : .5;
|
|
3574
|
-
r = r >= 0 && isSafeNum(r) ? r : .5;
|
|
3575
|
-
return ctx.createRadialGradient(x, y, 0, x, y, r);
|
|
3576
|
-
}
|
|
3577
|
-
function getCanvasGradient(ctx, obj, rect) {
|
|
3578
|
-
var canvasGradient = obj.type === "radial" ? createRadialGradient(ctx, obj, rect) : createLinearGradient(ctx, obj, rect);
|
|
3579
|
-
var colorStops = obj.colorStops;
|
|
3580
|
-
for (var i = 0; i < colorStops.length; i++) canvasGradient.addColorStop(colorStops[i].offset, colorStops[i].color);
|
|
3581
|
-
return canvasGradient;
|
|
3582
|
-
}
|
|
3583
|
-
function isClipPathChanged(clipPaths, prevClipPaths) {
|
|
3584
|
-
if (clipPaths === prevClipPaths || !clipPaths && !prevClipPaths) return false;
|
|
3585
|
-
if (!clipPaths || !prevClipPaths || clipPaths.length !== prevClipPaths.length) return true;
|
|
3586
|
-
for (var i = 0; i < clipPaths.length; i++) if (clipPaths[i] !== prevClipPaths[i]) return true;
|
|
3587
|
-
return false;
|
|
3588
|
-
}
|
|
3589
|
-
function parseInt10(val) {
|
|
3590
|
-
return parseInt(val, 10);
|
|
3591
|
-
}
|
|
3592
|
-
function getSize(root, whIdx, opts) {
|
|
3593
|
-
var wh = ["width", "height"][whIdx];
|
|
3594
|
-
var cwh = ["clientWidth", "clientHeight"][whIdx];
|
|
3595
|
-
var plt = ["paddingLeft", "paddingTop"][whIdx];
|
|
3596
|
-
var prb = ["paddingRight", "paddingBottom"][whIdx];
|
|
3597
|
-
if (opts[wh] != null && opts[wh] !== "auto") return parseFloat(opts[wh]);
|
|
3598
|
-
var stl = document.defaultView.getComputedStyle(root);
|
|
3599
|
-
return (root[cwh] || parseInt10(stl[wh]) || parseInt10(root.style[wh])) - (parseInt10(stl[plt]) || 0) - (parseInt10(stl[prb]) || 0) | 0;
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
//#endregion
|
|
3603
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/canvas/dashStyle.js
|
|
3604
|
-
function normalizeLineDash(lineType, lineWidth) {
|
|
3605
|
-
if (!lineType || lineType === "solid" || !(lineWidth > 0)) return null;
|
|
3606
|
-
return lineType === "dashed" ? [4 * lineWidth, 2 * lineWidth] : lineType === "dotted" ? [lineWidth] : isNumber(lineType) ? [lineType] : isArray(lineType) ? lineType : null;
|
|
3607
|
-
}
|
|
3608
|
-
function getLineDash(el) {
|
|
3609
|
-
var style = el.style;
|
|
3610
|
-
var lineDash = style.lineDash && style.lineWidth > 0 && normalizeLineDash(style.lineDash, style.lineWidth);
|
|
3611
|
-
var lineDashOffset = style.lineDashOffset;
|
|
3612
|
-
if (lineDash) {
|
|
3613
|
-
var lineScale_1 = style.strokeNoScale && el.getLineScale ? el.getLineScale() : 1;
|
|
3614
|
-
if (lineScale_1 && lineScale_1 !== 1) {
|
|
3615
|
-
lineDash = map(lineDash, function (rawVal) {
|
|
3616
|
-
return rawVal / lineScale_1;
|
|
3617
|
-
});
|
|
3618
|
-
lineDashOffset /= lineScale_1;
|
|
3619
|
-
}
|
|
3620
|
-
}
|
|
3621
|
-
return [lineDash, lineDashOffset];
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
//#endregion
|
|
3625
|
-
//#region ../../node_modules/.bun/zrender@6.0.0/node_modules/zrender/lib/canvas/graphic.js
|
|
3626
|
-
|
|
3627
|
-
function styleHasStroke(style) {
|
|
3628
|
-
var stroke = style.stroke;
|
|
3629
|
-
return !(stroke == null || stroke === "none" || !(style.lineWidth > 0));
|
|
3630
|
-
}
|
|
3631
|
-
function isValidStrokeFillStyle(strokeOrFill) {
|
|
3632
|
-
return typeof strokeOrFill === "string" && strokeOrFill !== "none";
|
|
3633
|
-
}
|
|
3634
|
-
function styleHasFill(style) {
|
|
3635
|
-
var fill = style.fill;
|
|
3636
|
-
return fill != null && fill !== "none";
|
|
3637
|
-
}
|
|
3638
|
-
function doFillPath(ctx, style) {
|
|
3639
|
-
if (style.fillOpacity != null && style.fillOpacity !== 1) {
|
|
3640
|
-
var originalGlobalAlpha = ctx.globalAlpha;
|
|
3641
|
-
ctx.globalAlpha = style.fillOpacity * style.opacity;
|
|
3642
|
-
ctx.fill();
|
|
3643
|
-
ctx.globalAlpha = originalGlobalAlpha;
|
|
3644
|
-
} else ctx.fill();
|
|
3645
|
-
}
|
|
3646
|
-
function doStrokePath(ctx, style) {
|
|
3647
|
-
if (style.strokeOpacity != null && style.strokeOpacity !== 1) {
|
|
3648
|
-
var originalGlobalAlpha = ctx.globalAlpha;
|
|
3649
|
-
ctx.globalAlpha = style.strokeOpacity * style.opacity;
|
|
3650
|
-
ctx.stroke();
|
|
3651
|
-
ctx.globalAlpha = originalGlobalAlpha;
|
|
3652
|
-
} else ctx.stroke();
|
|
3653
|
-
}
|
|
3654
|
-
function createCanvasPattern(ctx, pattern, el) {
|
|
3655
|
-
var image = createOrUpdateImage(pattern.image, pattern.__image, el);
|
|
3656
|
-
if (isImageReady(image)) {
|
|
3657
|
-
var canvasPattern = ctx.createPattern(image, pattern.repeat || "repeat");
|
|
3658
|
-
if (typeof DOMMatrix === "function" && canvasPattern && canvasPattern.setTransform) {
|
|
3659
|
-
var matrix = new DOMMatrix();
|
|
3660
|
-
matrix.translateSelf(pattern.x || 0, pattern.y || 0);
|
|
3661
|
-
matrix.rotateSelf(0, 0, (pattern.rotation || 0) * RADIAN_TO_DEGREE);
|
|
3662
|
-
matrix.scaleSelf(pattern.scaleX || 1, pattern.scaleY || 1);
|
|
3663
|
-
canvasPattern.setTransform(matrix);
|
|
3664
|
-
}
|
|
3665
|
-
return canvasPattern;
|
|
3666
|
-
}
|
|
3667
|
-
}
|
|
3668
|
-
function brushPath(ctx, el, style, inBatch) {
|
|
3669
|
-
var _a;
|
|
3670
|
-
var hasStroke = styleHasStroke(style);
|
|
3671
|
-
var hasFill = styleHasFill(style);
|
|
3672
|
-
var strokePercent = style.strokePercent;
|
|
3673
|
-
var strokePart = strokePercent < 1;
|
|
3674
|
-
var firstDraw = !el.path;
|
|
3675
|
-
if ((!el.silent || strokePart) && firstDraw) el.createPathProxy();
|
|
3676
|
-
var path = el.path || pathProxyForDraw;
|
|
3677
|
-
var dirtyFlag = el.__dirty;
|
|
3678
|
-
if (!inBatch) {
|
|
3679
|
-
var fill = style.fill;
|
|
3680
|
-
var stroke = style.stroke;
|
|
3681
|
-
var hasFillGradient = hasFill && !!fill.colorStops;
|
|
3682
|
-
var hasStrokeGradient = hasStroke && !!stroke.colorStops;
|
|
3683
|
-
var hasFillPattern = hasFill && !!fill.image;
|
|
3684
|
-
var hasStrokePattern = hasStroke && !!stroke.image;
|
|
3685
|
-
var fillGradient = void 0;
|
|
3686
|
-
var strokeGradient = void 0;
|
|
3687
|
-
var fillPattern = void 0;
|
|
3688
|
-
var strokePattern = void 0;
|
|
3689
|
-
var rect = void 0;
|
|
3690
|
-
if (hasFillGradient || hasStrokeGradient) rect = el.getBoundingRect();
|
|
3691
|
-
if (hasFillGradient) {
|
|
3692
|
-
fillGradient = dirtyFlag ? getCanvasGradient(ctx, fill, rect) : el.__canvasFillGradient;
|
|
3693
|
-
el.__canvasFillGradient = fillGradient;
|
|
3694
|
-
}
|
|
3695
|
-
if (hasStrokeGradient) {
|
|
3696
|
-
strokeGradient = dirtyFlag ? getCanvasGradient(ctx, stroke, rect) : el.__canvasStrokeGradient;
|
|
3697
|
-
el.__canvasStrokeGradient = strokeGradient;
|
|
3698
|
-
}
|
|
3699
|
-
if (hasFillPattern) {
|
|
3700
|
-
fillPattern = dirtyFlag || !el.__canvasFillPattern ? createCanvasPattern(ctx, fill, el) : el.__canvasFillPattern;
|
|
3701
|
-
el.__canvasFillPattern = fillPattern;
|
|
3702
|
-
}
|
|
3703
|
-
if (hasStrokePattern) {
|
|
3704
|
-
strokePattern = dirtyFlag || !el.__canvasStrokePattern ? createCanvasPattern(ctx, stroke, el) : el.__canvasStrokePattern;
|
|
3705
|
-
el.__canvasStrokePattern = strokePattern;
|
|
3706
|
-
}
|
|
3707
|
-
if (hasFillGradient) ctx.fillStyle = fillGradient;else if (hasFillPattern) if (fillPattern) ctx.fillStyle = fillPattern;else hasFill = false;
|
|
3708
|
-
if (hasStrokeGradient) ctx.strokeStyle = strokeGradient;else if (hasStrokePattern) if (strokePattern) ctx.strokeStyle = strokePattern;else hasStroke = false;
|
|
3709
|
-
}
|
|
3710
|
-
var scale = el.getGlobalScale();
|
|
3711
|
-
path.setScale(scale[0], scale[1], el.segmentIgnoreThreshold);
|
|
3712
|
-
var lineDash;
|
|
3713
|
-
var lineDashOffset;
|
|
3714
|
-
if (ctx.setLineDash && style.lineDash) _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];
|
|
3715
|
-
var needsRebuild = true;
|
|
3716
|
-
if (firstDraw || dirtyFlag & 4) {
|
|
3717
|
-
path.setDPR(ctx.dpr);
|
|
3718
|
-
if (strokePart) path.setContext(null);else {
|
|
3719
|
-
path.setContext(ctx);
|
|
3720
|
-
needsRebuild = false;
|
|
3721
|
-
}
|
|
3722
|
-
path.reset();
|
|
3723
|
-
el.buildPath(path, el.shape, inBatch);
|
|
3724
|
-
path.toStatic();
|
|
3725
|
-
el.pathUpdated();
|
|
3726
|
-
}
|
|
3727
|
-
if (needsRebuild) path.rebuildPath(ctx, strokePart ? strokePercent : 1);
|
|
3728
|
-
if (lineDash) {
|
|
3729
|
-
ctx.setLineDash(lineDash);
|
|
3730
|
-
ctx.lineDashOffset = lineDashOffset;
|
|
3731
|
-
}
|
|
3732
|
-
if (!inBatch) if (style.strokeFirst) {
|
|
3733
|
-
if (hasStroke) doStrokePath(ctx, style);
|
|
3734
|
-
if (hasFill) doFillPath(ctx, style);
|
|
3735
|
-
} else {
|
|
3736
|
-
if (hasFill) doFillPath(ctx, style);
|
|
3737
|
-
if (hasStroke) doStrokePath(ctx, style);
|
|
3738
|
-
}
|
|
3739
|
-
if (lineDash) ctx.setLineDash([]);
|
|
3740
|
-
}
|
|
3741
|
-
function brushImage(ctx, el, style) {
|
|
3742
|
-
var image = el.__image = createOrUpdateImage(style.image, el.__image, el, el.onload);
|
|
3743
|
-
if (!image || !isImageReady(image)) return;
|
|
3744
|
-
var x = style.x || 0;
|
|
3745
|
-
var y = style.y || 0;
|
|
3746
|
-
var width = el.getWidth();
|
|
3747
|
-
var height = el.getHeight();
|
|
3748
|
-
var aspect = image.width / image.height;
|
|
3749
|
-
if (width == null && height != null) width = height * aspect;else if (height == null && width != null) height = width / aspect;else if (width == null && height == null) {
|
|
3750
|
-
width = image.width;
|
|
3751
|
-
height = image.height;
|
|
3752
|
-
}
|
|
3753
|
-
if (style.sWidth && style.sHeight) {
|
|
3754
|
-
var sx = style.sx || 0;
|
|
3755
|
-
var sy = style.sy || 0;
|
|
3756
|
-
ctx.drawImage(image, sx, sy, style.sWidth, style.sHeight, x, y, width, height);
|
|
3757
|
-
} else if (style.sx && style.sy) {
|
|
3758
|
-
var sx = style.sx;
|
|
3759
|
-
var sy = style.sy;
|
|
3760
|
-
var sWidth = width - sx;
|
|
3761
|
-
var sHeight = height - sy;
|
|
3762
|
-
ctx.drawImage(image, sx, sy, sWidth, sHeight, x, y, width, height);
|
|
3763
|
-
} else ctx.drawImage(image, x, y, width, height);
|
|
3764
|
-
}
|
|
3765
|
-
function brushText(ctx, el, style) {
|
|
3766
|
-
var _a;
|
|
3767
|
-
var text = style.text;
|
|
3768
|
-
text != null && (text += "");
|
|
3769
|
-
if (text) {
|
|
3770
|
-
ctx.font = style.font || "12px sans-serif";
|
|
3771
|
-
ctx.textAlign = style.textAlign;
|
|
3772
|
-
ctx.textBaseline = style.textBaseline;
|
|
3773
|
-
var lineDash = void 0;
|
|
3774
|
-
var lineDashOffset = void 0;
|
|
3775
|
-
if (ctx.setLineDash && style.lineDash) _a = getLineDash(el), lineDash = _a[0], lineDashOffset = _a[1];
|
|
3776
|
-
if (lineDash) {
|
|
3777
|
-
ctx.setLineDash(lineDash);
|
|
3778
|
-
ctx.lineDashOffset = lineDashOffset;
|
|
3779
|
-
}
|
|
3780
|
-
if (style.strokeFirst) {
|
|
3781
|
-
if (styleHasStroke(style)) ctx.strokeText(text, style.x, style.y);
|
|
3782
|
-
if (styleHasFill(style)) ctx.fillText(text, style.x, style.y);
|
|
3783
|
-
} else {
|
|
3784
|
-
if (styleHasFill(style)) ctx.fillText(text, style.x, style.y);
|
|
3785
|
-
if (styleHasStroke(style)) ctx.strokeText(text, style.x, style.y);
|
|
3786
|
-
}
|
|
3787
|
-
if (lineDash) ctx.setLineDash([]);
|
|
3788
|
-
}
|
|
3789
|
-
}
|
|
3790
|
-
function bindCommonProps(ctx, style, prevStyle, forceSetAll, scope) {
|
|
3791
|
-
var styleChanged = false;
|
|
3792
|
-
if (!forceSetAll) {
|
|
3793
|
-
prevStyle = prevStyle || {};
|
|
3794
|
-
if (style === prevStyle) return false;
|
|
3795
|
-
}
|
|
3796
|
-
if (forceSetAll || style.opacity !== prevStyle.opacity) {
|
|
3797
|
-
flushPathDrawn(ctx, scope);
|
|
3798
|
-
styleChanged = true;
|
|
3799
|
-
var opacity = Math.max(Math.min(style.opacity, 1), 0);
|
|
3800
|
-
ctx.globalAlpha = isNaN(opacity) ? DEFAULT_COMMON_STYLE.opacity : opacity;
|
|
3801
|
-
}
|
|
3802
|
-
if (forceSetAll || style.blend !== prevStyle.blend) {
|
|
3803
|
-
if (!styleChanged) {
|
|
3804
|
-
flushPathDrawn(ctx, scope);
|
|
3805
|
-
styleChanged = true;
|
|
3806
|
-
}
|
|
3807
|
-
ctx.globalCompositeOperation = style.blend || DEFAULT_COMMON_STYLE.blend;
|
|
3808
|
-
}
|
|
3809
|
-
for (var i = 0; i < SHADOW_NUMBER_PROPS.length; i++) {
|
|
3810
|
-
var propName = SHADOW_NUMBER_PROPS[i];
|
|
3811
|
-
if (forceSetAll || style[propName] !== prevStyle[propName]) {
|
|
3812
|
-
if (!styleChanged) {
|
|
3813
|
-
flushPathDrawn(ctx, scope);
|
|
3814
|
-
styleChanged = true;
|
|
3815
|
-
}
|
|
3816
|
-
ctx[propName] = ctx.dpr * (style[propName] || 0);
|
|
3817
|
-
}
|
|
3818
|
-
}
|
|
3819
|
-
if (forceSetAll || style.shadowColor !== prevStyle.shadowColor) {
|
|
3820
|
-
if (!styleChanged) {
|
|
3821
|
-
flushPathDrawn(ctx, scope);
|
|
3822
|
-
styleChanged = true;
|
|
3823
|
-
}
|
|
3824
|
-
ctx.shadowColor = style.shadowColor || DEFAULT_COMMON_STYLE.shadowColor;
|
|
3825
|
-
}
|
|
3826
|
-
return styleChanged;
|
|
3827
|
-
}
|
|
3828
|
-
function bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetAll, scope) {
|
|
3829
|
-
var style = getStyle(el, scope.inHover);
|
|
3830
|
-
var prevStyle = forceSetAll ? null : prevEl && getStyle(prevEl, scope.inHover) || {};
|
|
3831
|
-
if (style === prevStyle) return false;
|
|
3832
|
-
var styleChanged = bindCommonProps(ctx, style, prevStyle, forceSetAll, scope);
|
|
3833
|
-
if (forceSetAll || style.fill !== prevStyle.fill) {
|
|
3834
|
-
if (!styleChanged) {
|
|
3835
|
-
flushPathDrawn(ctx, scope);
|
|
3836
|
-
styleChanged = true;
|
|
3837
|
-
}
|
|
3838
|
-
isValidStrokeFillStyle(style.fill) && (ctx.fillStyle = style.fill);
|
|
3839
|
-
}
|
|
3840
|
-
if (forceSetAll || style.stroke !== prevStyle.stroke) {
|
|
3841
|
-
if (!styleChanged) {
|
|
3842
|
-
flushPathDrawn(ctx, scope);
|
|
3843
|
-
styleChanged = true;
|
|
3844
|
-
}
|
|
3845
|
-
isValidStrokeFillStyle(style.stroke) && (ctx.strokeStyle = style.stroke);
|
|
3846
|
-
}
|
|
3847
|
-
if (forceSetAll || style.opacity !== prevStyle.opacity) {
|
|
3848
|
-
if (!styleChanged) {
|
|
3849
|
-
flushPathDrawn(ctx, scope);
|
|
3850
|
-
styleChanged = true;
|
|
3851
|
-
}
|
|
3852
|
-
ctx.globalAlpha = style.opacity == null ? 1 : style.opacity;
|
|
3853
|
-
}
|
|
3854
|
-
if (el.hasStroke()) {
|
|
3855
|
-
var newLineWidth = style.lineWidth / (style.strokeNoScale && el.getLineScale ? el.getLineScale() : 1);
|
|
3856
|
-
if (ctx.lineWidth !== newLineWidth) {
|
|
3857
|
-
if (!styleChanged) {
|
|
3858
|
-
flushPathDrawn(ctx, scope);
|
|
3859
|
-
styleChanged = true;
|
|
3860
|
-
}
|
|
3861
|
-
ctx.lineWidth = newLineWidth;
|
|
3862
|
-
}
|
|
3863
|
-
}
|
|
3864
|
-
for (var i = 0; i < STROKE_PROPS.length; i++) {
|
|
3865
|
-
var prop = STROKE_PROPS[i];
|
|
3866
|
-
var propName = prop[0];
|
|
3867
|
-
if (forceSetAll || style[propName] !== prevStyle[propName]) {
|
|
3868
|
-
if (!styleChanged) {
|
|
3869
|
-
flushPathDrawn(ctx, scope);
|
|
3870
|
-
styleChanged = true;
|
|
3871
|
-
}
|
|
3872
|
-
ctx[propName] = style[propName] || prop[1];
|
|
3873
|
-
}
|
|
3874
|
-
}
|
|
3875
|
-
return styleChanged;
|
|
3876
|
-
}
|
|
3877
|
-
function bindImageStyle(ctx, el, prevEl, forceSetAll, scope) {
|
|
3878
|
-
return bindCommonProps(ctx, getStyle(el, scope.inHover), prevEl && getStyle(prevEl, scope.inHover), forceSetAll, scope);
|
|
3879
|
-
}
|
|
3880
|
-
function setContextTransform(ctx, el) {
|
|
3881
|
-
var m = el.transform;
|
|
3882
|
-
var dpr = ctx.dpr || 1;
|
|
3883
|
-
if (m) ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);else ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
3884
|
-
}
|
|
3885
|
-
function updateClipStatus(clipPaths, ctx, scope) {
|
|
3886
|
-
var allClipped = false;
|
|
3887
|
-
for (var i = 0; i < clipPaths.length; i++) {
|
|
3888
|
-
var clipPath = clipPaths[i];
|
|
3889
|
-
allClipped = allClipped || clipPath.isZeroArea();
|
|
3890
|
-
setContextTransform(ctx, clipPath);
|
|
3891
|
-
ctx.beginPath();
|
|
3892
|
-
clipPath.buildPath(ctx, clipPath.shape);
|
|
3893
|
-
ctx.clip();
|
|
3894
|
-
}
|
|
3895
|
-
scope.allClipped = allClipped;
|
|
3896
|
-
}
|
|
3897
|
-
function isTransformChanged(m0, m1) {
|
|
3898
|
-
if (m0 && m1) return m0[0] !== m1[0] || m0[1] !== m1[1] || m0[2] !== m1[2] || m0[3] !== m1[3] || m0[4] !== m1[4] || m0[5] !== m1[5];else if (!m0 && !m1) return false;
|
|
3899
|
-
return true;
|
|
3900
|
-
}
|
|
3901
|
-
function canPathBatch(style) {
|
|
3902
|
-
var hasFill = styleHasFill(style);
|
|
3903
|
-
var hasStroke = styleHasStroke(style);
|
|
3904
|
-
return !(style.lineDash || !(+hasFill ^ +hasStroke) || hasFill && typeof style.fill !== "string" || hasStroke && typeof style.stroke !== "string" || style.strokePercent < 1 || style.strokeOpacity < 1 || style.fillOpacity < 1);
|
|
3905
|
-
}
|
|
3906
|
-
function flushPathDrawn(ctx, scope) {
|
|
3907
|
-
scope.batchFill && ctx.fill();
|
|
3908
|
-
scope.batchStroke && ctx.stroke();
|
|
3909
|
-
scope.batchFill = "";
|
|
3910
|
-
scope.batchStroke = "";
|
|
3911
|
-
}
|
|
3912
|
-
function getStyle(el, inHover) {
|
|
3913
|
-
return inHover ? el.__hoverStyle || el.style : el.style;
|
|
3914
|
-
}
|
|
3915
|
-
function brushSingle(ctx, el) {
|
|
3916
|
-
brush(ctx, el, {
|
|
3917
|
-
inHover: false,
|
|
3918
|
-
viewWidth: 0,
|
|
3919
|
-
viewHeight: 0
|
|
3920
|
-
}, true);
|
|
3921
|
-
}
|
|
3922
|
-
function brush(ctx, el, scope, isLast) {
|
|
3923
|
-
var m = el.transform;
|
|
3924
|
-
if (!el.shouldBePainted(scope.viewWidth, scope.viewHeight, false, false)) {
|
|
3925
|
-
el.__dirty &= ~1;
|
|
3926
|
-
el.__isRendered = false;
|
|
3927
|
-
return;
|
|
3928
|
-
}
|
|
3929
|
-
var clipPaths = el.__clipPaths;
|
|
3930
|
-
var prevElClipPaths = scope.prevElClipPaths;
|
|
3931
|
-
var forceSetTransform = false;
|
|
3932
|
-
var forceSetStyle = false;
|
|
3933
|
-
if (!prevElClipPaths || isClipPathChanged(clipPaths, prevElClipPaths)) {
|
|
3934
|
-
if (prevElClipPaths && prevElClipPaths.length) {
|
|
3935
|
-
flushPathDrawn(ctx, scope);
|
|
3936
|
-
ctx.restore();
|
|
3937
|
-
forceSetStyle = forceSetTransform = true;
|
|
3938
|
-
scope.prevElClipPaths = null;
|
|
3939
|
-
scope.allClipped = false;
|
|
3940
|
-
scope.prevEl = null;
|
|
3941
|
-
}
|
|
3942
|
-
if (clipPaths && clipPaths.length) {
|
|
3943
|
-
flushPathDrawn(ctx, scope);
|
|
3944
|
-
ctx.save();
|
|
3945
|
-
updateClipStatus(clipPaths, ctx, scope);
|
|
3946
|
-
forceSetTransform = true;
|
|
3947
|
-
}
|
|
3948
|
-
scope.prevElClipPaths = clipPaths;
|
|
3949
|
-
}
|
|
3950
|
-
if (scope.allClipped) {
|
|
3951
|
-
el.__isRendered = false;
|
|
3952
|
-
return;
|
|
3953
|
-
}
|
|
3954
|
-
el.beforeBrush && el.beforeBrush();
|
|
3955
|
-
el.innerBeforeBrush();
|
|
3956
|
-
var prevEl = scope.prevEl;
|
|
3957
|
-
if (!prevEl) forceSetStyle = forceSetTransform = true;
|
|
3958
|
-
var canBatchPath = el instanceof Path && el.autoBatch && canPathBatch(el.style);
|
|
3959
|
-
if (forceSetTransform || isTransformChanged(m, prevEl.transform)) {
|
|
3960
|
-
flushPathDrawn(ctx, scope);
|
|
3961
|
-
setContextTransform(ctx, el);
|
|
3962
|
-
} else if (!canBatchPath) flushPathDrawn(ctx, scope);
|
|
3963
|
-
var style = getStyle(el, scope.inHover);
|
|
3964
|
-
if (el instanceof Path) {
|
|
3965
|
-
if (scope.lastDrawType !== DRAW_TYPE_PATH) {
|
|
3966
|
-
forceSetStyle = true;
|
|
3967
|
-
scope.lastDrawType = DRAW_TYPE_PATH;
|
|
3968
|
-
}
|
|
3969
|
-
bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);
|
|
3970
|
-
if (!canBatchPath || !scope.batchFill && !scope.batchStroke) ctx.beginPath();
|
|
3971
|
-
brushPath(ctx, el, style, canBatchPath);
|
|
3972
|
-
if (canBatchPath) {
|
|
3973
|
-
scope.batchFill = style.fill || "";
|
|
3974
|
-
scope.batchStroke = style.stroke || "";
|
|
3975
|
-
}
|
|
3976
|
-
} else if (el instanceof TSpan) {
|
|
3977
|
-
if (scope.lastDrawType !== DRAW_TYPE_TEXT) {
|
|
3978
|
-
forceSetStyle = true;
|
|
3979
|
-
scope.lastDrawType = DRAW_TYPE_TEXT;
|
|
3980
|
-
}
|
|
3981
|
-
bindPathAndTextCommonStyle(ctx, el, prevEl, forceSetStyle, scope);
|
|
3982
|
-
brushText(ctx, el, style);
|
|
3983
|
-
} else if (el instanceof ZRImage) {
|
|
3984
|
-
if (scope.lastDrawType !== DRAW_TYPE_IMAGE) {
|
|
3985
|
-
forceSetStyle = true;
|
|
3986
|
-
scope.lastDrawType = DRAW_TYPE_IMAGE;
|
|
3987
|
-
}
|
|
3988
|
-
bindImageStyle(ctx, el, prevEl, forceSetStyle, scope);
|
|
3989
|
-
brushImage(ctx, el, style);
|
|
3990
|
-
} else if (el.getTemporalDisplayables) {
|
|
3991
|
-
if (scope.lastDrawType !== DRAW_TYPE_INCREMENTAL) {
|
|
3992
|
-
forceSetStyle = true;
|
|
3993
|
-
scope.lastDrawType = DRAW_TYPE_INCREMENTAL;
|
|
3994
|
-
}
|
|
3995
|
-
brushIncremental(ctx, el, scope);
|
|
3996
|
-
}
|
|
3997
|
-
if (canBatchPath && isLast) flushPathDrawn(ctx, scope);
|
|
3998
|
-
el.innerAfterBrush();
|
|
3999
|
-
el.afterBrush && el.afterBrush();
|
|
4000
|
-
scope.prevEl = el;
|
|
4001
|
-
el.__dirty = 0;
|
|
4002
|
-
el.__isRendered = true;
|
|
4003
|
-
}
|
|
4004
|
-
function brushIncremental(ctx, el, scope) {
|
|
4005
|
-
var displayables = el.getDisplayables();
|
|
4006
|
-
var temporalDisplayables = el.getTemporalDisplayables();
|
|
4007
|
-
ctx.save();
|
|
4008
|
-
var innerScope = {
|
|
4009
|
-
prevElClipPaths: null,
|
|
4010
|
-
prevEl: null,
|
|
4011
|
-
allClipped: false,
|
|
4012
|
-
viewWidth: scope.viewWidth,
|
|
4013
|
-
viewHeight: scope.viewHeight,
|
|
4014
|
-
inHover: scope.inHover
|
|
4015
|
-
};
|
|
4016
|
-
var i;
|
|
4017
|
-
var len;
|
|
4018
|
-
for (i = el.getCursor(), len = displayables.length; i < len; i++) {
|
|
4019
|
-
var displayable = displayables[i];
|
|
4020
|
-
displayable.beforeBrush && displayable.beforeBrush();
|
|
4021
|
-
displayable.innerBeforeBrush();
|
|
4022
|
-
brush(ctx, displayable, innerScope, i === len - 1);
|
|
4023
|
-
displayable.innerAfterBrush();
|
|
4024
|
-
displayable.afterBrush && displayable.afterBrush();
|
|
4025
|
-
innerScope.prevEl = displayable;
|
|
4026
|
-
}
|
|
4027
|
-
for (var i_1 = 0, len_1 = temporalDisplayables.length; i_1 < len_1; i_1++) {
|
|
4028
|
-
var displayable = temporalDisplayables[i_1];
|
|
4029
|
-
displayable.beforeBrush && displayable.beforeBrush();
|
|
4030
|
-
displayable.innerBeforeBrush();
|
|
4031
|
-
brush(ctx, displayable, innerScope, i_1 === len_1 - 1);
|
|
4032
|
-
displayable.innerAfterBrush();
|
|
4033
|
-
displayable.afterBrush && displayable.afterBrush();
|
|
4034
|
-
innerScope.prevEl = displayable;
|
|
4035
|
-
}
|
|
4036
|
-
el.clearTemporalDisplayables();
|
|
4037
|
-
el.notClear = true;
|
|
4038
|
-
ctx.restore();
|
|
4039
|
-
}
|
|
4040
|
-
|
|
4041
|
-
//#endregion
|
|
4042
|
-
export { hasShadow as $, setAsPrimitive as $n, createIntersectContext as $t, ZRImage as A, isArray as An, applyTransform as At, fromPoints as B, isTypedArray as Bn, min$1 as Bt, ZRText as C, eqNaN as Cn, quadraticAt as Ct, subPixelOptimize as D, hasOwn as Dn, Transformable as Dt, Rect as E, find as En, TRANSFORMABLE_PROPS as Et, normalizeRadian as F, isImagePatternObject as Fn, distSquare as Ft, TEXT_ALIGN_TO_ANCHOR as G, mergeAll as Gn, sub as Gt, devicePixelRatio as H, logError as Hn, scale as Ht, containStroke$2 as I, isNumber as In, distance as It, getIdURL as J, normalizeCssArray as Jn, calculateTextPosition as Jt, adjustTextY as K, mixin as Kn, vector_exports as Kt, containStroke$4 as L, isObject as Ln, len as Lt, DEFAULT_PATH_STYLE as M, isDom as Mn, copy as Mt, Path as N, isFunction as Nn, create as Nt, subPixelOptimizeLine as O, indexOf as On, copyTransform as Ot, windingLine as P, isGradientObject as Pn, dist$1 as Pt, getShadowKey as Q, retrieve3 as Qn, BoundingRect as Qt, PathProxy as R, isString as Rn, lerp$1 as Rt, Group as S, each as Sn, cubicSubdivide as St, parseFontSize as T, filter as Tn, quadraticSubdivide as Tt, Eventful as U, map as Un, scaleAndAdd as Ut, Displayable as V, keys as Vn, normalize as Vt, cloneValue as W, merge as Wn, set as Wt, getPathPrecision as X, retrieve as Xn, getLineHeight as Xt, getMatrixStr as Y, reduce as Yn, getBoundingRect as Yt, getSRTTransformString as Z, retrieve2 as Zn, parsePercent as Zt, stop as _, concatArray as _n, stringify as _t, getCanvasGradient as a, invert as an, platformApi as ar, isRadialGradient as at, transformLocalCoordClear as b, defaults as bn, cubicDerivativeAt as bt, init as c, rotate as cn, __exportAll as cr, color_exports as ct, zrender_exports as d, createOrUpdateImage as dn, lift as dt, Point as en, slice as er, isAroundZero as et, requestAnimationFrame as f, LRU as fn, liftColor as ft, normalizeEvent as g, clone$2 as gn, parseCssFloat as gt, isMiddleOrRightButtonOnMouseUpDown as h, bind as hn, parse as ht, getLineDash as i, identity as in, DEFAULT_FONT_FAMILY as ir, isPattern as it, TSpan as j, isArrayLike as jn, clone as jt, subPixelOptimizeRect as k, inherits as kn, add as kt, registerPainter as l, scale$1 as ln, fastLerp as lt, addEventListener as m, assert as mn, modifyHSL as mt, brushSingle as n, copy$1 as nn, util_exports as nr, isImagePattern as nt, getSize as o, matrix_exports as on, setPlatformAPI as or, normalizeColor as ot, sort as p, env as pn, modifyAlpha as pt, encodeBase64 as q, noop as qn, truncateText as qt, createCanvasPattern as r, create$1 as rn, DEFAULT_FONT as rr, isLinearGradient as rt, getElementSSRData as s, mul$1 as sn, __extends as sr, round4 as st, brush as t, clone$1 as tn, trim as tr, isGradient as tt, registerSSRDataGetter as u, translate as un, lerp as ut, encodeHTML as v, createHashMap as vn, createCubicEasingFunc as vt, hasSeparateFont as w, extend as wn, quadraticDerivativeAt as wt, CompoundPath as x, disableUserSelect as xn, cubicRootAt as xt, transformLocalCoord as y, curry as yn, cubicAt as yt, normalizeArcAngles as z, isStringSafe as zn, max$1 as zt };
|
|
4043
|
-
//# sourceMappingURL=graphic.d.ts.map
|