@visactor/vchart-extension 2.0.4-alpha.0 → 2.0.4-alpha.10
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 +2022 -522
- 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-transformer.d.ts +6 -0
- package/cjs/charts/candlestick/candlestick-transformer.js +24 -0
- package/cjs/charts/candlestick/candlestick-transformer.js.map +1 -0
- package/cjs/charts/candlestick/candlestick.d.ts +10 -0
- package/cjs/charts/candlestick/candlestick.js +26 -0
- package/cjs/charts/candlestick/candlestick.js.map +1 -0
- package/cjs/charts/candlestick/index.d.ts +3 -0
- package/cjs/charts/candlestick/index.js +22 -0
- package/cjs/charts/candlestick/index.js.map +1 -0
- package/cjs/charts/candlestick/interface.d.ts +6 -0
- package/cjs/charts/candlestick/interface.js +6 -0
- package/cjs/charts/candlestick/interface.js.map +1 -0
- package/cjs/charts/candlestick/mark/candlestick.d.ts +11 -0
- package/cjs/charts/candlestick/mark/candlestick.js +62 -0
- package/cjs/charts/candlestick/mark/candlestick.js.map +1 -0
- package/cjs/charts/candlestick/mark/interface.d.ts +9 -0
- package/cjs/charts/candlestick/mark/interface.js +6 -0
- package/cjs/charts/candlestick/mark/interface.js.map +1 -0
- package/cjs/charts/candlestick/series/animation.d.ts +32 -0
- package/cjs/charts/candlestick/series/animation.js +132 -0
- package/cjs/charts/candlestick/series/animation.js.map +1 -0
- package/cjs/charts/candlestick/series/candlestick.d.ts +105 -0
- package/cjs/charts/candlestick/series/candlestick.js +143 -0
- package/cjs/charts/candlestick/series/candlestick.js.map +1 -0
- package/cjs/charts/candlestick/series/constant.d.ts +77 -0
- package/cjs/charts/candlestick/series/constant.js +26 -0
- package/cjs/charts/candlestick/series/constant.js.map +1 -0
- package/cjs/charts/candlestick/series/interface.d.ts +20 -0
- package/cjs/charts/candlestick/series/interface.js +6 -0
- package/cjs/charts/candlestick/series/interface.js.map +1 -0
- package/cjs/charts/candlestick/series/theme.d.ts +3 -0
- package/cjs/charts/candlestick/series/theme.js +34 -0
- package/cjs/charts/candlestick/series/theme.js.map +1 -0
- package/cjs/charts/candlestick/series/tooltip-helper.d.ts +9 -0
- package/cjs/charts/candlestick/series/tooltip-helper.js +70 -0
- package/cjs/charts/candlestick/series/tooltip-helper.js.map +1 -0
- package/cjs/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/cjs/charts/conversion-funnel/constants.js +2 -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 +1 -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 +2 -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/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/cjs/charts/pictogram/element-select-by-graphic-name.js +1 -1
- package/cjs/charts/pictogram/index.js +1 -1
- package/cjs/charts/pictogram/interface.js +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/cjs/index.d.ts +1 -0
- package/cjs/index.js +3 -2
- package/cjs/index.js.map +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-transformer.d.ts +6 -0
- package/esm/charts/candlestick/candlestick-transformer.js +16 -0
- package/esm/charts/candlestick/candlestick-transformer.js.map +1 -0
- package/esm/charts/candlestick/candlestick.d.ts +10 -0
- package/esm/charts/candlestick/candlestick.js +23 -0
- package/esm/charts/candlestick/candlestick.js.map +1 -0
- package/esm/charts/candlestick/index.d.ts +3 -0
- package/esm/charts/candlestick/index.js +6 -0
- package/esm/charts/candlestick/index.js.map +1 -0
- package/esm/charts/candlestick/interface.d.ts +6 -0
- package/esm/charts/candlestick/interface.js +2 -0
- package/esm/charts/candlestick/interface.js.map +1 -0
- package/esm/charts/candlestick/mark/candlestick.d.ts +11 -0
- package/esm/charts/candlestick/mark/candlestick.js +58 -0
- package/esm/charts/candlestick/mark/candlestick.js.map +1 -0
- package/esm/charts/candlestick/mark/interface.d.ts +9 -0
- package/esm/charts/candlestick/mark/interface.js +2 -0
- package/esm/charts/candlestick/mark/interface.js.map +1 -0
- package/esm/charts/candlestick/series/animation.d.ts +32 -0
- package/esm/charts/candlestick/series/animation.js +124 -0
- package/esm/charts/candlestick/series/animation.js.map +1 -0
- package/esm/charts/candlestick/series/candlestick.d.ts +105 -0
- package/esm/charts/candlestick/series/candlestick.js +145 -0
- package/esm/charts/candlestick/series/candlestick.js.map +1 -0
- package/esm/charts/candlestick/series/constant.d.ts +77 -0
- package/esm/charts/candlestick/series/constant.js +27 -0
- package/esm/charts/candlestick/series/constant.js.map +1 -0
- package/esm/charts/candlestick/series/interface.d.ts +20 -0
- package/esm/charts/candlestick/series/interface.js +2 -0
- package/esm/charts/candlestick/series/interface.js.map +1 -0
- package/esm/charts/candlestick/series/theme.d.ts +3 -0
- package/esm/charts/candlestick/series/theme.js +52 -0
- package/esm/charts/candlestick/series/theme.js.map +1 -0
- package/esm/charts/candlestick/series/tooltip-helper.d.ts +9 -0
- package/esm/charts/candlestick/series/tooltip-helper.js +64 -0
- package/esm/charts/candlestick/series/tooltip-helper.js.map +1 -0
- package/esm/charts/conversion-funnel/arrow-data-transform.js +1 -1
- package/esm/charts/conversion-funnel/constants.js +2 -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 +1 -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 +2 -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/pictogram/element-highlight-by-graphic-name.js +1 -1
- package/esm/charts/pictogram/element-select-by-graphic-name.js +1 -1
- package/esm/charts/pictogram/index.js +1 -1
- package/esm/charts/pictogram/interface.js +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/esm/index.d.ts +1 -0
- package/esm/index.js +2 -0
- package/esm/index.js.map +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;
|
|
@@ -5397,29 +5203,1176 @@
|
|
|
5397
5203
|
addAnimationFrameCb(callback) {
|
|
5398
5204
|
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
5399
5205
|
}
|
|
5400
|
-
removeAnimationFrameCb(index) {
|
|
5401
|
-
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
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;
|
|
6260
|
+
}
|
|
6261
|
+
setHex(value) {
|
|
6262
|
+
const formatValue = `${value}`.trim().toLowerCase(),
|
|
6263
|
+
res = setHex(formatValue, !0);
|
|
6264
|
+
return null != res ? res : this;
|
|
6265
|
+
}
|
|
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;
|
|
6269
|
+
}
|
|
6270
|
+
setScalar(scalar) {
|
|
6271
|
+
return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
|
|
6272
|
+
}
|
|
6273
|
+
setOpacity(o = 1) {
|
|
6274
|
+
return this.color.opacity = o, this;
|
|
6275
|
+
}
|
|
6276
|
+
getLuminance() {
|
|
6277
|
+
return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
|
|
6278
|
+
}
|
|
6279
|
+
getLuminance2() {
|
|
6280
|
+
return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
|
|
6281
|
+
}
|
|
6282
|
+
getLuminance3() {
|
|
6283
|
+
return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
|
|
6284
|
+
}
|
|
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;
|
|
6292
|
+
}
|
|
6293
|
+
clone() {
|
|
6294
|
+
return new Color(this.color.toString());
|
|
6295
|
+
}
|
|
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;
|
|
6298
|
+
}
|
|
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;
|
|
6302
|
+
}
|
|
6303
|
+
convertGammaToLinear(gammaFactor) {
|
|
6304
|
+
return this.copyGammaToLinear(this, gammaFactor), this;
|
|
6305
|
+
}
|
|
6306
|
+
convertLinearToGamma(gammaFactor) {
|
|
6307
|
+
return this.copyLinearToGamma(this, gammaFactor), this;
|
|
6308
|
+
}
|
|
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;
|
|
6311
|
+
}
|
|
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;
|
|
6314
|
+
}
|
|
6315
|
+
convertSRGBToLinear() {
|
|
6316
|
+
return this.copySRGBToLinear(this), this;
|
|
6317
|
+
}
|
|
6318
|
+
convertLinearToSRGB() {
|
|
6319
|
+
return this.copyLinearToSRGB(this), this;
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
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;
|
|
6325
|
+
}
|
|
6326
|
+
formatHex() {
|
|
6327
|
+
return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
|
|
6328
|
+
}
|
|
6329
|
+
formatRgb() {
|
|
6330
|
+
const opacity = this.opacity;
|
|
6331
|
+
return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
|
|
6332
|
+
}
|
|
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 {
|
|
@@ -7015,7 +7968,8 @@
|
|
|
7015
7968
|
y1: 0,
|
|
7016
7969
|
strokeBoundsBuffer: 0,
|
|
7017
7970
|
cornerRadius: 0,
|
|
7018
|
-
cornerType: "round"
|
|
7971
|
+
cornerType: "round",
|
|
7972
|
+
drawStrokeWhenZeroWH: !1
|
|
7019
7973
|
});
|
|
7020
7974
|
Object.assign(Object.assign({}, DefaultAttribute), {
|
|
7021
7975
|
width: 0,
|
|
@@ -7024,7 +7978,8 @@
|
|
|
7024
7978
|
y1: 0,
|
|
7025
7979
|
cornerRadius: 0,
|
|
7026
7980
|
length: 0,
|
|
7027
|
-
cornerType: "round"
|
|
7981
|
+
cornerType: "round",
|
|
7982
|
+
drawStrokeWhenZeroWH: !1
|
|
7028
7983
|
});
|
|
7029
7984
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
7030
7985
|
symbolType: "circle",
|
|
@@ -10219,7 +11174,7 @@
|
|
|
10219
11174
|
});
|
|
10220
11175
|
}
|
|
10221
11176
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
10222
|
-
(params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
|
|
11177
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
|
|
10223
11178
|
}
|
|
10224
11179
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
10225
11180
|
const keys = Object.keys(params);
|
|
@@ -10620,7 +11575,7 @@
|
|
|
10620
11575
|
});
|
|
10621
11576
|
}
|
|
10622
11577
|
release() {
|
|
10623
|
-
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this);
|
|
11578
|
+
this.releaseStatus = "released", this.stopAnimates(), application.graphicService.onRelease(this), super.release();
|
|
10624
11579
|
}
|
|
10625
11580
|
_emitCustomEvent(type, context) {
|
|
10626
11581
|
var _a, _b;
|
|
@@ -10854,8 +11809,8 @@
|
|
|
10854
11809
|
function strokeVisible(opacity, strokeOpacity) {
|
|
10855
11810
|
return opacity * strokeOpacity > 0;
|
|
10856
11811
|
}
|
|
10857
|
-
function rectStrokeVisible(opacity, strokeOpacity, width, height) {
|
|
10858
|
-
return opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
11812
|
+
function rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH) {
|
|
11813
|
+
return drawStrokeWhenZeroWH ? opacity * strokeOpacity > 0 : opacity * strokeOpacity > 0 && 0 !== width && 0 !== height;
|
|
10859
11814
|
}
|
|
10860
11815
|
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
10861
11816
|
const x10 = x1 - x0,
|
|
@@ -14921,7 +15876,8 @@
|
|
|
14921
15876
|
y1: y1,
|
|
14922
15877
|
x: originX = rectAttribute.x,
|
|
14923
15878
|
y: originY = rectAttribute.y,
|
|
14924
|
-
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
15879
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder,
|
|
15880
|
+
drawStrokeWhenZeroWH = rectAttribute.drawStrokeWhenZeroWH
|
|
14925
15881
|
} = rect.attribute;
|
|
14926
15882
|
let {
|
|
14927
15883
|
width: width,
|
|
@@ -14929,7 +15885,7 @@
|
|
|
14929
15885
|
} = rect.attribute;
|
|
14930
15886
|
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
14931
15887
|
const fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
14932
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
|
|
15888
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
14933
15889
|
doFill = runFill(fill, background),
|
|
14934
15890
|
doStroke = runStroke(stroke, lineWidth);
|
|
14935
15891
|
if (!rect.valid || !visible) return;
|
|
@@ -15833,7 +16789,7 @@
|
|
|
15833
16789
|
super(...arguments), this.type = "rect3d", this.numberType = RECT3D_NUMBER_TYPE;
|
|
15834
16790
|
}
|
|
15835
16791
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
15836
|
-
var _a;
|
|
16792
|
+
var _a, _b;
|
|
15837
16793
|
const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
|
|
15838
16794
|
{
|
|
15839
16795
|
fill = rectAttribute.fill,
|
|
@@ -15846,16 +16802,17 @@
|
|
|
15846
16802
|
fillOpacity = rectAttribute.fillOpacity,
|
|
15847
16803
|
lineWidth = rectAttribute.lineWidth,
|
|
15848
16804
|
strokeOpacity = rectAttribute.strokeOpacity,
|
|
15849
|
-
visible = rectAttribute.visible
|
|
16805
|
+
visible = rectAttribute.visible,
|
|
16806
|
+
drawStrokeWhenZeroWH = null !== (_a = rectAttribute.drawStrokeWhenZeroWH) && void 0 !== _a && _a
|
|
15850
16807
|
} = rect.attribute;
|
|
15851
16808
|
let {
|
|
15852
16809
|
width: width,
|
|
15853
16810
|
height: height
|
|
15854
16811
|
} = rect.attribute;
|
|
15855
16812
|
width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0;
|
|
15856
|
-
const z = null !== (
|
|
16813
|
+
const z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
|
|
15857
16814
|
fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
|
|
15858
|
-
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
|
|
16815
|
+
sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height, drawStrokeWhenZeroWH),
|
|
15859
16816
|
doFill = runFill(fill),
|
|
15860
16817
|
doStroke = runStroke(stroke, lineWidth);
|
|
15861
16818
|
if (!rect.valid || !visible) return;
|
|
@@ -17848,6 +18805,7 @@
|
|
|
17848
18805
|
return this.getEndProps();
|
|
17849
18806
|
}
|
|
17850
18807
|
stop() {}
|
|
18808
|
+
release() {}
|
|
17851
18809
|
}
|
|
17852
18810
|
class WaitStep extends Step {
|
|
17853
18811
|
constructor(type, props, duration, easing) {
|
|
@@ -18065,7 +19023,9 @@
|
|
|
18065
19023
|
this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
|
|
18066
19024
|
}
|
|
18067
19025
|
release() {
|
|
18068
|
-
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = []
|
|
19026
|
+
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [], this.forEachStep(step => {
|
|
19027
|
+
step.release();
|
|
19028
|
+
});
|
|
18069
19029
|
}
|
|
18070
19030
|
getDuration() {
|
|
18071
19031
|
return this._duration;
|
|
@@ -18139,6 +19099,10 @@
|
|
|
18139
19099
|
getLoop() {
|
|
18140
19100
|
return this._loopCount;
|
|
18141
19101
|
}
|
|
19102
|
+
forEachStep(cb) {
|
|
19103
|
+
let step = this._firstStep;
|
|
19104
|
+
for (; step;) cb(step), step = step.next;
|
|
19105
|
+
}
|
|
18142
19106
|
}
|
|
18143
19107
|
|
|
18144
19108
|
const performanceRAF = new PerformanceRAF();
|
|
@@ -18174,6 +19138,8 @@
|
|
|
18174
19138
|
this.status === STATUS.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
18175
19139
|
timeline.tick(delta);
|
|
18176
19140
|
}), this.emit("tick", delta));
|
|
19141
|
+
}, this._handleGraphTick = () => {
|
|
19142
|
+
this.initHandler(!1);
|
|
18177
19143
|
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
18178
19144
|
}
|
|
18179
19145
|
bindStage(stage) {
|
|
@@ -18183,9 +19149,7 @@
|
|
|
18183
19149
|
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
18184
19150
|
}
|
|
18185
19151
|
init() {
|
|
18186
|
-
this.interval = 16, this.status = STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker",
|
|
18187
|
-
this.initHandler(!1);
|
|
18188
|
-
}), application.global.env && this.initHandler(!1);
|
|
19152
|
+
this.interval = 16, this.status = STATUS.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", this._handleGraphTick), application.global.env && this.initHandler(!1);
|
|
18189
19153
|
}
|
|
18190
19154
|
addTimeline(timeline) {
|
|
18191
19155
|
this.timelines.push(timeline);
|
|
@@ -18258,7 +19222,7 @@
|
|
|
18258
19222
|
}
|
|
18259
19223
|
release() {
|
|
18260
19224
|
var _a;
|
|
18261
|
-
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
19225
|
+
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1, application.global.hooks.onSetEnv.unTap("graph-ticker", this._handleGraphTick);
|
|
18262
19226
|
}
|
|
18263
19227
|
checkSkip(delta) {
|
|
18264
19228
|
var _a, _b, _c;
|
|
@@ -18371,6 +19335,9 @@
|
|
|
18371
19335
|
constructor(target) {
|
|
18372
19336
|
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
|
|
18373
19337
|
}
|
|
19338
|
+
get started() {
|
|
19339
|
+
return this._started;
|
|
19340
|
+
}
|
|
18374
19341
|
onStart(cb) {
|
|
18375
19342
|
cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
|
|
18376
19343
|
cb();
|
|
@@ -18511,14 +19478,14 @@
|
|
|
18511
19478
|
return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
18512
19479
|
}
|
|
18513
19480
|
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
18514
|
-
var _a, _b, _c, _d;
|
|
19481
|
+
var _a, _b, _c, _d, _e, _f;
|
|
18515
19482
|
if (custom && customType) {
|
|
18516
19483
|
const customParams = Object.assign({
|
|
18517
|
-
width: graphic.stage.width,
|
|
18518
|
-
height: graphic.stage.height,
|
|
19484
|
+
width: (null === (_a = graphic.stage) || void 0 === _a ? void 0 : _a.width) || 0,
|
|
19485
|
+
height: (null === (_b = graphic.stage) || void 0 === _b ? void 0 : _b.height) || 0,
|
|
18519
19486
|
group: this._target.parent
|
|
18520
19487
|
}, this.resolveValue(customParameters, graphic)),
|
|
18521
|
-
objOptions = isFunction$1(options) ? options.call(null, null !== (
|
|
19488
|
+
objOptions = isFunction$1(options) ? options.call(null, null !== (_d = customParams && (null === (_c = customParams.data) || void 0 === _c ? void 0 : _c[0])) && void 0 !== _d ? _d : null === (_f = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.data) || void 0 === _f ? void 0 : _f[0], graphic, customParams) : options;
|
|
18522
19489
|
customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
18523
19490
|
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
18524
19491
|
}
|
|
@@ -18738,7 +19705,7 @@
|
|
|
18738
19705
|
reApplyState(state) {
|
|
18739
19706
|
var _a;
|
|
18740
19707
|
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
18741
|
-
if (stateInfo) {
|
|
19708
|
+
if (stateInfo && stateInfo.executor.started) {
|
|
18742
19709
|
const stateList = this.stateList.slice();
|
|
18743
19710
|
stateInfo.executor.stop(), this.stateList = stateList, stateInfo.executor.execute(stateInfo.animationConfig);
|
|
18744
19711
|
}
|
|
@@ -19153,35 +20120,35 @@
|
|
|
19153
20120
|
vchart.registerCartesianBandAxis();
|
|
19154
20121
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianBandAxis.type);
|
|
19155
20122
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianBandAxis.builtInTheme.axisX), axisZ) });
|
|
19156
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20123
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19157
20124
|
};
|
|
19158
20125
|
|
|
19159
20126
|
const registerCartesianLinearAxis3d = () => {
|
|
19160
20127
|
vchart.registerCartesianLinearAxis();
|
|
19161
20128
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLinearAxis.type);
|
|
19162
20129
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLinearAxis.builtInTheme.axisX), axisZ) });
|
|
19163
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20130
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19164
20131
|
};
|
|
19165
20132
|
|
|
19166
20133
|
const registerCartesianLogAxis3d = () => {
|
|
19167
20134
|
vchart.registerCartesianLogAxis();
|
|
19168
20135
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianLogAxis.type);
|
|
19169
20136
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, vchart.CartesianLogAxis.builtInTheme.axisX), axisZ) });
|
|
19170
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20137
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19171
20138
|
};
|
|
19172
20139
|
|
|
19173
20140
|
const registerCartesianSymlogAxis3d = () => {
|
|
19174
20141
|
vchart.registerCartesianLogAxis();
|
|
19175
20142
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianSymlogAxis.type);
|
|
19176
20143
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
|
|
19177
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20144
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19178
20145
|
};
|
|
19179
20146
|
|
|
19180
20147
|
const registerCartesianTimeAxis3d = () => {
|
|
19181
20148
|
vchart.registerCartesianTimeAxis();
|
|
19182
20149
|
const AxisCls = vchart.Factory.getComponentInKey(vchart.CartesianTimeAxis.type);
|
|
19183
20150
|
AxisCls.builtInTheme = Object.assign(Object.assign({}, AxisCls.builtInTheme), { axisZ: Object.assign(Object.assign({}, AxisCls.builtInTheme.axisX), axisZ) });
|
|
19184
|
-
mixin(AxisCls, Axis3dMixin);
|
|
20151
|
+
mixin$1(AxisCls, Axis3dMixin);
|
|
19185
20152
|
};
|
|
19186
20153
|
|
|
19187
20154
|
const registerAxis3dPlugin = () => {
|
|
@@ -19340,7 +20307,7 @@
|
|
|
19340
20307
|
const svg = chartSpec.svg;
|
|
19341
20308
|
const elements = (_c = (_b = svgSourceMap.get(svg)) === null || _b === void 0 ? void 0 : _b.latestData) === null || _c === void 0 ? void 0 : _c.elements;
|
|
19342
20309
|
if (elements && elements.length) {
|
|
19343
|
-
const names = elements.map(e => e.name).filter(n => isValid$
|
|
20310
|
+
const names = elements.map(e => e.name).filter(n => isValid$3(n));
|
|
19344
20311
|
names.forEach(name => {
|
|
19345
20312
|
if (chartSpec[name]) {
|
|
19346
20313
|
spec[name] = chartSpec[name];
|
|
@@ -19401,7 +20368,7 @@
|
|
|
19401
20368
|
return e.node.name;
|
|
19402
20369
|
}
|
|
19403
20370
|
start(itemKey) {
|
|
19404
|
-
if (isNil$
|
|
20371
|
+
if (isNil$3(itemKey)) {
|
|
19405
20372
|
return;
|
|
19406
20373
|
}
|
|
19407
20374
|
const { interaction, highlightState, blurState } = this.options;
|
|
@@ -19456,7 +20423,7 @@
|
|
|
19456
20423
|
|
|
19457
20424
|
function isValidStrokeOrFill(attr) {
|
|
19458
20425
|
var _a;
|
|
19459
|
-
return isValid$
|
|
20426
|
+
return isValid$3(attr) && attr !== 'none' && !((_a = attr.includes) === null || _a === void 0 ? void 0 : _a.call(attr, 'url'));
|
|
19460
20427
|
}
|
|
19461
20428
|
const getLineWidth = (attributes) => {
|
|
19462
20429
|
const strokeWidth = parseFloat(attributes.strokeWidth);
|
|
@@ -19537,10 +20504,10 @@
|
|
|
19537
20504
|
visible: el.attributes.visibility !== 'hidden' && el.attributes.visibility !== 'collapse'
|
|
19538
20505
|
};
|
|
19539
20506
|
if (el.graphicType === 'text') {
|
|
19540
|
-
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);
|
|
19541
20508
|
}
|
|
19542
20509
|
else if (el.graphicType !== 'group') {
|
|
19543
|
-
merge(finalAttributes, el._inheritStyle, el.attributes);
|
|
20510
|
+
merge$1(finalAttributes, el._inheritStyle, el.attributes);
|
|
19544
20511
|
}
|
|
19545
20512
|
if (graphicAttributeTransform[type]) {
|
|
19546
20513
|
el._finalAttributes = graphicAttributeTransform[type](finalAttributes, el.value);
|
|
@@ -19641,7 +20608,7 @@
|
|
|
19641
20608
|
}
|
|
19642
20609
|
_defaultSelectConfig(finalSelectSpec) {
|
|
19643
20610
|
const isMultiple = finalSelectSpec.mode === 'multiple';
|
|
19644
|
-
const triggerOff = isValid$
|
|
20611
|
+
const triggerOff = isValid$3(finalSelectSpec.triggerOff)
|
|
19645
20612
|
? finalSelectSpec.triggerOff
|
|
19646
20613
|
: isMultiple
|
|
19647
20614
|
? ['empty', 'self']
|
|
@@ -19750,10 +20717,10 @@
|
|
|
19750
20717
|
if (mark) {
|
|
19751
20718
|
this.setMarkStyle(mark, { keepStrokeScale: true }, 'normal', vchart.AttributeLevel.Built_In);
|
|
19752
20719
|
if (valid) {
|
|
19753
|
-
this.initMarkStyleWithSpec(mark, merge({}, this._spec.pictogram, this._spec[mark.name]));
|
|
20720
|
+
this.initMarkStyleWithSpec(mark, merge$1({}, this._spec.pictogram, this._spec[mark.name]));
|
|
19754
20721
|
this.setMarkStyle(mark, attributes, 'normal', vchart.AttributeLevel.Series);
|
|
19755
20722
|
mark.setPostProcess('fill', (result, datum) => {
|
|
19756
|
-
return isValid$
|
|
20723
|
+
return isValid$3(result) ? result : this._spec.defaultFillColor;
|
|
19757
20724
|
});
|
|
19758
20725
|
}
|
|
19759
20726
|
else {
|
|
@@ -19787,7 +20754,7 @@
|
|
|
19787
20754
|
if (!mark || mark.length === 0) {
|
|
19788
20755
|
return null;
|
|
19789
20756
|
}
|
|
19790
|
-
let bounds = new Bounds();
|
|
20757
|
+
let bounds = new Bounds$1();
|
|
19791
20758
|
if (global) {
|
|
19792
20759
|
mark.forEach(m => {
|
|
19793
20760
|
bounds = bounds.union(m.getGraphics()[0].globalAABBBounds);
|
|
@@ -19912,7 +20879,7 @@
|
|
|
19912
20879
|
if (root) {
|
|
19913
20880
|
if (!root.attribute.postMatrix) {
|
|
19914
20881
|
root.setAttributes({
|
|
19915
|
-
postMatrix: new Matrix()
|
|
20882
|
+
postMatrix: new Matrix$1()
|
|
19916
20883
|
});
|
|
19917
20884
|
}
|
|
19918
20885
|
root.scale(scale, scale, scaleCenter);
|
|
@@ -19927,7 +20894,7 @@
|
|
|
19927
20894
|
if (root) {
|
|
19928
20895
|
if (!root.attribute.postMatrix) {
|
|
19929
20896
|
root.setAttributes({
|
|
19930
|
-
postMatrix: new Matrix()
|
|
20897
|
+
postMatrix: new Matrix$1()
|
|
19931
20898
|
});
|
|
19932
20899
|
}
|
|
19933
20900
|
root.translate(delta[0], delta[1]);
|
|
@@ -20155,7 +21122,7 @@
|
|
|
20155
21122
|
g = imageData.data[y * width * 4 + 4 * x + 1],
|
|
20156
21123
|
b = imageData.data[y * width * 4 + 4 * x + 2];
|
|
20157
21124
|
if (255 === r && 255 === g && 255 === b) return !invert;
|
|
20158
|
-
if (isValidNumber$
|
|
21125
|
+
if (isValidNumber$3(threshold)) {
|
|
20159
21126
|
const grayValue = .3 * r + .59 * g + .11 * b;
|
|
20160
21127
|
return invert ? grayValue <= threshold : grayValue >= threshold;
|
|
20161
21128
|
}
|
|
@@ -20210,7 +21177,7 @@
|
|
|
20210
21177
|
ctx.font = `${fontStyle} ${fontVariant} ${fontWeight} ${baseFontSize}px ${fontFamily}`, ctx.textAlign = "center", ctx.textBaseline = "middle", ctx.fillStyle = fillColor;
|
|
20211
21178
|
const textMetrics = ctx.measureText(text),
|
|
20212
21179
|
scale = "normal" !== fontStyle ? 1.1 : 1,
|
|
20213
|
-
actualWidth = isValid$
|
|
21180
|
+
actualWidth = isValid$3(textMetrics.actualBoundingBoxRight) && isValid$3(textMetrics.actualBoundingBoxLeft) ? Math.ceil(scale * (Math.abs(textMetrics.actualBoundingBoxRight) + Math.abs(textMetrics.actualBoundingBoxLeft))) : 0,
|
|
20214
21181
|
textWidth = Math.max(Math.ceil(textMetrics.width), actualWidth, baseFontSize);
|
|
20215
21182
|
if (hollow && (ctx.globalCompositeOperation = "xor"), textWidth > width) {
|
|
20216
21183
|
const scale = Math.min(width / textWidth, height / baseFontSize);
|
|
@@ -20467,7 +21434,7 @@
|
|
|
20467
21434
|
}
|
|
20468
21435
|
|
|
20469
21436
|
function loadImage(url, createImage) {
|
|
20470
|
-
return url && (isValidUrl$
|
|
21437
|
+
return url && (isValidUrl$3(url) || isBase64$3(url) || url.startsWith("<svg")) ? new Promise((resolve, reject) => {
|
|
20471
21438
|
var _a;
|
|
20472
21439
|
const imageMark = createImage({
|
|
20473
21440
|
image: url
|
|
@@ -20535,18 +21502,18 @@
|
|
|
20535
21502
|
this._rangeFactorStart = null, this._rangeFactorEnd = null;
|
|
20536
21503
|
}
|
|
20537
21504
|
_calculateWholeRange(range) {
|
|
20538
|
-
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;
|
|
20539
21506
|
}
|
|
20540
21507
|
rangeFactor(_, slience, clear) {
|
|
20541
|
-
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;
|
|
20542
21509
|
}
|
|
20543
21510
|
rangeFactorStart(_, slience) {
|
|
20544
21511
|
var _a;
|
|
20545
|
-
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);
|
|
20546
21513
|
}
|
|
20547
21514
|
rangeFactorEnd(_, slience) {
|
|
20548
21515
|
var _a;
|
|
20549
|
-
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);
|
|
20550
21517
|
}
|
|
20551
21518
|
generateFishEyeTransform() {
|
|
20552
21519
|
var _a;
|
|
@@ -20561,8 +21528,8 @@
|
|
|
20561
21528
|
last = range[range.length - 1],
|
|
20562
21529
|
min = Math.min(first, last),
|
|
20563
21530
|
max = Math.max(first, last),
|
|
20564
|
-
focus = clamp$
|
|
20565
|
-
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;
|
|
20566
21533
|
let k0 = Math.exp(distortion);
|
|
20567
21534
|
k0 = k0 / (k0 - 1) * rangeRadius;
|
|
20568
21535
|
const k1 = distortion / rangeRadius;
|
|
@@ -20589,16 +21556,16 @@
|
|
|
20589
21556
|
function interpolate(a, b) {
|
|
20590
21557
|
const t = typeof b;
|
|
20591
21558
|
let c;
|
|
20592
|
-
if (isNil$
|
|
21559
|
+
if (isNil$3(b) || "boolean" === t) return () => b;
|
|
20593
21560
|
if ("number" === t) return interpolateNumber$1(a, b);
|
|
20594
21561
|
if ("string" === t) {
|
|
20595
|
-
if (c = Color.parseColorString(b)) {
|
|
20596
|
-
const rgb = interpolateRgb(Color.parseColorString(a), c);
|
|
21562
|
+
if (c = Color$1.parseColorString(b)) {
|
|
21563
|
+
const rgb = interpolateRgb(Color$1.parseColorString(a), c);
|
|
20597
21564
|
return t => rgb(t).formatRgb();
|
|
20598
21565
|
}
|
|
20599
21566
|
return interpolateNumber$1(Number(a), Number(b));
|
|
20600
21567
|
}
|
|
20601
|
-
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));
|
|
20602
21569
|
}
|
|
20603
21570
|
|
|
20604
21571
|
class ContinuousScale extends BaseScale {
|
|
@@ -20607,7 +21574,7 @@
|
|
|
20607
21574
|
}
|
|
20608
21575
|
calculateVisibleDomain(range) {
|
|
20609
21576
|
var _a;
|
|
20610
|
-
if (isValid$
|
|
21577
|
+
if (isValid$3(this._rangeFactorStart) && isValid$3(this._rangeFactorEnd) && 2 === range.length) {
|
|
20611
21578
|
return [this.invert(range[0]), this.invert(range[1])];
|
|
20612
21579
|
}
|
|
20613
21580
|
return null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain;
|
|
@@ -20679,10 +21646,10 @@
|
|
|
20679
21646
|
return _ ? (super.rangeFactor(_), this._output = this._input = null, this) : super.rangeFactor();
|
|
20680
21647
|
}
|
|
20681
21648
|
rangeFactorStart(_, slience) {
|
|
20682
|
-
return isNil$
|
|
21649
|
+
return isNil$3(_) ? super.rangeFactorStart() : (super.rangeFactorStart(_), this._output = this._input = null, this);
|
|
20683
21650
|
}
|
|
20684
21651
|
rangeFactorEnd(_, slience) {
|
|
20685
|
-
return isNil$
|
|
21652
|
+
return isNil$3(_) ? super.rangeFactorEnd() : (super.rangeFactorEnd(_), this._output = this._input = null, this);
|
|
20686
21653
|
}
|
|
20687
21654
|
forceAlignDomainRange(forceAlign) {
|
|
20688
21655
|
return arguments.length ? (this._forceAlign = forceAlign, this) : this._forceAlign;
|
|
@@ -20839,13 +21806,13 @@
|
|
|
20839
21806
|
}
|
|
20840
21807
|
}
|
|
20841
21808
|
function parseNiceOptions(originalDomain, option) {
|
|
20842
|
-
const hasForceMin = isNumber$
|
|
20843
|
-
hasForceMax = isNumber$
|
|
21809
|
+
const hasForceMin = isNumber$3(option.forceMin),
|
|
21810
|
+
hasForceMax = isNumber$3(option.forceMax);
|
|
20844
21811
|
let niceType = null;
|
|
20845
21812
|
const niceMinMax = [];
|
|
20846
21813
|
let niceDomain = null;
|
|
20847
21814
|
const domainValidator = hasForceMin && hasForceMax ? x => x >= option.forceMin && x <= option.forceMax : hasForceMin ? x => x >= option.forceMin : hasForceMax ? x => x <= option.forceMax : null;
|
|
20848
|
-
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", {
|
|
20849
21816
|
niceType: niceType,
|
|
20850
21817
|
niceDomain: niceDomain,
|
|
20851
21818
|
niceMinMax: niceMinMax,
|
|
@@ -20871,8 +21838,8 @@
|
|
|
20871
21838
|
}
|
|
20872
21839
|
ticks(count = 10, options) {
|
|
20873
21840
|
var _a;
|
|
20874
|
-
if (isFunction$
|
|
20875
|
-
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);
|
|
20876
21843
|
const curNiceDomain = null !== (_a = this._niceDomain) && void 0 !== _a ? _a : this._domain,
|
|
20877
21844
|
originalDomain = this._domain,
|
|
20878
21845
|
start = curNiceDomain[0],
|
|
@@ -21007,7 +21974,7 @@
|
|
|
21007
21974
|
});
|
|
21008
21975
|
tempCtx.textAlign = "center", tempCtx.textBaseline = "middle", segmentationInput.tempCanvas = tempCanvas;
|
|
21009
21976
|
const boardW = size[0] + 31 >> 5 << 5;
|
|
21010
|
-
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)) {
|
|
21011
21978
|
segmentationInput.isEmptyPixel = generateIsEmptyPixel(void 0, {
|
|
21012
21979
|
threshold: null !== (_d = null === (_c = options.maskConfig) || void 0 === _c ? void 0 : _c.threshold) && void 0 !== _d ? _d : 200,
|
|
21013
21980
|
invert: null === (_e = options.maskConfig) || void 0 === _e ? void 0 : _e.invert
|
|
@@ -21043,7 +22010,7 @@
|
|
|
21043
22010
|
imagesPromise ? imagesPromise.then(images => {
|
|
21044
22011
|
this.onImageCollageInputReady(images), this.isImagesFinished = !0;
|
|
21045
22012
|
}).catch(error => {
|
|
21046
|
-
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);
|
|
21047
22014
|
}) : (this.isImagesFinished = !0, this.isLayoutFinished = !0);
|
|
21048
22015
|
}
|
|
21049
22016
|
canAnimate() {
|
|
@@ -21073,13 +22040,13 @@
|
|
|
21073
22040
|
imageSizeRange: imageSizeRange,
|
|
21074
22041
|
padding = 0
|
|
21075
22042
|
} = imageConfig,
|
|
21076
|
-
imageSize = isNumber$
|
|
22043
|
+
imageSize = isNumber$3(imageConfig.imageSize) ? imageConfig.imageSize : field(imageConfig.imageSize),
|
|
21077
22044
|
size = this.options.size;
|
|
21078
22045
|
if (imageSize || imageSizeRange) {
|
|
21079
|
-
if (imageSize && !isFunction$
|
|
22046
|
+
if (imageSize && !isFunction$3(imageSize)) images.forEach(img => setSize(img, imageSize));else if (imageSizeRange) {
|
|
21080
22047
|
const sizeScale = new SqrtScale().domain(extent(images, d => d.weight)).range(imageSizeRange);
|
|
21081
22048
|
images.forEach(img => setSize(img, ~~sizeScale.scale(img.weight)));
|
|
21082
|
-
} else if (imageSize && isFunction$
|
|
22049
|
+
} else if (imageSize && isFunction$3(imageSize) && !imageSizeRange) {
|
|
21083
22050
|
const a = .5,
|
|
21084
22051
|
[min, max] = extent(images, d => d.weight),
|
|
21085
22052
|
picArea = images.reduce((prev, img) => {
|
|
@@ -21608,11 +22575,11 @@
|
|
|
21608
22575
|
|
|
21609
22576
|
const transform = (options, upstreamData, parameters) => {
|
|
21610
22577
|
var _a, _b;
|
|
21611
|
-
const size = isFunction$
|
|
21612
|
-
if (options.size = size, !size || isNil$
|
|
21613
|
-
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"), [];
|
|
21614
22581
|
}
|
|
21615
|
-
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 [];
|
|
21616
22583
|
let layoutConstructor;
|
|
21617
22584
|
switch (null !== (_b = null === (_a = options.layoutConfig) || void 0 === _a ? void 0 : _a.layoutMode) && void 0 !== _b ? _b : "spiral") {
|
|
21618
22585
|
case "grid":
|
|
@@ -21638,7 +22605,7 @@
|
|
|
21638
22605
|
}
|
|
21639
22606
|
onBind() {
|
|
21640
22607
|
this._scaleX = this.target.attribute.scaleX;
|
|
21641
|
-
if (!isValidNumber$
|
|
22608
|
+
if (!isValidNumber$3(this._rotations)) {
|
|
21642
22609
|
this.valid = false;
|
|
21643
22610
|
}
|
|
21644
22611
|
}
|
|
@@ -21754,7 +22721,7 @@
|
|
|
21754
22721
|
this.type = IMAGE_CLOUD_SERIES_TYPE;
|
|
21755
22722
|
}
|
|
21756
22723
|
setValueField(field) {
|
|
21757
|
-
if (isValid$
|
|
22724
|
+
if (isValid$3(field)) {
|
|
21758
22725
|
this._valueField = field;
|
|
21759
22726
|
}
|
|
21760
22727
|
}
|
|
@@ -21974,6 +22941,536 @@
|
|
|
21974
22941
|
vchart.Factory.registerChart(ImageCloudChart.type, ImageCloudChart);
|
|
21975
22942
|
};
|
|
21976
22943
|
|
|
22944
|
+
class CandlestickChartSpecTransformer extends vchart.CartesianChartSpecTransformer {
|
|
22945
|
+
_getDefaultSeriesSpec(spec) {
|
|
22946
|
+
const dataFields = [spec.openField, spec.highField, spec.lowField, spec.closeField];
|
|
22947
|
+
const seriesSpec = super._getDefaultSeriesSpec(spec, [
|
|
22948
|
+
'candlestick',
|
|
22949
|
+
'openField',
|
|
22950
|
+
'highField',
|
|
22951
|
+
'lowField',
|
|
22952
|
+
'closeField',
|
|
22953
|
+
'rising',
|
|
22954
|
+
'falling',
|
|
22955
|
+
'doji'
|
|
22956
|
+
]);
|
|
22957
|
+
seriesSpec.yField = dataFields;
|
|
22958
|
+
return seriesSpec;
|
|
22959
|
+
}
|
|
22960
|
+
transformSpec(spec) {
|
|
22961
|
+
super.transformSpec(spec);
|
|
22962
|
+
if (!spec.axes) {
|
|
22963
|
+
spec.axes = [
|
|
22964
|
+
{
|
|
22965
|
+
orient: 'bottom'
|
|
22966
|
+
},
|
|
22967
|
+
{
|
|
22968
|
+
orient: 'left'
|
|
22969
|
+
}
|
|
22970
|
+
];
|
|
22971
|
+
}
|
|
22972
|
+
vchart.setDefaultCrosshairForCartesianChart(spec);
|
|
22973
|
+
}
|
|
22974
|
+
}
|
|
22975
|
+
|
|
22976
|
+
const CANDLESTICK_MARK_TYPE = 'candlestick';
|
|
22977
|
+
class CandlestickMark extends vchart.GlyphMark {
|
|
22978
|
+
constructor() {
|
|
22979
|
+
super(...arguments);
|
|
22980
|
+
this.type = CandlestickMark.type;
|
|
22981
|
+
}
|
|
22982
|
+
setGlyphConfig(cfg) {
|
|
22983
|
+
super.setGlyphConfig(cfg);
|
|
22984
|
+
this._subMarks = {
|
|
22985
|
+
line: { type: 'line', defaultAttributes: { x: 0, y: 0 } },
|
|
22986
|
+
box: { type: 'rect' }
|
|
22987
|
+
};
|
|
22988
|
+
this._positionChannels = ['x', 'boxWidth', 'open', 'close', 'high', 'low'];
|
|
22989
|
+
this._channelEncoder = null;
|
|
22990
|
+
this._positionEncoder = (glyphAttrs, datum, g) => {
|
|
22991
|
+
const { x = g.attribute.x, boxWidth = g.attribute.boxWidth, open = g.attribute.open, close = g.attribute.close, low = g.attribute.low, high = g.attribute.high } = glyphAttrs;
|
|
22992
|
+
const attributes = {};
|
|
22993
|
+
attributes.line = {
|
|
22994
|
+
points: [
|
|
22995
|
+
{
|
|
22996
|
+
x: x,
|
|
22997
|
+
y: low
|
|
22998
|
+
},
|
|
22999
|
+
{
|
|
23000
|
+
x: x,
|
|
23001
|
+
y: high
|
|
23002
|
+
}
|
|
23003
|
+
]
|
|
23004
|
+
};
|
|
23005
|
+
attributes.box = {
|
|
23006
|
+
x: x - boxWidth / 2,
|
|
23007
|
+
x1: x + boxWidth / 2,
|
|
23008
|
+
y: Math.min(open, close),
|
|
23009
|
+
y1: Math.max(open, close),
|
|
23010
|
+
drawStrokeWhenZeroWH: true
|
|
23011
|
+
};
|
|
23012
|
+
return attributes;
|
|
23013
|
+
};
|
|
23014
|
+
}
|
|
23015
|
+
_getDefaultStyle() {
|
|
23016
|
+
const defaultStyle = Object.assign({}, super._getDefaultStyle());
|
|
23017
|
+
return defaultStyle;
|
|
23018
|
+
}
|
|
23019
|
+
}
|
|
23020
|
+
CandlestickMark.type = CANDLESTICK_MARK_TYPE;
|
|
23021
|
+
const registerCandlestickMark = () => {
|
|
23022
|
+
vchart.registerGlyphMark();
|
|
23023
|
+
registerLine();
|
|
23024
|
+
registerRect();
|
|
23025
|
+
vchart.Factory.registerGraphicComponent('line', (attrs) => createLine(attrs));
|
|
23026
|
+
vchart.Factory.registerGraphicComponent('rect', (attrs) => createRect(attrs));
|
|
23027
|
+
vchart.Factory.registerMark(CandlestickMark.type, CandlestickMark);
|
|
23028
|
+
};
|
|
23029
|
+
|
|
23030
|
+
const scaleIn = () => {
|
|
23031
|
+
return (graphic) => {
|
|
23032
|
+
const finalAttribute = graphic.getFinalAttribute();
|
|
23033
|
+
const { x, y, open, high, low, close } = finalAttribute;
|
|
23034
|
+
const animateAttributes = { from: { x, y }, to: { x, y } };
|
|
23035
|
+
if (isValidNumber$3(open) && isValidNumber$3(close)) {
|
|
23036
|
+
if (open > close) {
|
|
23037
|
+
animateAttributes.from.open = low;
|
|
23038
|
+
animateAttributes.to.open = open;
|
|
23039
|
+
animateAttributes.from.close = low;
|
|
23040
|
+
animateAttributes.to.close = close;
|
|
23041
|
+
if (isValidNumber$3(high)) {
|
|
23042
|
+
animateAttributes.from.high = low;
|
|
23043
|
+
animateAttributes.to.high = high;
|
|
23044
|
+
}
|
|
23045
|
+
}
|
|
23046
|
+
else {
|
|
23047
|
+
animateAttributes.from.open = high;
|
|
23048
|
+
animateAttributes.to.open = open;
|
|
23049
|
+
animateAttributes.from.close = high;
|
|
23050
|
+
animateAttributes.to.close = close;
|
|
23051
|
+
if (isValidNumber$3(low)) {
|
|
23052
|
+
animateAttributes.from.low = high;
|
|
23053
|
+
animateAttributes.to.low = low;
|
|
23054
|
+
}
|
|
23055
|
+
}
|
|
23056
|
+
}
|
|
23057
|
+
return animateAttributes;
|
|
23058
|
+
};
|
|
23059
|
+
};
|
|
23060
|
+
const scaleOut = () => {
|
|
23061
|
+
return (graphic) => {
|
|
23062
|
+
const finalAttribute = graphic.getFinalAttribute();
|
|
23063
|
+
const { x, y, open, high, low, close } = finalAttribute;
|
|
23064
|
+
const animateAttributes = { from: { x, y }, to: { x, y } };
|
|
23065
|
+
if (isValidNumber$3(open) && isValidNumber$3(close)) {
|
|
23066
|
+
if (open > close) {
|
|
23067
|
+
animateAttributes.from.open = open;
|
|
23068
|
+
animateAttributes.to.open = low;
|
|
23069
|
+
animateAttributes.from.close = close;
|
|
23070
|
+
animateAttributes.to.close = low;
|
|
23071
|
+
if (isValidNumber$3(high)) {
|
|
23072
|
+
animateAttributes.from.high = high;
|
|
23073
|
+
animateAttributes.to.high = low;
|
|
23074
|
+
}
|
|
23075
|
+
}
|
|
23076
|
+
else {
|
|
23077
|
+
animateAttributes.from.open = open;
|
|
23078
|
+
animateAttributes.to.open = high;
|
|
23079
|
+
animateAttributes.from.close = close;
|
|
23080
|
+
animateAttributes.to.close = high;
|
|
23081
|
+
if (isValidNumber$3(low)) {
|
|
23082
|
+
animateAttributes.from.low = low;
|
|
23083
|
+
animateAttributes.to.low = high;
|
|
23084
|
+
}
|
|
23085
|
+
}
|
|
23086
|
+
}
|
|
23087
|
+
return animateAttributes;
|
|
23088
|
+
};
|
|
23089
|
+
};
|
|
23090
|
+
class CandlestickScaleIn extends ACustomAnimate {
|
|
23091
|
+
constructor(from, to, duration, easing, params) {
|
|
23092
|
+
super(from, to, duration, easing, params);
|
|
23093
|
+
}
|
|
23094
|
+
onBind() {
|
|
23095
|
+
super.onBind();
|
|
23096
|
+
const finalAttribute = this.target.getFinalAttribute();
|
|
23097
|
+
if (finalAttribute) {
|
|
23098
|
+
this.target.setAttributes(finalAttribute);
|
|
23099
|
+
}
|
|
23100
|
+
const { from, to } = this.computeAttribute();
|
|
23101
|
+
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
23102
|
+
this.animate.reSyncProps();
|
|
23103
|
+
this.from = from;
|
|
23104
|
+
this.to = to;
|
|
23105
|
+
this.target.setAttributes(this.from);
|
|
23106
|
+
}
|
|
23107
|
+
computeAttribute() {
|
|
23108
|
+
const attr = scaleIn()(this.target, this.params, this.params.options);
|
|
23109
|
+
return attr;
|
|
23110
|
+
}
|
|
23111
|
+
onUpdate(end, ratio, out) {
|
|
23112
|
+
const attribute = this.target.attribute;
|
|
23113
|
+
this.propKeys.forEach(key => {
|
|
23114
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
23115
|
+
});
|
|
23116
|
+
this.target.setAttributes(attribute);
|
|
23117
|
+
}
|
|
23118
|
+
}
|
|
23119
|
+
class CandlestickScaleOut extends ACustomAnimate {
|
|
23120
|
+
constructor(from, to, duration, easing, params) {
|
|
23121
|
+
super(from, to, duration, easing, params);
|
|
23122
|
+
}
|
|
23123
|
+
onBind() {
|
|
23124
|
+
var _a;
|
|
23125
|
+
if ((_a = this.params) === null || _a === void 0 ? void 0 : _a.diffAttrs) {
|
|
23126
|
+
this.target.setAttributes(this.params.diffAttrs);
|
|
23127
|
+
}
|
|
23128
|
+
const { from, to } = this.computeAttribute();
|
|
23129
|
+
this.propKeys = Object.keys(to).filter(key => to[key] != null);
|
|
23130
|
+
this.animate.reSyncProps();
|
|
23131
|
+
this.from = from;
|
|
23132
|
+
this.to = to;
|
|
23133
|
+
this.target.setAttributes(this.from);
|
|
23134
|
+
}
|
|
23135
|
+
computeAttribute() {
|
|
23136
|
+
const attr = scaleOut()(this.target, this.params, this.params.options);
|
|
23137
|
+
return attr;
|
|
23138
|
+
}
|
|
23139
|
+
onUpdate(end, ratio, out) {
|
|
23140
|
+
const attribute = this.target.attribute;
|
|
23141
|
+
this.propKeys.forEach(key => {
|
|
23142
|
+
attribute[key] = this.from[key] + (this.to[key] - this.from[key]) * ratio;
|
|
23143
|
+
});
|
|
23144
|
+
this.target.setAttributes(attribute);
|
|
23145
|
+
}
|
|
23146
|
+
}
|
|
23147
|
+
const registerCandlestickScaleAnimation = () => {
|
|
23148
|
+
AnimateExecutor.registerBuiltInAnimate('candlestickScaleIn', CandlestickScaleIn);
|
|
23149
|
+
AnimateExecutor.registerBuiltInAnimate('candlestickScaleOut', CandlestickScaleOut);
|
|
23150
|
+
};
|
|
23151
|
+
|
|
23152
|
+
const CANDLESTICK_CHART_TYPE = 'candlestick';
|
|
23153
|
+
const CANDLESTICK_SERIES_TYPE = 'candlestick';
|
|
23154
|
+
var CANDLESTICK_TOOLTIP_KEYS;
|
|
23155
|
+
(function (CANDLESTICK_TOOLTIP_KEYS) {
|
|
23156
|
+
CANDLESTICK_TOOLTIP_KEYS["OPEN"] = "open";
|
|
23157
|
+
CANDLESTICK_TOOLTIP_KEYS["HIGH"] = "high";
|
|
23158
|
+
CANDLESTICK_TOOLTIP_KEYS["LOW"] = "low";
|
|
23159
|
+
CANDLESTICK_TOOLTIP_KEYS["CLOSE"] = "close";
|
|
23160
|
+
CANDLESTICK_TOOLTIP_KEYS["SERIES_FIELD"] = "seriesField";
|
|
23161
|
+
})(CANDLESTICK_TOOLTIP_KEYS || (CANDLESTICK_TOOLTIP_KEYS = {}));
|
|
23162
|
+
var CandlestickMarkNameEnum;
|
|
23163
|
+
(function (CandlestickMarkNameEnum) {
|
|
23164
|
+
CandlestickMarkNameEnum["candlestick"] = "candlestick";
|
|
23165
|
+
})(CandlestickMarkNameEnum || (CandlestickMarkNameEnum = {}));
|
|
23166
|
+
const CandlestickSeriesMark = Object.assign(Object.assign({}, vchart.baseSeriesMark), { ["candlestick"]: { name: "candlestick", type: 'candlestick' } });
|
|
23167
|
+
|
|
23168
|
+
class CandlestickSeriesTooltipHelper extends vchart.BaseSeriesTooltipHelper {
|
|
23169
|
+
constructor() {
|
|
23170
|
+
super(...arguments);
|
|
23171
|
+
this.getContentKey = (contentType) => (datum) => {
|
|
23172
|
+
switch (contentType) {
|
|
23173
|
+
case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
|
|
23174
|
+
const openField = this.series.getOpenField();
|
|
23175
|
+
return openField;
|
|
23176
|
+
}
|
|
23177
|
+
case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
|
|
23178
|
+
const highField = this.series.getHighField();
|
|
23179
|
+
return highField;
|
|
23180
|
+
}
|
|
23181
|
+
case CANDLESTICK_TOOLTIP_KEYS.LOW: {
|
|
23182
|
+
const lowField = this.series.getLowField();
|
|
23183
|
+
return lowField;
|
|
23184
|
+
}
|
|
23185
|
+
case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
|
|
23186
|
+
const closeField = this.series.getCloseField();
|
|
23187
|
+
return closeField;
|
|
23188
|
+
}
|
|
23189
|
+
case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
|
|
23190
|
+
const seriesField = this.series.getSeriesField();
|
|
23191
|
+
return seriesField;
|
|
23192
|
+
}
|
|
23193
|
+
}
|
|
23194
|
+
return null;
|
|
23195
|
+
};
|
|
23196
|
+
this.getContentValue = (contentType) => (datum) => {
|
|
23197
|
+
switch (contentType) {
|
|
23198
|
+
case CANDLESTICK_TOOLTIP_KEYS.OPEN: {
|
|
23199
|
+
const openField = this.series.getOpenField();
|
|
23200
|
+
return datum[openField];
|
|
23201
|
+
}
|
|
23202
|
+
case CANDLESTICK_TOOLTIP_KEYS.HIGH: {
|
|
23203
|
+
const highField = this.series.getHighField();
|
|
23204
|
+
return datum[highField];
|
|
23205
|
+
}
|
|
23206
|
+
case CANDLESTICK_TOOLTIP_KEYS.LOW: {
|
|
23207
|
+
const lowField = this.series.getLowField();
|
|
23208
|
+
return datum[lowField];
|
|
23209
|
+
}
|
|
23210
|
+
case CANDLESTICK_TOOLTIP_KEYS.CLOSE: {
|
|
23211
|
+
const closeField = this.series.getCloseField();
|
|
23212
|
+
return datum[closeField];
|
|
23213
|
+
}
|
|
23214
|
+
case CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD: {
|
|
23215
|
+
const seriesField = this.series.getSeriesField();
|
|
23216
|
+
return datum[seriesField];
|
|
23217
|
+
}
|
|
23218
|
+
}
|
|
23219
|
+
return null;
|
|
23220
|
+
};
|
|
23221
|
+
this.shapeColorCallback = (datum) => {
|
|
23222
|
+
return this.series.getMarkInName('candlestick').getAttribute('stroke', datum);
|
|
23223
|
+
};
|
|
23224
|
+
}
|
|
23225
|
+
getDefaultContentList(activeType) {
|
|
23226
|
+
return [
|
|
23227
|
+
{
|
|
23228
|
+
key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.OPEN),
|
|
23229
|
+
value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.OPEN)
|
|
23230
|
+
},
|
|
23231
|
+
{
|
|
23232
|
+
key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.HIGH),
|
|
23233
|
+
value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.HIGH)
|
|
23234
|
+
},
|
|
23235
|
+
{
|
|
23236
|
+
key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.LOW),
|
|
23237
|
+
value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.LOW)
|
|
23238
|
+
},
|
|
23239
|
+
{
|
|
23240
|
+
key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.CLOSE),
|
|
23241
|
+
value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.CLOSE)
|
|
23242
|
+
},
|
|
23243
|
+
{
|
|
23244
|
+
key: this.getContentKey(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD),
|
|
23245
|
+
value: this.getContentValue(CANDLESTICK_TOOLTIP_KEYS.SERIES_FIELD)
|
|
23246
|
+
}
|
|
23247
|
+
];
|
|
23248
|
+
}
|
|
23249
|
+
}
|
|
23250
|
+
|
|
23251
|
+
const getCandlestickTheme = () => {
|
|
23252
|
+
const res = {
|
|
23253
|
+
rising: {
|
|
23254
|
+
style: {
|
|
23255
|
+
boxFill: '#FF0000',
|
|
23256
|
+
stroke: '#FF0000'
|
|
23257
|
+
}
|
|
23258
|
+
},
|
|
23259
|
+
falling: {
|
|
23260
|
+
style: {
|
|
23261
|
+
boxFill: '#00AA00',
|
|
23262
|
+
stroke: '#00AA00'
|
|
23263
|
+
}
|
|
23264
|
+
},
|
|
23265
|
+
doji: {
|
|
23266
|
+
style: {
|
|
23267
|
+
boxFill: '#000000',
|
|
23268
|
+
stroke: '#000000'
|
|
23269
|
+
}
|
|
23270
|
+
},
|
|
23271
|
+
candlestick: {
|
|
23272
|
+
style: {
|
|
23273
|
+
lineWidth: 1
|
|
23274
|
+
}
|
|
23275
|
+
}
|
|
23276
|
+
};
|
|
23277
|
+
return res;
|
|
23278
|
+
};
|
|
23279
|
+
const candlestick = getCandlestickTheme();
|
|
23280
|
+
|
|
23281
|
+
class CandlestickSeries extends vchart.CartesianSeries {
|
|
23282
|
+
constructor() {
|
|
23283
|
+
super(...arguments);
|
|
23284
|
+
this.type = CANDLESTICK_SERIES_TYPE;
|
|
23285
|
+
this._mergedStyles = {
|
|
23286
|
+
rising: {},
|
|
23287
|
+
falling: {},
|
|
23288
|
+
doji: {}
|
|
23289
|
+
};
|
|
23290
|
+
}
|
|
23291
|
+
getOpenField() {
|
|
23292
|
+
return this._openField;
|
|
23293
|
+
}
|
|
23294
|
+
getHighField() {
|
|
23295
|
+
return this._highField;
|
|
23296
|
+
}
|
|
23297
|
+
getLowField() {
|
|
23298
|
+
return this._lowField;
|
|
23299
|
+
}
|
|
23300
|
+
getCloseField() {
|
|
23301
|
+
return this._closeField;
|
|
23302
|
+
}
|
|
23303
|
+
getBoxFill() {
|
|
23304
|
+
return this._boxFill;
|
|
23305
|
+
}
|
|
23306
|
+
getStrokeColor() {
|
|
23307
|
+
return this._strokeColor;
|
|
23308
|
+
}
|
|
23309
|
+
setAttrFromSpec() {
|
|
23310
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
23311
|
+
super.setAttrFromSpec();
|
|
23312
|
+
const spec = this._spec;
|
|
23313
|
+
const CandlestickStyle = (_b = (_a = spec.candlestick) === null || _a === void 0 ? void 0 : _a.style) !== null && _b !== void 0 ? _b : {};
|
|
23314
|
+
this._openField = spec.openField;
|
|
23315
|
+
this._highField = spec.highField;
|
|
23316
|
+
this._lowField = spec.lowField;
|
|
23317
|
+
this._closeField = spec.closeField;
|
|
23318
|
+
this._boxWidth = CandlestickStyle.boxWidth;
|
|
23319
|
+
this._boxFill = CandlestickStyle.boxFill;
|
|
23320
|
+
this._strokeColor = CandlestickStyle.strokeColor;
|
|
23321
|
+
this._buildMergedStyles(CandlestickStyle, (_d = (_c = spec.rising) === null || _c === void 0 ? void 0 : _c.style) !== null && _d !== void 0 ? _d : {}, (_f = (_e = spec.falling) === null || _e === void 0 ? void 0 : _e.style) !== null && _f !== void 0 ? _f : {}, (_h = (_g = spec.doji) === null || _g === void 0 ? void 0 : _g.style) !== null && _h !== void 0 ? _h : {});
|
|
23322
|
+
}
|
|
23323
|
+
initMark() {
|
|
23324
|
+
this._candlestickMark = this._createMark(CandlestickSeries.mark.candlestick, {
|
|
23325
|
+
groupKey: this._seriesField,
|
|
23326
|
+
isSeriesMark: true
|
|
23327
|
+
});
|
|
23328
|
+
}
|
|
23329
|
+
initMarkStyle() {
|
|
23330
|
+
var _a;
|
|
23331
|
+
const candlestickMark = this._candlestickMark;
|
|
23332
|
+
if (candlestickMark) {
|
|
23333
|
+
const CandlestickStyles = {
|
|
23334
|
+
fill: (datum) => {
|
|
23335
|
+
const boxFill = this.mergeStyle(datum).boxFill;
|
|
23336
|
+
return boxFill;
|
|
23337
|
+
},
|
|
23338
|
+
stroke: (datum) => {
|
|
23339
|
+
const strokeColor = this.mergeStyle(datum).stroke;
|
|
23340
|
+
return strokeColor;
|
|
23341
|
+
},
|
|
23342
|
+
lineWidth: (datum) => {
|
|
23343
|
+
const lineWidth = this.mergeStyle(datum).lineWidth;
|
|
23344
|
+
return lineWidth;
|
|
23345
|
+
},
|
|
23346
|
+
boxWidth: (_a = this._boxWidth) !== null && _a !== void 0 ? _a : this._getMarkWidth.bind(this),
|
|
23347
|
+
x: this.dataToPositionX.bind(this)
|
|
23348
|
+
};
|
|
23349
|
+
candlestickMark.setGlyphConfig({});
|
|
23350
|
+
this.setMarkStyle(candlestickMark, CandlestickStyles, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
|
|
23351
|
+
}
|
|
23352
|
+
}
|
|
23353
|
+
initCandlestickMarkStyle() {
|
|
23354
|
+
var _a;
|
|
23355
|
+
const candlestickMark = this._candlestickMark;
|
|
23356
|
+
const axisHelper = this._yAxisHelper;
|
|
23357
|
+
if (candlestickMark && axisHelper) {
|
|
23358
|
+
const { dataToPosition } = axisHelper;
|
|
23359
|
+
const scale = (_a = axisHelper === null || axisHelper === void 0 ? void 0 : axisHelper.getScale) === null || _a === void 0 ? void 0 : _a.call(axisHelper, 0);
|
|
23360
|
+
this.setMarkStyle(candlestickMark, {
|
|
23361
|
+
open: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._openField), {
|
|
23362
|
+
bandPosition: this._bandPosition
|
|
23363
|
+
}), scale),
|
|
23364
|
+
high: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._highField), {
|
|
23365
|
+
bandPosition: this._bandPosition
|
|
23366
|
+
}), scale),
|
|
23367
|
+
low: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._lowField), {
|
|
23368
|
+
bandPosition: this._bandPosition
|
|
23369
|
+
}), scale),
|
|
23370
|
+
close: (datum) => vchart.valueInScaleRange(dataToPosition(this.getDatumPositionValues(datum, this._closeField), {
|
|
23371
|
+
bandPosition: this._bandPosition
|
|
23372
|
+
}), scale)
|
|
23373
|
+
}, vchart.STATE_VALUE_ENUM.STATE_NORMAL, vchart.AttributeLevel.Series);
|
|
23374
|
+
}
|
|
23375
|
+
}
|
|
23376
|
+
init(option) {
|
|
23377
|
+
super.init(option);
|
|
23378
|
+
this.initCandlestickMarkStyle();
|
|
23379
|
+
}
|
|
23380
|
+
_initAnimationSpec(config = {}) {
|
|
23381
|
+
const newConfig = merge$1({}, config);
|
|
23382
|
+
['appear', 'enter', 'update', 'exit', 'disappear'].forEach(state => {
|
|
23383
|
+
if (newConfig[state] && newConfig[state].type === 'scaleIn') {
|
|
23384
|
+
newConfig[state].type = 'candlestickScaleIn';
|
|
23385
|
+
}
|
|
23386
|
+
else if (newConfig[state] && newConfig[state].type === 'scaleOut') {
|
|
23387
|
+
newConfig[state].type = 'candlestickScaleOut';
|
|
23388
|
+
}
|
|
23389
|
+
});
|
|
23390
|
+
return newConfig;
|
|
23391
|
+
}
|
|
23392
|
+
initAnimation() {
|
|
23393
|
+
var _a;
|
|
23394
|
+
const animationParams = vchart.getGroupAnimationParams(this);
|
|
23395
|
+
if (this._candlestickMark) {
|
|
23396
|
+
const newDefaultConfig = this._initAnimationSpec((_a = vchart.Factory.getAnimationInKey('scaleInOut')) === null || _a === void 0 ? void 0 : _a());
|
|
23397
|
+
const newConfig = this._initAnimationSpec(vchart.userAnimationConfig(CANDLESTICK_SERIES_TYPE, this._spec, this._markAttributeContext));
|
|
23398
|
+
this._candlestickMark.setAnimationConfig(vchart.animationConfig(newDefaultConfig, newConfig, animationParams));
|
|
23399
|
+
}
|
|
23400
|
+
}
|
|
23401
|
+
initTooltip() {
|
|
23402
|
+
this._tooltipHelper = new CandlestickSeriesTooltipHelper(this);
|
|
23403
|
+
this._candlestickMark && this._tooltipHelper.activeTriggerSet.mark.add(this._candlestickMark);
|
|
23404
|
+
}
|
|
23405
|
+
_buildMergedStyles(baseStyle, risingStyle, fallingStyle, 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);
|
|
23409
|
+
}
|
|
23410
|
+
mergeStyle(datum) {
|
|
23411
|
+
const open = this.getDatumPositionValues(datum, this._openField)[0];
|
|
23412
|
+
const close = this.getDatumPositionValues(datum, this._closeField)[0];
|
|
23413
|
+
if (open < close) {
|
|
23414
|
+
return this._mergedStyles.rising;
|
|
23415
|
+
}
|
|
23416
|
+
else if (open > close) {
|
|
23417
|
+
return this._mergedStyles.falling;
|
|
23418
|
+
}
|
|
23419
|
+
else {
|
|
23420
|
+
return this._mergedStyles.doji;
|
|
23421
|
+
}
|
|
23422
|
+
}
|
|
23423
|
+
_getMarkWidth() {
|
|
23424
|
+
if (this._autoBoxWidth) {
|
|
23425
|
+
return this._autoBoxWidth;
|
|
23426
|
+
}
|
|
23427
|
+
const bandAxisHelper = this._xAxisHelper;
|
|
23428
|
+
const xField = this._fieldX;
|
|
23429
|
+
const innerBandWidth = bandAxisHelper.getBandwidth(xField.length - 1);
|
|
23430
|
+
const autoBoxWidth = innerBandWidth / xField.length;
|
|
23431
|
+
this._autoBoxWidth = autoBoxWidth;
|
|
23432
|
+
return this._autoBoxWidth;
|
|
23433
|
+
}
|
|
23434
|
+
onLayoutEnd() {
|
|
23435
|
+
super.onLayoutEnd();
|
|
23436
|
+
this._autoBoxWidth = null;
|
|
23437
|
+
}
|
|
23438
|
+
getActiveMarks() {
|
|
23439
|
+
return [this._candlestickMark];
|
|
23440
|
+
}
|
|
23441
|
+
}
|
|
23442
|
+
CandlestickSeries.type = CANDLESTICK_SERIES_TYPE;
|
|
23443
|
+
CandlestickSeries.builtInTheme = { candlestick };
|
|
23444
|
+
CandlestickSeries.mark = CandlestickSeriesMark;
|
|
23445
|
+
const registerCandlestickSeries = () => {
|
|
23446
|
+
registerCandlestickMark();
|
|
23447
|
+
vchart.registerSymbolMark();
|
|
23448
|
+
vchart.registerScaleInOutAnimation();
|
|
23449
|
+
vchart.registerCartesianBandAxis();
|
|
23450
|
+
vchart.registerCartesianLinearAxis();
|
|
23451
|
+
registerCandlestickScaleAnimation();
|
|
23452
|
+
vchart.Factory.registerSeries(CandlestickSeries.type, CandlestickSeries);
|
|
23453
|
+
};
|
|
23454
|
+
|
|
23455
|
+
class CandlestickChart extends vchart.BaseChart {
|
|
23456
|
+
_setModelOption() {
|
|
23457
|
+
this._modelOption.getDimensionInfo = vchart.getCartesianDimensionInfo;
|
|
23458
|
+
this._modelOption.getDimensionInfoByValue = vchart.getDimensionInfoByValue;
|
|
23459
|
+
this._modelOption.getRectByDimensionData = vchart.getCartesianCrosshairRect;
|
|
23460
|
+
}
|
|
23461
|
+
}
|
|
23462
|
+
CandlestickChart.type = CANDLESTICK_CHART_TYPE;
|
|
23463
|
+
CandlestickChart.seriesType = CANDLESTICK_SERIES_TYPE;
|
|
23464
|
+
CandlestickChart.transformerConstructor = CandlestickChartSpecTransformer;
|
|
23465
|
+
const registerCandlestickChart = () => {
|
|
23466
|
+
vchart.registerDimensionTooltipProcessor();
|
|
23467
|
+
vchart.registerMarkTooltipProcessor();
|
|
23468
|
+
vchart.registerDimensionEvents();
|
|
23469
|
+
vchart.registerDimensionHover();
|
|
23470
|
+
registerCandlestickSeries();
|
|
23471
|
+
vchart.Factory.registerChart(CandlestickChart.type, CandlestickChart);
|
|
23472
|
+
};
|
|
23473
|
+
|
|
21977
23474
|
const GROUP_ATTRIBUTES = ["x", "y", "dx", "dy", "scaleX", "scaleY", "angle", "anchor", "postMatrix", "visible", "clip", "pickable", "childrenPickable", "zIndex", "cursor"];
|
|
21978
23475
|
class AbstractComponent extends Group {
|
|
21979
23476
|
constructor(attributes, options) {
|
|
@@ -23403,7 +24900,7 @@
|
|
|
23403
24900
|
render() {
|
|
23404
24901
|
this.removeAllChild();
|
|
23405
24902
|
const { data = [] } = this.attribute;
|
|
23406
|
-
if (isEmpty(data)) {
|
|
24903
|
+
if (isEmpty$1(data)) {
|
|
23407
24904
|
return;
|
|
23408
24905
|
}
|
|
23409
24906
|
const verticalData = [];
|
|
@@ -23472,7 +24969,7 @@
|
|
|
23472
24969
|
}));
|
|
23473
24970
|
breakGroup.name = 'series-break';
|
|
23474
24971
|
breakGroup.data = rest;
|
|
23475
|
-
if (isValid$
|
|
24972
|
+
if (isValid$3(rest.axisId)) {
|
|
23476
24973
|
breakGroup.id = `${(_a = rest.axisId) !== null && _a !== void 0 ? _a : ''}_${id}`;
|
|
23477
24974
|
}
|
|
23478
24975
|
this.add(breakGroup);
|
|
@@ -23527,9 +25024,9 @@
|
|
|
23527
25024
|
axesSpec.forEach((spec, index) => {
|
|
23528
25025
|
var _a, _b;
|
|
23529
25026
|
const axisId = spec.id;
|
|
23530
|
-
const axisModel = isValid$
|
|
25027
|
+
const axisModel = isValid$3(axisId)
|
|
23531
25028
|
? chart.getComponentByUserId(axisId)
|
|
23532
|
-
: axesIndex && isValid$
|
|
25029
|
+
: axesIndex && isValid$3(axesIndex[index])
|
|
23533
25030
|
? chart.getComponentByIndex('axes', axesIndex[index])
|
|
23534
25031
|
: (_a = chart.getComponentsByKey('axes').filter((axis) => {
|
|
23535
25032
|
const axisInnerSpec = axis.getSpec();
|
|
@@ -23540,7 +25037,7 @@
|
|
|
23540
25037
|
}
|
|
23541
25038
|
const parsedAxisId = axisId !== null && axisId !== void 0 ? axisId : `${axisModel.type}-${axisModel.id}`;
|
|
23542
25039
|
const regionBounds = getAllRegionBounds(axisModel.getRegions());
|
|
23543
|
-
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) => {
|
|
23544
25041
|
const { range, breakSymbol, gap = 5 } = breakConfig;
|
|
23545
25042
|
const pos1 = axisModel.valueToPosition(range[0]);
|
|
23546
25043
|
const pos2 = axisModel.valueToPosition(range[1]);
|
|
@@ -23724,7 +25221,7 @@
|
|
|
23724
25221
|
for (let index = 1; index < points.length; index++) {
|
|
23725
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]);
|
|
23726
25223
|
if (intersection &&
|
|
23727
|
-
!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))) {
|
|
23728
25225
|
intersections.push(intersection);
|
|
23729
25226
|
}
|
|
23730
25227
|
}
|
|
@@ -23801,7 +25298,7 @@
|
|
|
23801
25298
|
if ((_a = rawSpec.axes) === null || _a === void 0 ? void 0 : _a.length) {
|
|
23802
25299
|
const breakedAxes = rawSpec.axes.filter((axis) => axis.breaks && axis.breaks.length && axis.visible !== false);
|
|
23803
25300
|
if (breakedAxes.length) {
|
|
23804
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_BREAK);
|
|
25301
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_BREAK);
|
|
23805
25302
|
rawSpec.customMark.push(getSeriesBreakConfig(breakedAxes, breakedAxes.map((axisSpec) => {
|
|
23806
25303
|
return rawSpec.axes.indexOf(axisSpec);
|
|
23807
25304
|
})));
|
|
@@ -23820,7 +25317,7 @@
|
|
|
23820
25317
|
}
|
|
23821
25318
|
render() {
|
|
23822
25319
|
const { data, linkStyle, areaStyle, styleMap, label, linkType = 'total' } = this.attribute;
|
|
23823
|
-
if (isEmpty(data)) {
|
|
25320
|
+
if (isEmpty$1(data)) {
|
|
23824
25321
|
return;
|
|
23825
25322
|
}
|
|
23826
25323
|
this.removeAllChild();
|
|
@@ -24143,7 +25640,7 @@
|
|
|
24143
25640
|
};
|
|
24144
25641
|
}
|
|
24145
25642
|
function appendBarLinkConfig(rawSpec, barLinkSpec) {
|
|
24146
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== BAR_LINK);
|
|
25643
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== BAR_LINK);
|
|
24147
25644
|
rawSpec.customMark.push(getBarLinkConfig(barLinkSpec));
|
|
24148
25645
|
}
|
|
24149
25646
|
|
|
@@ -24341,7 +25838,7 @@
|
|
|
24341
25838
|
}
|
|
24342
25839
|
function appendSeriesLabelConfig(rawSpec, seriesLabelSpec) {
|
|
24343
25840
|
var _a, _b, _c;
|
|
24344
|
-
rawSpec.customMark = array(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_LABEL);
|
|
25841
|
+
rawSpec.customMark = array$1(rawSpec.customMark).filter((obj) => obj.componentType !== SERIES_LABEL);
|
|
24345
25842
|
if (!seriesLabelSpec) {
|
|
24346
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 : {};
|
|
24347
25844
|
}
|
|
@@ -24360,7 +25857,7 @@
|
|
|
24360
25857
|
var _a, _b, _c, _d;
|
|
24361
25858
|
this.removeAllChild();
|
|
24362
25859
|
const { data, layout, label, line = {} } = this.attribute;
|
|
24363
|
-
if (isEmpty(data)) {
|
|
25860
|
+
if (isEmpty$1(data)) {
|
|
24364
25861
|
return;
|
|
24365
25862
|
}
|
|
24366
25863
|
const labelStyleMap = (_a = label === null || label === void 0 ? void 0 : label.styleMap) !== null && _a !== void 0 ? _a : {};
|
|
@@ -24685,7 +26182,7 @@
|
|
|
24685
26182
|
}
|
|
24686
26183
|
static getSpecInfo(chartSpec) {
|
|
24687
26184
|
return vchart.getSpecInfo(chartSpec, this.specKey, this.type, (s) => {
|
|
24688
|
-
return s.visible && isValid$
|
|
26185
|
+
return s.visible && isValid$3(s.seriesId);
|
|
24689
26186
|
});
|
|
24690
26187
|
}
|
|
24691
26188
|
setAttrFromSpec() {
|
|
@@ -24884,7 +26381,7 @@
|
|
|
24884
26381
|
contentWidth += nameLabelWidth;
|
|
24885
26382
|
contentItemCount++;
|
|
24886
26383
|
}
|
|
24887
|
-
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])) {
|
|
24888
26385
|
const valueLabel = graphicCreator.text(vchart.transformToGraphic(Object.assign({}, this._spec.valueLabel.style)));
|
|
24889
26386
|
valueLabel.setAttributes(positionAttr);
|
|
24890
26387
|
valueLabel.setAttribute('text', data[this.valueField]);
|
|
@@ -25044,6 +26541,8 @@
|
|
|
25044
26541
|
exports.Bar3dSeries = Bar3dSeries;
|
|
25045
26542
|
exports.Bar3dSeriesSpecTransformer = Bar3dSeriesSpecTransformer;
|
|
25046
26543
|
exports.BarLinkComponent = BarLinkComponent;
|
|
26544
|
+
exports.CandlestickChart = CandlestickChart;
|
|
26545
|
+
exports.CandlestickChartSpecTransformer = CandlestickChartSpecTransformer;
|
|
25047
26546
|
exports.ConversionFunnelChart = ConversionFunnelChart;
|
|
25048
26547
|
exports.ConversionFunnelSeries = ConversionFunnelSeries;
|
|
25049
26548
|
exports.DefaultBandWidth = DefaultBandWidth;
|
|
@@ -25088,6 +26587,7 @@
|
|
|
25088
26587
|
exports.registerBar3dChart = registerBar3dChart;
|
|
25089
26588
|
exports.registerBar3dSeries = registerBar3dSeries;
|
|
25090
26589
|
exports.registerBarLink = registerBarLink;
|
|
26590
|
+
exports.registerCandlestickChart = registerCandlestickChart;
|
|
25091
26591
|
exports.registerConversionFunnelChart = registerConversionFunnelChart;
|
|
25092
26592
|
exports.registerFunnel3dChart = registerFunnel3dChart;
|
|
25093
26593
|
exports.registerFunnel3dSeries = registerFunnel3dSeries;
|