@visactor/vchart-extension 2.0.4-alpha.7 → 2.0.4-alpha.9
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/build/index.js +1607 -678
- package/build/index.min.js +2 -2
- package/cjs/charts/3d/rect-3d.js +1 -2
- package/cjs/charts/axis-3d/linear-axis.js +2 -1
- package/cjs/charts/bar-3d/interface.js +1 -2
- package/cjs/charts/candlestick/candlestick.js +2 -1
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/cjs/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/cjs/charts/conversion-funnel/index.js +1 -1
- package/cjs/charts/conversion-funnel/interface.js +1 -1
- package/cjs/charts/conversion-funnel/util.js +1 -1
- package/cjs/charts/funnel-3d/chart.js +1 -1
- package/cjs/charts/funnel-3d/constant.js +1 -1
- package/cjs/charts/funnel-3d/index.js +1 -1
- package/cjs/charts/funnel-3d/interface.js +1 -1
- package/cjs/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/cjs/charts/funnel-3d/series.js +1 -1
- package/cjs/charts/funnel-3d/theme.js +2 -1
- package/cjs/charts/histogram-3d/chart.js +1 -1
- package/cjs/charts/histogram-3d/index.js +1 -1
- package/cjs/charts/histogram-3d/interface.js +1 -1
- package/cjs/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/cjs/charts/image-cloud/image-cloud.js +1 -1
- package/cjs/charts/image-cloud/index.js +1 -1
- package/cjs/charts/image-cloud/interface.js +1 -1
- package/cjs/charts/image-cloud/series/image-cloud.d.ts +0 -1
- package/cjs/charts/image-cloud/series/image-cloud.js +1 -5
- package/cjs/charts/image-cloud/series/image-cloud.js.map +1 -1
- package/cjs/components/bar-link/bar-link.js +1 -1
- package/cjs/components/bar-link/constant.js +1 -1
- package/cjs/components/bar-link/index.js +1 -1
- package/cjs/components/bar-link/type.js +1 -1
- package/cjs/components/bar-link/util.js +1 -1
- package/cjs/components/map-label/index.js +1 -1
- package/cjs/components/map-label/layout.js +1 -1
- package/cjs/components/map-label/map-label-transformer.js +1 -1
- package/cjs/components/map-label/map-label.js +1 -1
- package/cjs/components/map-label/theme.js +1 -1
- package/cjs/components/map-label/type.js +1 -1
- package/cjs/components/series-break/constant.js +1 -2
- package/cjs/components/series-break/index.js +1 -1
- package/cjs/components/series-break/series-break.js +1 -1
- package/cjs/components/series-break/type.js +1 -1
- package/cjs/components/series-break/util.js +1 -1
- package/cjs/components/series-label/constant.js +1 -1
- package/cjs/components/series-label/index.js +1 -1
- package/cjs/components/series-label/series-label.js +1 -1
- package/cjs/components/series-label/type.js +1 -1
- package/cjs/components/series-label/util.js +1 -1
- package/esm/charts/3d/rect-3d.js +1 -2
- package/esm/charts/axis-3d/linear-axis.js +2 -1
- package/esm/charts/bar-3d/interface.js +1 -2
- package/esm/charts/candlestick/candlestick.js +2 -1
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel-transformer.js +1 -1
- package/esm/charts/conversion-funnel/conversion-funnel.js +1 -1
- package/esm/charts/conversion-funnel/index.js +1 -1
- package/esm/charts/conversion-funnel/interface.js +1 -1
- package/esm/charts/conversion-funnel/util.js +1 -1
- package/esm/charts/funnel-3d/chart.js +1 -1
- package/esm/charts/funnel-3d/constant.js +1 -1
- package/esm/charts/funnel-3d/index.js +1 -1
- package/esm/charts/funnel-3d/interface.js +1 -1
- package/esm/charts/funnel-3d/series-spec-transformer.js +1 -1
- package/esm/charts/funnel-3d/series.js +1 -1
- package/esm/charts/funnel-3d/theme.js +2 -1
- package/esm/charts/histogram-3d/chart.js +1 -1
- package/esm/charts/histogram-3d/index.js +1 -1
- package/esm/charts/histogram-3d/interface.js +1 -1
- package/esm/charts/image-cloud/image-cloud-transformer.js +1 -1
- package/esm/charts/image-cloud/image-cloud.js +1 -1
- package/esm/charts/image-cloud/index.js +1 -1
- package/esm/charts/image-cloud/interface.js +1 -1
- package/esm/charts/image-cloud/series/image-cloud.d.ts +0 -1
- package/esm/charts/image-cloud/series/image-cloud.js +1 -5
- package/esm/charts/image-cloud/series/image-cloud.js.map +1 -1
- package/esm/components/bar-link/bar-link.js +1 -1
- package/esm/components/bar-link/constant.js +1 -1
- package/esm/components/bar-link/index.js +1 -1
- package/esm/components/bar-link/type.js +1 -1
- package/esm/components/bar-link/util.js +1 -1
- package/esm/components/map-label/index.js +1 -1
- package/esm/components/map-label/layout.js +1 -1
- package/esm/components/map-label/map-label-transformer.js +1 -1
- package/esm/components/map-label/map-label.js +1 -1
- package/esm/components/map-label/theme.js +1 -1
- package/esm/components/map-label/type.js +1 -1
- package/esm/components/series-break/constant.js +1 -2
- package/esm/components/series-break/index.js +1 -1
- package/esm/components/series-break/series-break.js +1 -1
- package/esm/components/series-break/type.js +1 -1
- package/esm/components/series-break/util.js +1 -1
- package/esm/components/series-label/constant.js +1 -1
- package/esm/components/series-label/index.js +1 -1
- package/esm/components/series-label/series-label.js +1 -1
- package/esm/components/series-label/type.js +1 -1
- package/esm/components/series-label/util.js +1 -1
- package/package.json +13 -8
package/build/index.js
CHANGED
|
@@ -325,94 +325,88 @@
|
|
|
325
325
|
var eventemitter3Exports = eventemitter3.exports;
|
|
326
326
|
var EventEmitter = /*@__PURE__*/getDefaultExportFromCjs(eventemitter3Exports);
|
|
327
327
|
|
|
328
|
-
const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
329
|
-
var isType$
|
|
330
|
-
|
|
331
|
-
const isBoolean = (value, fuzzy = !1) => fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
|
|
332
|
-
var isBoolean$1 = isBoolean;
|
|
328
|
+
const isType$2 = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
329
|
+
var isType$3 = isType$2;
|
|
333
330
|
|
|
334
|
-
const
|
|
335
|
-
var
|
|
331
|
+
const isBoolean$2 = (value, fuzzy = !1) => fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$3(value, "Boolean");
|
|
332
|
+
var isBoolean$3 = isBoolean$2;
|
|
336
333
|
|
|
337
|
-
const
|
|
338
|
-
var
|
|
334
|
+
const isFunction$2 = value => "function" == typeof value;
|
|
335
|
+
var isFunction$3 = isFunction$2;
|
|
339
336
|
|
|
340
|
-
const
|
|
341
|
-
var
|
|
337
|
+
const isNil$2 = value => null == value;
|
|
338
|
+
var isNil$3 = isNil$2;
|
|
342
339
|
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
return null !== value && "object" === type || "function" === type;
|
|
346
|
-
};
|
|
347
|
-
var isObject$1 = isObject;
|
|
340
|
+
const isValid$2 = value => null != value;
|
|
341
|
+
var isValid$3 = isValid$2;
|
|
348
342
|
|
|
349
|
-
const isObjectLike = value => "object" == typeof value && null !== value;
|
|
350
|
-
var isObjectLike$
|
|
343
|
+
const isObjectLike$2 = value => "object" == typeof value && null !== value;
|
|
344
|
+
var isObjectLike$3 = isObjectLike$2;
|
|
351
345
|
|
|
352
|
-
const isPlainObject = function (value) {
|
|
353
|
-
if (!isObjectLike$
|
|
346
|
+
const isPlainObject$2 = function (value) {
|
|
347
|
+
if (!isObjectLike$3(value) || !isType$3(value, "Object")) return !1;
|
|
354
348
|
if (null === Object.getPrototypeOf(value)) return !0;
|
|
355
349
|
let proto = value;
|
|
356
350
|
for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
|
|
357
351
|
return Object.getPrototypeOf(value) === proto;
|
|
358
352
|
};
|
|
359
|
-
var isPlainObject$
|
|
353
|
+
var isPlainObject$3 = isPlainObject$2;
|
|
360
354
|
|
|
361
|
-
const isString = (value, fuzzy = !1) => {
|
|
355
|
+
const isString$2 = (value, fuzzy = !1) => {
|
|
362
356
|
const type = typeof value;
|
|
363
|
-
return fuzzy ? "string" === type : "string" === type || isType$
|
|
357
|
+
return fuzzy ? "string" === type : "string" === type || isType$3(value, "String");
|
|
364
358
|
};
|
|
365
|
-
var isString$
|
|
359
|
+
var isString$3 = isString$2;
|
|
366
360
|
|
|
367
|
-
const isArray = value => Array.isArray ? Array.isArray(value) : isType$
|
|
368
|
-
var isArray$
|
|
361
|
+
const isArray$2 = value => Array.isArray ? Array.isArray(value) : isType$3(value, "Array");
|
|
362
|
+
var isArray$3 = isArray$2;
|
|
369
363
|
|
|
370
|
-
const isArrayLike = function (value) {
|
|
364
|
+
const isArrayLike$2 = function (value) {
|
|
371
365
|
return null !== value && "function" != typeof value && Number.isFinite(value.length);
|
|
372
366
|
};
|
|
373
|
-
var isArrayLike$
|
|
367
|
+
var isArrayLike$3 = isArrayLike$2;
|
|
374
368
|
|
|
375
|
-
const isDate = value => isType$
|
|
369
|
+
const isDate = value => isType$3(value, "Date");
|
|
376
370
|
var isDate$1 = isDate;
|
|
377
371
|
|
|
378
|
-
const isNumber = (value, fuzzy = !1) => {
|
|
372
|
+
const isNumber$2 = (value, fuzzy = !1) => {
|
|
379
373
|
const type = typeof value;
|
|
380
|
-
return fuzzy ? "number" === type : "number" === type || isType$
|
|
374
|
+
return fuzzy ? "number" === type : "number" === type || isType$3(value, "Number");
|
|
381
375
|
};
|
|
382
|
-
var isNumber$
|
|
376
|
+
var isNumber$3 = isNumber$2;
|
|
383
377
|
|
|
384
|
-
const isValidNumber = value => isNumber$
|
|
385
|
-
var isValidNumber$
|
|
378
|
+
const isValidNumber$2 = value => isNumber$3(value) && Number.isFinite(value);
|
|
379
|
+
var isValidNumber$3 = isValidNumber$2;
|
|
386
380
|
|
|
387
|
-
const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
|
|
388
|
-
var isValidUrl$
|
|
381
|
+
const isValidUrl$2 = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
|
|
382
|
+
var isValidUrl$3 = isValidUrl$2;
|
|
389
383
|
|
|
390
|
-
const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
|
|
391
|
-
var isBase64$
|
|
384
|
+
const isBase64$2 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
|
|
385
|
+
var isBase64$3 = isBase64$2;
|
|
392
386
|
|
|
393
|
-
const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
|
|
394
|
-
var getType$
|
|
387
|
+
const getType$2 = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
|
|
388
|
+
var getType$3 = getType$2;
|
|
395
389
|
|
|
396
|
-
const objectProto = Object.prototype,
|
|
397
|
-
isPrototype = function (value) {
|
|
390
|
+
const objectProto$1 = Object.prototype,
|
|
391
|
+
isPrototype$2 = function (value) {
|
|
398
392
|
const Ctor = value && value.constructor;
|
|
399
|
-
return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
|
|
393
|
+
return value === ("function" == typeof Ctor && Ctor.prototype || objectProto$1);
|
|
400
394
|
};
|
|
401
|
-
var isPrototype$
|
|
395
|
+
var isPrototype$3 = isPrototype$2;
|
|
402
396
|
|
|
403
|
-
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
404
|
-
function isEmpty(value) {
|
|
405
|
-
if (isNil$
|
|
406
|
-
if (isArrayLike$
|
|
407
|
-
const type = getType$
|
|
397
|
+
const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
398
|
+
function isEmpty$1(value) {
|
|
399
|
+
if (isNil$3(value)) return !0;
|
|
400
|
+
if (isArrayLike$3(value)) return !value.length;
|
|
401
|
+
const type = getType$3(value);
|
|
408
402
|
if ("Map" === type || "Set" === type) return !value.size;
|
|
409
|
-
if (isPrototype$
|
|
410
|
-
for (const key in value) if (hasOwnProperty.call(value, key)) return !1;
|
|
403
|
+
if (isPrototype$3(value)) return !Object.keys(value).length;
|
|
404
|
+
for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
|
|
411
405
|
return !0;
|
|
412
406
|
}
|
|
413
407
|
|
|
414
408
|
const get = (obj, path, defaultValue) => {
|
|
415
|
-
const paths = isString$
|
|
409
|
+
const paths = isString$3(path) ? path.split(".") : path;
|
|
416
410
|
for (let p = 0; p < paths.length; p++) obj = obj ? obj[paths[p]] : void 0;
|
|
417
411
|
return void 0 === obj ? defaultValue : obj;
|
|
418
412
|
};
|
|
@@ -420,10 +414,10 @@
|
|
|
420
414
|
|
|
421
415
|
function cloneDeep(value, ignoreWhen, excludeKeys) {
|
|
422
416
|
let result;
|
|
423
|
-
if (!isValid$
|
|
424
|
-
const isArr = isArray$
|
|
417
|
+
if (!isValid$3(value) || "object" != typeof value || ignoreWhen && ignoreWhen(value)) return value;
|
|
418
|
+
const isArr = isArray$3(value),
|
|
425
419
|
length = value.length;
|
|
426
|
-
result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean$
|
|
420
|
+
result = isArr ? new Array(length) : "object" == typeof value ? {} : isBoolean$3(value) || isNumber$3(value) || isString$3(value) ? value : isDate$1(value) ? new Date(+value) : void 0;
|
|
427
421
|
const props = isArr ? void 0 : Object.keys(Object(value));
|
|
428
422
|
let index = -1;
|
|
429
423
|
if (result) for (; ++index < (props || value).length;) {
|
|
@@ -434,10 +428,10 @@
|
|
|
434
428
|
return result;
|
|
435
429
|
}
|
|
436
430
|
|
|
437
|
-
function baseMerge(target, source, shallowArray = !1, skipTargetArray = !1) {
|
|
431
|
+
function baseMerge$1(target, source, shallowArray = !1, skipTargetArray = !1) {
|
|
438
432
|
if (source) {
|
|
439
433
|
if (target === source) return;
|
|
440
|
-
if (isValid$
|
|
434
|
+
if (isValid$3(source) && "object" == typeof source) {
|
|
441
435
|
const iterable = Object(source),
|
|
442
436
|
props = [];
|
|
443
437
|
for (const key in iterable) props.push(key);
|
|
@@ -447,49 +441,49 @@
|
|
|
447
441
|
propIndex = -1;
|
|
448
442
|
for (; length--;) {
|
|
449
443
|
const key = props[++propIndex];
|
|
450
|
-
!isValid$
|
|
444
|
+
!isValid$3(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$3(target[key]) ? assignMergeValue$1(target, key, iterable[key]) : baseMergeDeep$1(target, source, key, shallowArray, skipTargetArray);
|
|
451
445
|
}
|
|
452
446
|
}
|
|
453
447
|
}
|
|
454
448
|
}
|
|
455
|
-
function baseMergeDeep(target, source, key, shallowArray = !1, skipTargetArray = !1) {
|
|
449
|
+
function baseMergeDeep$1(target, source, key, shallowArray = !1, skipTargetArray = !1) {
|
|
456
450
|
const objValue = target[key],
|
|
457
451
|
srcValue = source[key];
|
|
458
452
|
let newValue = source[key],
|
|
459
453
|
isCommon = !0;
|
|
460
|
-
if (isArray$
|
|
461
|
-
if (shallowArray) newValue = [];else if (isArray$
|
|
454
|
+
if (isArray$3(srcValue)) {
|
|
455
|
+
if (shallowArray) newValue = [];else if (isArray$3(objValue)) newValue = objValue;else if (isArrayLike$3(objValue)) {
|
|
462
456
|
newValue = new Array(objValue.length);
|
|
463
457
|
let index = -1;
|
|
464
458
|
const length = objValue.length;
|
|
465
459
|
for (; ++index < length;) newValue[index] = objValue[index];
|
|
466
460
|
}
|
|
467
|
-
} else isPlainObject$
|
|
468
|
-
isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
|
|
461
|
+
} else isPlainObject$3(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
|
|
462
|
+
isCommon && baseMerge$1(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue$1(target, key, newValue);
|
|
469
463
|
}
|
|
470
|
-
function assignMergeValue(target, key, value) {
|
|
471
|
-
(void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
|
|
464
|
+
function assignMergeValue$1(target, key, value) {
|
|
465
|
+
(void 0 !== value && !eq$1(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
|
|
472
466
|
}
|
|
473
|
-
function eq(value, other) {
|
|
467
|
+
function eq$1(value, other) {
|
|
474
468
|
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
475
469
|
}
|
|
476
|
-
function merge(target, ...sources) {
|
|
470
|
+
function merge$1(target, ...sources) {
|
|
477
471
|
let sourceIndex = -1;
|
|
478
472
|
const length = sources.length;
|
|
479
473
|
for (; ++sourceIndex < length;) {
|
|
480
|
-
baseMerge(target, sources[sourceIndex], !0);
|
|
474
|
+
baseMerge$1(target, sources[sourceIndex], !0);
|
|
481
475
|
}
|
|
482
476
|
return target;
|
|
483
477
|
}
|
|
484
478
|
|
|
485
479
|
function pickWithout(obj, keys) {
|
|
486
|
-
if (!obj || !isPlainObject$
|
|
480
|
+
if (!obj || !isPlainObject$3(obj)) return obj;
|
|
487
481
|
const result = {};
|
|
488
482
|
return Object.keys(obj).forEach(k => {
|
|
489
483
|
const v = obj[k];
|
|
490
484
|
let match = !1;
|
|
491
485
|
keys.forEach(itKey => {
|
|
492
|
-
(isString$
|
|
486
|
+
(isString$3(itKey) && itKey === k || itKey instanceof RegExp && k.match(itKey)) && (match = !0);
|
|
493
487
|
}), match || (result[k] = v);
|
|
494
488
|
}), result;
|
|
495
489
|
}
|
|
@@ -506,14 +500,14 @@
|
|
|
506
500
|
if (null == a || null == b) return !1;
|
|
507
501
|
if (Number.isNaN(a) && Number.isNaN(b)) return !0;
|
|
508
502
|
if (objToString(a) !== objToString(b)) return !1;
|
|
509
|
-
if (isFunction$
|
|
503
|
+
if (isFunction$3(a)) return !!(null == options ? void 0 : options.skipFunction);
|
|
510
504
|
if ("object" != typeof a) return !1;
|
|
511
|
-
if (isArray$
|
|
505
|
+
if (isArray$3(a)) {
|
|
512
506
|
if (a.length !== b.length) return !1;
|
|
513
507
|
for (let i = a.length - 1; i >= 0; i--) if (!isEqual(a[i], b[i], options)) return !1;
|
|
514
508
|
return !0;
|
|
515
509
|
}
|
|
516
|
-
if (!isPlainObject$
|
|
510
|
+
if (!isPlainObject$3(a)) return !1;
|
|
517
511
|
const ka = objectKeys(a),
|
|
518
512
|
kb = objectKeys(b);
|
|
519
513
|
if (ka.length !== kb.length) return !1;
|
|
@@ -526,36 +520,36 @@
|
|
|
526
520
|
return !0;
|
|
527
521
|
}
|
|
528
522
|
|
|
529
|
-
function keys(obj) {
|
|
523
|
+
function keys$1(obj) {
|
|
530
524
|
if (!obj) return [];
|
|
531
525
|
if (Object.keys) return Object.keys(obj);
|
|
532
526
|
const keyList = [];
|
|
533
527
|
for (const key in obj) obj.hasOwnProperty(key) && keyList.push(key);
|
|
534
528
|
return keyList;
|
|
535
529
|
}
|
|
536
|
-
function defaults(target, source, overlay) {
|
|
537
|
-
const keysArr = keys(source);
|
|
530
|
+
function defaults$1(target, source, overlay) {
|
|
531
|
+
const keysArr = keys$1(source);
|
|
538
532
|
for (let i = 0; i < keysArr.length; i++) {
|
|
539
533
|
const key = keysArr[i];
|
|
540
534
|
(overlay ? null != source[key] : null == target[key]) && (target[key] = source[key]);
|
|
541
535
|
}
|
|
542
536
|
return target;
|
|
543
537
|
}
|
|
544
|
-
function mixin(target, source, override = !0) {
|
|
538
|
+
function mixin$1(target, source, override = !0) {
|
|
545
539
|
if (target = "prototype" in target ? target.prototype : target, source = "prototype" in source ? source.prototype : source, Object.getOwnPropertyNames) {
|
|
546
540
|
const keyList = Object.getOwnPropertyNames(source);
|
|
547
541
|
for (let i = 0; i < keyList.length; i++) {
|
|
548
542
|
const key = keyList[i];
|
|
549
543
|
"constructor" !== key && (override ? null != source[key] : null == target[key]) && (target[key] = source[key]);
|
|
550
544
|
}
|
|
551
|
-
} else defaults(target, source, override);
|
|
545
|
+
} else defaults$1(target, source, override);
|
|
552
546
|
}
|
|
553
547
|
|
|
554
|
-
function array(arr) {
|
|
555
|
-
return isValid$
|
|
548
|
+
function array$1(arr) {
|
|
549
|
+
return isValid$3(arr) ? isArray$3(arr) ? arr : [arr] : [];
|
|
556
550
|
}
|
|
557
551
|
function last(val) {
|
|
558
|
-
if (isArrayLike$
|
|
552
|
+
if (isArrayLike$3(val)) {
|
|
559
553
|
return val[val.length - 1];
|
|
560
554
|
}
|
|
561
555
|
}
|
|
@@ -579,21 +573,9 @@
|
|
|
579
573
|
}
|
|
580
574
|
return min;
|
|
581
575
|
};
|
|
582
|
-
function arrayEqual(a, b) {
|
|
583
|
-
if (!isArray$1(a) || !isArray$1(b)) return !1;
|
|
584
|
-
if (a.length !== b.length) return !1;
|
|
585
|
-
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
|
|
586
|
-
return !0;
|
|
587
|
-
}
|
|
588
|
-
function flattenArray(arr) {
|
|
589
|
-
if (!isArray$1(arr)) return [arr];
|
|
590
|
-
const result = [];
|
|
591
|
-
for (const value of arr) result.push(...flattenArray(value));
|
|
592
|
-
return result;
|
|
593
|
-
}
|
|
594
576
|
|
|
595
577
|
function range$1(start, stop, step) {
|
|
596
|
-
isValid$
|
|
578
|
+
isValid$3(stop) || (stop = start, start = 0), isValid$3(step) || (step = 1);
|
|
597
579
|
let i = -1;
|
|
598
580
|
const n = 0 | Math.max(0, Math.ceil((stop - start) / step)),
|
|
599
581
|
range = new Array(n);
|
|
@@ -609,18 +591,18 @@
|
|
|
609
591
|
return Number(a);
|
|
610
592
|
}
|
|
611
593
|
|
|
612
|
-
const hasConsole = "undefined" != typeof console;
|
|
613
|
-
function log(method, level, input) {
|
|
594
|
+
const hasConsole$1 = "undefined" != typeof console;
|
|
595
|
+
function log$1(method, level, input) {
|
|
614
596
|
const args = [level].concat([].slice.call(input));
|
|
615
|
-
hasConsole && console[method].apply(console, args);
|
|
597
|
+
hasConsole$1 && console[method].apply(console, args);
|
|
616
598
|
}
|
|
617
|
-
var LoggerLevel;
|
|
599
|
+
var LoggerLevel$1;
|
|
618
600
|
!function (LoggerLevel) {
|
|
619
601
|
LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
|
|
620
|
-
}(LoggerLevel || (LoggerLevel = {}));
|
|
621
|
-
class Logger {
|
|
602
|
+
}(LoggerLevel$1 || (LoggerLevel$1 = {}));
|
|
603
|
+
let Logger$1 = class Logger {
|
|
622
604
|
static getInstance(level, method) {
|
|
623
|
-
return Logger._instance && isNumber$
|
|
605
|
+
return Logger._instance && isNumber$3(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
|
|
624
606
|
}
|
|
625
607
|
static setInstance(logger) {
|
|
626
608
|
return Logger._instance = logger;
|
|
@@ -631,7 +613,7 @@
|
|
|
631
613
|
static clearInstance() {
|
|
632
614
|
Logger._instance = null;
|
|
633
615
|
}
|
|
634
|
-
constructor(level = LoggerLevel.None, method) {
|
|
616
|
+
constructor(level = LoggerLevel$1.None, method) {
|
|
635
617
|
this._onErrorHandler = [], this._level = level, this._method = method;
|
|
636
618
|
}
|
|
637
619
|
addErrorHandler(handler) {
|
|
@@ -645,38 +627,38 @@
|
|
|
645
627
|
this._onErrorHandler.forEach(h => h(...args));
|
|
646
628
|
}
|
|
647
629
|
canLogInfo() {
|
|
648
|
-
return this._level >= LoggerLevel.Info;
|
|
630
|
+
return this._level >= LoggerLevel$1.Info;
|
|
649
631
|
}
|
|
650
632
|
canLogDebug() {
|
|
651
|
-
return this._level >= LoggerLevel.Debug;
|
|
633
|
+
return this._level >= LoggerLevel$1.Debug;
|
|
652
634
|
}
|
|
653
635
|
canLogError() {
|
|
654
|
-
return this._level >= LoggerLevel.Error;
|
|
636
|
+
return this._level >= LoggerLevel$1.Error;
|
|
655
637
|
}
|
|
656
638
|
canLogWarn() {
|
|
657
|
-
return this._level >= LoggerLevel.Warn;
|
|
639
|
+
return this._level >= LoggerLevel$1.Warn;
|
|
658
640
|
}
|
|
659
641
|
level(levelValue) {
|
|
660
642
|
return arguments.length ? (this._level = +levelValue, this) : this._level;
|
|
661
643
|
}
|
|
662
644
|
error(...args) {
|
|
663
645
|
var _a;
|
|
664
|
-
return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
|
|
646
|
+
return this._level >= LoggerLevel$1.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log$1(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
|
|
665
647
|
}
|
|
666
648
|
warn(...args) {
|
|
667
|
-
return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
|
|
649
|
+
return this._level >= LoggerLevel$1.Warn && log$1(this._method || "warn", "WARN", args), this;
|
|
668
650
|
}
|
|
669
651
|
info(...args) {
|
|
670
|
-
return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
|
|
652
|
+
return this._level >= LoggerLevel$1.Info && log$1(this._method || "log", "INFO", args), this;
|
|
671
653
|
}
|
|
672
654
|
debug(...args) {
|
|
673
|
-
return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
|
|
655
|
+
return this._level >= LoggerLevel$1.Debug && log$1(this._method || "log", "DEBUG", args), this;
|
|
674
656
|
}
|
|
675
|
-
}
|
|
676
|
-
Logger._instance = null;
|
|
657
|
+
};
|
|
658
|
+
Logger$1._instance = null;
|
|
677
659
|
|
|
678
660
|
function bisect(a, x, lo = 0, hi) {
|
|
679
|
-
for (isNil$
|
|
661
|
+
for (isNil$3(hi) && (hi = a.length); lo < hi;) {
|
|
680
662
|
const mid = lo + hi >>> 1;
|
|
681
663
|
ascending$1(a[mid], x) > 0 ? hi = mid : lo = mid + 1;
|
|
682
664
|
}
|
|
@@ -697,10 +679,10 @@
|
|
|
697
679
|
return (...args) => (lastArgs && args.every((val, i) => val === lastArgs[i]) || (lastArgs = args, lastResult = func(...args)), lastResult);
|
|
698
680
|
};
|
|
699
681
|
|
|
700
|
-
const clamp = function (input, min, max) {
|
|
682
|
+
const clamp$2 = function (input, min, max) {
|
|
701
683
|
return input < min ? min : input > max ? max : input;
|
|
702
684
|
};
|
|
703
|
-
var clamp$
|
|
685
|
+
var clamp$3 = clamp$2;
|
|
704
686
|
|
|
705
687
|
function clamper(a, b) {
|
|
706
688
|
let t;
|
|
@@ -730,68 +712,44 @@
|
|
|
730
712
|
|
|
731
713
|
const getter = path => obj => get$1(obj, path);
|
|
732
714
|
const fieldSingle = (fieldStr, opt = {}) => {
|
|
733
|
-
if (isFunction$
|
|
715
|
+
if (isFunction$3(fieldStr)) return fieldStr;
|
|
734
716
|
const path = [fieldStr];
|
|
735
717
|
return (opt && opt.get || getter)(path);
|
|
736
718
|
};
|
|
737
719
|
const field = (fieldStr, opt = {}) => {
|
|
738
|
-
if (isArray$
|
|
720
|
+
if (isArray$3(fieldStr)) {
|
|
739
721
|
const funcs = fieldStr.map(entry => fieldSingle(entry, opt));
|
|
740
722
|
return datum => funcs.map(func => func(datum));
|
|
741
723
|
}
|
|
742
724
|
return fieldSingle(fieldStr, opt);
|
|
743
725
|
};
|
|
744
|
-
const simpleField = option => option ? "string" == typeof option || "number" == typeof option ? () => option : isFunction$
|
|
726
|
+
const simpleField = option => option ? "string" == typeof option || "number" == typeof option ? () => option : isFunction$3(option) ? option : datum => datum[option.field] : null;
|
|
745
727
|
|
|
746
728
|
const extent = (array, func) => {
|
|
747
|
-
const valueGetter = isFunction$
|
|
729
|
+
const valueGetter = isFunction$3(func) ? func : val => val;
|
|
748
730
|
let min, max;
|
|
749
731
|
if (array && array.length) {
|
|
750
732
|
const n = array.length;
|
|
751
733
|
for (let i = 0; i < n; i += 1) {
|
|
752
734
|
let value = valueGetter(array[i]);
|
|
753
|
-
isNil$
|
|
735
|
+
isNil$3(value) || !isNumber$3(value = +value) || Number.isNaN(value) || (isNil$3(min) ? (min = value, max = value) : (min = Math.min(min, value), max = Math.max(max, value)));
|
|
754
736
|
}
|
|
755
737
|
return [min, max];
|
|
756
738
|
}
|
|
757
739
|
return [min, max];
|
|
758
740
|
};
|
|
759
741
|
|
|
760
|
-
const
|
|
761
|
-
const
|
|
762
|
-
const
|
|
763
|
-
const tau = 2 * pi;
|
|
764
|
-
const pi2 = 2 * Math.PI;
|
|
765
|
-
const abs = Math.abs;
|
|
766
|
-
const atan2 = Math.atan2;
|
|
767
|
-
const cos = Math.cos;
|
|
768
|
-
const max = Math.max;
|
|
769
|
-
const min = Math.min;
|
|
770
|
-
const sin = Math.sin;
|
|
771
|
-
const sqrt$1 = Math.sqrt;
|
|
772
|
-
const pow = Math.pow;
|
|
773
|
-
function acos(x) {
|
|
774
|
-
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
775
|
-
}
|
|
776
|
-
function asin(x) {
|
|
777
|
-
return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
|
|
778
|
-
}
|
|
779
|
-
function pointAt(x1, y1, x2, y2, t) {
|
|
780
|
-
let x = x2,
|
|
781
|
-
y = y2;
|
|
782
|
-
return "number" == typeof x1 && "number" == typeof x2 && (x = (1 - t) * x1 + t * x2), "number" == typeof y1 && "number" == typeof y2 && (y = (1 - t) * y1 + t * y2), {
|
|
783
|
-
x: x,
|
|
784
|
-
y: y
|
|
785
|
-
};
|
|
786
|
-
}
|
|
742
|
+
const abs$1 = Math.abs;
|
|
743
|
+
const sqrt$2 = Math.sqrt;
|
|
744
|
+
const pow$1 = Math.pow;
|
|
787
745
|
function crossProduct(dir1, dir2) {
|
|
788
746
|
return dir1[0] * dir2[1] - dir1[1] * dir2[0];
|
|
789
747
|
}
|
|
790
748
|
function fuzzyEqualVec(a, b) {
|
|
791
|
-
return abs(a[0] - b[0]) + abs(a[1] - b[1]) < 1e-12;
|
|
749
|
+
return abs$1(a[0] - b[0]) + abs$1(a[1] - b[1]) < 1e-12;
|
|
792
750
|
}
|
|
793
751
|
|
|
794
|
-
class Point {
|
|
752
|
+
let Point$1 = class Point {
|
|
795
753
|
constructor(x = 0, y = 0, x1, y1) {
|
|
796
754
|
this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
|
|
797
755
|
}
|
|
@@ -805,10 +763,10 @@
|
|
|
805
763
|
return this.x = x, this.y = y, this;
|
|
806
764
|
}
|
|
807
765
|
add(point) {
|
|
808
|
-
return isNumber$
|
|
766
|
+
return isNumber$3(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
|
|
809
767
|
}
|
|
810
768
|
sub(point) {
|
|
811
|
-
return isNumber$
|
|
769
|
+
return isNumber$3(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
|
|
812
770
|
}
|
|
813
771
|
multi(point) {
|
|
814
772
|
throw new Error("暂不支持");
|
|
@@ -816,33 +774,28 @@
|
|
|
816
774
|
div(point) {
|
|
817
775
|
throw new Error("暂不支持");
|
|
818
776
|
}
|
|
819
|
-
}
|
|
820
|
-
class PointService {
|
|
777
|
+
};
|
|
778
|
+
let PointService$1 = class PointService {
|
|
821
779
|
static distancePP(p1, p2) {
|
|
822
|
-
return sqrt$
|
|
780
|
+
return sqrt$2(pow$1(p1.x - p2.x, 2) + pow$1(p1.y - p2.y, 2));
|
|
823
781
|
}
|
|
824
782
|
static distanceNN(x, y, x1, y1) {
|
|
825
|
-
return sqrt$
|
|
783
|
+
return sqrt$2(pow$1(x - x1, 2) + pow$1(y - y1, 2));
|
|
826
784
|
}
|
|
827
785
|
static distancePN(point, x, y) {
|
|
828
|
-
return sqrt$
|
|
786
|
+
return sqrt$2(pow$1(x - point.x, 2) + pow$1(y - point.y, 2));
|
|
829
787
|
}
|
|
830
788
|
static pointAtPP(p1, p2, t) {
|
|
831
|
-
return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
|
|
789
|
+
return new Point$1((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
|
|
832
790
|
}
|
|
833
|
-
}
|
|
791
|
+
};
|
|
834
792
|
|
|
835
|
-
function degreeToRadian(degree) {
|
|
793
|
+
function degreeToRadian$1(degree) {
|
|
836
794
|
return degree * (Math.PI / 180);
|
|
837
795
|
}
|
|
838
|
-
function radianToDegree(radian) {
|
|
796
|
+
function radianToDegree$1(radian) {
|
|
839
797
|
return 180 * radian / Math.PI;
|
|
840
798
|
}
|
|
841
|
-
const clampRadian = (angle = 0) => {
|
|
842
|
-
if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
|
|
843
|
-
return angle;
|
|
844
|
-
};
|
|
845
|
-
const clampAngleByRadian = clampRadian;
|
|
846
799
|
function polarToCartesian(center, radius, angleInRadian) {
|
|
847
800
|
return radius ? {
|
|
848
801
|
x: center.x + radius * Math.cos(angleInRadian),
|
|
@@ -852,11 +805,6 @@
|
|
|
852
805
|
y: center.y
|
|
853
806
|
};
|
|
854
807
|
}
|
|
855
|
-
function normalizeAngle(angle) {
|
|
856
|
-
for (; angle < 0;) angle += 2 * Math.PI;
|
|
857
|
-
for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
858
|
-
return angle;
|
|
859
|
-
}
|
|
860
808
|
|
|
861
809
|
function sub(out, v1, v2) {
|
|
862
810
|
out[0] = v1[0] - v2[0], out[1] = v1[1] - v2[1];
|
|
@@ -878,10 +826,10 @@
|
|
|
878
826
|
const t = crossProduct(tempVec, dir2) / crossProduct(dir1, dir2);
|
|
879
827
|
return t >= 0 && t <= 1 && [left1[0] + dir1[0] * t, left1[1] + dir1[1] * t];
|
|
880
828
|
}
|
|
881
|
-
var InnerBBox;
|
|
829
|
+
var InnerBBox$1;
|
|
882
830
|
!function (InnerBBox) {
|
|
883
831
|
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
|
|
884
|
-
}(InnerBBox || (InnerBBox = {}));
|
|
832
|
+
}(InnerBBox$1 || (InnerBBox$1 = {}));
|
|
885
833
|
function pointInRect(point, bbox, format) {
|
|
886
834
|
if (!bbox) return !0;
|
|
887
835
|
if (!format) return point.x >= bbox.x1 && point.x <= bbox.x2 && point.y >= bbox.y1 && point.y <= bbox.y2;
|
|
@@ -891,64 +839,6 @@
|
|
|
891
839
|
y12 = bbox.y2;
|
|
892
840
|
return x11 > x12 && ([x11, x12] = [x12, x11]), y11 > y12 && ([y11, y12] = [y12, y11]), point.x >= x11 && point.x <= x12 && point.y >= y11 && point.y <= y12;
|
|
893
841
|
}
|
|
894
|
-
function getProjectionRadius(checkAxis, axis) {
|
|
895
|
-
return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
|
|
896
|
-
}
|
|
897
|
-
function rotatePoint({
|
|
898
|
-
x: x,
|
|
899
|
-
y: y
|
|
900
|
-
}, rad, origin = {
|
|
901
|
-
x: 0,
|
|
902
|
-
y: 0
|
|
903
|
-
}) {
|
|
904
|
-
return {
|
|
905
|
-
x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
|
|
906
|
-
y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
|
|
907
|
-
};
|
|
908
|
-
}
|
|
909
|
-
function getCenterPoint(box) {
|
|
910
|
-
return {
|
|
911
|
-
x: (box.x1 + box.x2) / 2,
|
|
912
|
-
y: (box.y1 + box.y2) / 2
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
function toRect$1(box, isDeg) {
|
|
916
|
-
const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
|
|
917
|
-
cp = getCenterPoint(box);
|
|
918
|
-
return [rotatePoint({
|
|
919
|
-
x: box.x1,
|
|
920
|
-
y: box.y1
|
|
921
|
-
}, deg, cp), rotatePoint({
|
|
922
|
-
x: box.x2,
|
|
923
|
-
y: box.y1
|
|
924
|
-
}, deg, cp), rotatePoint({
|
|
925
|
-
x: box.x2,
|
|
926
|
-
y: box.y2
|
|
927
|
-
}, deg, cp), rotatePoint({
|
|
928
|
-
x: box.x1,
|
|
929
|
-
y: box.y2
|
|
930
|
-
}, deg, cp)];
|
|
931
|
-
}
|
|
932
|
-
function isRotateAABBIntersect(box1, box2, isDeg = !1) {
|
|
933
|
-
const rect1 = toRect$1(box1, isDeg),
|
|
934
|
-
rect2 = toRect$1(box2, isDeg),
|
|
935
|
-
vector = (start, end) => [end.x - start.x, end.y - start.y],
|
|
936
|
-
vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
|
|
937
|
-
AB = vector(rect1[0], rect1[1]),
|
|
938
|
-
BC = vector(rect1[1], rect1[2]),
|
|
939
|
-
A1B1 = vector(rect2[0], rect2[1]),
|
|
940
|
-
B1C1 = vector(rect2[1], rect2[2]),
|
|
941
|
-
deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
|
|
942
|
-
let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
|
|
943
|
-
const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
|
|
944
|
-
let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
|
|
945
|
-
deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
|
|
946
|
-
const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
|
|
947
|
-
const checkAxis = [Math.cos(deg), Math.sin(deg)];
|
|
948
|
-
return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
|
|
949
|
-
};
|
|
950
|
-
return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
|
|
951
|
-
}
|
|
952
842
|
|
|
953
843
|
let x1, y1, x2, y2;
|
|
954
844
|
function getAABBFromPoints(points) {
|
|
@@ -969,12 +859,12 @@
|
|
|
969
859
|
if (!p) return !1;
|
|
970
860
|
for (let i = 1; i < points.length; i++) {
|
|
971
861
|
const p2 = points[i];
|
|
972
|
-
w += isPointInLine(p.x, p.y, p2.x, p2.y, x, y), p = p2;
|
|
862
|
+
w += isPointInLine$1(p.x, p.y, p2.x, p2.y, x, y), p = p2;
|
|
973
863
|
}
|
|
974
864
|
const p0 = points[0];
|
|
975
|
-
return isAroundEqual$1(p.x, p0.x) && isAroundEqual$1(p.y, p0.y) || (w += isPointInLine(p.x, p.y, p0.x, p0.y, x, y)), 0 !== w;
|
|
865
|
+
return isAroundEqual$1(p.x, p0.x) && isAroundEqual$1(p.y, p0.y) || (w += isPointInLine$1(p.x, p.y, p0.x, p0.y, x, y)), 0 !== w;
|
|
976
866
|
}
|
|
977
|
-
function isPointInLine(x0, y0, x1, y1, x, y) {
|
|
867
|
+
function isPointInLine$1(x0, y0, x1, y1, x, y) {
|
|
978
868
|
if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
|
|
979
869
|
if (y1 === y0) return 0;
|
|
980
870
|
const t = (y - y0) / (y1 - y0);
|
|
@@ -994,7 +884,7 @@
|
|
|
994
884
|
return 55296 <= x && x <= 56319 && 56320 <= y && y <= 57343 && (x &= 1023, y &= 1023, codePoint = x << 10 | y, codePoint += 65536), 12288 === codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 ? "F" : 8361 === codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518 ? "H" : 4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? "W" : 32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 === codePoint || 175 === codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630 ? "Na" : 161 === codePoint || 164 === codePoint || 167 <= codePoint && codePoint <= 168 || 170 === codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 === codePoint || 208 === codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 === codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 === codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 === codePoint || 254 === codePoint || 257 === codePoint || 273 === codePoint || 275 === codePoint || 283 === codePoint || 294 <= codePoint && codePoint <= 295 || 299 === codePoint || 305 <= codePoint && codePoint <= 307 || 312 === codePoint || 319 <= codePoint && codePoint <= 322 || 324 === codePoint || 328 <= codePoint && codePoint <= 331 || 333 === codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 === codePoint || 462 === codePoint || 464 === codePoint || 466 === codePoint || 468 === codePoint || 470 === codePoint || 472 === codePoint || 474 === codePoint || 476 === codePoint || 593 === codePoint || 609 === codePoint || 708 === codePoint || 711 === codePoint || 713 <= codePoint && codePoint <= 715 || 717 === codePoint || 720 === codePoint || 728 <= codePoint && codePoint <= 731 || 733 === codePoint || 735 === codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 === codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 === codePoint || 8208 === codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 === codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 === codePoint || 8251 === codePoint || 8254 === codePoint || 8308 === codePoint || 8319 === codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 === codePoint || 8451 === codePoint || 8453 === codePoint || 8457 === codePoint || 8467 === codePoint || 8470 === codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 === codePoint || 8491 === codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 === codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 === codePoint || 8660 === codePoint || 8679 === codePoint || 8704 === codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 === codePoint || 8719 === codePoint || 8721 === codePoint || 8725 === codePoint || 8730 === codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 === codePoint || 8741 === codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 === codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 === codePoint || 8780 === codePoint || 8786 === codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 === codePoint || 8857 === codePoint || 8869 === codePoint || 8895 === codePoint || 8978 === codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 === codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 === codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 === codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 === codePoint || 9758 === codePoint || 9792 === codePoint || 9794 === codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 === codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 === codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 === codePoint || 10071 === codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 === codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109 ? "A" : "N";
|
|
995
885
|
};
|
|
996
886
|
|
|
997
|
-
function getContextFont(text, defaultAttr = {}, fontSizeScale) {
|
|
887
|
+
function getContextFont$1(text, defaultAttr = {}, fontSizeScale) {
|
|
998
888
|
fontSizeScale || (fontSizeScale = 1);
|
|
999
889
|
const {
|
|
1000
890
|
fontStyle = defaultAttr.fontStyle,
|
|
@@ -1008,15 +898,15 @@
|
|
|
1008
898
|
|
|
1009
899
|
class TextMeasure {
|
|
1010
900
|
constructor(option, textSpec) {
|
|
1011
|
-
this._numberCharSize = null, this._fullCharSize = null, this._letterCharSize = null, this._specialCharSizeMap = {}, this._canvas = null, this._context = null, this._contextSaved = !1, this._notSupportCanvas = !1, this._notSupportVRender = !1, this._userSpec = {}, this.specialCharSet = "-/: .,@%'\"~", this._option = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$
|
|
901
|
+
this._numberCharSize = null, this._fullCharSize = null, this._letterCharSize = null, this._specialCharSizeMap = {}, this._canvas = null, this._context = null, this._contextSaved = !1, this._notSupportCanvas = !1, this._notSupportVRender = !1, this._userSpec = {}, this.specialCharSet = "-/: .,@%'\"~", this._option = option, this._userSpec = null != textSpec ? textSpec : {}, this.textSpec = this._initSpec(), isValid$3(option.specialCharSet) && (this.specialCharSet = option.specialCharSet), this._standardMethod = isValid$3(option.getTextBounds) ? this.fullMeasure.bind(this) : this.measureWithNaiveCanvas.bind(this);
|
|
1012
902
|
}
|
|
1013
903
|
initContext() {
|
|
1014
904
|
if (this._notSupportCanvas) return !1;
|
|
1015
|
-
if (isNil$
|
|
905
|
+
if (isNil$3(this._canvas) && (isValid$3(this._option.getCanvasForMeasure) && (this._canvas = this._option.getCanvasForMeasure()), isNil$3(this._canvas) && "undefined" != typeof window && void 0 !== window.document && globalThis && isValid$3(globalThis.document) && (this._canvas = globalThis.document.createElement("canvas"))), isNil$3(this._context) && isValid$3(this._canvas)) {
|
|
1016
906
|
const context = this._canvas.getContext("2d");
|
|
1017
|
-
isValid$
|
|
907
|
+
isValid$3(context) && (context.save(), context.font = getContextFont$1(this.textSpec), this._contextSaved = !0, this._context = context);
|
|
1018
908
|
}
|
|
1019
|
-
return !isNil$
|
|
909
|
+
return !isNil$3(this._context) || (this._notSupportCanvas = !0, !1);
|
|
1020
910
|
}
|
|
1021
911
|
_initSpec() {
|
|
1022
912
|
var _a, _b, _c;
|
|
@@ -1039,7 +929,7 @@
|
|
|
1039
929
|
let {
|
|
1040
930
|
lineHeight = fontSize
|
|
1041
931
|
} = this._userSpec;
|
|
1042
|
-
if (isString$
|
|
932
|
+
if (isString$3(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
1043
933
|
const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
1044
934
|
lineHeight = fontSize * scale;
|
|
1045
935
|
}
|
|
@@ -1070,11 +960,11 @@
|
|
|
1070
960
|
}
|
|
1071
961
|
}
|
|
1072
962
|
fullMeasure(text) {
|
|
1073
|
-
if (isNil$
|
|
963
|
+
if (isNil$3(text)) return {
|
|
1074
964
|
width: 0,
|
|
1075
965
|
height: 0
|
|
1076
966
|
};
|
|
1077
|
-
if (isNil$
|
|
967
|
+
if (isNil$3(this._option.getTextBounds) || !this._notSupportVRender) return this.measureWithNaiveCanvas(text);
|
|
1078
968
|
const {
|
|
1079
969
|
fontFamily: fontFamily,
|
|
1080
970
|
fontSize: fontSize,
|
|
@@ -1136,7 +1026,7 @@
|
|
|
1136
1026
|
for (let i = 0; i < text.length; i++) {
|
|
1137
1027
|
const char = text[i];
|
|
1138
1028
|
let size = this._measureSpecialChar(char);
|
|
1139
|
-
isNil$
|
|
1029
|
+
isNil$3(size) && TextMeasure.NUMBERS_CHAR_SET.includes(char) && (size = this._measureNumberChar()), isNil$3(size) && ["F", "W"].includes(eastAsianCharacterInfo(char)) && (size = this._measureFullSizeChar()), isNil$3(size) && (size = this._measureLetterChar()), totalSize.width += size.width, totalSize.height = Math.max(totalSize.height, size.height), !isNil$3(size.fontBoundingBoxAscent) && (totalSize.fontBoundingBoxAscent = size.fontBoundingBoxAscent), !isNil$3(size.fontBoundingBoxDescent) && (totalSize.fontBoundingBoxDescent = size.fontBoundingBoxDescent);
|
|
1140
1030
|
}
|
|
1141
1031
|
return totalSize;
|
|
1142
1032
|
}
|
|
@@ -1170,9 +1060,9 @@
|
|
|
1170
1060
|
width: 0,
|
|
1171
1061
|
height: 0
|
|
1172
1062
|
};
|
|
1173
|
-
if (isNil$
|
|
1174
|
-
if (isArray$
|
|
1175
|
-
const textArr = text.filter(isValid$
|
|
1063
|
+
if (isNil$3(text)) return defaultResult;
|
|
1064
|
+
if (isArray$3(text)) {
|
|
1065
|
+
const textArr = text.filter(isValid$3).map(s => s.toString());
|
|
1176
1066
|
return 0 === textArr.length ? defaultResult : 1 === textArr.length ? processor(textArr[0]) : {
|
|
1177
1067
|
width: textArr.reduce((maxWidth, cur) => Math.max(maxWidth, processor(cur).width), 0),
|
|
1178
1068
|
height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
|
|
@@ -1181,7 +1071,7 @@
|
|
|
1181
1071
|
return processor(text.toString());
|
|
1182
1072
|
}
|
|
1183
1073
|
_measureNumberChar() {
|
|
1184
|
-
if (isNil$
|
|
1074
|
+
if (isNil$3(this._numberCharSize)) {
|
|
1185
1075
|
const numberBounds = this._standardMethod(TextMeasure.NUMBERS_CHAR_SET);
|
|
1186
1076
|
this._numberCharSize = {
|
|
1187
1077
|
width: numberBounds.width / TextMeasure.NUMBERS_CHAR_SET.length,
|
|
@@ -1193,10 +1083,10 @@
|
|
|
1193
1083
|
return this._numberCharSize;
|
|
1194
1084
|
}
|
|
1195
1085
|
_measureFullSizeChar() {
|
|
1196
|
-
return isNil$
|
|
1086
|
+
return isNil$3(this._fullCharSize) && (this._fullCharSize = this._standardMethod(TextMeasure.FULL_SIZE_CHAR)), this._fullCharSize;
|
|
1197
1087
|
}
|
|
1198
1088
|
_measureLetterChar() {
|
|
1199
|
-
if (isNil$
|
|
1089
|
+
if (isNil$3(this._letterCharSize)) {
|
|
1200
1090
|
const alphabetBounds = this._standardMethod(TextMeasure.ALPHABET_CHAR_SET);
|
|
1201
1091
|
this._letterCharSize = {
|
|
1202
1092
|
width: alphabetBounds.width / TextMeasure.ALPHABET_CHAR_SET.length,
|
|
@@ -1208,15 +1098,15 @@
|
|
|
1208
1098
|
return this._letterCharSize;
|
|
1209
1099
|
}
|
|
1210
1100
|
_measureSpecialChar(char) {
|
|
1211
|
-
return isValid$
|
|
1101
|
+
return isValid$3(this._specialCharSizeMap[char]) ? this._specialCharSizeMap[char] : this.specialCharSet.includes(char) ? (this._specialCharSizeMap[char] = this._standardMethod(char), this._specialCharSizeMap[char]) : null;
|
|
1212
1102
|
}
|
|
1213
1103
|
release() {
|
|
1214
|
-
isValid$
|
|
1104
|
+
isValid$3(this._canvas) && (this._canvas = null), isValid$3(this._context) && (this._contextSaved && (this._context.restore(), this._contextSaved = !1), this._context = null);
|
|
1215
1105
|
}
|
|
1216
1106
|
}
|
|
1217
1107
|
TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
|
|
1218
1108
|
|
|
1219
|
-
function transformBoundsWithMatrix(out, bounds, matrix) {
|
|
1109
|
+
function transformBoundsWithMatrix$1(out, bounds, matrix) {
|
|
1220
1110
|
const {
|
|
1221
1111
|
x1: x1,
|
|
1222
1112
|
y1: y1,
|
|
@@ -1225,7 +1115,7 @@
|
|
|
1225
1115
|
} = bounds;
|
|
1226
1116
|
return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
|
|
1227
1117
|
}
|
|
1228
|
-
class Bounds {
|
|
1118
|
+
let Bounds$1 = class Bounds {
|
|
1229
1119
|
constructor(bounds) {
|
|
1230
1120
|
bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
|
|
1231
1121
|
}
|
|
@@ -1251,7 +1141,7 @@
|
|
|
1251
1141
|
return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
|
|
1252
1142
|
}
|
|
1253
1143
|
expand(d = 0) {
|
|
1254
|
-
return isArray$
|
|
1144
|
+
return isArray$3(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
|
|
1255
1145
|
}
|
|
1256
1146
|
round() {
|
|
1257
1147
|
return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
|
|
@@ -1301,7 +1191,7 @@
|
|
|
1301
1191
|
return this.y1 *= s, this.y2 *= s, this;
|
|
1302
1192
|
}
|
|
1303
1193
|
transformWithMatrix(matrix) {
|
|
1304
|
-
return transformBoundsWithMatrix(this, this, matrix), this;
|
|
1194
|
+
return transformBoundsWithMatrix$1(this, this, matrix), this;
|
|
1305
1195
|
}
|
|
1306
1196
|
copy(b) {
|
|
1307
1197
|
return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
|
|
@@ -1328,55 +1218,20 @@
|
|
|
1328
1218
|
} = this;
|
|
1329
1219
|
return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
|
|
1330
1220
|
}
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
constructor(
|
|
1335
|
-
|
|
1336
|
-
super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
|
|
1221
|
+
};
|
|
1222
|
+
|
|
1223
|
+
let Matrix$1 = class Matrix {
|
|
1224
|
+
constructor(a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
|
|
1225
|
+
this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
|
|
1337
1226
|
}
|
|
1338
|
-
|
|
1339
|
-
return
|
|
1227
|
+
equalToMatrix(m2) {
|
|
1228
|
+
return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
|
|
1340
1229
|
}
|
|
1341
|
-
|
|
1342
|
-
return
|
|
1230
|
+
equalTo(a, b, c, d, e, f) {
|
|
1231
|
+
return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
|
|
1343
1232
|
}
|
|
1344
|
-
|
|
1345
|
-
return
|
|
1346
|
-
}
|
|
1347
|
-
getRotatedCorners() {
|
|
1348
|
-
const originPoint = {
|
|
1349
|
-
x: (this.x1 + this.x2) / 2,
|
|
1350
|
-
y: (this.y1 + this.y2) / 2
|
|
1351
|
-
};
|
|
1352
|
-
return [rotatePoint({
|
|
1353
|
-
x: this.x1,
|
|
1354
|
-
y: this.y1
|
|
1355
|
-
}, this.angle, originPoint), rotatePoint({
|
|
1356
|
-
x: this.x2,
|
|
1357
|
-
y: this.y1
|
|
1358
|
-
}, this.angle, originPoint), rotatePoint({
|
|
1359
|
-
x: this.x1,
|
|
1360
|
-
y: this.y2
|
|
1361
|
-
}, this.angle, originPoint), rotatePoint({
|
|
1362
|
-
x: this.x2,
|
|
1363
|
-
y: this.y2
|
|
1364
|
-
}, this.angle, originPoint)];
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
class Matrix {
|
|
1369
|
-
constructor(a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
|
|
1370
|
-
this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
|
|
1371
|
-
}
|
|
1372
|
-
equalToMatrix(m2) {
|
|
1373
|
-
return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
|
|
1374
|
-
}
|
|
1375
|
-
equalTo(a, b, c, d, e, f) {
|
|
1376
|
-
return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
|
|
1377
|
-
}
|
|
1378
|
-
setValue(a, b, c, d, e, f) {
|
|
1379
|
-
return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
|
|
1233
|
+
setValue(a, b, c, d, e, f) {
|
|
1234
|
+
return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
|
|
1380
1235
|
}
|
|
1381
1236
|
reset() {
|
|
1382
1237
|
return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
|
|
@@ -1504,30 +1359,11 @@
|
|
|
1504
1359
|
const s = Math.sqrt(c * c + d * d);
|
|
1505
1360
|
result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
|
|
1506
1361
|
}
|
|
1507
|
-
return result.rotateDeg = radianToDegree(result.rotateDeg), result;
|
|
1362
|
+
return result.rotateDeg = radianToDegree$1(result.rotateDeg), result;
|
|
1508
1363
|
}
|
|
1509
|
-
}
|
|
1510
|
-
function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
|
|
1511
|
-
const oa = origin.a,
|
|
1512
|
-
ob = origin.b,
|
|
1513
|
-
oc = origin.c,
|
|
1514
|
-
od = origin.d,
|
|
1515
|
-
oe = origin.e,
|
|
1516
|
-
of = origin.f,
|
|
1517
|
-
cosTheta = cos(angle),
|
|
1518
|
-
sinTheta = sin(angle);
|
|
1519
|
-
let rotateCenterX, rotateCenterY;
|
|
1520
|
-
rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
|
|
1521
|
-
const offsetX = rotateCenterX - x,
|
|
1522
|
-
offsetY = rotateCenterY - y,
|
|
1523
|
-
a1 = oa * cosTheta + oc * sinTheta,
|
|
1524
|
-
b1 = ob * cosTheta + od * sinTheta,
|
|
1525
|
-
c1 = oc * cosTheta - oa * sinTheta,
|
|
1526
|
-
d1 = od * cosTheta - ob * sinTheta;
|
|
1527
|
-
out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
|
|
1528
|
-
}
|
|
1364
|
+
};
|
|
1529
1365
|
|
|
1530
|
-
function hslToRgb(h, s, l) {
|
|
1366
|
+
function hslToRgb$1(h, s, l) {
|
|
1531
1367
|
s /= 100, l /= 100;
|
|
1532
1368
|
const c = (1 - Math.abs(2 * l - 1)) * s,
|
|
1533
1369
|
x = c * (1 - Math.abs(h / 60 % 2 - 1)),
|
|
@@ -1542,7 +1378,7 @@
|
|
|
1542
1378
|
};
|
|
1543
1379
|
}
|
|
1544
1380
|
|
|
1545
|
-
function rgbToHsl(r, g, b) {
|
|
1381
|
+
function rgbToHsl$1(r, g, b) {
|
|
1546
1382
|
r /= 255, g /= 255, b /= 255;
|
|
1547
1383
|
const cMin = Math.min(r, g, b),
|
|
1548
1384
|
cMax = Math.max(r, g, b),
|
|
@@ -1557,11 +1393,11 @@
|
|
|
1557
1393
|
};
|
|
1558
1394
|
}
|
|
1559
1395
|
|
|
1560
|
-
const REG_HEX = /^#([0-9a-f]{3,8})$/,
|
|
1561
|
-
DEFAULT_COLORS_OPACITY = {
|
|
1396
|
+
const REG_HEX$1 = /^#([0-9a-f]{3,8})$/,
|
|
1397
|
+
DEFAULT_COLORS_OPACITY$1 = {
|
|
1562
1398
|
transparent: 4294967040
|
|
1563
1399
|
};
|
|
1564
|
-
const DEFAULT_COLORS = {
|
|
1400
|
+
const DEFAULT_COLORS$1 = {
|
|
1565
1401
|
aliceblue: 15792383,
|
|
1566
1402
|
antiquewhite: 16444375,
|
|
1567
1403
|
aqua: 65535,
|
|
@@ -1711,30 +1547,30 @@
|
|
|
1711
1547
|
yellow: 16776960,
|
|
1712
1548
|
yellowgreen: 10145074
|
|
1713
1549
|
};
|
|
1714
|
-
function hex(value) {
|
|
1550
|
+
function hex$1(value) {
|
|
1715
1551
|
return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
|
|
1716
1552
|
}
|
|
1717
|
-
function rgb(value) {
|
|
1718
|
-
return isNumber$
|
|
1553
|
+
function rgb$1(value) {
|
|
1554
|
+
return isNumber$3(value) ? new RGB$1(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$3(value) ? new RGB$1(value[0], value[1], value[2]) : new RGB$1(255, 255, 255);
|
|
1719
1555
|
}
|
|
1720
|
-
function rgba(value) {
|
|
1721
|
-
return isNumber$
|
|
1556
|
+
function rgba$1(value) {
|
|
1557
|
+
return isNumber$3(value) ? new RGB$1(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$3(value) ? new RGB$1(value[0], value[1], value[2], value[3]) : new RGB$1(255, 255, 255, 1);
|
|
1722
1558
|
}
|
|
1723
|
-
function SRGBToLinear(c) {
|
|
1559
|
+
function SRGBToLinear$1(c) {
|
|
1724
1560
|
return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
|
|
1725
1561
|
}
|
|
1726
|
-
function LinearToSRGB(c) {
|
|
1562
|
+
function LinearToSRGB$1(c) {
|
|
1727
1563
|
return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
|
|
1728
1564
|
}
|
|
1729
|
-
const setHex = (formatValue, forceHex) => {
|
|
1730
|
-
const isHex = REG_HEX.exec(formatValue);
|
|
1565
|
+
const setHex$1 = (formatValue, forceHex) => {
|
|
1566
|
+
const isHex = REG_HEX$1.exec(formatValue);
|
|
1731
1567
|
if (forceHex || isHex) {
|
|
1732
1568
|
const hex = parseInt(isHex[1], 16),
|
|
1733
1569
|
hexLength = isHex[1].length;
|
|
1734
|
-
return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
|
|
1570
|
+
return 3 === hexLength ? new RGB$1((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb$1(hex) : 8 === hexLength ? new RGB$1(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
|
|
1735
1571
|
}
|
|
1736
1572
|
};
|
|
1737
|
-
class Color {
|
|
1573
|
+
let Color$1 = class Color {
|
|
1738
1574
|
static Brighter(source, b = 1) {
|
|
1739
1575
|
return 1 === b ? source : new Color(source).brighter(b).toRGBA();
|
|
1740
1576
|
}
|
|
@@ -1760,24 +1596,24 @@
|
|
|
1760
1596
|
}
|
|
1761
1597
|
}
|
|
1762
1598
|
static parseColorString(value) {
|
|
1763
|
-
if (isValid$
|
|
1764
|
-
if (isValid$
|
|
1599
|
+
if (isValid$3(DEFAULT_COLORS_OPACITY$1[value])) return rgba$1(DEFAULT_COLORS_OPACITY$1[value]);
|
|
1600
|
+
if (isValid$3(DEFAULT_COLORS$1[value])) return rgb$1(DEFAULT_COLORS$1[value]);
|
|
1765
1601
|
const formatValue = `${value}`.trim().toLowerCase(),
|
|
1766
|
-
hexRes = setHex(formatValue);
|
|
1602
|
+
hexRes = setHex$1(formatValue);
|
|
1767
1603
|
if (void 0 !== hexRes) return hexRes;
|
|
1768
1604
|
if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
|
|
1769
1605
|
const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
|
|
1770
|
-
return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
|
|
1606
|
+
return new RGB$1(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
|
|
1771
1607
|
}
|
|
1772
1608
|
if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
|
|
1773
1609
|
const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
|
|
1774
|
-
rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
|
|
1775
|
-
return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
|
|
1610
|
+
rgb = hslToRgb$1(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
|
|
1611
|
+
return new RGB$1(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
|
|
1776
1612
|
}
|
|
1777
1613
|
}
|
|
1778
1614
|
constructor(value) {
|
|
1779
1615
|
const color = Color.parseColorString(value);
|
|
1780
|
-
color ? this.color = color : (console.warn(`Warn: 传入${value}无法解析为Color`), this.color = new RGB(255, 255, 255));
|
|
1616
|
+
color ? this.color = color : (console.warn(`Warn: 传入${value}无法解析为Color`), this.color = new RGB$1(255, 255, 255));
|
|
1781
1617
|
}
|
|
1782
1618
|
toRGBA() {
|
|
1783
1619
|
return this.color.formatRgb();
|
|
@@ -1826,20 +1662,20 @@
|
|
|
1826
1662
|
}
|
|
1827
1663
|
setHsl(h, s, l) {
|
|
1828
1664
|
const opacity = this.color.opacity,
|
|
1829
|
-
hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
|
|
1830
|
-
rgb = hslToRgb(isNil$
|
|
1831
|
-
return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
|
|
1665
|
+
hsl = rgbToHsl$1(this.color.r, this.color.g, this.color.b),
|
|
1666
|
+
rgb = hslToRgb$1(isNil$3(h) ? hsl.h : clamp$3(h, 0, 360), isNil$3(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$3(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
|
|
1667
|
+
return this.color = new RGB$1(rgb.r, rgb.g, rgb.b, opacity), this;
|
|
1832
1668
|
}
|
|
1833
1669
|
setRGB(r, g, b) {
|
|
1834
|
-
return !isNil$
|
|
1670
|
+
return !isNil$3(r) && (this.color.r = r), !isNil$3(g) && (this.color.g = g), !isNil$3(b) && (this.color.b = b), this;
|
|
1835
1671
|
}
|
|
1836
1672
|
setHex(value) {
|
|
1837
1673
|
const formatValue = `${value}`.trim().toLowerCase(),
|
|
1838
|
-
res = setHex(formatValue, !0);
|
|
1674
|
+
res = setHex$1(formatValue, !0);
|
|
1839
1675
|
return null != res ? res : this;
|
|
1840
1676
|
}
|
|
1841
1677
|
setColorName(name) {
|
|
1842
|
-
const hex = DEFAULT_COLORS[name.toLowerCase()];
|
|
1678
|
+
const hex = DEFAULT_COLORS$1[name.toLowerCase()];
|
|
1843
1679
|
return void 0 !== hex ? this.setHex(hex) : console.warn("THREE.Color: Unknown color " + name), this;
|
|
1844
1680
|
}
|
|
1845
1681
|
setScalar(scalar) {
|
|
@@ -1882,10 +1718,10 @@
|
|
|
1882
1718
|
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
1883
1719
|
}
|
|
1884
1720
|
copySRGBToLinear(color) {
|
|
1885
|
-
return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
|
|
1721
|
+
return this.color.r = SRGBToLinear$1(color.color.r), this.color.g = SRGBToLinear$1(color.color.g), this.color.b = SRGBToLinear$1(color.color.b), this;
|
|
1886
1722
|
}
|
|
1887
1723
|
copyLinearToSRGB(color) {
|
|
1888
|
-
return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
|
|
1724
|
+
return this.color.r = LinearToSRGB$1(color.color.r), this.color.g = LinearToSRGB$1(color.color.g), this.color.b = LinearToSRGB$1(color.color.b), this;
|
|
1889
1725
|
}
|
|
1890
1726
|
convertSRGBToLinear() {
|
|
1891
1727
|
return this.copySRGBToLinear(this), this;
|
|
@@ -1893,13 +1729,13 @@
|
|
|
1893
1729
|
convertLinearToSRGB() {
|
|
1894
1730
|
return this.copyLinearToSRGB(this), this;
|
|
1895
1731
|
}
|
|
1896
|
-
}
|
|
1897
|
-
class RGB {
|
|
1732
|
+
};
|
|
1733
|
+
let RGB$1 = class RGB {
|
|
1898
1734
|
constructor(r, g, b, opacity) {
|
|
1899
|
-
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$
|
|
1735
|
+
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$3(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
|
|
1900
1736
|
}
|
|
1901
1737
|
formatHex() {
|
|
1902
|
-
return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
|
|
1738
|
+
return `#${hex$1(this.r) + hex$1(this.g) + hex$1(this.b) + (1 === this.opacity ? "" : hex$1(255 * this.opacity))}`;
|
|
1903
1739
|
}
|
|
1904
1740
|
formatRgb() {
|
|
1905
1741
|
const opacity = this.opacity;
|
|
@@ -1911,13 +1747,13 @@
|
|
|
1911
1747
|
h: h,
|
|
1912
1748
|
s: s,
|
|
1913
1749
|
l: l
|
|
1914
|
-
} = rgbToHsl(this.r, this.g, this.b);
|
|
1750
|
+
} = rgbToHsl$1(this.r, this.g, this.b);
|
|
1915
1751
|
return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
|
|
1916
1752
|
}
|
|
1917
1753
|
toString() {
|
|
1918
1754
|
return this.formatHex();
|
|
1919
1755
|
}
|
|
1920
|
-
}
|
|
1756
|
+
};
|
|
1921
1757
|
|
|
1922
1758
|
function hexToRgb(str) {
|
|
1923
1759
|
let r = "",
|
|
@@ -1945,52 +1781,22 @@
|
|
|
1945
1781
|
const r = Math.round(redA * (1 - t) + redB * t),
|
|
1946
1782
|
g = Math.round(greenA * (1 - t) + greenB * t),
|
|
1947
1783
|
b = Math.round(blueA * (1 - t) + blueB * t);
|
|
1948
|
-
return new RGB(r, g, b, opacityA * (1 - t) + opacityB * t);
|
|
1784
|
+
return new RGB$1(r, g, b, opacityA * (1 - t) + opacityB * t);
|
|
1949
1785
|
};
|
|
1950
1786
|
}
|
|
1951
1787
|
|
|
1952
1788
|
var ColorUtil = /*#__PURE__*/Object.freeze({
|
|
1953
1789
|
__proto__: null,
|
|
1954
|
-
Color: Color,
|
|
1955
|
-
DEFAULT_COLORS: DEFAULT_COLORS,
|
|
1956
|
-
RGB: RGB,
|
|
1790
|
+
Color: Color$1,
|
|
1791
|
+
DEFAULT_COLORS: DEFAULT_COLORS$1,
|
|
1792
|
+
RGB: RGB$1,
|
|
1957
1793
|
hexToRgb: hexToRgb,
|
|
1958
|
-
hslToRgb: hslToRgb,
|
|
1794
|
+
hslToRgb: hslToRgb$1,
|
|
1959
1795
|
interpolateRgb: interpolateRgb$1,
|
|
1960
1796
|
rgbToHex: rgbToHex,
|
|
1961
|
-
rgbToHsl: rgbToHsl
|
|
1797
|
+
rgbToHsl: rgbToHsl$1
|
|
1962
1798
|
});
|
|
1963
1799
|
|
|
1964
|
-
function normalizePadding(padding) {
|
|
1965
|
-
if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
|
|
1966
|
-
if (isArray$1(padding)) {
|
|
1967
|
-
const length = padding.length;
|
|
1968
|
-
if (1 === length) {
|
|
1969
|
-
const paddingValue = padding[0];
|
|
1970
|
-
return [paddingValue, paddingValue, paddingValue, paddingValue];
|
|
1971
|
-
}
|
|
1972
|
-
if (2 === length) {
|
|
1973
|
-
const [vertical, horizontal] = padding;
|
|
1974
|
-
return [vertical, horizontal, vertical, horizontal];
|
|
1975
|
-
}
|
|
1976
|
-
if (3 === length) {
|
|
1977
|
-
const [top, horizontal, bottom] = padding;
|
|
1978
|
-
return [top, horizontal, bottom, horizontal];
|
|
1979
|
-
}
|
|
1980
|
-
if (4 === length) return padding;
|
|
1981
|
-
}
|
|
1982
|
-
if (isObject$1(padding)) {
|
|
1983
|
-
const {
|
|
1984
|
-
top = 0,
|
|
1985
|
-
right = 0,
|
|
1986
|
-
bottom = 0,
|
|
1987
|
-
left = 0
|
|
1988
|
-
} = padding;
|
|
1989
|
-
return [top, right, bottom, left];
|
|
1990
|
-
}
|
|
1991
|
-
return [0, 0, 0, 0];
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
1800
|
function toCamelCase(str) {
|
|
1995
1801
|
return str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
|
|
1996
1802
|
}
|
|
@@ -2076,15 +1882,15 @@
|
|
|
2076
1882
|
return result;
|
|
2077
1883
|
}
|
|
2078
1884
|
function destination(point, distance, bearing, options = {}) {
|
|
2079
|
-
const longitude1 = degreeToRadian(point[0]),
|
|
2080
|
-
latitude1 = degreeToRadian(point[1]),
|
|
2081
|
-
bearingRad = degreeToRadian(bearing),
|
|
1885
|
+
const longitude1 = degreeToRadian$1(point[0]),
|
|
1886
|
+
latitude1 = degreeToRadian$1(point[1]),
|
|
1887
|
+
bearingRad = degreeToRadian$1(bearing),
|
|
2082
1888
|
radians = lengthToRadians(distance, options.units),
|
|
2083
1889
|
latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad)),
|
|
2084
1890
|
longitude2 = longitude1 + Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
|
|
2085
1891
|
return {
|
|
2086
|
-
x: radianToDegree(longitude2),
|
|
2087
|
-
y: radianToDegree(latitude2)
|
|
1892
|
+
x: radianToDegree$1(longitude2),
|
|
1893
|
+
y: radianToDegree$1(latitude2)
|
|
2088
1894
|
};
|
|
2089
1895
|
}
|
|
2090
1896
|
|
|
@@ -2155,7 +1961,7 @@
|
|
|
2155
1961
|
data.sort((d1, d2) => Number(d2[xField]) - Number(d1[xField]));
|
|
2156
1962
|
data.forEach(d => {
|
|
2157
1963
|
const time = d[timeField];
|
|
2158
|
-
if (isValid$
|
|
1964
|
+
if (isValid$3(time)) {
|
|
2159
1965
|
timeNodes.add(time);
|
|
2160
1966
|
}
|
|
2161
1967
|
if (!timeData.has(time)) {
|
|
@@ -2497,7 +2303,7 @@
|
|
|
2497
2303
|
const applyVisible = (spec, keyList) => {
|
|
2498
2304
|
keyList.forEach(key => {
|
|
2499
2305
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
2500
|
-
if (isArray$
|
|
2306
|
+
if (isArray$3(spec[key])) {
|
|
2501
2307
|
(_a = spec[key]) === null || _a === void 0 ? void 0 : _a.forEach((s, i) => {
|
|
2502
2308
|
var _a, _b, _c;
|
|
2503
2309
|
spec[key][i] = Object.assign(Object.assign({}, s), { style: Object.assign(Object.assign({}, s === null || s === void 0 ? void 0 : s.style), { visible: (_c = (_b = (_a = s === null || s === void 0 ? void 0 : s.style) === null || _a === void 0 ? void 0 : _a.visible) !== null && _b !== void 0 ? _b : s === null || s === void 0 ? void 0 : s.visible) !== null && _c !== void 0 ? _c : true }) });
|
|
@@ -3117,7 +2923,7 @@
|
|
|
3117
2923
|
sortFields = [];
|
|
3118
2924
|
for (const key in fields) if (Object.prototype.hasOwnProperty.call(fields, key)) {
|
|
3119
2925
|
const fieldInfo = fields[key];
|
|
3120
|
-
if (fieldInfo.sort && (isValidNumber$
|
|
2926
|
+
if (fieldInfo.sort && (isValidNumber$3(fieldInfo.sortIndex) || (fieldInfo.sortIndex = 0), isValid$3(fieldInfo.sortReverse) || (fieldInfo.sortReverse = "desc" === fieldInfo.sort)), !fieldInfo.type) {
|
|
3121
2927
|
let dataCheck = dataTemp;
|
|
3122
2928
|
key in dataTemp || (dataCheck = null !== (_a = data.find(d => key in d)) && void 0 !== _a ? _a : dataTemp), fieldInfo.type = "number" == typeof dataCheck[key] ? "linear" : "ordinal";
|
|
3123
2929
|
}
|
|
@@ -3196,7 +3002,7 @@
|
|
|
3196
3002
|
root = parseNode(svg, null);
|
|
3197
3003
|
let width = parseFloat(svg.getAttribute("width") || opt.width),
|
|
3198
3004
|
height = parseFloat(svg.getAttribute("height") || opt.height);
|
|
3199
|
-
!isValidNumber$
|
|
3005
|
+
!isValidNumber$3(width) && (width = null), !isValidNumber$3(height) && (height = null);
|
|
3200
3006
|
const viewBox = svg.getAttribute("viewBox");
|
|
3201
3007
|
let viewBoxRect;
|
|
3202
3008
|
if (viewBox) {
|
|
@@ -3218,7 +3024,7 @@
|
|
|
3218
3024
|
scale = Math.min(scaleX, scaleY),
|
|
3219
3025
|
transLateX = -(viewBoxRect.x + viewBoxRect.width / 2) * scale + (boundingRect.x + boundingRect.width / 2),
|
|
3220
3026
|
transLateY = -(viewBoxRect.y + viewBoxRect.height / 2) * scale + (boundingRect.y + boundingRect.height / 2),
|
|
3221
|
-
viewBoxTransform = new Matrix().translate(transLateX, transLateY).scale(scale, scale);
|
|
3027
|
+
viewBoxTransform = new Matrix$1().translate(transLateX, transLateY).scale(scale, scale);
|
|
3222
3028
|
root.transform = viewBoxTransform;
|
|
3223
3029
|
}
|
|
3224
3030
|
}
|
|
@@ -3238,9 +3044,9 @@
|
|
|
3238
3044
|
} = parsedElement,
|
|
3239
3045
|
parse = parent => parent ? validInheritAttributes.reduce((acc, attrName) => {
|
|
3240
3046
|
const camelAttrName = toCamelCase(attrName);
|
|
3241
|
-
return isValid$
|
|
3047
|
+
return isValid$3(parent[camelAttrName]) && (acc[camelAttrName] = parent[camelAttrName]), acc;
|
|
3242
3048
|
}, {}) : {};
|
|
3243
|
-
return parent ? (parent._inheritStyle || (parent._inheritStyle = parse(parent.attributes)), inheritedAttrs = merge({}, parent._inheritStyle, parse(attributes))) : inheritedAttrs = parse(attributes), inheritedAttrs;
|
|
3049
|
+
return parent ? (parent._inheritStyle || (parent._inheritStyle = parse(parent.attributes)), inheritedAttrs = merge$1({}, parent._inheritStyle, parse(attributes))) : inheritedAttrs = parse(attributes), inheritedAttrs;
|
|
3244
3050
|
}
|
|
3245
3051
|
function parseAttributes(el) {
|
|
3246
3052
|
var _a, _b, _c;
|
|
@@ -3249,12 +3055,12 @@
|
|
|
3249
3055
|
style = null !== (_b = el.style) && void 0 !== _b ? _b : {};
|
|
3250
3056
|
for (let i = 0; i < validAttributes.length; i++) {
|
|
3251
3057
|
const attrName = validAttributes[i],
|
|
3252
|
-
attrValue = isValid$
|
|
3253
|
-
isValid$
|
|
3058
|
+
attrValue = isValid$3(style[attrName]) && "" !== style[attrName] ? style[attrName] : null === (_c = attributes[attrName]) || void 0 === _c ? void 0 : _c.value;
|
|
3059
|
+
isValid$3(attrValue) && (attrs[toCamelCase(attrName)] = isNaN(+attrValue) ? attrValue : parseFloat(attrValue));
|
|
3254
3060
|
}
|
|
3255
3061
|
return "none" === style.display && (attrs.visible = !1), ["fontSize", "strokeWidth", "width", "height"].forEach(attr => {
|
|
3256
3062
|
const attrValue = attrs[attr];
|
|
3257
|
-
isString$
|
|
3063
|
+
isString$3(attrs[attr]) && (attrs[attr] = parseFloat(attrValue));
|
|
3258
3064
|
}), attrs;
|
|
3259
3065
|
}
|
|
3260
3066
|
function parseNode(node, parent) {
|
|
@@ -3271,7 +3077,7 @@
|
|
|
3271
3077
|
id: null !== (_d = node.getAttribute("id")) && void 0 !== _d ? _d : `${tagName}-${idx$1++}`,
|
|
3272
3078
|
transform: parseTransform(node)
|
|
3273
3079
|
};
|
|
3274
|
-
return parsed._inheritStyle = parseInheritAttributes(parsed), parent && !isValid$
|
|
3080
|
+
return parsed._inheritStyle = parseInheritAttributes(parsed), parent && !isValid$3(parsed.name) && (parsed._nameFromParent = null !== (_e = parent.name) && void 0 !== _e ? _e : parent._nameFromParent), parsed;
|
|
3275
3081
|
}
|
|
3276
3082
|
function parseText(node, parent) {
|
|
3277
3083
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -3300,7 +3106,7 @@
|
|
|
3300
3106
|
name: null == parent ? void 0 : parent.name,
|
|
3301
3107
|
id: null !== (_e = null === (_d = node.getAttribute) || void 0 === _d ? void 0 : _d.call(node, "id")) && void 0 !== _e ? _e : `${tagName}-${idx$1++}`,
|
|
3302
3108
|
value: value
|
|
3303
|
-
}, parsed._inheritStyle = parseInheritAttributes(parsed), isValid$
|
|
3109
|
+
}, parsed._inheritStyle = parseInheritAttributes(parsed), isValid$3(parsed.name) || (parsed._nameFromParent = null !== (_f = parent.name) && void 0 !== _f ? _f : parent._nameFromParent), nodeAsGroup ? parent._textGroupStyle ? parsed._textGroupStyle = merge$1({}, parent._textGroupStyle, parseAttributes(node)) : parsed._textGroupStyle = parseAttributes(node) : parsed.attributes = parsed._inheritStyle, parsed;
|
|
3304
3110
|
}
|
|
3305
3111
|
function parseTransform(node) {
|
|
3306
3112
|
var _a, _b;
|
|
@@ -3316,7 +3122,7 @@
|
|
|
3316
3122
|
e: e,
|
|
3317
3123
|
f: f
|
|
3318
3124
|
} = matrix;
|
|
3319
|
-
return new Matrix(a, b, c, d, e, f);
|
|
3125
|
+
return new Matrix$1(a, b, c, d, e, f);
|
|
3320
3126
|
}
|
|
3321
3127
|
function traverse(node, parsedParent, result = []) {
|
|
3322
3128
|
var _a;
|
|
@@ -3337,7 +3143,7 @@
|
|
|
3337
3143
|
constructor(options) {
|
|
3338
3144
|
var _a;
|
|
3339
3145
|
let name;
|
|
3340
|
-
this.options = options, this.isDataSet = !0, this.transformMap = {}, this.parserMap = {}, this.dataViewMap = {}, this.target = new EventEmitter(), name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataset"), this.name = name, this._logger = null !== (_a = null == options ? void 0 : options.logger) && void 0 !== _a ? _a : Logger.getInstance();
|
|
3146
|
+
this.options = options, this.isDataSet = !0, this.transformMap = {}, this.parserMap = {}, this.dataViewMap = {}, this.target = new EventEmitter(), name = (null == options ? void 0 : options.name) ? options.name : getUUID("dataset"), this.name = name, this._logger = null !== (_a = null == options ? void 0 : options.logger) && void 0 !== _a ? _a : Logger$1.getInstance();
|
|
3341
3147
|
}
|
|
3342
3148
|
setLogger(logger) {
|
|
3343
3149
|
this._logger = logger;
|
|
@@ -3492,9 +3298,9 @@
|
|
|
3492
3298
|
return this._fields ? this._fields : "dataview" === (null === (_a = this.parseOption) || void 0 === _a ? void 0 : _a.type) && 1 === this.rawData.length && this.rawData[0].getFields ? this.rawData[0].getFields() : null;
|
|
3493
3299
|
}
|
|
3494
3300
|
setFields(f, foreMerge = !1) {
|
|
3495
|
-
this._fields = f && foreMerge ? merge({}, this._fields, f) : f;
|
|
3301
|
+
this._fields = f && foreMerge ? merge$1({}, this._fields, f) : f;
|
|
3496
3302
|
const fieldsOption = this.transformsArr.find(_op => "fields" === _op.type);
|
|
3497
|
-
!isNil$
|
|
3303
|
+
!isNil$3(this._fields) && isNil$3(fieldsOption) ? (this.dataSet.registerTransform("fields", fields), this.transform({
|
|
3498
3304
|
type: "fields",
|
|
3499
3305
|
options: {
|
|
3500
3306
|
fields: this._fields
|
|
@@ -3660,7 +3466,7 @@
|
|
|
3660
3466
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
3661
3467
|
const { text: textContent } = arrow;
|
|
3662
3468
|
let displayTextContent = textContent;
|
|
3663
|
-
if (isFunction$
|
|
3469
|
+
if (isFunction$3(formatMethod)) {
|
|
3664
3470
|
const { vchart } = ctx;
|
|
3665
3471
|
const { from, to } = arrow;
|
|
3666
3472
|
const { field } = arrow.context;
|
|
@@ -3779,7 +3585,7 @@
|
|
|
3779
3585
|
};
|
|
3780
3586
|
function parseArrow(arrows, categoryField) {
|
|
3781
3587
|
return arrows
|
|
3782
|
-
.filter(arrow => isValidNumber$
|
|
3588
|
+
.filter(arrow => isValidNumber$3(arrow.from * arrow.to))
|
|
3783
3589
|
.map((arrow, index) => {
|
|
3784
3590
|
const { from, to, position = 'right' } = arrow;
|
|
3785
3591
|
return Object.assign(Object.assign({}, arrow), { position, distance: arrow.distance || 40, from: Math.min(from, to), to: Math.max(from, to), span: Math.abs(from - to), isLayout: false, context: {
|
|
@@ -3796,7 +3602,7 @@
|
|
|
3796
3602
|
const nodeDegreeMap = new Map();
|
|
3797
3603
|
arrows.forEach(arrow => {
|
|
3798
3604
|
const fromNodeDegree = nodeDegreeMap.get(arrow.from);
|
|
3799
|
-
if (isValid$
|
|
3605
|
+
if (isValid$3(fromNodeDegree)) {
|
|
3800
3606
|
const firstNodeWidthSameFromTo = fromNodeDegree.fromArrows.find(node => isSameArrow(node, arrow));
|
|
3801
3607
|
if (!firstNodeWidthSameFromTo) {
|
|
3802
3608
|
fromNodeDegree.degree += 1;
|
|
@@ -3815,7 +3621,7 @@
|
|
|
3815
3621
|
});
|
|
3816
3622
|
}
|
|
3817
3623
|
const toNodeDegree = nodeDegreeMap.get(arrow.to);
|
|
3818
|
-
if (isValid$
|
|
3624
|
+
if (isValid$3(toNodeDegree)) {
|
|
3819
3625
|
const firstNodeWidthSameFromTo = toNodeDegree.toArrows.find(node => isSameArrow(node, arrow));
|
|
3820
3626
|
if (!firstNodeWidthSameFromTo) {
|
|
3821
3627
|
toNodeDegree.degree += 1;
|
|
@@ -5248,178 +5054,1325 @@
|
|
|
5248
5054
|
}
|
|
5249
5055
|
return arr;
|
|
5250
5056
|
}
|
|
5251
|
-
_resolveFromBinding(binding) {
|
|
5252
|
-
const result = this._getResolvedFromBinding(binding);
|
|
5253
|
-
return this._saveToScope(binding, result), result;
|
|
5057
|
+
_resolveFromBinding(binding) {
|
|
5058
|
+
const result = this._getResolvedFromBinding(binding);
|
|
5059
|
+
return this._saveToScope(binding, result), result;
|
|
5060
|
+
}
|
|
5061
|
+
_getResolvedFromBinding(binding) {
|
|
5062
|
+
let result;
|
|
5063
|
+
switch (binding.type) {
|
|
5064
|
+
case BindingTypeEnum.ConstantValue:
|
|
5065
|
+
case BindingTypeEnum.Function:
|
|
5066
|
+
result = binding.cache;
|
|
5067
|
+
break;
|
|
5068
|
+
case BindingTypeEnum.Instance:
|
|
5069
|
+
result = this._resolveInstance(binding, binding.implementationType);
|
|
5070
|
+
break;
|
|
5071
|
+
default:
|
|
5072
|
+
result = binding.dynamicValue({
|
|
5073
|
+
container: this
|
|
5074
|
+
});
|
|
5075
|
+
}
|
|
5076
|
+
return result;
|
|
5077
|
+
}
|
|
5078
|
+
_resolveInstance(binding, constr) {
|
|
5079
|
+
if (binding.activated) return binding.cache;
|
|
5080
|
+
const childRequests = this._getChildRequest(binding);
|
|
5081
|
+
return this._createInstance(constr, childRequests);
|
|
5082
|
+
}
|
|
5083
|
+
_createInstance(constr, childRequests) {
|
|
5084
|
+
if (childRequests.length) {
|
|
5085
|
+
return new constr(...this._resolveRequests(childRequests));
|
|
5086
|
+
}
|
|
5087
|
+
return new constr();
|
|
5088
|
+
}
|
|
5089
|
+
_resolveRequests(childRequests) {
|
|
5090
|
+
return childRequests.map(request => request.bindings.length > 1 ? request.bindings.map(binding => this._resolveFromBinding(binding)) : this._resolveFromBinding(request.bindings[0]));
|
|
5091
|
+
}
|
|
5092
|
+
_saveToScope(binding, result) {
|
|
5093
|
+
binding.scope === BindingScopeEnum.Singleton && (binding.cache = result, binding.activated = !0);
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
const ContributionProvider = Symbol("ContributionProvider");
|
|
5098
|
+
class ContributionProviderCache {
|
|
5099
|
+
constructor(serviceIdentifier, container) {
|
|
5100
|
+
this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
|
|
5101
|
+
}
|
|
5102
|
+
getContributions() {
|
|
5103
|
+
return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
|
|
5104
|
+
}
|
|
5105
|
+
refresh() {
|
|
5106
|
+
this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
|
|
5107
|
+
}
|
|
5108
|
+
}
|
|
5109
|
+
function bindContributionProvider(bind, id) {
|
|
5110
|
+
bind(ContributionProvider).toDynamicValue(({
|
|
5111
|
+
container: container
|
|
5112
|
+
}) => new ContributionProviderCache(id, container)).inSingletonScope().whenTargetNamed(id);
|
|
5113
|
+
}
|
|
5114
|
+
class ContributionStore {
|
|
5115
|
+
static getStore(id) {
|
|
5116
|
+
return this.store.get(id);
|
|
5117
|
+
}
|
|
5118
|
+
static setStore(id, cache) {
|
|
5119
|
+
this.store.set(id, cache);
|
|
5120
|
+
}
|
|
5121
|
+
static refreshAllContributions() {
|
|
5122
|
+
this.store.forEach(cache => {
|
|
5123
|
+
cache.refresh();
|
|
5124
|
+
});
|
|
5125
|
+
}
|
|
5126
|
+
}
|
|
5127
|
+
ContributionStore.store = new Map();
|
|
5128
|
+
|
|
5129
|
+
class Hook {
|
|
5130
|
+
constructor(args, name) {
|
|
5131
|
+
this._args = args, this.name = name, this.taps = [];
|
|
5132
|
+
}
|
|
5133
|
+
tap(options, fn) {
|
|
5134
|
+
this._tap("sync", options, fn);
|
|
5135
|
+
}
|
|
5136
|
+
unTap(options, fn) {
|
|
5137
|
+
const name = "string" == typeof options ? options.trim() : options.name;
|
|
5138
|
+
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
5139
|
+
}
|
|
5140
|
+
_parseOptions(type, options, fn) {
|
|
5141
|
+
let _options;
|
|
5142
|
+
if ("string" == typeof options) _options = {
|
|
5143
|
+
name: options.trim()
|
|
5144
|
+
};else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
|
|
5145
|
+
if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
|
|
5146
|
+
return _options = Object.assign({
|
|
5147
|
+
type: type,
|
|
5148
|
+
fn: fn
|
|
5149
|
+
}, _options), _options;
|
|
5150
|
+
}
|
|
5151
|
+
_tap(type, options, fn) {
|
|
5152
|
+
this._insert(this._parseOptions(type, options, fn));
|
|
5153
|
+
}
|
|
5154
|
+
_insert(item) {
|
|
5155
|
+
let before;
|
|
5156
|
+
"string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
5157
|
+
let stage = 0;
|
|
5158
|
+
"number" == typeof item.stage && (stage = item.stage);
|
|
5159
|
+
let i = this.taps.length;
|
|
5160
|
+
for (; i > 0;) {
|
|
5161
|
+
i--;
|
|
5162
|
+
const x = this.taps[i];
|
|
5163
|
+
this.taps[i + 1] = x;
|
|
5164
|
+
const xStage = x.stage || 0;
|
|
5165
|
+
if (before) {
|
|
5166
|
+
if (before.has(x.name)) {
|
|
5167
|
+
before.delete(x.name);
|
|
5168
|
+
continue;
|
|
5169
|
+
}
|
|
5170
|
+
if (before.size > 0) continue;
|
|
5171
|
+
}
|
|
5172
|
+
if (!(xStage > stage)) {
|
|
5173
|
+
i++;
|
|
5174
|
+
break;
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
this.taps[i] = item;
|
|
5178
|
+
}
|
|
5179
|
+
}
|
|
5180
|
+
|
|
5181
|
+
class SyncHook extends Hook {
|
|
5182
|
+
call(...args) {
|
|
5183
|
+
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
5184
|
+
}
|
|
5185
|
+
}
|
|
5186
|
+
|
|
5187
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
5188
|
+
|
|
5189
|
+
class Application {}
|
|
5190
|
+
const application = new Application();
|
|
5191
|
+
|
|
5192
|
+
let idx = 0;
|
|
5193
|
+
class PerformanceRAF {
|
|
5194
|
+
constructor() {
|
|
5195
|
+
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
5196
|
+
this._rafHandle = null;
|
|
5197
|
+
const cbs = this.nextAnimationFrameCbs;
|
|
5198
|
+
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
5199
|
+
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
5200
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
5201
|
+
};
|
|
5202
|
+
}
|
|
5203
|
+
addAnimationFrameCb(callback) {
|
|
5204
|
+
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
5205
|
+
}
|
|
5206
|
+
removeAnimationFrameCb(index) {
|
|
5207
|
+
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
5208
|
+
}
|
|
5209
|
+
}
|
|
5210
|
+
|
|
5211
|
+
var MeasureModeEnum;
|
|
5212
|
+
!function (MeasureModeEnum) {
|
|
5213
|
+
MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
|
|
5214
|
+
}(MeasureModeEnum || (MeasureModeEnum = {}));
|
|
5215
|
+
|
|
5216
|
+
var STATUS;
|
|
5217
|
+
!function (STATUS) {
|
|
5218
|
+
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
5219
|
+
}(STATUS || (STATUS = {}));
|
|
5220
|
+
|
|
5221
|
+
var AnimateStepType;
|
|
5222
|
+
!function (AnimateStepType) {
|
|
5223
|
+
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
5224
|
+
}(AnimateStepType || (AnimateStepType = {}));
|
|
5225
|
+
var AnimateStatus;
|
|
5226
|
+
!function (AnimateStatus) {
|
|
5227
|
+
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
5228
|
+
}(AnimateStatus || (AnimateStatus = {}));
|
|
5229
|
+
|
|
5230
|
+
const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
|
|
5231
|
+
var isType$1 = isType;
|
|
5232
|
+
|
|
5233
|
+
const isBoolean = (value, fuzzy = !1) => fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
|
|
5234
|
+
var isBoolean$1 = isBoolean;
|
|
5235
|
+
|
|
5236
|
+
const isFunction = value => "function" == typeof value;
|
|
5237
|
+
var isFunction$1 = isFunction;
|
|
5238
|
+
|
|
5239
|
+
const isNil = value => null == value;
|
|
5240
|
+
var isNil$1 = isNil;
|
|
5241
|
+
|
|
5242
|
+
const isValid = value => null != value;
|
|
5243
|
+
var isValid$1 = isValid;
|
|
5244
|
+
|
|
5245
|
+
const isObject = value => {
|
|
5246
|
+
const type = typeof value;
|
|
5247
|
+
return null !== value && "object" === type || "function" === type;
|
|
5248
|
+
};
|
|
5249
|
+
var isObject$1 = isObject;
|
|
5250
|
+
|
|
5251
|
+
const isObjectLike = value => "object" == typeof value && null !== value;
|
|
5252
|
+
var isObjectLike$1 = isObjectLike;
|
|
5253
|
+
|
|
5254
|
+
const isPlainObject = function (value) {
|
|
5255
|
+
if (!isObjectLike$1(value) || !isType$1(value, "Object")) return !1;
|
|
5256
|
+
if (null === Object.getPrototypeOf(value)) return !0;
|
|
5257
|
+
let proto = value;
|
|
5258
|
+
for (; null !== Object.getPrototypeOf(proto);) proto = Object.getPrototypeOf(proto);
|
|
5259
|
+
return Object.getPrototypeOf(value) === proto;
|
|
5260
|
+
};
|
|
5261
|
+
var isPlainObject$1 = isPlainObject;
|
|
5262
|
+
|
|
5263
|
+
const isString = (value, fuzzy = !1) => {
|
|
5264
|
+
const type = typeof value;
|
|
5265
|
+
return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
|
|
5266
|
+
};
|
|
5267
|
+
var isString$1 = isString;
|
|
5268
|
+
|
|
5269
|
+
const isArray = value => Array.isArray ? Array.isArray(value) : isType$1(value, "Array");
|
|
5270
|
+
var isArray$1 = isArray;
|
|
5271
|
+
|
|
5272
|
+
const isArrayLike = function (value) {
|
|
5273
|
+
return null !== value && "function" != typeof value && Number.isFinite(value.length);
|
|
5274
|
+
};
|
|
5275
|
+
var isArrayLike$1 = isArrayLike;
|
|
5276
|
+
|
|
5277
|
+
const isNumber = (value, fuzzy = !1) => {
|
|
5278
|
+
const type = typeof value;
|
|
5279
|
+
return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
|
|
5280
|
+
};
|
|
5281
|
+
var isNumber$1 = isNumber;
|
|
5282
|
+
|
|
5283
|
+
const isValidNumber = value => isNumber$1(value) && Number.isFinite(value);
|
|
5284
|
+
var isValidNumber$1 = isValidNumber;
|
|
5285
|
+
|
|
5286
|
+
const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
|
|
5287
|
+
var isValidUrl$1 = isValidUrl;
|
|
5288
|
+
|
|
5289
|
+
const isBase64 = value => new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(value);
|
|
5290
|
+
var isBase64$1 = isBase64;
|
|
5291
|
+
|
|
5292
|
+
const getType = value => ({}).toString.call(value).replace(/^\[object /, "").replace(/]$/, "");
|
|
5293
|
+
var getType$1 = getType;
|
|
5294
|
+
|
|
5295
|
+
const objectProto = Object.prototype,
|
|
5296
|
+
isPrototype = function (value) {
|
|
5297
|
+
const Ctor = value && value.constructor;
|
|
5298
|
+
return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
|
|
5299
|
+
};
|
|
5300
|
+
var isPrototype$1 = isPrototype;
|
|
5301
|
+
|
|
5302
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
5303
|
+
function isEmpty(value) {
|
|
5304
|
+
if (isNil$1(value)) return !0;
|
|
5305
|
+
if (isArrayLike$1(value)) return !value.length;
|
|
5306
|
+
const type = getType$1(value);
|
|
5307
|
+
if ("Map" === type || "Set" === type) return !value.size;
|
|
5308
|
+
if (isPrototype$1(value)) return !Object.keys(value).length;
|
|
5309
|
+
for (const key in value) if (hasOwnProperty.call(value, key)) return !1;
|
|
5310
|
+
return !0;
|
|
5311
|
+
}
|
|
5312
|
+
|
|
5313
|
+
function baseMerge(target, source, shallowArray = !1, skipTargetArray = !1) {
|
|
5314
|
+
if (source) {
|
|
5315
|
+
if (target === source) return;
|
|
5316
|
+
if (isValid$1(source) && "object" == typeof source) {
|
|
5317
|
+
const iterable = Object(source),
|
|
5318
|
+
props = [];
|
|
5319
|
+
for (const key in iterable) props.push(key);
|
|
5320
|
+
let {
|
|
5321
|
+
length: length
|
|
5322
|
+
} = props,
|
|
5323
|
+
propIndex = -1;
|
|
5324
|
+
for (; length--;) {
|
|
5325
|
+
const key = props[++propIndex];
|
|
5326
|
+
!isValid$1(iterable[key]) || "object" != typeof iterable[key] || skipTargetArray && isArray$1(target[key]) ? assignMergeValue(target, key, iterable[key]) : baseMergeDeep(target, source, key, shallowArray, skipTargetArray);
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5330
|
+
}
|
|
5331
|
+
function baseMergeDeep(target, source, key, shallowArray = !1, skipTargetArray = !1) {
|
|
5332
|
+
const objValue = target[key],
|
|
5333
|
+
srcValue = source[key];
|
|
5334
|
+
let newValue = source[key],
|
|
5335
|
+
isCommon = !0;
|
|
5336
|
+
if (isArray$1(srcValue)) {
|
|
5337
|
+
if (shallowArray) newValue = [];else if (isArray$1(objValue)) newValue = objValue;else if (isArrayLike$1(objValue)) {
|
|
5338
|
+
newValue = new Array(objValue.length);
|
|
5339
|
+
let index = -1;
|
|
5340
|
+
const length = objValue.length;
|
|
5341
|
+
for (; ++index < length;) newValue[index] = objValue[index];
|
|
5342
|
+
}
|
|
5343
|
+
} else isPlainObject$1(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
|
|
5344
|
+
isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
|
|
5345
|
+
}
|
|
5346
|
+
function assignMergeValue(target, key, value) {
|
|
5347
|
+
(void 0 !== value && !eq(target[key], value) || void 0 === value && !(key in target)) && (target[key] = value);
|
|
5348
|
+
}
|
|
5349
|
+
function eq(value, other) {
|
|
5350
|
+
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
5351
|
+
}
|
|
5352
|
+
function merge(target, ...sources) {
|
|
5353
|
+
let sourceIndex = -1;
|
|
5354
|
+
const length = sources.length;
|
|
5355
|
+
for (; ++sourceIndex < length;) {
|
|
5356
|
+
baseMerge(target, sources[sourceIndex], !0);
|
|
5357
|
+
}
|
|
5358
|
+
return target;
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5361
|
+
function keys(obj) {
|
|
5362
|
+
if (!obj) return [];
|
|
5363
|
+
if (Object.keys) return Object.keys(obj);
|
|
5364
|
+
const keyList = [];
|
|
5365
|
+
for (const key in obj) obj.hasOwnProperty(key) && keyList.push(key);
|
|
5366
|
+
return keyList;
|
|
5367
|
+
}
|
|
5368
|
+
function defaults(target, source, overlay) {
|
|
5369
|
+
const keysArr = keys(source);
|
|
5370
|
+
for (let i = 0; i < keysArr.length; i++) {
|
|
5371
|
+
const key = keysArr[i];
|
|
5372
|
+
(overlay ? null != source[key] : null == target[key]) && (target[key] = source[key]);
|
|
5373
|
+
}
|
|
5374
|
+
return target;
|
|
5375
|
+
}
|
|
5376
|
+
function mixin(target, source, override = !0) {
|
|
5377
|
+
if (target = "prototype" in target ? target.prototype : target, source = "prototype" in source ? source.prototype : source, Object.getOwnPropertyNames) {
|
|
5378
|
+
const keyList = Object.getOwnPropertyNames(source);
|
|
5379
|
+
for (let i = 0; i < keyList.length; i++) {
|
|
5380
|
+
const key = keyList[i];
|
|
5381
|
+
"constructor" !== key && (override ? null != source[key] : null == target[key]) && (target[key] = source[key]);
|
|
5382
|
+
}
|
|
5383
|
+
} else defaults(target, source, override);
|
|
5384
|
+
}
|
|
5385
|
+
|
|
5386
|
+
function array(arr) {
|
|
5387
|
+
return isValid$1(arr) ? isArray$1(arr) ? arr : [arr] : [];
|
|
5388
|
+
}
|
|
5389
|
+
function arrayEqual(a, b) {
|
|
5390
|
+
if (!isArray$1(a) || !isArray$1(b)) return !1;
|
|
5391
|
+
if (a.length !== b.length) return !1;
|
|
5392
|
+
for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return !1;
|
|
5393
|
+
return !0;
|
|
5394
|
+
}
|
|
5395
|
+
function flattenArray(arr) {
|
|
5396
|
+
if (!isArray$1(arr)) return [arr];
|
|
5397
|
+
const result = [];
|
|
5398
|
+
for (const value of arr) result.push(...flattenArray(value));
|
|
5399
|
+
return result;
|
|
5400
|
+
}
|
|
5401
|
+
|
|
5402
|
+
const hasConsole = "undefined" != typeof console;
|
|
5403
|
+
function log(method, level, input) {
|
|
5404
|
+
const args = [level].concat([].slice.call(input));
|
|
5405
|
+
hasConsole && console[method].apply(console, args);
|
|
5406
|
+
}
|
|
5407
|
+
var LoggerLevel;
|
|
5408
|
+
!function (LoggerLevel) {
|
|
5409
|
+
LoggerLevel[LoggerLevel.None = 0] = "None", LoggerLevel[LoggerLevel.Error = 1] = "Error", LoggerLevel[LoggerLevel.Warn = 2] = "Warn", LoggerLevel[LoggerLevel.Info = 3] = "Info", LoggerLevel[LoggerLevel.Debug = 4] = "Debug";
|
|
5410
|
+
}(LoggerLevel || (LoggerLevel = {}));
|
|
5411
|
+
class Logger {
|
|
5412
|
+
static getInstance(level, method) {
|
|
5413
|
+
return Logger._instance && isNumber$1(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
|
|
5414
|
+
}
|
|
5415
|
+
static setInstance(logger) {
|
|
5416
|
+
return Logger._instance = logger;
|
|
5417
|
+
}
|
|
5418
|
+
static setInstanceLevel(level) {
|
|
5419
|
+
Logger._instance ? Logger._instance.level(level) : Logger._instance = new Logger(level);
|
|
5420
|
+
}
|
|
5421
|
+
static clearInstance() {
|
|
5422
|
+
Logger._instance = null;
|
|
5423
|
+
}
|
|
5424
|
+
constructor(level = LoggerLevel.None, method) {
|
|
5425
|
+
this._onErrorHandler = [], this._level = level, this._method = method;
|
|
5426
|
+
}
|
|
5427
|
+
addErrorHandler(handler) {
|
|
5428
|
+
this._onErrorHandler.find(h => h === handler) || this._onErrorHandler.push(handler);
|
|
5429
|
+
}
|
|
5430
|
+
removeErrorHandler(handler) {
|
|
5431
|
+
const index = this._onErrorHandler.findIndex(h => h === handler);
|
|
5432
|
+
index < 0 || this._onErrorHandler.splice(index, 1);
|
|
5433
|
+
}
|
|
5434
|
+
callErrorHandler(...args) {
|
|
5435
|
+
this._onErrorHandler.forEach(h => h(...args));
|
|
5436
|
+
}
|
|
5437
|
+
canLogInfo() {
|
|
5438
|
+
return this._level >= LoggerLevel.Info;
|
|
5439
|
+
}
|
|
5440
|
+
canLogDebug() {
|
|
5441
|
+
return this._level >= LoggerLevel.Debug;
|
|
5442
|
+
}
|
|
5443
|
+
canLogError() {
|
|
5444
|
+
return this._level >= LoggerLevel.Error;
|
|
5445
|
+
}
|
|
5446
|
+
canLogWarn() {
|
|
5447
|
+
return this._level >= LoggerLevel.Warn;
|
|
5448
|
+
}
|
|
5449
|
+
level(levelValue) {
|
|
5450
|
+
return arguments.length ? (this._level = +levelValue, this) : this._level;
|
|
5451
|
+
}
|
|
5452
|
+
error(...args) {
|
|
5453
|
+
var _a;
|
|
5454
|
+
return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
|
|
5455
|
+
}
|
|
5456
|
+
warn(...args) {
|
|
5457
|
+
return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
|
|
5458
|
+
}
|
|
5459
|
+
info(...args) {
|
|
5460
|
+
return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
|
|
5461
|
+
}
|
|
5462
|
+
debug(...args) {
|
|
5463
|
+
return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
|
|
5464
|
+
}
|
|
5465
|
+
}
|
|
5466
|
+
Logger._instance = null;
|
|
5467
|
+
|
|
5468
|
+
const clamp = function (input, min, max) {
|
|
5469
|
+
return input < min ? min : input > max ? max : input;
|
|
5470
|
+
};
|
|
5471
|
+
var clamp$1 = clamp;
|
|
5472
|
+
|
|
5473
|
+
const epsilon = 1e-12;
|
|
5474
|
+
const pi = Math.PI;
|
|
5475
|
+
const halfPi$1 = pi / 2;
|
|
5476
|
+
const tau = 2 * pi;
|
|
5477
|
+
const pi2 = 2 * Math.PI;
|
|
5478
|
+
const abs = Math.abs;
|
|
5479
|
+
const atan2 = Math.atan2;
|
|
5480
|
+
const cos = Math.cos;
|
|
5481
|
+
const max = Math.max;
|
|
5482
|
+
const min = Math.min;
|
|
5483
|
+
const sin = Math.sin;
|
|
5484
|
+
const sqrt$1 = Math.sqrt;
|
|
5485
|
+
const pow = Math.pow;
|
|
5486
|
+
function acos(x) {
|
|
5487
|
+
return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
|
|
5488
|
+
}
|
|
5489
|
+
function asin(x) {
|
|
5490
|
+
return x >= 1 ? halfPi$1 : x <= -1 ? -halfPi$1 : Math.asin(x);
|
|
5491
|
+
}
|
|
5492
|
+
function pointAt(x1, y1, x2, y2, t) {
|
|
5493
|
+
let x = x2,
|
|
5494
|
+
y = y2;
|
|
5495
|
+
return "number" == typeof x1 && "number" == typeof x2 && (x = (1 - t) * x1 + t * x2), "number" == typeof y1 && "number" == typeof y2 && (y = (1 - t) * y1 + t * y2), {
|
|
5496
|
+
x: x,
|
|
5497
|
+
y: y
|
|
5498
|
+
};
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5501
|
+
class Point {
|
|
5502
|
+
constructor(x = 0, y = 0, x1, y1) {
|
|
5503
|
+
this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
|
|
5504
|
+
}
|
|
5505
|
+
clone() {
|
|
5506
|
+
return new Point(this.x, this.y);
|
|
5507
|
+
}
|
|
5508
|
+
copyFrom(p) {
|
|
5509
|
+
return this.x = p.x, this.y = p.y, this.x1 = p.x1, this.y1 = p.y1, this.defined = p.defined, this.context = p.context, this;
|
|
5510
|
+
}
|
|
5511
|
+
set(x, y) {
|
|
5512
|
+
return this.x = x, this.y = y, this;
|
|
5513
|
+
}
|
|
5514
|
+
add(point) {
|
|
5515
|
+
return isNumber$1(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
|
|
5516
|
+
}
|
|
5517
|
+
sub(point) {
|
|
5518
|
+
return isNumber$1(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
|
|
5519
|
+
}
|
|
5520
|
+
multi(point) {
|
|
5521
|
+
throw new Error("暂不支持");
|
|
5522
|
+
}
|
|
5523
|
+
div(point) {
|
|
5524
|
+
throw new Error("暂不支持");
|
|
5525
|
+
}
|
|
5526
|
+
}
|
|
5527
|
+
class PointService {
|
|
5528
|
+
static distancePP(p1, p2) {
|
|
5529
|
+
return sqrt$1(pow(p1.x - p2.x, 2) + pow(p1.y - p2.y, 2));
|
|
5530
|
+
}
|
|
5531
|
+
static distanceNN(x, y, x1, y1) {
|
|
5532
|
+
return sqrt$1(pow(x - x1, 2) + pow(y - y1, 2));
|
|
5533
|
+
}
|
|
5534
|
+
static distancePN(point, x, y) {
|
|
5535
|
+
return sqrt$1(pow(x - point.x, 2) + pow(y - point.y, 2));
|
|
5536
|
+
}
|
|
5537
|
+
static pointAtPP(p1, p2, t) {
|
|
5538
|
+
return new Point((p2.x - p1.x) * t + p1.x, (p2.y - p1.y) * t + p1.y);
|
|
5539
|
+
}
|
|
5540
|
+
}
|
|
5541
|
+
|
|
5542
|
+
function degreeToRadian(degree) {
|
|
5543
|
+
return degree * (Math.PI / 180);
|
|
5544
|
+
}
|
|
5545
|
+
function radianToDegree(radian) {
|
|
5546
|
+
return 180 * radian / Math.PI;
|
|
5547
|
+
}
|
|
5548
|
+
const clampRadian = (angle = 0) => {
|
|
5549
|
+
if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
|
|
5550
|
+
return angle;
|
|
5551
|
+
};
|
|
5552
|
+
const clampAngleByRadian = clampRadian;
|
|
5553
|
+
function normalizeAngle(angle) {
|
|
5554
|
+
for (; angle < 0;) angle += 2 * Math.PI;
|
|
5555
|
+
for (; angle >= 2 * Math.PI;) angle -= 2 * Math.PI;
|
|
5556
|
+
return angle;
|
|
5557
|
+
}
|
|
5558
|
+
|
|
5559
|
+
var InnerBBox;
|
|
5560
|
+
!function (InnerBBox) {
|
|
5561
|
+
InnerBBox[InnerBBox.NONE = 0] = "NONE", InnerBBox[InnerBBox.BBOX1 = 1] = "BBOX1", InnerBBox[InnerBBox.BBOX2 = 2] = "BBOX2";
|
|
5562
|
+
}(InnerBBox || (InnerBBox = {}));
|
|
5563
|
+
function getProjectionRadius(checkAxis, axis) {
|
|
5564
|
+
return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
|
|
5565
|
+
}
|
|
5566
|
+
function rotatePoint({
|
|
5567
|
+
x: x,
|
|
5568
|
+
y: y
|
|
5569
|
+
}, rad, origin = {
|
|
5570
|
+
x: 0,
|
|
5571
|
+
y: 0
|
|
5572
|
+
}) {
|
|
5573
|
+
return {
|
|
5574
|
+
x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
|
|
5575
|
+
y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
|
|
5576
|
+
};
|
|
5577
|
+
}
|
|
5578
|
+
function getCenterPoint(box) {
|
|
5579
|
+
return {
|
|
5580
|
+
x: (box.x1 + box.x2) / 2,
|
|
5581
|
+
y: (box.y1 + box.y2) / 2
|
|
5582
|
+
};
|
|
5583
|
+
}
|
|
5584
|
+
function toRect$1(box, isDeg) {
|
|
5585
|
+
const deg = isDeg ? degreeToRadian(box.angle) : box.angle,
|
|
5586
|
+
cp = getCenterPoint(box);
|
|
5587
|
+
return [rotatePoint({
|
|
5588
|
+
x: box.x1,
|
|
5589
|
+
y: box.y1
|
|
5590
|
+
}, deg, cp), rotatePoint({
|
|
5591
|
+
x: box.x2,
|
|
5592
|
+
y: box.y1
|
|
5593
|
+
}, deg, cp), rotatePoint({
|
|
5594
|
+
x: box.x2,
|
|
5595
|
+
y: box.y2
|
|
5596
|
+
}, deg, cp), rotatePoint({
|
|
5597
|
+
x: box.x1,
|
|
5598
|
+
y: box.y2
|
|
5599
|
+
}, deg, cp)];
|
|
5600
|
+
}
|
|
5601
|
+
function isRotateAABBIntersect(box1, box2, isDeg = !1) {
|
|
5602
|
+
const rect1 = toRect$1(box1, isDeg),
|
|
5603
|
+
rect2 = toRect$1(box2, isDeg),
|
|
5604
|
+
vector = (start, end) => [end.x - start.x, end.y - start.y],
|
|
5605
|
+
vp1p2 = vector(getCenterPoint(box1), getCenterPoint(box2)),
|
|
5606
|
+
AB = vector(rect1[0], rect1[1]),
|
|
5607
|
+
BC = vector(rect1[1], rect1[2]),
|
|
5608
|
+
A1B1 = vector(rect2[0], rect2[1]),
|
|
5609
|
+
B1C1 = vector(rect2[1], rect2[2]),
|
|
5610
|
+
deg11 = isDeg ? degreeToRadian(box1.angle) : box1.angle;
|
|
5611
|
+
let deg12 = isDeg ? degreeToRadian(90 - box1.angle) : box1.angle + halfPi$1;
|
|
5612
|
+
const deg21 = isDeg ? degreeToRadian(box2.angle) : box2.angle;
|
|
5613
|
+
let deg22 = isDeg ? degreeToRadian(90 - box2.angle) : box2.angle + halfPi$1;
|
|
5614
|
+
deg12 > pi2 && (deg12 -= pi2), deg22 > pi2 && (deg22 -= pi2);
|
|
5615
|
+
const isCover = (checkAxisRadius, deg, targetAxis1, targetAxis2) => {
|
|
5616
|
+
const checkAxis = [Math.cos(deg), Math.sin(deg)];
|
|
5617
|
+
return checkAxisRadius + (getProjectionRadius(checkAxis, targetAxis1) + getProjectionRadius(checkAxis, targetAxis2)) / 2 > getProjectionRadius(checkAxis, vp1p2);
|
|
5618
|
+
};
|
|
5619
|
+
return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
|
|
5620
|
+
}
|
|
5621
|
+
|
|
5622
|
+
function isPointInLine(x0, y0, x1, y1, x, y) {
|
|
5623
|
+
if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
|
|
5624
|
+
if (y1 === y0) return 0;
|
|
5625
|
+
const t = (y - y0) / (y1 - y0);
|
|
5626
|
+
let dir = y1 < y0 ? 1 : -1;
|
|
5627
|
+
1 !== t && 0 !== t || (dir = y1 < y0 ? .5 : -.5);
|
|
5628
|
+
const x_ = t * (x1 - x0) + x0;
|
|
5629
|
+
return x_ === x ? 1 / 0 : x_ > x ? dir : 0;
|
|
5630
|
+
}
|
|
5631
|
+
|
|
5632
|
+
function getContextFont(text, defaultAttr = {}, fontSizeScale) {
|
|
5633
|
+
fontSizeScale || (fontSizeScale = 1);
|
|
5634
|
+
const {
|
|
5635
|
+
fontStyle = defaultAttr.fontStyle,
|
|
5636
|
+
fontVariant = defaultAttr.fontVariant,
|
|
5637
|
+
fontWeight = defaultAttr.fontWeight,
|
|
5638
|
+
fontSize = defaultAttr.fontSize,
|
|
5639
|
+
fontFamily = defaultAttr.fontFamily
|
|
5640
|
+
} = text;
|
|
5641
|
+
return (fontStyle ? fontStyle + " " : "") + (fontVariant ? fontVariant + " " : "") + (fontWeight ? fontWeight + " " : "") + fontSize * fontSizeScale + "px " + (fontFamily || "sans-serif");
|
|
5642
|
+
}
|
|
5643
|
+
|
|
5644
|
+
function transformBoundsWithMatrix(out, bounds, matrix) {
|
|
5645
|
+
const {
|
|
5646
|
+
x1: x1,
|
|
5647
|
+
y1: y1,
|
|
5648
|
+
x2: x2,
|
|
5649
|
+
y2: y2
|
|
5650
|
+
} = bounds;
|
|
5651
|
+
return matrix.onlyTranslate() ? (out !== bounds && out.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2), out.translate(matrix.e, matrix.f), bounds) : (out.clear(), out.add(matrix.a * x1 + matrix.c * y1 + matrix.e, matrix.b * x1 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y1 + matrix.e, matrix.b * x2 + matrix.d * y1 + matrix.f), out.add(matrix.a * x2 + matrix.c * y2 + matrix.e, matrix.b * x2 + matrix.d * y2 + matrix.f), out.add(matrix.a * x1 + matrix.c * y2 + matrix.e, matrix.b * x1 + matrix.d * y2 + matrix.f), bounds);
|
|
5652
|
+
}
|
|
5653
|
+
class Bounds {
|
|
5654
|
+
constructor(bounds) {
|
|
5655
|
+
bounds ? this.setValue(bounds.x1, bounds.y1, bounds.x2, bounds.y2) : this.clear();
|
|
5656
|
+
}
|
|
5657
|
+
clone() {
|
|
5658
|
+
return new Bounds(this);
|
|
5659
|
+
}
|
|
5660
|
+
clear() {
|
|
5661
|
+
return this.x1 = +Number.MAX_VALUE, this.y1 = +Number.MAX_VALUE, this.x2 = -Number.MAX_VALUE, this.y2 = -Number.MAX_VALUE, this;
|
|
5662
|
+
}
|
|
5663
|
+
empty() {
|
|
5664
|
+
return this.x1 === +Number.MAX_VALUE && this.y1 === +Number.MAX_VALUE && this.x2 === -Number.MAX_VALUE && this.y2 === -Number.MAX_VALUE;
|
|
5665
|
+
}
|
|
5666
|
+
equals(b) {
|
|
5667
|
+
return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
|
|
5668
|
+
}
|
|
5669
|
+
setValue(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
|
|
5670
|
+
return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
|
|
5671
|
+
}
|
|
5672
|
+
set(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
|
|
5673
|
+
return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
|
|
5674
|
+
}
|
|
5675
|
+
add(x = 0, y = 0) {
|
|
5676
|
+
return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
|
|
5677
|
+
}
|
|
5678
|
+
expand(d = 0) {
|
|
5679
|
+
return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
|
|
5680
|
+
}
|
|
5681
|
+
round() {
|
|
5682
|
+
return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
|
|
5683
|
+
}
|
|
5684
|
+
translate(dx = 0, dy = 0) {
|
|
5685
|
+
return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
|
|
5686
|
+
}
|
|
5687
|
+
rotate(angle = 0, x = 0, y = 0) {
|
|
5688
|
+
const p = this.rotatedPoints(angle, x, y);
|
|
5689
|
+
return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
|
|
5690
|
+
}
|
|
5691
|
+
scale(sx = 0, sy = 0, x = 0, y = 0) {
|
|
5692
|
+
const p = this.scalePoints(sx, sy, x, y);
|
|
5693
|
+
return this.clear().add(p[0], p[1]).add(p[2], p[3]);
|
|
5694
|
+
}
|
|
5695
|
+
union(b) {
|
|
5696
|
+
return b.x1 < this.x1 && (this.x1 = b.x1), b.y1 < this.y1 && (this.y1 = b.y1), b.x2 > this.x2 && (this.x2 = b.x2), b.y2 > this.y2 && (this.y2 = b.y2), this;
|
|
5697
|
+
}
|
|
5698
|
+
intersect(b) {
|
|
5699
|
+
return b.x1 > this.x1 && (this.x1 = b.x1), b.y1 > this.y1 && (this.y1 = b.y1), b.x2 < this.x2 && (this.x2 = b.x2), b.y2 < this.y2 && (this.y2 = b.y2), this;
|
|
5700
|
+
}
|
|
5701
|
+
encloses(b) {
|
|
5702
|
+
return b && this.x1 <= b.x1 && this.x2 >= b.x2 && this.y1 <= b.y1 && this.y2 >= b.y2;
|
|
5703
|
+
}
|
|
5704
|
+
alignsWith(b) {
|
|
5705
|
+
return b && (this.x1 === b.x1 || this.x2 === b.x2 || this.y1 === b.y1 || this.y2 === b.y2);
|
|
5706
|
+
}
|
|
5707
|
+
intersects(b) {
|
|
5708
|
+
return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
|
|
5709
|
+
}
|
|
5710
|
+
contains(x = 0, y = 0) {
|
|
5711
|
+
return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
|
|
5712
|
+
}
|
|
5713
|
+
containsPoint(p) {
|
|
5714
|
+
return !(p.x < this.x1 || p.x > this.x2 || p.y < this.y1 || p.y > this.y2);
|
|
5715
|
+
}
|
|
5716
|
+
width() {
|
|
5717
|
+
return this.empty() ? 0 : this.x2 - this.x1;
|
|
5718
|
+
}
|
|
5719
|
+
height() {
|
|
5720
|
+
return this.empty() ? 0 : this.y2 - this.y1;
|
|
5721
|
+
}
|
|
5722
|
+
scaleX(s = 0) {
|
|
5723
|
+
return this.x1 *= s, this.x2 *= s, this;
|
|
5724
|
+
}
|
|
5725
|
+
scaleY(s = 0) {
|
|
5726
|
+
return this.y1 *= s, this.y2 *= s, this;
|
|
5727
|
+
}
|
|
5728
|
+
transformWithMatrix(matrix) {
|
|
5729
|
+
return transformBoundsWithMatrix(this, this, matrix), this;
|
|
5730
|
+
}
|
|
5731
|
+
copy(b) {
|
|
5732
|
+
return this.x1 = b.x1, this.y1 = b.y1, this.x2 = b.x2, this.y2 = b.y2, this;
|
|
5733
|
+
}
|
|
5734
|
+
rotatedPoints(angle, x, y) {
|
|
5735
|
+
const {
|
|
5736
|
+
x1: x1,
|
|
5737
|
+
y1: y1,
|
|
5738
|
+
x2: x2,
|
|
5739
|
+
y2: y2
|
|
5740
|
+
} = this,
|
|
5741
|
+
cos = Math.cos(angle),
|
|
5742
|
+
sin = Math.sin(angle),
|
|
5743
|
+
cx = x - x * cos + y * sin,
|
|
5744
|
+
cy = y - x * sin - y * cos;
|
|
5745
|
+
return [cos * x1 - sin * y1 + cx, sin * x1 + cos * y1 + cy, cos * x1 - sin * y2 + cx, sin * x1 + cos * y2 + cy, cos * x2 - sin * y1 + cx, sin * x2 + cos * y1 + cy, cos * x2 - sin * y2 + cx, sin * x2 + cos * y2 + cy];
|
|
5746
|
+
}
|
|
5747
|
+
scalePoints(sx, sy, x, y) {
|
|
5748
|
+
const {
|
|
5749
|
+
x1: x1,
|
|
5750
|
+
y1: y1,
|
|
5751
|
+
x2: x2,
|
|
5752
|
+
y2: y2
|
|
5753
|
+
} = this;
|
|
5754
|
+
return [sx * x1 + (1 - sx) * x, sy * y1 + (1 - sy) * y, sx * x2 + (1 - sx) * x, sy * y2 + (1 - sy) * y];
|
|
5755
|
+
}
|
|
5756
|
+
}
|
|
5757
|
+
class AABBBounds extends Bounds {}
|
|
5758
|
+
class OBBBounds extends Bounds {
|
|
5759
|
+
constructor(bounds, angle = 0) {
|
|
5760
|
+
var _a;
|
|
5761
|
+
super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
|
|
5762
|
+
}
|
|
5763
|
+
intersects(b) {
|
|
5764
|
+
return isRotateAABBIntersect(this, b);
|
|
5765
|
+
}
|
|
5766
|
+
setValue(x1 = 0, y1 = 0, x2 = 0, y2 = 0, angle = 0) {
|
|
5767
|
+
return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
|
|
5768
|
+
}
|
|
5769
|
+
clone() {
|
|
5770
|
+
return new OBBBounds(this);
|
|
5771
|
+
}
|
|
5772
|
+
getRotatedCorners() {
|
|
5773
|
+
const originPoint = {
|
|
5774
|
+
x: (this.x1 + this.x2) / 2,
|
|
5775
|
+
y: (this.y1 + this.y2) / 2
|
|
5776
|
+
};
|
|
5777
|
+
return [rotatePoint({
|
|
5778
|
+
x: this.x1,
|
|
5779
|
+
y: this.y1
|
|
5780
|
+
}, this.angle, originPoint), rotatePoint({
|
|
5781
|
+
x: this.x2,
|
|
5782
|
+
y: this.y1
|
|
5783
|
+
}, this.angle, originPoint), rotatePoint({
|
|
5784
|
+
x: this.x1,
|
|
5785
|
+
y: this.y2
|
|
5786
|
+
}, this.angle, originPoint), rotatePoint({
|
|
5787
|
+
x: this.x2,
|
|
5788
|
+
y: this.y2
|
|
5789
|
+
}, this.angle, originPoint)];
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
|
|
5793
|
+
class Matrix {
|
|
5794
|
+
constructor(a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
|
|
5795
|
+
this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
|
|
5796
|
+
}
|
|
5797
|
+
equalToMatrix(m2) {
|
|
5798
|
+
return !(this.e !== m2.e || this.f !== m2.f || this.a !== m2.a || this.d !== m2.d || this.b !== m2.b || this.c !== m2.c);
|
|
5799
|
+
}
|
|
5800
|
+
equalTo(a, b, c, d, e, f) {
|
|
5801
|
+
return !(this.e !== e || this.f !== f || this.a !== a || this.d !== d || this.b !== b || this.c !== c);
|
|
5802
|
+
}
|
|
5803
|
+
setValue(a, b, c, d, e, f) {
|
|
5804
|
+
return this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f, this;
|
|
5805
|
+
}
|
|
5806
|
+
reset() {
|
|
5807
|
+
return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this;
|
|
5808
|
+
}
|
|
5809
|
+
getInverse() {
|
|
5810
|
+
const a = this.a,
|
|
5811
|
+
b = this.b,
|
|
5812
|
+
c = this.c,
|
|
5813
|
+
d = this.d,
|
|
5814
|
+
e = this.e,
|
|
5815
|
+
f = this.f,
|
|
5816
|
+
m = new Matrix(),
|
|
5817
|
+
dt = a * d - b * c;
|
|
5818
|
+
return m.a = d / dt, m.b = -b / dt, m.c = -c / dt, m.d = a / dt, m.e = (c * f - d * e) / dt, m.f = -(a * f - b * e) / dt, m;
|
|
5819
|
+
}
|
|
5820
|
+
rotate(rad) {
|
|
5821
|
+
const c = Math.cos(rad),
|
|
5822
|
+
s = Math.sin(rad),
|
|
5823
|
+
m11 = this.a * c + this.c * s,
|
|
5824
|
+
m12 = this.b * c + this.d * s,
|
|
5825
|
+
m21 = this.a * -s + this.c * c,
|
|
5826
|
+
m22 = this.b * -s + this.d * c;
|
|
5827
|
+
return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this;
|
|
5828
|
+
}
|
|
5829
|
+
rotateByCenter(rad, cx, cy) {
|
|
5830
|
+
const cos = Math.cos(rad),
|
|
5831
|
+
sin = Math.sin(rad),
|
|
5832
|
+
rotateM13 = (1 - cos) * cx + sin * cy,
|
|
5833
|
+
rotateM23 = (1 - cos) * cy - sin * cx,
|
|
5834
|
+
m11 = cos * this.a - sin * this.b,
|
|
5835
|
+
m21 = sin * this.a + cos * this.b,
|
|
5836
|
+
m12 = cos * this.c - sin * this.d,
|
|
5837
|
+
m22 = sin * this.c + cos * this.d,
|
|
5838
|
+
m13 = cos * this.e - sin * this.f + rotateM13,
|
|
5839
|
+
m23 = sin * this.e + cos * this.f + rotateM23;
|
|
5840
|
+
return this.a = m11, this.b = m21, this.c = m12, this.d = m22, this.e = m13, this.f = m23, this;
|
|
5841
|
+
}
|
|
5842
|
+
scale(sx, sy) {
|
|
5843
|
+
return this.a *= sx, this.b *= sx, this.c *= sy, this.d *= sy, this;
|
|
5844
|
+
}
|
|
5845
|
+
setScale(sx, sy) {
|
|
5846
|
+
return this.b = this.b / this.a * sx, this.c = this.c / this.d * sy, this.a = sx, this.d = sy, this;
|
|
5847
|
+
}
|
|
5848
|
+
transform(a, b, c, d, e, f) {
|
|
5849
|
+
return this.multiply(a, b, c, d, e, f), this;
|
|
5850
|
+
}
|
|
5851
|
+
translate(x, y) {
|
|
5852
|
+
return this.e += this.a * x + this.c * y, this.f += this.b * x + this.d * y, this;
|
|
5853
|
+
}
|
|
5854
|
+
transpose() {
|
|
5855
|
+
const {
|
|
5856
|
+
a: a,
|
|
5857
|
+
b: b,
|
|
5858
|
+
c: c,
|
|
5859
|
+
d: d,
|
|
5860
|
+
e: e,
|
|
5861
|
+
f: f
|
|
5862
|
+
} = this;
|
|
5863
|
+
return this.a = b, this.b = a, this.c = d, this.d = c, this.e = f, this.f = e, this;
|
|
5864
|
+
}
|
|
5865
|
+
multiply(a2, b2, c2, d2, e2, f2) {
|
|
5866
|
+
const a1 = this.a,
|
|
5867
|
+
b1 = this.b,
|
|
5868
|
+
c1 = this.c,
|
|
5869
|
+
d1 = this.d,
|
|
5870
|
+
m11 = a1 * a2 + c1 * b2,
|
|
5871
|
+
m12 = b1 * a2 + d1 * b2,
|
|
5872
|
+
m21 = a1 * c2 + c1 * d2,
|
|
5873
|
+
m22 = b1 * c2 + d1 * d2,
|
|
5874
|
+
dx = a1 * e2 + c1 * f2 + this.e,
|
|
5875
|
+
dy = b1 * e2 + d1 * f2 + this.f;
|
|
5876
|
+
return this.a = m11, this.b = m12, this.c = m21, this.d = m22, this.e = dx, this.f = dy, this;
|
|
5877
|
+
}
|
|
5878
|
+
interpolate(m2, t) {
|
|
5879
|
+
const m = new Matrix();
|
|
5880
|
+
return m.a = this.a + (m2.a - this.a) * t, m.b = this.b + (m2.b - this.b) * t, m.c = this.c + (m2.c - this.c) * t, m.d = this.d + (m2.d - this.d) * t, m.e = this.e + (m2.e - this.e) * t, m.f = this.f + (m2.f - this.f) * t, m;
|
|
5881
|
+
}
|
|
5882
|
+
transformPoint(source, target) {
|
|
5883
|
+
const {
|
|
5884
|
+
a: a,
|
|
5885
|
+
b: b,
|
|
5886
|
+
c: c,
|
|
5887
|
+
d: d,
|
|
5888
|
+
e: e,
|
|
5889
|
+
f: f
|
|
5890
|
+
} = this,
|
|
5891
|
+
dt = a * d - b * c,
|
|
5892
|
+
nextA = d / dt,
|
|
5893
|
+
nextB = -b / dt,
|
|
5894
|
+
nextC = -c / dt,
|
|
5895
|
+
nextD = a / dt,
|
|
5896
|
+
nextE = (c * f - d * e) / dt,
|
|
5897
|
+
nextF = -(a * f - b * e) / dt,
|
|
5898
|
+
{
|
|
5899
|
+
x: x,
|
|
5900
|
+
y: y
|
|
5901
|
+
} = source;
|
|
5902
|
+
target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
|
|
5903
|
+
}
|
|
5904
|
+
onlyTranslate(scale = 1) {
|
|
5905
|
+
return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
|
|
5906
|
+
}
|
|
5907
|
+
clone() {
|
|
5908
|
+
return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f);
|
|
5909
|
+
}
|
|
5910
|
+
toTransformAttrs() {
|
|
5911
|
+
const a = this.a,
|
|
5912
|
+
b = this.b,
|
|
5913
|
+
c = this.c,
|
|
5914
|
+
d = this.d,
|
|
5915
|
+
delta = a * d - b * c,
|
|
5916
|
+
result = {
|
|
5917
|
+
x: this.e,
|
|
5918
|
+
y: this.f,
|
|
5919
|
+
rotateDeg: 0,
|
|
5920
|
+
scaleX: 0,
|
|
5921
|
+
scaleY: 0,
|
|
5922
|
+
skewX: 0,
|
|
5923
|
+
skewY: 0
|
|
5924
|
+
};
|
|
5925
|
+
if (0 !== a || 0 !== b) {
|
|
5926
|
+
const r = Math.sqrt(a * a + b * b);
|
|
5927
|
+
result.rotateDeg = b > 0 ? Math.acos(a / r) : -Math.acos(a / r), result.scaleX = r, result.scaleY = delta / r, result.skewX = (a * c + b * d) / delta, result.skewY = 0;
|
|
5928
|
+
} else if (0 !== c || 0 !== d) {
|
|
5929
|
+
const s = Math.sqrt(c * c + d * d);
|
|
5930
|
+
result.rotateDeg = Math.PI / 2 - (d > 0 ? Math.acos(-c / s) : -Math.acos(c / s)), result.scaleX = delta / s, result.scaleY = s, result.skewX = 0, result.skewY = (a * c + b * d) / delta;
|
|
5931
|
+
}
|
|
5932
|
+
return result.rotateDeg = radianToDegree(result.rotateDeg), result;
|
|
5933
|
+
}
|
|
5934
|
+
}
|
|
5935
|
+
function normalTransform(out, origin, x, y, scaleX, scaleY, angle, rotateCenter) {
|
|
5936
|
+
const oa = origin.a,
|
|
5937
|
+
ob = origin.b,
|
|
5938
|
+
oc = origin.c,
|
|
5939
|
+
od = origin.d,
|
|
5940
|
+
oe = origin.e,
|
|
5941
|
+
of = origin.f,
|
|
5942
|
+
cosTheta = cos(angle),
|
|
5943
|
+
sinTheta = sin(angle);
|
|
5944
|
+
let rotateCenterX, rotateCenterY;
|
|
5945
|
+
rotateCenter ? (rotateCenterX = rotateCenter[0], rotateCenterY = rotateCenter[1]) : (rotateCenterX = x, rotateCenterY = y);
|
|
5946
|
+
const offsetX = rotateCenterX - x,
|
|
5947
|
+
offsetY = rotateCenterY - y,
|
|
5948
|
+
a1 = oa * cosTheta + oc * sinTheta,
|
|
5949
|
+
b1 = ob * cosTheta + od * sinTheta,
|
|
5950
|
+
c1 = oc * cosTheta - oa * sinTheta,
|
|
5951
|
+
d1 = od * cosTheta - ob * sinTheta;
|
|
5952
|
+
out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
|
|
5953
|
+
}
|
|
5954
|
+
|
|
5955
|
+
function hslToRgb(h, s, l) {
|
|
5956
|
+
s /= 100, l /= 100;
|
|
5957
|
+
const c = (1 - Math.abs(2 * l - 1)) * s,
|
|
5958
|
+
x = c * (1 - Math.abs(h / 60 % 2 - 1)),
|
|
5959
|
+
m = l - c / 2;
|
|
5960
|
+
let r = 0,
|
|
5961
|
+
g = 0,
|
|
5962
|
+
b = 0;
|
|
5963
|
+
return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
|
|
5964
|
+
r: r,
|
|
5965
|
+
g: g,
|
|
5966
|
+
b: b
|
|
5967
|
+
};
|
|
5968
|
+
}
|
|
5969
|
+
|
|
5970
|
+
function rgbToHsl(r, g, b) {
|
|
5971
|
+
r /= 255, g /= 255, b /= 255;
|
|
5972
|
+
const cMin = Math.min(r, g, b),
|
|
5973
|
+
cMax = Math.max(r, g, b),
|
|
5974
|
+
delta = cMax - cMin;
|
|
5975
|
+
let h = 0,
|
|
5976
|
+
s = 0,
|
|
5977
|
+
l = 0;
|
|
5978
|
+
return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
|
|
5979
|
+
h: h,
|
|
5980
|
+
s: s,
|
|
5981
|
+
l: l
|
|
5982
|
+
};
|
|
5983
|
+
}
|
|
5984
|
+
|
|
5985
|
+
const REG_HEX = /^#([0-9a-f]{3,8})$/,
|
|
5986
|
+
DEFAULT_COLORS_OPACITY = {
|
|
5987
|
+
transparent: 4294967040
|
|
5988
|
+
};
|
|
5989
|
+
const DEFAULT_COLORS = {
|
|
5990
|
+
aliceblue: 15792383,
|
|
5991
|
+
antiquewhite: 16444375,
|
|
5992
|
+
aqua: 65535,
|
|
5993
|
+
aquamarine: 8388564,
|
|
5994
|
+
azure: 15794175,
|
|
5995
|
+
beige: 16119260,
|
|
5996
|
+
bisque: 16770244,
|
|
5997
|
+
black: 0,
|
|
5998
|
+
blanchedalmond: 16772045,
|
|
5999
|
+
blue: 255,
|
|
6000
|
+
blueviolet: 9055202,
|
|
6001
|
+
brown: 10824234,
|
|
6002
|
+
burlywood: 14596231,
|
|
6003
|
+
cadetblue: 6266528,
|
|
6004
|
+
chartreuse: 8388352,
|
|
6005
|
+
chocolate: 13789470,
|
|
6006
|
+
coral: 16744272,
|
|
6007
|
+
cornflowerblue: 6591981,
|
|
6008
|
+
cornsilk: 16775388,
|
|
6009
|
+
crimson: 14423100,
|
|
6010
|
+
cyan: 65535,
|
|
6011
|
+
darkblue: 139,
|
|
6012
|
+
darkcyan: 35723,
|
|
6013
|
+
darkgoldenrod: 12092939,
|
|
6014
|
+
darkgray: 11119017,
|
|
6015
|
+
darkgreen: 25600,
|
|
6016
|
+
darkgrey: 11119017,
|
|
6017
|
+
darkkhaki: 12433259,
|
|
6018
|
+
darkmagenta: 9109643,
|
|
6019
|
+
darkolivegreen: 5597999,
|
|
6020
|
+
darkorange: 16747520,
|
|
6021
|
+
darkorchid: 10040012,
|
|
6022
|
+
darkred: 9109504,
|
|
6023
|
+
darksalmon: 15308410,
|
|
6024
|
+
darkseagreen: 9419919,
|
|
6025
|
+
darkslateblue: 4734347,
|
|
6026
|
+
darkslategray: 3100495,
|
|
6027
|
+
darkslategrey: 3100495,
|
|
6028
|
+
darkturquoise: 52945,
|
|
6029
|
+
darkviolet: 9699539,
|
|
6030
|
+
deeppink: 16716947,
|
|
6031
|
+
deepskyblue: 49151,
|
|
6032
|
+
dimgray: 6908265,
|
|
6033
|
+
dimgrey: 6908265,
|
|
6034
|
+
dodgerblue: 2003199,
|
|
6035
|
+
firebrick: 11674146,
|
|
6036
|
+
floralwhite: 16775920,
|
|
6037
|
+
forestgreen: 2263842,
|
|
6038
|
+
fuchsia: 16711935,
|
|
6039
|
+
gainsboro: 14474460,
|
|
6040
|
+
ghostwhite: 16316671,
|
|
6041
|
+
gold: 16766720,
|
|
6042
|
+
goldenrod: 14329120,
|
|
6043
|
+
gray: 8421504,
|
|
6044
|
+
green: 32768,
|
|
6045
|
+
greenyellow: 11403055,
|
|
6046
|
+
grey: 8421504,
|
|
6047
|
+
honeydew: 15794160,
|
|
6048
|
+
hotpink: 16738740,
|
|
6049
|
+
indianred: 13458524,
|
|
6050
|
+
indigo: 4915330,
|
|
6051
|
+
ivory: 16777200,
|
|
6052
|
+
khaki: 15787660,
|
|
6053
|
+
lavender: 15132410,
|
|
6054
|
+
lavenderblush: 16773365,
|
|
6055
|
+
lawngreen: 8190976,
|
|
6056
|
+
lemonchiffon: 16775885,
|
|
6057
|
+
lightblue: 11393254,
|
|
6058
|
+
lightcoral: 15761536,
|
|
6059
|
+
lightcyan: 14745599,
|
|
6060
|
+
lightgoldenrodyellow: 16448210,
|
|
6061
|
+
lightgray: 13882323,
|
|
6062
|
+
lightgreen: 9498256,
|
|
6063
|
+
lightgrey: 13882323,
|
|
6064
|
+
lightpink: 16758465,
|
|
6065
|
+
lightsalmon: 16752762,
|
|
6066
|
+
lightseagreen: 2142890,
|
|
6067
|
+
lightskyblue: 8900346,
|
|
6068
|
+
lightslategray: 7833753,
|
|
6069
|
+
lightslategrey: 7833753,
|
|
6070
|
+
lightsteelblue: 11584734,
|
|
6071
|
+
lightyellow: 16777184,
|
|
6072
|
+
lime: 65280,
|
|
6073
|
+
limegreen: 3329330,
|
|
6074
|
+
linen: 16445670,
|
|
6075
|
+
magenta: 16711935,
|
|
6076
|
+
maroon: 8388608,
|
|
6077
|
+
mediumaquamarine: 6737322,
|
|
6078
|
+
mediumblue: 205,
|
|
6079
|
+
mediumorchid: 12211667,
|
|
6080
|
+
mediumpurple: 9662683,
|
|
6081
|
+
mediumseagreen: 3978097,
|
|
6082
|
+
mediumslateblue: 8087790,
|
|
6083
|
+
mediumspringgreen: 64154,
|
|
6084
|
+
mediumturquoise: 4772300,
|
|
6085
|
+
mediumvioletred: 13047173,
|
|
6086
|
+
midnightblue: 1644912,
|
|
6087
|
+
mintcream: 16121850,
|
|
6088
|
+
mistyrose: 16770273,
|
|
6089
|
+
moccasin: 16770229,
|
|
6090
|
+
navajowhite: 16768685,
|
|
6091
|
+
navy: 128,
|
|
6092
|
+
oldlace: 16643558,
|
|
6093
|
+
olive: 8421376,
|
|
6094
|
+
olivedrab: 7048739,
|
|
6095
|
+
orange: 16753920,
|
|
6096
|
+
orangered: 16729344,
|
|
6097
|
+
orchid: 14315734,
|
|
6098
|
+
palegoldenrod: 15657130,
|
|
6099
|
+
palegreen: 10025880,
|
|
6100
|
+
paleturquoise: 11529966,
|
|
6101
|
+
palevioletred: 14381203,
|
|
6102
|
+
papayawhip: 16773077,
|
|
6103
|
+
peachpuff: 16767673,
|
|
6104
|
+
peru: 13468991,
|
|
6105
|
+
pink: 16761035,
|
|
6106
|
+
plum: 14524637,
|
|
6107
|
+
powderblue: 11591910,
|
|
6108
|
+
purple: 8388736,
|
|
6109
|
+
rebeccapurple: 6697881,
|
|
6110
|
+
red: 16711680,
|
|
6111
|
+
rosybrown: 12357519,
|
|
6112
|
+
royalblue: 4286945,
|
|
6113
|
+
saddlebrown: 9127187,
|
|
6114
|
+
salmon: 16416882,
|
|
6115
|
+
sandybrown: 16032864,
|
|
6116
|
+
seagreen: 3050327,
|
|
6117
|
+
seashell: 16774638,
|
|
6118
|
+
sienna: 10506797,
|
|
6119
|
+
silver: 12632256,
|
|
6120
|
+
skyblue: 8900331,
|
|
6121
|
+
slateblue: 6970061,
|
|
6122
|
+
slategray: 7372944,
|
|
6123
|
+
slategrey: 7372944,
|
|
6124
|
+
snow: 16775930,
|
|
6125
|
+
springgreen: 65407,
|
|
6126
|
+
steelblue: 4620980,
|
|
6127
|
+
tan: 13808780,
|
|
6128
|
+
teal: 32896,
|
|
6129
|
+
thistle: 14204888,
|
|
6130
|
+
tomato: 16737095,
|
|
6131
|
+
turquoise: 4251856,
|
|
6132
|
+
violet: 15631086,
|
|
6133
|
+
wheat: 16113331,
|
|
6134
|
+
white: 16777215,
|
|
6135
|
+
whitesmoke: 16119285,
|
|
6136
|
+
yellow: 16776960,
|
|
6137
|
+
yellowgreen: 10145074
|
|
6138
|
+
};
|
|
6139
|
+
function hex(value) {
|
|
6140
|
+
return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
|
|
6141
|
+
}
|
|
6142
|
+
function rgb(value) {
|
|
6143
|
+
return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
|
|
6144
|
+
}
|
|
6145
|
+
function rgba(value) {
|
|
6146
|
+
return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
|
|
6147
|
+
}
|
|
6148
|
+
function SRGBToLinear(c) {
|
|
6149
|
+
return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
|
|
6150
|
+
}
|
|
6151
|
+
function LinearToSRGB(c) {
|
|
6152
|
+
return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
|
|
6153
|
+
}
|
|
6154
|
+
const setHex = (formatValue, forceHex) => {
|
|
6155
|
+
const isHex = REG_HEX.exec(formatValue);
|
|
6156
|
+
if (forceHex || isHex) {
|
|
6157
|
+
const hex = parseInt(isHex[1], 16),
|
|
6158
|
+
hexLength = isHex[1].length;
|
|
6159
|
+
return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
|
|
6160
|
+
}
|
|
6161
|
+
};
|
|
6162
|
+
class Color {
|
|
6163
|
+
static Brighter(source, b = 1) {
|
|
6164
|
+
return 1 === b ? source : new Color(source).brighter(b).toRGBA();
|
|
6165
|
+
}
|
|
6166
|
+
static SetOpacity(source, o = 1) {
|
|
6167
|
+
return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
|
|
6168
|
+
}
|
|
6169
|
+
static getColorBrightness(source, model = "hsl") {
|
|
6170
|
+
const color = source instanceof Color ? source : new Color(source);
|
|
6171
|
+
switch (model) {
|
|
6172
|
+
case "hsv":
|
|
6173
|
+
default:
|
|
6174
|
+
return color.getHSVBrightness();
|
|
6175
|
+
case "hsl":
|
|
6176
|
+
return color.getHSLBrightness();
|
|
6177
|
+
case "lum":
|
|
6178
|
+
return color.getLuminance();
|
|
6179
|
+
case "lum2":
|
|
6180
|
+
return color.getLuminance2();
|
|
6181
|
+
case "lum3":
|
|
6182
|
+
return color.getLuminance3();
|
|
6183
|
+
case "wcag":
|
|
6184
|
+
return color.getLuminanceWCAG();
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
static parseColorString(value) {
|
|
6188
|
+
if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
|
|
6189
|
+
if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
|
|
6190
|
+
const formatValue = `${value}`.trim().toLowerCase(),
|
|
6191
|
+
hexRes = setHex(formatValue);
|
|
6192
|
+
if (void 0 !== hexRes) return hexRes;
|
|
6193
|
+
if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
|
|
6194
|
+
const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
|
|
6195
|
+
return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
|
|
6196
|
+
}
|
|
6197
|
+
if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
|
|
6198
|
+
const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
|
|
6199
|
+
rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
|
|
6200
|
+
return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
|
|
6201
|
+
}
|
|
6202
|
+
}
|
|
6203
|
+
constructor(value) {
|
|
6204
|
+
const color = Color.parseColorString(value);
|
|
6205
|
+
color ? this.color = color : (console.warn(`Warn: 传入${value}无法解析为Color`), this.color = new RGB(255, 255, 255));
|
|
6206
|
+
}
|
|
6207
|
+
toRGBA() {
|
|
6208
|
+
return this.color.formatRgb();
|
|
6209
|
+
}
|
|
6210
|
+
toString() {
|
|
6211
|
+
return this.color.formatRgb();
|
|
6212
|
+
}
|
|
6213
|
+
toHex() {
|
|
6214
|
+
return this.color.formatHex();
|
|
6215
|
+
}
|
|
6216
|
+
toHsl() {
|
|
6217
|
+
return this.color.formatHsl();
|
|
6218
|
+
}
|
|
6219
|
+
brighter(k) {
|
|
6220
|
+
const {
|
|
6221
|
+
r: r,
|
|
6222
|
+
g: g,
|
|
6223
|
+
b: b
|
|
6224
|
+
} = this.color;
|
|
6225
|
+
return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
|
|
6226
|
+
}
|
|
6227
|
+
add(color) {
|
|
6228
|
+
const {
|
|
6229
|
+
r: r,
|
|
6230
|
+
g: g,
|
|
6231
|
+
b: b
|
|
6232
|
+
} = this.color;
|
|
6233
|
+
return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
|
|
6234
|
+
}
|
|
6235
|
+
sub(color) {
|
|
6236
|
+
return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
|
|
6237
|
+
}
|
|
6238
|
+
multiply(color) {
|
|
6239
|
+
const {
|
|
6240
|
+
r: r,
|
|
6241
|
+
g: g,
|
|
6242
|
+
b: b
|
|
6243
|
+
} = this.color;
|
|
6244
|
+
return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
|
|
6245
|
+
}
|
|
6246
|
+
getHSVBrightness() {
|
|
6247
|
+
return Math.max(this.color.r, this.color.g, this.color.b) / 255;
|
|
6248
|
+
}
|
|
6249
|
+
getHSLBrightness() {
|
|
6250
|
+
return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
|
|
6251
|
+
}
|
|
6252
|
+
setHsl(h, s, l) {
|
|
6253
|
+
const opacity = this.color.opacity,
|
|
6254
|
+
hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
|
|
6255
|
+
rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
|
|
6256
|
+
return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
|
|
6257
|
+
}
|
|
6258
|
+
setRGB(r, g, b) {
|
|
6259
|
+
return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
|
|
5254
6260
|
}
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
case BindingTypeEnum.Function:
|
|
5260
|
-
result = binding.cache;
|
|
5261
|
-
break;
|
|
5262
|
-
case BindingTypeEnum.Instance:
|
|
5263
|
-
result = this._resolveInstance(binding, binding.implementationType);
|
|
5264
|
-
break;
|
|
5265
|
-
default:
|
|
5266
|
-
result = binding.dynamicValue({
|
|
5267
|
-
container: this
|
|
5268
|
-
});
|
|
5269
|
-
}
|
|
5270
|
-
return result;
|
|
6261
|
+
setHex(value) {
|
|
6262
|
+
const formatValue = `${value}`.trim().toLowerCase(),
|
|
6263
|
+
res = setHex(formatValue, !0);
|
|
6264
|
+
return null != res ? res : this;
|
|
5271
6265
|
}
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
return this._createInstance(constr, childRequests);
|
|
6266
|
+
setColorName(name) {
|
|
6267
|
+
const hex = DEFAULT_COLORS[name.toLowerCase()];
|
|
6268
|
+
return void 0 !== hex ? this.setHex(hex) : console.warn("THREE.Color: Unknown color " + name), this;
|
|
5276
6269
|
}
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
return new constr(...this._resolveRequests(childRequests));
|
|
5280
|
-
}
|
|
5281
|
-
return new constr();
|
|
6270
|
+
setScalar(scalar) {
|
|
6271
|
+
return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
|
|
5282
6272
|
}
|
|
5283
|
-
|
|
5284
|
-
return
|
|
6273
|
+
setOpacity(o = 1) {
|
|
6274
|
+
return this.color.opacity = o, this;
|
|
5285
6275
|
}
|
|
5286
|
-
|
|
5287
|
-
|
|
6276
|
+
getLuminance() {
|
|
6277
|
+
return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
|
|
5288
6278
|
}
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
const ContributionProvider = Symbol("ContributionProvider");
|
|
5292
|
-
class ContributionProviderCache {
|
|
5293
|
-
constructor(serviceIdentifier, container) {
|
|
5294
|
-
this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
|
|
6279
|
+
getLuminance2() {
|
|
6280
|
+
return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
|
|
5295
6281
|
}
|
|
5296
|
-
|
|
5297
|
-
return
|
|
6282
|
+
getLuminance3() {
|
|
6283
|
+
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
5298
6284
|
}
|
|
5299
|
-
|
|
5300
|
-
|
|
6285
|
+
getLuminanceWCAG() {
|
|
6286
|
+
const RsRGB = this.color.r / 255,
|
|
6287
|
+
GsRGB = this.color.g / 255,
|
|
6288
|
+
BsRGB = this.color.b / 255;
|
|
6289
|
+
let R, G, B;
|
|
6290
|
+
R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
|
|
6291
|
+
return .2126 * R + .7152 * G + .0722 * B;
|
|
5301
6292
|
}
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
bind(ContributionProvider).toDynamicValue(({
|
|
5305
|
-
container: container
|
|
5306
|
-
}) => new ContributionProviderCache(id, container)).inSingletonScope().whenTargetNamed(id);
|
|
5307
|
-
}
|
|
5308
|
-
class ContributionStore {
|
|
5309
|
-
static getStore(id) {
|
|
5310
|
-
return this.store.get(id);
|
|
6293
|
+
clone() {
|
|
6294
|
+
return new Color(this.color.toString());
|
|
5311
6295
|
}
|
|
5312
|
-
|
|
5313
|
-
this.
|
|
6296
|
+
copyGammaToLinear(color, gammaFactor = 2) {
|
|
6297
|
+
return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
|
|
5314
6298
|
}
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
});
|
|
6299
|
+
copyLinearToGamma(color, gammaFactor = 2) {
|
|
6300
|
+
const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
|
|
6301
|
+
return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
|
|
5319
6302
|
}
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
class Hook {
|
|
5324
|
-
constructor(args, name) {
|
|
5325
|
-
this._args = args, this.name = name, this.taps = [];
|
|
6303
|
+
convertGammaToLinear(gammaFactor) {
|
|
6304
|
+
return this.copyGammaToLinear(this, gammaFactor), this;
|
|
5326
6305
|
}
|
|
5327
|
-
|
|
5328
|
-
this.
|
|
6306
|
+
convertLinearToGamma(gammaFactor) {
|
|
6307
|
+
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
5329
6308
|
}
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
name && (this.taps = this.taps.filter(tap => !(tap.name === name && (!fn || tap.fn === fn))));
|
|
6309
|
+
copySRGBToLinear(color) {
|
|
6310
|
+
return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
|
|
5333
6311
|
}
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
if ("string" == typeof options) _options = {
|
|
5337
|
-
name: options.trim()
|
|
5338
|
-
};else if ("object" != typeof options || null === options) throw new Error("Invalid tap options");
|
|
5339
|
-
if ("string" != typeof _options.name || "" === _options.name) throw new Error("Missing name for tap");
|
|
5340
|
-
return _options = Object.assign({
|
|
5341
|
-
type: type,
|
|
5342
|
-
fn: fn
|
|
5343
|
-
}, _options), _options;
|
|
6312
|
+
copyLinearToSRGB(color) {
|
|
6313
|
+
return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
|
|
5344
6314
|
}
|
|
5345
|
-
|
|
5346
|
-
this.
|
|
6315
|
+
convertSRGBToLinear() {
|
|
6316
|
+
return this.copySRGBToLinear(this), this;
|
|
5347
6317
|
}
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
"string" == typeof item.before ? before = new Set([item.before]) : Array.isArray(item.before) && (before = new Set(item.before));
|
|
5351
|
-
let stage = 0;
|
|
5352
|
-
"number" == typeof item.stage && (stage = item.stage);
|
|
5353
|
-
let i = this.taps.length;
|
|
5354
|
-
for (; i > 0;) {
|
|
5355
|
-
i--;
|
|
5356
|
-
const x = this.taps[i];
|
|
5357
|
-
this.taps[i + 1] = x;
|
|
5358
|
-
const xStage = x.stage || 0;
|
|
5359
|
-
if (before) {
|
|
5360
|
-
if (before.has(x.name)) {
|
|
5361
|
-
before.delete(x.name);
|
|
5362
|
-
continue;
|
|
5363
|
-
}
|
|
5364
|
-
if (before.size > 0) continue;
|
|
5365
|
-
}
|
|
5366
|
-
if (!(xStage > stage)) {
|
|
5367
|
-
i++;
|
|
5368
|
-
break;
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
this.taps[i] = item;
|
|
6318
|
+
convertLinearToSRGB() {
|
|
6319
|
+
return this.copyLinearToSRGB(this), this;
|
|
5372
6320
|
}
|
|
5373
6321
|
}
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
6322
|
+
class RGB {
|
|
6323
|
+
constructor(r, g, b, opacity) {
|
|
6324
|
+
this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
|
|
5378
6325
|
}
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
5382
|
-
|
|
5383
|
-
class Application {}
|
|
5384
|
-
const application = new Application();
|
|
5385
|
-
|
|
5386
|
-
let idx = 0;
|
|
5387
|
-
class PerformanceRAF {
|
|
5388
|
-
constructor() {
|
|
5389
|
-
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
5390
|
-
this._rafHandle = null;
|
|
5391
|
-
const cbs = this.nextAnimationFrameCbs;
|
|
5392
|
-
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
5393
|
-
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
5394
|
-
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
5395
|
-
};
|
|
6326
|
+
formatHex() {
|
|
6327
|
+
return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
|
|
5396
6328
|
}
|
|
5397
|
-
|
|
5398
|
-
|
|
6329
|
+
formatRgb() {
|
|
6330
|
+
const opacity = this.opacity;
|
|
6331
|
+
return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
|
|
5399
6332
|
}
|
|
5400
|
-
|
|
5401
|
-
|
|
6333
|
+
formatHsl() {
|
|
6334
|
+
const opacity = this.opacity,
|
|
6335
|
+
{
|
|
6336
|
+
h: h,
|
|
6337
|
+
s: s,
|
|
6338
|
+
l: l
|
|
6339
|
+
} = rgbToHsl(this.r, this.g, this.b);
|
|
6340
|
+
return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
|
|
6341
|
+
}
|
|
6342
|
+
toString() {
|
|
6343
|
+
return this.formatHex();
|
|
5402
6344
|
}
|
|
5403
6345
|
}
|
|
5404
6346
|
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
6347
|
+
function normalizePadding(padding) {
|
|
6348
|
+
if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
|
|
6349
|
+
if (isArray$1(padding)) {
|
|
6350
|
+
const length = padding.length;
|
|
6351
|
+
if (1 === length) {
|
|
6352
|
+
const paddingValue = padding[0];
|
|
6353
|
+
return [paddingValue, paddingValue, paddingValue, paddingValue];
|
|
6354
|
+
}
|
|
6355
|
+
if (2 === length) {
|
|
6356
|
+
const [vertical, horizontal] = padding;
|
|
6357
|
+
return [vertical, horizontal, vertical, horizontal];
|
|
6358
|
+
}
|
|
6359
|
+
if (3 === length) {
|
|
6360
|
+
const [top, horizontal, bottom] = padding;
|
|
6361
|
+
return [top, horizontal, bottom, horizontal];
|
|
6362
|
+
}
|
|
6363
|
+
if (4 === length) return padding;
|
|
6364
|
+
}
|
|
6365
|
+
if (isObject$1(padding)) {
|
|
6366
|
+
const {
|
|
6367
|
+
top = 0,
|
|
6368
|
+
right = 0,
|
|
6369
|
+
bottom = 0,
|
|
6370
|
+
left = 0
|
|
6371
|
+
} = padding;
|
|
6372
|
+
return [top, right, bottom, left];
|
|
6373
|
+
}
|
|
6374
|
+
return [0, 0, 0, 0];
|
|
6375
|
+
}
|
|
5423
6376
|
|
|
5424
6377
|
const circleThreshold = tau - 1e-8;
|
|
5425
6378
|
class BoundsContext {
|
|
@@ -7253,34 +8206,6 @@
|
|
|
7253
8206
|
}
|
|
7254
8207
|
return c;
|
|
7255
8208
|
}
|
|
7256
|
-
static processColorStops(colorStops) {
|
|
7257
|
-
if (!colorStops || 0 === colorStops.length) return [];
|
|
7258
|
-
if (colorStops.some(item => item.length)) {
|
|
7259
|
-
const stops = colorStops.map(item => ({
|
|
7260
|
-
color: item.value,
|
|
7261
|
-
offset: item.length ? parseFloat(item.length.value) / 100 : -1
|
|
7262
|
-
}));
|
|
7263
|
-
stops[0].offset < 0 && (stops[0].offset = 0), stops[stops.length - 1].offset < 0 && (stops[stops.length - 1].offset = 1);
|
|
7264
|
-
for (let i = 1; i < stops.length - 1; i++) if (stops[i].offset < 0) {
|
|
7265
|
-
const prevWithOffsetIdx = i - 1;
|
|
7266
|
-
let nextWithOffsetIdx = i + 1;
|
|
7267
|
-
for (; nextWithOffsetIdx < stops.length && stops[nextWithOffsetIdx].offset < 0;) nextWithOffsetIdx++;
|
|
7268
|
-
const startOffset = stops[prevWithOffsetIdx].offset,
|
|
7269
|
-
endOffset = stops[nextWithOffsetIdx].offset,
|
|
7270
|
-
unspecCount = nextWithOffsetIdx - prevWithOffsetIdx;
|
|
7271
|
-
for (let j = 1; j < unspecCount; j++) stops[prevWithOffsetIdx + j].offset = startOffset + (endOffset - startOffset) * j / unspecCount;
|
|
7272
|
-
i = nextWithOffsetIdx - 1;
|
|
7273
|
-
}
|
|
7274
|
-
return stops;
|
|
7275
|
-
}
|
|
7276
|
-
return colorStops.map((item, index) => {
|
|
7277
|
-
const offset = colorStops.length > 1 ? index / (colorStops.length - 1) : 0;
|
|
7278
|
-
return {
|
|
7279
|
-
color: item.value,
|
|
7280
|
-
offset: offset
|
|
7281
|
-
};
|
|
7282
|
-
});
|
|
7283
|
-
}
|
|
7284
8209
|
static ParseConic(datum) {
|
|
7285
8210
|
const {
|
|
7286
8211
|
orientation: orientation,
|
|
@@ -7294,7 +8219,10 @@
|
|
|
7294
8219
|
y: .5,
|
|
7295
8220
|
startAngle: sa,
|
|
7296
8221
|
endAngle: sa + pi2,
|
|
7297
|
-
stops:
|
|
8222
|
+
stops: colorStops.map(item => ({
|
|
8223
|
+
color: item.value,
|
|
8224
|
+
offset: parseFloat(item.length.value) / 100
|
|
8225
|
+
}))
|
|
7298
8226
|
};
|
|
7299
8227
|
}
|
|
7300
8228
|
static ParseRadial(datum) {
|
|
@@ -7309,7 +8237,10 @@
|
|
|
7309
8237
|
y1: .5,
|
|
7310
8238
|
r0: 0,
|
|
7311
8239
|
r1: 1,
|
|
7312
|
-
stops:
|
|
8240
|
+
stops: colorStops.map(item => ({
|
|
8241
|
+
color: item.value,
|
|
8242
|
+
offset: parseFloat(item.length.value) / 100
|
|
8243
|
+
}))
|
|
7313
8244
|
};
|
|
7314
8245
|
}
|
|
7315
8246
|
static ParseLinear(datum) {
|
|
@@ -7331,7 +8262,10 @@
|
|
|
7331
8262
|
y0: y0,
|
|
7332
8263
|
x1: x1,
|
|
7333
8264
|
y1: y1,
|
|
7334
|
-
stops:
|
|
8265
|
+
stops: colorStops.map(item => ({
|
|
8266
|
+
color: item.value,
|
|
8267
|
+
offset: parseFloat(item.length.value) / 100
|
|
8268
|
+
}))
|
|
7335
8269
|
};
|
|
7336
8270
|
}
|
|
7337
8271
|
}
|
|
@@ -10641,7 +11575,7 @@
|
|
|
10641
11575
|
});
|
|
10642
11576
|
}
|
|
10643
11577
|
release() {
|
|
10644
|
-
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
11578
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
|
|
10645
11579
|
}
|
|
10646
11580
|
_emitCustomEvent(type, context) {
|
|
10647
11581
|
var _a, _b;
|
|
@@ -12864,7 +13798,7 @@
|
|
|
12864
13798
|
case "right":
|
|
12865
13799
|
deltaX = -aabbBounds.width();
|
|
12866
13800
|
}
|
|
12867
|
-
return
|
|
13801
|
+
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
12868
13802
|
}
|
|
12869
13803
|
needUpdateTags(keys) {
|
|
12870
13804
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -17879,6 +18813,8 @@
|
|
|
17879
18813
|
}
|
|
17880
18814
|
onStart() {
|
|
17881
18815
|
super.onStart();
|
|
18816
|
+
}
|
|
18817
|
+
onFirstRun() {
|
|
17882
18818
|
const fromProps = this.getFromProps();
|
|
17883
18819
|
this.target.setAttributes(fromProps);
|
|
17884
18820
|
}
|
|
@@ -19184,35 +20120,35 @@
|
|
|
19184
20120
|
vchart.registerCartesianBandAxis();
|
|
19185
20121
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianBandAxis.type);
|
|
19186
20122
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianBandAxis.builtInTheme.axisX), axisZ) });
|
|
19187
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20123
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19188
20124
|
};
|
|
19189
20125
|
|
|
19190
20126
|
const registerCartesianLinearAxis3d = () => {
|
|
19191
20127
|
vchart.registerCartesianLinearAxis();
|
|
19192
20128
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLinearAxis.type);
|
|
19193
20129
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLinearAxis.builtInTheme.axisX), axisZ) });
|
|
19194
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20130
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19195
20131
|
};
|
|
19196
20132
|
|
|
19197
20133
|
const registerCartesianLogAxis3d = () => {
|
|
19198
20134
|
vchart.registerCartesianLogAxis();
|
|
19199
20135
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLogAxis.type);
|
|
19200
20136
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLogAxis.builtInTheme.axisX), axisZ) });
|
|
19201
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20137
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19202
20138
|
};
|
|
19203
20139
|
|
|
19204
20140
|
const registerCartesianSymlogAxis3d = () => {
|
|
19205
20141
|
vchart.registerCartesianLogAxis();
|
|
19206
20142
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianSymlogAxis.type);
|
|
19207
20143
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
|
|
19208
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20144
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19209
20145
|
};
|
|
19210
20146
|
|
|
19211
20147
|
const registerCartesianTimeAxis3d = () => {
|
|
19212
20148
|
vchart.registerCartesianTimeAxis();
|
|
19213
20149
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianTimeAxis.type);
|
|
19214
20150
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
|
|
19215
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20151
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19216
20152
|
};
|
|
19217
20153
|
|
|
19218
20154
|
const registerAxis3dPlugin = () => {
|
|
@@ -19371,7 +20307,7 @@
|
|
|
19371
20307
|
const svg = chartSpec.svg;
|
|
19372
20308
|
const elements = (_c = (_b = svgSourceMap.get(svg)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c.elements;
|
|
19373
20309
|
if (elements && elements.length) {
|
|
19374
|
-
const names = elements.map(e => e.name).filter(n => isValid$
|
|
20310
|
+
const names = elements.map(e => e.name).filter(n => isValid$3(n));
|
|
19375
20311
|
names.forEach(name => {
|
|
19376
20312
|
if (chartSpec[name]) {
|
|
19377
20313
|
spec[name] = chartSpec[name];
|
|
@@ -19432,7 +20368,7 @@
|
|
|
19432
20368
|
return e.node.name;
|
|
19433
20369
|
}
|
|
19434
20370
|
start(itemKey) {
|
|
19435
|
-
if (isNil$
|
|
20371
|
+
if (isNil$3(itemKey)) {
|
|
19436
20372
|
return;
|
|
19437
20373
|
}
|
|
19438
20374
|
const { interaction, highlightState, blurState } = this.options;
|
|
@@ -19487,7 +20423,7 @@
|
|
|
19487
20423
|
|
|
19488
20424
|
function isValidStrokeOrFill(attr) {
|
|
19489
20425
|
var _a;
|
|
19490
|
-
return isValid$
|
|
20426
|
+
return isValid$3(attr) && attr !== 'none' && !((_a = attr.includes) === null || _a === void 0 ? void 0 : _a.call(attr, 'url'));
|
|
19491
20427
|
}
|
|
19492
20428
|
const getLineWidth = (attributes) => {
|
|
19493
20429
|
const strokeWidth = parseFloat(attributes.strokeWidth);
|
|
@@ -19568,10 +20504,10 @@
|
|
|
19568
20504
|
visible: el.attributes.visibility !== 'hidden' && el.attributes.visibility !== 'collapse'
|
|
19569
20505
|
};
|
|
19570
20506
|
if (el.graphicType === 'text') {
|
|
19571
|
-
merge(finalAttributes, el._inheritStyle, (_a = el.parent) === null || _a === void 0 ? void 0 : _a._textGroupStyle, el.attributes);
|
|
20507
|
+
merge$1(finalAttributes, el._inheritStyle, (_a = el.parent) === null || _a === void 0 ? void 0 : _a._textGroupStyle, el.attributes);
|
|
19572
20508
|
}
|
|
19573
20509
|
else if (el.graphicType !== 'group') {
|
|
19574
|
-
merge(finalAttributes, el._inheritStyle, el.attributes);
|
|
20510
|
+
merge$1(finalAttributes, el._inheritStyle, el.attributes);
|
|
19575
20511
|
}
|
|
19576
20512
|
if (graphicAttributeTransform[type]) {
|
|
19577
20513
|
el._finalAttributes = graphicAttributeTransform[type](finalAttributes, el.value);
|
|
@@ -19672,7 +20608,7 @@
|
|
|
19672
20608
|
}
|
|
19673
20609
|
_defaultSelectConfig(finalSelectSpec) {
|
|
19674
20610
|
const isMultiple = finalSelectSpec.mode === 'multiple';
|
|
19675
|
-
const triggerOff = isValid$
|
|
20611
|
+
const triggerOff = isValid$3(finalSelectSpec.triggerOff)
|
|
19676
20612
|
? finalSelectSpec.triggerOff
|
|
19677
20613
|
: isMultiple
|
|
19678
20614
|
? ['empty', 'self']
|
|
@@ -19781,10 +20717,10 @@
|
|
|
19781
20717
|
if (mark) {
|
|
19782
20718
|
this.setMarkStyle(mark, { keepStrokeScale: true }, 'normal', vchart.AttributeLevel.Built_In);
|
|
19783
20719
|
if (valid) {
|
|
19784
|
-
this.initMarkStyleWithSpec(mark, merge({}, this._spec.pictogram, this._spec[mark.name]));
|
|
20720
|
+
this.initMarkStyleWithSpec(mark, merge$1({}, this._spec.pictogram, this._spec[mark.name]));
|
|
19785
20721
|
this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Series);
|
|
19786
20722
|
mark.setPostProcess('fill', (result, datum) => {
|
|
19787
|
-
return isValid$
|
|
20723
|
+
return isValid$3(result) ? result : this._spec.defaultFillColor;
|
|
19788
20724
|
});
|
|
19789
20725
|
}
|
|
19790
20726
|
else {
|
|
@@ -19818,7 +20754,7 @@
|
|
|
19818
20754
|
if (!mark || mark.length === 0) {
|
|
19819
20755
|
return null;
|
|
19820
20756
|
}
|
|
19821
|
-
let bounds = new Bounds();
|
|
20757
|
+
let bounds = new Bounds$1();
|
|
19822
20758
|
if (global) {
|
|
19823
20759
|
mark.forEach(m => {
|
|
19824
20760
|
bounds = bounds.union(m.getGraphics()[0].globalAABBBounds);
|
|
@@ -19943,7 +20879,7 @@
|
|
|
19943
20879
|
if (root) {
|
|
19944
20880
|
if (!root.attribute.postMatrix) {
|
|
19945
20881
|
root.setAttributes({
|
|
19946
|
-
postMatrix: new Matrix()
|
|
20882
|
+
postMatrix: new Matrix$1()
|
|
19947
20883
|
});
|
|
19948
20884
|
}
|
|
19949
20885
|
root.scale(scale, scale, scaleCenter);
|
|
@@ -19958,7 +20894,7 @@
|
|
|
19958
20894
|
if (root) {
|
|
19959
20895
|
if (!root.attribute.postMatrix) {
|
|
19960
20896
|
root.setAttributes({
|
|
19961
|
-
postMatrix: new Matrix()
|
|
20897
|
+
postMatrix: new Matrix$1()
|
|
19962
20898
|
});
|
|
19963
20899
|
}
|
|
19964
20900
|
root.translate(delta[0], delta[1]);
|
|
@@ -20186,7 +21122,7 @@
|
|
|
20186
21122
|
g = imageData.data[y * width * 4 + 4 * x + 1],
|
|
20187
21123
|
b = imageData.data[y * width * 4 + 4 * x + 2];
|
|
20188
21124
|
if (255 === r && 255 === g && 255 === b) return !invert;
|
|
20189
|
-
if (isValidNumber$
|
|
21125
|
+
if (isValidNumber$3(threshold)) {
|
|
20190
21126
|
const grayValue = .3 * r + .59 * g + .11 * b;
|
|
20191
21127
|
return invert ? grayValue <= threshold : grayValue >= threshold;
|
|
20192
21128
|
}
|
|
@@ -20241,7 +21177,7 @@
|
|
|
20241
21177
|
ctx.font = `${fontStyle} ${fontVariant} ${fontWeight} ${baseFontSize}px ${fontFamily}`, ctx.textAlign = "center", ctx.textBaseline = "middle", ctx.fillStyle = fillColor;
|
|
20242
21178
|
const textMetrics = ctx.measureText(text),
|
|
20243
21179
|
scale = "normal" !== fontStyle ? 1.1 : 1,
|
|
20244
|
-
actualWidth = isValid$
|
|
21180
|
+
actualWidth = isValid$3(textMetrics.actualBoundingBoxRight) && isValid$3(textMetrics.actualBoundingBoxLeft) ? Math.ceil(scale * (Math.abs(textMetrics.actualBoundingBoxRight) + Math.abs(textMetrics.actualBoundingBoxLeft))) : 0,
|
|
20245
21181
|
textWidth = Math.max(Math.ceil(textMetrics.width), actualWidth, baseFontSize);
|
|
20246
21182
|
if (hollow && (ctx.globalCompositeOperation = "xor"), textWidth > width) {
|
|
20247
21183
|
const scale = Math.min(width / textWidth, height / baseFontSize);
|
|
@@ -20498,7 +21434,7 @@
|
|
|
20498
21434
|
}
|
|
20499
21435
|
|
|
20500
21436
|
function loadImage(url, createImage) {
|
|
20501
|
-
return url && (isValidUrl$
|
|
21437
|
+
return url && (isValidUrl$3(url) || isBase64$3(url) || url.startsWith("<svg")) ? new Promise((resolve, reject) => {
|
|
20502
21438
|
var _a;
|
|
20503
21439
|
const imageMark = createImage({
|
|
20504
21440
|
image: url
|
|
@@ -20566,18 +21502,18 @@
|
|
|
20566
21502
|
this._rangeFactorStart = null, this._rangeFactorEnd = null;
|
|
20567
21503
|
}
|
|
20568
21504
|
_calculateWholeRange(range) {
|
|
20569
|
-
return this._wholeRange ? this._wholeRange : isValid$
|
|
21505
|
+
return this._wholeRange ? this._wholeRange : isValid$3(this._rangeFactorStart) && isValid$3(this._rangeFactorEnd) && 2 === range.length ? (this._wholeRange = calculateWholeRangeFromRangeFactor(range, [this._rangeFactorStart, this._rangeFactorEnd]), this._wholeRange) : range;
|
|
20570
21506
|
}
|
|
20571
21507
|
rangeFactor(_, slience, clear) {
|
|
20572
|
-
return _ ? (2 === _.length && _.every(r => r >= 0 && r <= 1) && (this._wholeRange = null, 0 === _[0] && 1 === _[1] ? (this._rangeFactorStart = null, this._rangeFactorEnd = null) : (this._rangeFactorStart = _[0], this._rangeFactorEnd = _[1])), this) : clear ? (this._wholeRange = null, this._rangeFactorStart = null, this._rangeFactorEnd = null, this) : isValid$
|
|
21508
|
+
return _ ? (2 === _.length && _.every(r => r >= 0 && r <= 1) && (this._wholeRange = null, 0 === _[0] && 1 === _[1] ? (this._rangeFactorStart = null, this._rangeFactorEnd = null) : (this._rangeFactorStart = _[0], this._rangeFactorEnd = _[1])), this) : clear ? (this._wholeRange = null, this._rangeFactorStart = null, this._rangeFactorEnd = null, this) : isValid$3(this._rangeFactorStart) && isValid$3(this._rangeFactorEnd) ? [this._rangeFactorStart, this._rangeFactorEnd] : null;
|
|
20573
21509
|
}
|
|
20574
21510
|
rangeFactorStart(_, slience) {
|
|
20575
21511
|
var _a;
|
|
20576
|
-
return isNil$
|
|
21512
|
+
return isNil$3(_) ? this._rangeFactorStart : (_ >= 0 && _ <= 1 && (this._wholeRange = null, 0 !== _ || !isNil$3(this._rangeFactorEnd) && 1 !== this._rangeFactorEnd ? (this._rangeFactorStart = _, this._rangeFactorEnd = null !== (_a = this._rangeFactorEnd) && void 0 !== _a ? _a : 1) : (this._rangeFactorStart = null, this._rangeFactorEnd = null)), this);
|
|
20577
21513
|
}
|
|
20578
21514
|
rangeFactorEnd(_, slience) {
|
|
20579
21515
|
var _a;
|
|
20580
|
-
return isNil$
|
|
21516
|
+
return isNil$3(_) ? this._rangeFactorEnd : (_ >= 0 && _ <= 1 && (this._wholeRange = null, 0 !== _ || !isNil$3(this._rangeFactorStart) && 0 !== this._rangeFactorStart ? (this._rangeFactorEnd = _, this._rangeFactorStart = null !== (_a = this._rangeFactorStart) && void 0 !== _a ? _a : 0) : (this._rangeFactorStart = null, this._rangeFactorEnd = null)), this);
|
|
20581
21517
|
}
|
|
20582
21518
|
generateFishEyeTransform() {
|
|
20583
21519
|
var _a;
|
|
@@ -20592,8 +21528,8 @@
|
|
|
20592
21528
|
last = range[range.length - 1],
|
|
20593
21529
|
min = Math.min(first, last),
|
|
20594
21530
|
max = Math.max(first, last),
|
|
20595
|
-
focus = clamp$
|
|
20596
|
-
rangeRadius = isNil$
|
|
21531
|
+
focus = clamp$3(null !== (_a = this._fishEyeOptions.focus) && void 0 !== _a ? _a : 0, min, max),
|
|
21532
|
+
rangeRadius = isNil$3(radius) ? (max - min) * radiusRatio : radius;
|
|
20597
21533
|
let k0 = Math.exp(distortion);
|
|
20598
21534
|
k0 = k0 / (k0 - 1) * rangeRadius;
|
|
20599
21535
|
const k1 = distortion / rangeRadius;
|
|
@@ -20620,16 +21556,16 @@
|
|
|
20620
21556
|
function interpolate(a, b) {
|
|
20621
21557
|
const t = typeof b;
|
|
20622
21558
|
let c;
|
|
20623
|
-
if (isNil$
|
|
21559
|
+
if (isNil$3(b) || "boolean" === t) return () => b;
|
|
20624
21560
|
if ("number" === t) return interpolateNumber$1(a, b);
|
|
20625
21561
|
if ("string" === t) {
|
|
20626
|
-
if (c = Color.parseColorString(b)) {
|
|
20627
|
-
const rgb = interpolateRgb(Color.parseColorString(a), c);
|
|
21562
|
+
if (c = Color$1.parseColorString(b)) {
|
|
21563
|
+
const rgb = interpolateRgb(Color$1.parseColorString(a), c);
|
|
20628
21564
|
return t => rgb(t).formatRgb();
|
|
20629
21565
|
}
|
|
20630
21566
|
return interpolateNumber$1(Number(a), Number(b));
|
|
20631
21567
|
}
|
|
20632
|
-
return b instanceof RGB ? interpolateRgb(a, b) : b instanceof Color ? interpolateRgb(a.color, b.color) : b instanceof Date ? interpolateDate(a, b) : interpolateNumber$1(Number(a), Number(b));
|
|
21568
|
+
return b instanceof RGB$1 ? interpolateRgb(a, b) : b instanceof Color$1 ? interpolateRgb(a.color, b.color) : b instanceof Date ? interpolateDate(a, b) : interpolateNumber$1(Number(a), Number(b));
|
|
20633
21569
|
}
|
|
20634
21570
|
|
|
20635
21571
|
class ContinuousScale extends BaseScale {
|
|
@@ -20638,7 +21574,7 @@
|
|
|
20638
21574
|
}
|
|
20639
21575
|
calculateVisibleDomain(range) {
|
|
20640
21576
|
var _a;
|
|
20641
|
-
if (isValid$
|
|
21577
|
+
if (isValid$3(this._rangeFactorStart) && isValid$3(this._rangeFactorEnd) && 2 === range.length) {
|
|
20642
21578
|
return [this.invert(range[0]), this.invert(range[1])];
|
|
20643
21579
|
}
|
|
20644
21580
|
return null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain;
|
|
@@ -20710,10 +21646,10 @@
|
|
|
20710
21646
|
return _ ? (super.rangeFactor(_), this._output = this._input = null, this) : super.rangeFactor();
|
|
20711
21647
|
}
|
|
20712
21648
|
rangeFactorStart(_, slience) {
|
|
20713
|
-
return isNil$
|
|
21649
|
+
return isNil$3(_) ? super.rangeFactorStart() : (super.rangeFactorStart(_), this._output = this._input = null, this);
|
|
20714
21650
|
}
|
|
20715
21651
|
rangeFactorEnd(_, slience) {
|
|
20716
|
-
return isNil$
|
|
21652
|
+
return isNil$3(_) ? super.rangeFactorEnd() : (super.rangeFactorEnd(_), this._output = this._input = null, this);
|
|
20717
21653
|
}
|
|
20718
21654
|
forceAlignDomainRange(forceAlign) {
|
|
20719
21655
|
return arguments.length ? (this._forceAlign = forceAlign, this) : this._forceAlign;
|
|
@@ -20870,13 +21806,13 @@
|
|
|
20870
21806
|
}
|
|
20871
21807
|
}
|
|
20872
21808
|
function parseNiceOptions(originalDomain, option) {
|
|
20873
|
-
const hasForceMin = isNumber$
|
|
20874
|
-
hasForceMax = isNumber$
|
|
21809
|
+
const hasForceMin = isNumber$3(option.forceMin),
|
|
21810
|
+
hasForceMax = isNumber$3(option.forceMax);
|
|
20875
21811
|
let niceType = null;
|
|
20876
21812
|
const niceMinMax = [];
|
|
20877
21813
|
let niceDomain = null;
|
|
20878
21814
|
const domainValidator = hasForceMin && hasForceMax ? x => x >= option.forceMin && x <= option.forceMax : hasForceMin ? x => x >= option.forceMin : hasForceMax ? x => x <= option.forceMax : null;
|
|
20879
|
-
return hasForceMin ? niceMinMax[0] = option.forceMin : isNumber$
|
|
21815
|
+
return hasForceMin ? niceMinMax[0] = option.forceMin : isNumber$3(option.min) && option.min <= Math.min(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[0] = option.min), hasForceMax ? niceMinMax[1] = option.forceMax : isNumber$3(option.max) && option.max >= Math.max(originalDomain[0], originalDomain[originalDomain.length - 1]) && (niceMinMax[1] = option.max), isNumber$3(niceMinMax[0]) && isNumber$3(niceMinMax[1]) ? (niceDomain = originalDomain.slice(), niceDomain[0] = niceMinMax[0], niceDomain[niceDomain.length - 1] = niceMinMax[1]) : niceType = isNumber$3(niceMinMax[0]) || isNumber$3(niceMinMax[1]) ? isNumber$3(niceMinMax[0]) ? "max" : "min" : "all", {
|
|
20880
21816
|
niceType: niceType,
|
|
20881
21817
|
niceDomain: niceDomain,
|
|
20882
21818
|
niceMinMax: niceMinMax,
|
|
@@ -20902,8 +21838,8 @@
|
|
|
20902
21838
|
}
|
|
20903
21839
|
ticks(count = 10, options) {
|
|
20904
21840
|
var _a;
|
|
20905
|
-
if (isFunction$
|
|
20906
|
-
if (isValid$
|
|
21841
|
+
if (isFunction$3(null == options ? void 0 : options.customTicks)) return options.customTicks(this, count);
|
|
21842
|
+
if (isValid$3(this._rangeFactorStart) && isValid$3(this._rangeFactorEnd) && (this._rangeFactorStart > 0 || this._rangeFactorEnd < 1) && 2 === this._range.length || !this._niceType) return this.d3Ticks(count, options);
|
|
20907
21843
|
const curNiceDomain = null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain,
|
|
20908
21844
|
originalDomain = this._domain,
|
|
20909
21845
|
start = curNiceDomain[0],
|
|
@@ -21038,7 +21974,7 @@
|
|
|
21038
21974
|
});
|
|
21039
21975
|
tempCtx.textAlign = "center", tempCtx.textBaseline = "middle", segmentationInput.tempCanvas = tempCanvas;
|
|
21040
21976
|
const boardW = size[0] + 31 >> 5 << 5;
|
|
21041
|
-
if (segmentationInput.boardSize = [boardW, size[1]], segmentationInput.random ? segmentationInput.randomGenerator = Math.random : segmentationInput.randomGenerator = fakeRandom(), this.segmentationInput = segmentationInput, isString$
|
|
21977
|
+
if (segmentationInput.boardSize = [boardW, size[1]], segmentationInput.random ? segmentationInput.randomGenerator = Math.random : segmentationInput.randomGenerator = fakeRandom(), this.segmentationInput = segmentationInput, isString$3(segmentationInput.shapeUrl)) {
|
|
21042
21978
|
segmentationInput.isEmptyPixel = generateIsEmptyPixel(void 0, {
|
|
21043
21979
|
threshold: null !== (_d = null === (_c = options.maskConfig) || void 0 === _c ? void 0 : _c.threshold) && void 0 !== _d ? _d : 200,
|
|
21044
21980
|
invert: null === (_e = options.maskConfig) || void 0 === _e ? void 0 : _e.invert
|
|
@@ -21074,7 +22010,7 @@
|
|
|
21074
22010
|
imagesPromise ? imagesPromise.then(images => {
|
|
21075
22011
|
this.onImageCollageInputReady(images), this.isImagesFinished = !0;
|
|
21076
22012
|
}).catch(error => {
|
|
21077
|
-
this.isImagesFinished = !0, this.isLayoutFinished = !0, Logger.getInstance().error("image load failed", error);
|
|
22013
|
+
this.isImagesFinished = !0, this.isLayoutFinished = !0, Logger$1.getInstance().error("image load failed", error);
|
|
21078
22014
|
}) : (this.isImagesFinished = !0, this.isLayoutFinished = !0);
|
|
21079
22015
|
}
|
|
21080
22016
|
canAnimate() {
|
|
@@ -21104,13 +22040,13 @@
|
|
|
21104
22040
|
imageSizeRange: imageSizeRange,
|
|
21105
22041
|
padding = 0
|
|
21106
22042
|
} = imageConfig,
|
|
21107
|
-
imageSize = isNumber$
|
|
22043
|
+
imageSize = isNumber$3(imageConfig.imageSize) ? imageConfig.imageSize : field(imageConfig.imageSize),
|
|
21108
22044
|
size = this.options.size;
|
|
21109
22045
|
if (imageSize || imageSizeRange) {
|
|
21110
|
-
if (imageSize && !isFunction$
|
|
22046
|
+
if (imageSize && !isFunction$3(imageSize)) images.forEach(img => setSize(img, imageSize));else if (imageSizeRange) {
|
|
21111
22047
|
const sizeScale = new SqrtScale().domain(extent(images, d => d.weight)).range(imageSizeRange);
|
|
21112
22048
|
images.forEach(img => setSize(img, ~~sizeScale.scale(img.weight)));
|
|
21113
|
-
} else if (imageSize && isFunction$
|
|
22049
|
+
} else if (imageSize && isFunction$3(imageSize) && !imageSizeRange) {
|
|
21114
22050
|
const a = .5,
|
|
21115
22051
|
[min, max] = extent(images, d => d.weight),
|
|
21116
22052
|
picArea = images.reduce((prev, img) => {
|
|
@@ -21639,11 +22575,11 @@
|
|
|
21639
22575
|
|
|
21640
22576
|
const transform = (options, upstreamData, parameters) => {
|
|
21641
22577
|
var _a, _b;
|
|
21642
|
-
const size = isFunction$
|
|
21643
|
-
if (options.size = size, !size || isNil$
|
|
21644
|
-
return Logger.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
|
|
22578
|
+
const size = isFunction$3(options.size) ? options.size() : options.size;
|
|
22579
|
+
if (options.size = size, !size || isNil$3(size[0]) || isNil$3(size[1]) || size[0] <= 0 || size[1] <= 0) {
|
|
22580
|
+
return Logger$1.getInstance().info("Wordcloud size dimensions must be greater than 0"), [];
|
|
21645
22581
|
}
|
|
21646
|
-
if (options.size = [Math.ceil(size[0]), Math.ceil(size[1])], options.image || Logger.getInstance().error("Imagecloud: image source must be specified."), options.onBeforeLayout && options.onBeforeLayout(), !upstreamData || 0 === upstreamData.length) return [];
|
|
22582
|
+
if (options.size = [Math.ceil(size[0]), Math.ceil(size[1])], options.image || Logger$1.getInstance().error("Imagecloud: image source must be specified."), options.onBeforeLayout && options.onBeforeLayout(), !upstreamData || 0 === upstreamData.length) return [];
|
|
21647
22583
|
let layoutConstructor;
|
|
21648
22584
|
switch (null !== (_b = null === (_a = options.layoutConfig) || void 0 === _a ? void 0 : _a.layoutMode) && void 0 !== _b ? _b : "spiral") {
|
|
21649
22585
|
case "grid":
|
|
@@ -21669,7 +22605,7 @@
|
|
|
21669
22605
|
}
|
|
21670
22606
|
onBind() {
|
|
21671
22607
|
this._scaleX = this.target.attribute.scaleX;
|
|
21672
|
-
if (!isValidNumber$
|
|
22608
|
+
if (!isValidNumber$3(this._rotations)) {
|
|
21673
22609
|
this.valid = false;
|
|
21674
22610
|
}
|
|
21675
22611
|
}
|
|
@@ -21785,7 +22721,7 @@
|
|
|
21785
22721
|
this.type = IMAGE_CLOUD_SERIES_TYPE;
|
|
21786
22722
|
}
|
|
21787
22723
|
setValueField(field) {
|
|
21788
|
-
if (isValid$
|
|
22724
|
+
if (isValid$3(field)) {
|
|
21789
22725
|
this._valueField = field;
|
|
21790
22726
|
}
|
|
21791
22727
|
}
|
|
@@ -21908,14 +22844,7 @@
|
|
|
21908
22844
|
if (maskImage && ((_a = this._spec.layoutConfig) === null || _a === void 0 ? void 0 : _a.placement) === 'masked') {
|
|
21909
22845
|
this._rootMark.getProduct().setAttribute('background', maskImage);
|
|
21910
22846
|
}
|
|
21911
|
-
}).bind(this)
|
|
21912
|
-
onLayoutFinished: () => {
|
|
21913
|
-
var _a, _b;
|
|
21914
|
-
return (_b = (_a = this._option.globalInstance
|
|
21915
|
-
.getChart()
|
|
21916
|
-
.getOption()
|
|
21917
|
-
.performanceHook) === null || _a === void 0 ? void 0 : _a.afterWordcloudShapeDraw) === null || _b === void 0 ? void 0 : _b.call(_a, this._option.globalInstance);
|
|
21918
|
-
}
|
|
22847
|
+
}).bind(this)
|
|
21919
22848
|
};
|
|
21920
22849
|
}
|
|
21921
22850
|
_buildMarkAttributeContext() {
|
|
@@ -22103,13 +23032,13 @@
|
|
|
22103
23032
|
const finalAttribute = graphic.getFinalAttribute();
|
|
22104
23033
|
const { x, y, open, high, low, close } = finalAttribute;
|
|
22105
23034
|
const animateAttributes = { from: { x, y }, to: { x, y } };
|
|
22106
|
-
if (isValidNumber$
|
|
23035
|
+
if (isValidNumber$3(open) && isValidNumber$3(close)) {
|
|
22107
23036
|
if (open > close) {
|
|
22108
23037
|
animateAttributes.from.open = low;
|
|
22109
23038
|
animateAttributes.to.open = open;
|
|
22110
23039
|
animateAttributes.from.close = low;
|
|
22111
23040
|
animateAttributes.to.close = close;
|
|
22112
|
-
if (isValidNumber$
|
|
23041
|
+
if (isValidNumber$3(high)) {
|
|
22113
23042
|
animateAttributes.from.high = low;
|
|
22114
23043
|
animateAttributes.to.high = high;
|
|
22115
23044
|
}
|
|
@@ -22119,7 +23048,7 @@
|
|
|
22119
23048
|
animateAttributes.to.open = open;
|
|
22120
23049
|
animateAttributes.from.close = high;
|
|
22121
23050
|
animateAttributes.to.close = close;
|
|
22122
|
-
if (isValidNumber$
|
|
23051
|
+
if (isValidNumber$3(low)) {
|
|
22123
23052
|
animateAttributes.from.low = high;
|
|
22124
23053
|
animateAttributes.to.low = low;
|
|
22125
23054
|
}
|
|
@@ -22133,13 +23062,13 @@
|
|
|
22133
23062
|
const finalAttribute = graphic.getFinalAttribute();
|
|
22134
23063
|
const { x, y, open, high, low, close } = finalAttribute;
|
|
22135
23064
|
const animateAttributes = { from: { x, y }, to: { x, y } };
|
|
22136
|
-
if (isValidNumber$
|
|
23065
|
+
if (isValidNumber$3(open) && isValidNumber$3(close)) {
|
|
22137
23066
|
if (open > close) {
|
|
22138
23067
|
animateAttributes.from.open = open;
|
|
22139
23068
|
animateAttributes.to.open = low;
|
|
22140
23069
|
animateAttributes.from.close = close;
|
|
22141
23070
|
animateAttributes.to.close = low;
|
|
22142
|
-
if (isValidNumber$
|
|
23071
|
+
if (isValidNumber$3(high)) {
|
|
22143
23072
|
animateAttributes.from.high = high;
|
|
22144
23073
|
animateAttributes.to.high = low;
|
|
22145
23074
|
}
|
|
@@ -22149,7 +23078,7 @@
|
|
|
22149
23078
|
animateAttributes.to.open = high;
|
|
22150
23079
|
animateAttributes.from.close = close;
|
|
22151
23080
|
animateAttributes.to.close = high;
|
|
22152
|
-
if (isValidNumber$
|
|
23081
|
+
if (isValidNumber$3(low)) {
|
|
22153
23082
|
animateAttributes.from.low = low;
|
|
22154
23083
|
animateAttributes.to.low = high;
|
|
22155
23084
|
}
|
|
@@ -22449,7 +23378,7 @@
|
|
|
22449
23378
|
this.initCandlestickMarkStyle();
|
|
22450
23379
|
}
|
|
22451
23380
|
_initAnimationSpec(config = {}) {
|
|
22452
|
-
const newConfig = merge({}, config);
|
|
23381
|
+
const newConfig = merge$1({}, config);
|
|
22453
23382
|
['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
|
|
22454
23383
|
if (newConfig[state] && newConfig[state].type === 'scaleIn') {
|
|
22455
23384
|
newConfig[state].type = 'candlestickScaleIn';
|
|
@@ -22474,9 +23403,9 @@
|
|
|
22474
23403
|
this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);
|
|
22475
23404
|
}
|
|
22476
23405
|
_buildMergedStyles(baseStyle, risingStyle, fallingStyle, dojiStyle) {
|
|
22477
|
-
this._mergedStyles.rising = merge({}, baseStyle, risingStyle);
|
|
22478
|
-
this._mergedStyles.falling = merge({}, baseStyle, fallingStyle);
|
|
22479
|
-
this._mergedStyles.doji = merge({}, baseStyle, dojiStyle);
|
|
23406
|
+
this._mergedStyles.rising = merge$1({}, baseStyle, risingStyle);
|
|
23407
|
+
this._mergedStyles.falling = merge$1({}, baseStyle, fallingStyle);
|
|
23408
|
+
this._mergedStyles.doji = merge$1({}, baseStyle, dojiStyle);
|
|
22480
23409
|
}
|
|
22481
23410
|
mergeStyle(datum) {
|
|
22482
23411
|
const open = this.getDatumPositionValues(datum, this._openField)[0];
|
|
@@ -23971,7 +24900,7 @@
|
|
|
23971
24900
|
render() {
|
|
23972
24901
|
this.removeAllChild();
|
|
23973
24902
|
const { data = [] } = this.attribute;
|
|
23974
|
-
if (isEmpty(data)) {
|
|
24903
|
+
if (isEmpty$1(data)) {
|
|
23975
24904
|
return;
|
|
23976
24905
|
}
|
|
23977
24906
|
const verticalData = [];
|
|
@@ -24040,7 +24969,7 @@
|
|
|
24040
24969
|
}));
|
|
24041
24970
|
breakGroup.name = 'series-break';
|
|
24042
24971
|
breakGroup.data = rest;
|
|
24043
|
-
if (isValid$
|
|
24972
|
+
if (isValid$3(rest.axisId)) {
|
|
24044
24973
|
breakGroup.id = `${(_a = rest.axisId) !== null && _a !== void 0 ? _a : ''}_${id}`;
|
|
24045
24974
|
}
|
|
24046
24975
|
this.add(breakGroup);
|
|
@@ -24095,9 +25024,9 @@
|
|
|
24095
25024
|
axesSpec.forEach((spec, index) => {
|
|
24096
25025
|
var _a, _b;
|
|
24097
25026
|
const axisId = spec.id;
|
|
24098
|
-
const axisModel = isValid$
|
|
25027
|
+
const axisModel = isValid$3(axisId)
|
|
24099
25028
|
? chart.getComponentByUserId(axisId)
|
|
24100
|
-
: axesIndex && isValid$
|
|
25029
|
+
: axesIndex && isValid$3(axesIndex[index])
|
|
24101
25030
|
? chart.getComponentByIndex('axes', axesIndex[index])
|
|
24102
25031
|
: (_a = chart.getComponentsByKey('axes').filter((axis) => {
|
|
24103
25032
|
const axisInnerSpec = axis.getSpec();
|
|
@@ -24108,7 +25037,7 @@
|
|
|
24108
25037
|
}
|
|
24109
25038
|
const parsedAxisId = axisId !== null && axisId !== void 0 ? axisId : `${axisModel.type}-${axisModel.id}`;
|
|
24110
25039
|
const regionBounds = getAllRegionBounds(axisModel.getRegions());
|
|
24111
|
-
array((_b = axisModel._break) === null || _b === void 0 ? void 0 : _b.breaks).forEach((breakConfig) => {
|
|
25040
|
+
array$1((_b = axisModel._break) === null || _b === void 0 ? void 0 : _b.breaks).forEach((breakConfig) => {
|
|
24112
25041
|
const { range, breakSymbol, gap = 5 } = breakConfig;
|
|
24113
25042
|
const pos1 = axisModel.valueToPosition(range[0]);
|
|
24114
25043
|
const pos2 = axisModel.valueToPosition(range[1]);
|
|
@@ -24292,7 +25221,7 @@
|
|
|
24292
25221
|
for (let index = 1; index < points.length; index++) {
|
|
24293
25222
|
const intersection = getIntersectPoint([line.start.x, line.start.y], [line.end.x, line.end.y], [points[index].x, points[index].y], [points[index - 1].x, points[index - 1].y]);
|
|
24294
25223
|
if (intersection &&
|
|
24295
|
-
!intersections.find(point => isNumberEqual(PointService.distancePP({ x: point[0], y: point[1] }, { x: intersection[0], y: intersection[1] }), 0))) {
|
|
25224
|
+
!intersections.find(point => isNumberEqual(PointService$1.distancePP({ x: point[0], y: point[1] }, { x: intersection[0], y: intersection[1] }), 0))) {
|
|
24296
25225
|
intersections.push(intersection);
|
|
24297
25226
|
}
|
|
24298
25227
|
}
|
|
@@ -24369,7 +25298,7 @@
|
|
|
24369
25298
|
if ((_a = rawSpec.axes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
24370
25299
|
const breakedAxes = rawSpec.axes.filter((axis) => axis.breaks && axis.breaks.length && axis.visible !== false);
|
|
24371
25300
|
if (breakedAxes.length) {
|
|
24372
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_BREAK);
|
|
25301
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_BREAK);
|
|
24373
25302
|
rawSpec.customMark.push(getSeriesBreakConfig(breakedAxes, breakedAxes.map((axisSpec) => {
|
|
24374
25303
|
return rawSpec.axes.indexOf(axisSpec);
|
|
24375
25304
|
})));
|
|
@@ -24388,7 +25317,7 @@
|
|
|
24388
25317
|
}
|
|
24389
25318
|
render() {
|
|
24390
25319
|
const { data, linkStyle, areaStyle, styleMap, label, linkType = 'total' } = this.attribute;
|
|
24391
|
-
if (isEmpty(data)) {
|
|
25320
|
+
if (isEmpty$1(data)) {
|
|
24392
25321
|
return;
|
|
24393
25322
|
}
|
|
24394
25323
|
this.removeAllChild();
|
|
@@ -24711,7 +25640,7 @@
|
|
|
24711
25640
|
};
|
|
24712
25641
|
}
|
|
24713
25642
|
function appendBarLinkConfig(rawSpec, barLinkSpec) {
|
|
24714
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== BAR_LINK);
|
|
25643
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== BAR_LINK);
|
|
24715
25644
|
rawSpec.customMark.push(getBarLinkConfig(barLinkSpec));
|
|
24716
25645
|
}
|
|
24717
25646
|
|
|
@@ -24909,7 +25838,7 @@
|
|
|
24909
25838
|
}
|
|
24910
25839
|
function appendSeriesLabelConfig(rawSpec, seriesLabelSpec) {
|
|
24911
25840
|
var _a, _b, _c;
|
|
24912
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_LABEL);
|
|
25841
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_LABEL);
|
|
24913
25842
|
if (!seriesLabelSpec) {
|
|
24914
25843
|
seriesLabelSpec = (_c = (_a = get$1(rawSpec, SERIES_LABEL)) !== null && _a !== void 0 ? _a : get$1((_b = rawSpec.series) === null || _b === void 0 ? void 0 : _b[0], SERIES_LABEL)) !== null && _c !== void 0 ? _c : {};
|
|
24915
25844
|
}
|
|
@@ -24928,7 +25857,7 @@
|
|
|
24928
25857
|
var _a, _b, _c, _d;
|
|
24929
25858
|
this.removeAllChild();
|
|
24930
25859
|
const { data, layout, label, line = {} } = this.attribute;
|
|
24931
|
-
if (isEmpty(data)) {
|
|
25860
|
+
if (isEmpty$1(data)) {
|
|
24932
25861
|
return;
|
|
24933
25862
|
}
|
|
24934
25863
|
const labelStyleMap = (_a = label === null || label === void 0 ? void 0 : label.styleMap) !== null && _a !== void 0 ? _a : {};
|
|
@@ -25253,7 +26182,7 @@
|
|
|
25253
26182
|
}
|
|
25254
26183
|
static getSpecInfo(chartSpec) {
|
|
25255
26184
|
return vchart.getSpecInfo(chartSpec, this.specKey, this.type, (s) => {
|
|
25256
|
-
return s.visible && isValid$
|
|
26185
|
+
return s.visible && isValid$3(s.seriesId);
|
|
25257
26186
|
});
|
|
25258
26187
|
}
|
|
25259
26188
|
setAttrFromSpec() {
|
|
@@ -25452,7 +26381,7 @@
|
|
|
25452
26381
|
contentWidth += nameLabelWidth;
|
|
25453
26382
|
contentItemCount++;
|
|
25454
26383
|
}
|
|
25455
|
-
if (((_m = this._spec.valueLabel) === null || _m === void 0 ? void 0 : _m.visible) && isValid$
|
|
26384
|
+
if (((_m = this._spec.valueLabel) === null || _m === void 0 ? void 0 : _m.visible) && isValid$3(data[this.valueField])) {
|
|
25456
26385
|
const valueLabel = graphicCreator.text(vchart.transformToGraphic(Object.assign({}, this._spec.valueLabel.style)));
|
|
25457
26386
|
valueLabel.setAttributes(positionAttr);
|
|
25458
26387
|
valueLabel.setAttribute('text', data[this.valueField]);
|