@visactor/vrender-components 1.0.0-alpha.9 → 1.0.1
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/cjs/animation/label-animate.js +1 -0
- package/cjs/animation/label-animate.js.map +1 -1
- package/cjs/axis/base.js +2 -2
- package/cjs/axis/base.js.map +1 -1
- package/cjs/brush/brush.d.ts +1 -5
- package/cjs/brush/brush.js +11 -13
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/core/base.d.ts +5 -1
- package/cjs/core/base.js +11 -0
- package/cjs/core/base.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +1 -5
- package/cjs/data-zoom/data-zoom.js +7 -9
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.d.ts +1 -0
- package/cjs/label/base.js +20 -27
- package/cjs/label/base.js.map +1 -1
- package/cjs/marker/config.d.ts +0 -18
- package/cjs/marker/config.js +1 -19
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.d.ts +0 -18
- package/cjs/marker/point.js +16 -19
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/register.js +8 -7
- package/cjs/marker/register.js.map +1 -1
- package/cjs/marker/type.d.ts +4 -11
- package/cjs/marker/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +2 -0
- package/cjs/scrollbar/scrollbar.js +15 -8
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/slider/slider.js +6 -10
- package/cjs/slider/slider.js.map +1 -1
- package/dist/index.es.js +970 -507
- package/es/animation/label-animate.js +3 -2
- package/es/animation/label-animate.js.map +1 -1
- package/es/axis/base.js +2 -2
- package/es/axis/base.js.map +1 -1
- package/es/brush/brush.d.ts +1 -5
- package/es/brush/brush.js +11 -13
- package/es/brush/brush.js.map +1 -1
- package/es/core/base.d.ts +5 -1
- package/es/core/base.js +11 -0
- package/es/core/base.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +1 -5
- package/es/data-zoom/data-zoom.js +7 -9
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.d.ts +1 -0
- package/es/label/base.js +20 -27
- package/es/label/base.js.map +1 -1
- package/es/marker/config.d.ts +0 -18
- package/es/marker/config.js +1 -19
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.d.ts +0 -18
- package/es/marker/point.js +16 -19
- package/es/marker/point.js.map +1 -1
- package/es/marker/register.js +8 -6
- package/es/marker/register.js.map +1 -1
- package/es/marker/type.d.ts +4 -11
- package/es/marker/type.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +2 -0
- package/es/scrollbar/scrollbar.js +16 -9
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/slider/slider.js +6 -10
- package/es/slider/slider.js.map +1 -1
- package/package.json +9 -9
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isPointInLine, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, sqrt, Color, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isPointInLine, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, sqrt, Color, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, isValid, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Generator {
|
|
@@ -489,28 +489,39 @@ class Container {
|
|
|
489
489
|
const ContributionProvider = Symbol("ContributionProvider");
|
|
490
490
|
class ContributionProviderCache {
|
|
491
491
|
constructor(serviceIdentifier, container) {
|
|
492
|
-
this.serviceIdentifier = serviceIdentifier, this.container = container;
|
|
492
|
+
this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
|
|
493
493
|
}
|
|
494
494
|
getContributions() {
|
|
495
495
|
return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
|
|
496
496
|
}
|
|
497
|
+
refresh() {
|
|
498
|
+
this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
|
|
499
|
+
}
|
|
497
500
|
}
|
|
498
501
|
function bindContributionProvider(bind, id) {
|
|
499
|
-
bind(ContributionProvider).toDynamicValue(
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
} = _ref;
|
|
503
|
-
return new ContributionProviderCache(id, container);
|
|
504
|
-
}).inSingletonScope().whenTargetNamed(id);
|
|
502
|
+
bind(ContributionProvider).toDynamicValue(({
|
|
503
|
+
container: container
|
|
504
|
+
}) => new ContributionProviderCache(id, container)).inSingletonScope().whenTargetNamed(id);
|
|
505
505
|
}
|
|
506
506
|
function bindContributionProviderNoSingletonScope(bind, id) {
|
|
507
|
-
bind(ContributionProvider).toDynamicValue(
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
} = _ref2;
|
|
511
|
-
return new ContributionProviderCache(id, container);
|
|
512
|
-
}).whenTargetNamed(id);
|
|
507
|
+
bind(ContributionProvider).toDynamicValue(({
|
|
508
|
+
container: container
|
|
509
|
+
}) => new ContributionProviderCache(id, container)).whenTargetNamed(id);
|
|
513
510
|
}
|
|
511
|
+
class ContributionStore {
|
|
512
|
+
static getStore(id) {
|
|
513
|
+
return this.store.get(id);
|
|
514
|
+
}
|
|
515
|
+
static setStore(id, cache) {
|
|
516
|
+
this.store.set(id, cache);
|
|
517
|
+
}
|
|
518
|
+
static refreshAllContributions() {
|
|
519
|
+
this.store.forEach(cache => {
|
|
520
|
+
cache.refresh();
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
ContributionStore.store = new Map();
|
|
514
525
|
|
|
515
526
|
class Hook {
|
|
516
527
|
constructor(args, name) {
|
|
@@ -565,10 +576,7 @@ class Hook {
|
|
|
565
576
|
}
|
|
566
577
|
|
|
567
578
|
class SyncHook extends Hook {
|
|
568
|
-
call() {
|
|
569
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
570
|
-
args[_key] = arguments[_key];
|
|
571
|
-
}
|
|
579
|
+
call(...args) {
|
|
572
580
|
this.taps.map(t => t.fn).forEach(cb => cb(...args));
|
|
573
581
|
}
|
|
574
582
|
}
|
|
@@ -577,22 +585,67 @@ const EnvContribution = Symbol.for("EnvContribution");
|
|
|
577
585
|
const VGlobal = Symbol.for("VGlobal");
|
|
578
586
|
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
579
587
|
|
|
588
|
+
class Application {}
|
|
589
|
+
const application = new Application();
|
|
590
|
+
|
|
591
|
+
let idx = 0;
|
|
580
592
|
class PerformanceRAF {
|
|
581
593
|
constructor() {
|
|
582
|
-
this.nextAnimationFrameCbs =
|
|
594
|
+
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
583
595
|
this._rafHandle = null;
|
|
584
596
|
const cbs = this.nextAnimationFrameCbs;
|
|
585
|
-
this.nextAnimationFrameCbs =
|
|
586
|
-
for (let i = 0; i < cbs.length; i++) cbs[i] && cbs[i](time);
|
|
597
|
+
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
587
598
|
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
588
|
-
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.
|
|
599
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
589
600
|
};
|
|
590
601
|
}
|
|
591
602
|
addAnimationFrameCb(callback) {
|
|
592
|
-
return this.nextAnimationFrameCbs.
|
|
603
|
+
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
593
604
|
}
|
|
594
605
|
removeAnimationFrameCb(index) {
|
|
595
|
-
return
|
|
606
|
+
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
class EventListenerManager {
|
|
611
|
+
constructor() {
|
|
612
|
+
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
613
|
+
}
|
|
614
|
+
setEventListenerTransformer(transformer) {
|
|
615
|
+
this._eventListenerTransformer = transformer || (event => event);
|
|
616
|
+
}
|
|
617
|
+
addEventListener(type, listener, options) {
|
|
618
|
+
if (!listener) return;
|
|
619
|
+
const wrappedListener = event => {
|
|
620
|
+
const transformedEvent = this._eventListenerTransformer(event);
|
|
621
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
622
|
+
};
|
|
623
|
+
this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
|
|
624
|
+
}
|
|
625
|
+
removeEventListener(type, listener, options) {
|
|
626
|
+
var _a;
|
|
627
|
+
if (!listener) return;
|
|
628
|
+
const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
|
|
629
|
+
wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
|
|
630
|
+
}
|
|
631
|
+
dispatchEvent(event) {
|
|
632
|
+
return this._nativeDispatchEvent(event);
|
|
633
|
+
}
|
|
634
|
+
clearAllEventListeners() {
|
|
635
|
+
this._listenerMap.forEach((listenersMap, type) => {
|
|
636
|
+
listenersMap.forEach((wrappedListener, originalListener) => {
|
|
637
|
+
this._nativeRemoveEventListener(type, wrappedListener, void 0);
|
|
638
|
+
});
|
|
639
|
+
}), this._listenerMap.clear();
|
|
640
|
+
}
|
|
641
|
+
_nativeAddEventListener(type, listener, options) {
|
|
642
|
+
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
643
|
+
}
|
|
644
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
645
|
+
throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
|
|
646
|
+
}
|
|
647
|
+
_nativeDispatchEvent(event) {
|
|
648
|
+
throw new Error("_nativeDispatchEvent must be implemented by derived classes");
|
|
596
649
|
}
|
|
597
650
|
}
|
|
598
651
|
|
|
@@ -636,7 +689,7 @@ var __decorate$Q = undefined && undefined.__decorate || function (decorators, ta
|
|
|
636
689
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
637
690
|
});
|
|
638
691
|
};
|
|
639
|
-
let DefaultGlobal = class {
|
|
692
|
+
let DefaultGlobal = class extends EventListenerManager {
|
|
640
693
|
get env() {
|
|
641
694
|
return this._env;
|
|
642
695
|
}
|
|
@@ -680,10 +733,19 @@ let DefaultGlobal = class {
|
|
|
680
733
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
681
734
|
}
|
|
682
735
|
constructor(contributions) {
|
|
683
|
-
this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
736
|
+
super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
684
737
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
685
738
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
686
739
|
}
|
|
740
|
+
_nativeAddEventListener(type, listener, options) {
|
|
741
|
+
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
742
|
+
}
|
|
743
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
744
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
745
|
+
}
|
|
746
|
+
_nativeDispatchEvent(event) {
|
|
747
|
+
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
748
|
+
}
|
|
687
749
|
bindContribution(params) {
|
|
688
750
|
const promiseArr = [];
|
|
689
751
|
if (this.contributions.getContributions().forEach(contribution => {
|
|
@@ -724,15 +786,6 @@ let DefaultGlobal = class {
|
|
|
724
786
|
releaseCanvas(canvas) {
|
|
725
787
|
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
726
788
|
}
|
|
727
|
-
addEventListener(type, listener, options) {
|
|
728
|
-
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
729
|
-
}
|
|
730
|
-
removeEventListener(type, listener, options) {
|
|
731
|
-
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
732
|
-
}
|
|
733
|
-
dispatchEvent(event) {
|
|
734
|
-
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
735
|
-
}
|
|
736
789
|
getRequestAnimationFrame() {
|
|
737
790
|
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
738
791
|
}
|
|
@@ -799,16 +852,13 @@ let DefaultGlobal = class {
|
|
|
799
852
|
updateDom(dom, params) {
|
|
800
853
|
return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
|
|
801
854
|
}
|
|
802
|
-
getElementTop(dom) {
|
|
803
|
-
let baseWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
855
|
+
getElementTop(dom, baseWindow = !1) {
|
|
804
856
|
return this._env || this.setEnv("browser"), this.envContribution.getElementTop(dom, baseWindow);
|
|
805
857
|
}
|
|
806
|
-
getElementLeft(dom) {
|
|
807
|
-
let baseWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
858
|
+
getElementLeft(dom, baseWindow = !1) {
|
|
808
859
|
return this._env || this.setEnv("browser"), this.envContribution.getElementLeft(dom, baseWindow);
|
|
809
860
|
}
|
|
810
|
-
getElementTopLeft(dom) {
|
|
811
|
-
let baseWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
861
|
+
getElementTopLeft(dom, baseWindow = !1) {
|
|
812
862
|
return this._env || this.setEnv("browser"), this.envContribution.getElementTopLeft(dom, baseWindow);
|
|
813
863
|
}
|
|
814
864
|
isMacOS() {
|
|
@@ -830,6 +880,11 @@ var AnimateMode;
|
|
|
830
880
|
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
831
881
|
}(AnimateMode || (AnimateMode = {}));
|
|
832
882
|
|
|
883
|
+
var STATUS$1;
|
|
884
|
+
!function (STATUS) {
|
|
885
|
+
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
886
|
+
}(STATUS$1 || (STATUS$1 = {}));
|
|
887
|
+
|
|
833
888
|
var AnimateStepType;
|
|
834
889
|
!function (AnimateStepType) {
|
|
835
890
|
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
@@ -888,7 +943,7 @@ class BoundsContext {
|
|
|
888
943
|
clear() {
|
|
889
944
|
this.bounds.clear();
|
|
890
945
|
}
|
|
891
|
-
release() {}
|
|
946
|
+
release(...params) {}
|
|
892
947
|
}
|
|
893
948
|
|
|
894
949
|
class CurvePath {
|
|
@@ -1063,8 +1118,7 @@ function drawArc(context, x, y, coords) {
|
|
|
1063
1118
|
context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
|
|
1064
1119
|
}
|
|
1065
1120
|
}
|
|
1066
|
-
const addArcToBezierPath =
|
|
1067
|
-
let counterclockwise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : !1;
|
|
1121
|
+
const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry, counterclockwise = !1) => {
|
|
1068
1122
|
const PI2 = 2 * Math.PI,
|
|
1069
1123
|
sAngle = (startAngle % PI2 + PI2) % PI2;
|
|
1070
1124
|
let deltaAngle,
|
|
@@ -1092,12 +1146,7 @@ const addArcToBezierPath = function (bezierPath, startAngle, endAngle, cx, cy, r
|
|
|
1092
1146
|
};
|
|
1093
1147
|
|
|
1094
1148
|
const commandFuncs = [(command, context, x, y, sx, sy, z) => context.arc(command[1] * sx + x, command[2] * sy + y, command[3] * (sx + sy) / 2, command[4], command[5], command[6], z), (command, context, x, y, sx, sy, z) => context.arcTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * (sx + sy) / 2, z), (command, context, x, y, sx, sy, z) => context.bezierCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * sx + x, command[6] * sy + y, z), (command, context, x, y) => context.closePath(), (command, context, x, y, sx, sy) => context.ellipse(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, command[5], command[6], command[7], command[8]), (command, context, x, y, sx, sy, z) => context.lineTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.moveTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.quadraticCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, z), (command, context, x, y, sx, sy, z) => context.rect(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, z)];
|
|
1095
|
-
function renderCommandList(commandList, context) {
|
|
1096
|
-
let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1097
|
-
let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1098
|
-
let sx = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
1099
|
-
let sy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
|
|
1100
|
-
let z = arguments.length > 6 ? arguments[6] : undefined;
|
|
1149
|
+
function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy = 1, z) {
|
|
1101
1150
|
for (let i = 0; i < commandList.length; i++) {
|
|
1102
1151
|
const command = commandList[i];
|
|
1103
1152
|
commandFuncs[command[0]](command, context, x, y, sx, sy, z);
|
|
@@ -1147,44 +1196,6 @@ function quadLength(p0, p1, p2, iterationCount) {
|
|
|
1147
1196
|
return snapLength([p0.x, p1.x, p2.x], [p0.y, p1.y, p2.y]);
|
|
1148
1197
|
}
|
|
1149
1198
|
|
|
1150
|
-
class QuadraticBezierCurve extends Curve {
|
|
1151
|
-
constructor(p0, p1, p2) {
|
|
1152
|
-
super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
|
|
1153
|
-
}
|
|
1154
|
-
_validPoint() {
|
|
1155
|
-
return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
|
|
1156
|
-
}
|
|
1157
|
-
getPointAt(t) {
|
|
1158
|
-
if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
|
|
1159
|
-
throw new Error("defined为false的点不能getPointAt");
|
|
1160
|
-
}
|
|
1161
|
-
calcLength() {
|
|
1162
|
-
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1163
|
-
}
|
|
1164
|
-
calcProjLength(direction) {
|
|
1165
|
-
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1166
|
-
}
|
|
1167
|
-
getAngleAt(t) {
|
|
1168
|
-
const minT = max(t - .01, 0),
|
|
1169
|
-
maxT = min(t + .01, 1),
|
|
1170
|
-
minP = this.getPointAt(minT),
|
|
1171
|
-
maxP = this.getPointAt(maxT);
|
|
1172
|
-
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1173
|
-
}
|
|
1174
|
-
draw(path, x, y, sx, sy, percent) {
|
|
1175
|
-
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.quadraticCurveTo(this.p1.x * sx + x, this.p1.y * sy + y, this.p2.x * sx + x, this.p2.y * sy + y);else if (percent > 0) {
|
|
1176
|
-
const [curve1] = divideQuad(this, percent);
|
|
1177
|
-
path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
getYAt(x) {
|
|
1181
|
-
throw new Error("QuadraticBezierCurve暂不支持getYAt");
|
|
1182
|
-
}
|
|
1183
|
-
includeX(x) {
|
|
1184
|
-
throw new Error("QuadraticBezierCurve暂不支持includeX");
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
1199
|
function divideCubic(curve, t) {
|
|
1189
1200
|
const {
|
|
1190
1201
|
p0: p0,
|
|
@@ -1200,17 +1211,6 @@ function divideCubic(curve, t) {
|
|
|
1200
1211
|
c23 = PointService.pointAtPP(c2, c3, t);
|
|
1201
1212
|
return [new CubicBezierCurve(p0, c1, c12, pt), new CubicBezierCurve(pt, c23, c3, p3)];
|
|
1202
1213
|
}
|
|
1203
|
-
function divideQuad(curve, t) {
|
|
1204
|
-
const {
|
|
1205
|
-
p0: p0,
|
|
1206
|
-
p1: p1,
|
|
1207
|
-
p2: p2
|
|
1208
|
-
} = curve,
|
|
1209
|
-
pt = quadPointAt(p0, p1, p2, t),
|
|
1210
|
-
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1211
|
-
c2 = PointService.pointAtPP(p1, p2, t);
|
|
1212
|
-
return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
|
|
1213
|
-
}
|
|
1214
1214
|
class CubicBezierCurve extends Curve {
|
|
1215
1215
|
constructor(p0, p1, p2, p3) {
|
|
1216
1216
|
super(), this.type = CurveTypeEnum.CubicBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2, this.p3 = p3;
|
|
@@ -1387,7 +1387,7 @@ class ReflectSegContext extends SegContext {
|
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
|
|
1390
|
-
function genCurveSegments(path, points) {
|
|
1390
|
+
function genCurveSegments(path, points, step = 1) {
|
|
1391
1391
|
let defined0 = !1;
|
|
1392
1392
|
for (let i = 0, n = points.length; i <= n; i++) i >= n === defined0 && ((defined0 = !defined0) ? path.lineStart() : path.lineEnd()), defined0 && path.point(points[i]);
|
|
1393
1393
|
}
|
|
@@ -1430,8 +1430,7 @@ class Linear {
|
|
|
1430
1430
|
return this.context.tryUpdateLength();
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
function genLinearSegments(points) {
|
|
1434
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1433
|
+
function genLinearSegments(points, params = {}) {
|
|
1435
1434
|
const {
|
|
1436
1435
|
direction: direction,
|
|
1437
1436
|
startPoint: startPoint
|
|
@@ -1441,7 +1440,7 @@ function genLinearSegments(points) {
|
|
|
1441
1440
|
return genLinearTypeSegments(new Linear(segContext, startPoint), points), segContext;
|
|
1442
1441
|
}
|
|
1443
1442
|
function genLinearTypeSegments(path, points) {
|
|
1444
|
-
return genCurveSegments(path, points);
|
|
1443
|
+
return genCurveSegments(path, points, 1);
|
|
1445
1444
|
}
|
|
1446
1445
|
|
|
1447
1446
|
function point$3(curveClass, x, y, defined, p) {
|
|
@@ -1484,10 +1483,9 @@ class Basis {
|
|
|
1484
1483
|
}
|
|
1485
1484
|
}
|
|
1486
1485
|
function genBasisTypeSegments(path, points) {
|
|
1487
|
-
return genCurveSegments(path, points);
|
|
1486
|
+
return genCurveSegments(path, points, 2);
|
|
1488
1487
|
}
|
|
1489
|
-
function genBasisSegments(points) {
|
|
1490
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1488
|
+
function genBasisSegments(points, params = {}) {
|
|
1491
1489
|
const {
|
|
1492
1490
|
direction: direction,
|
|
1493
1491
|
startPoint: startPoint
|
|
@@ -1580,10 +1578,9 @@ class MonotoneY extends MonotoneX {
|
|
|
1580
1578
|
}
|
|
1581
1579
|
}
|
|
1582
1580
|
function genMonotoneXTypeSegments(path, points) {
|
|
1583
|
-
return genCurveSegments(path, points);
|
|
1581
|
+
return genCurveSegments(path, points, 2);
|
|
1584
1582
|
}
|
|
1585
|
-
function genMonotoneXSegments(points) {
|
|
1586
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1583
|
+
function genMonotoneXSegments(points, params = {}) {
|
|
1587
1584
|
const {
|
|
1588
1585
|
direction: direction,
|
|
1589
1586
|
startPoint: startPoint
|
|
@@ -1594,10 +1591,9 @@ function genMonotoneXSegments(points) {
|
|
|
1594
1591
|
return genMonotoneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
|
|
1595
1592
|
}
|
|
1596
1593
|
function genMonotoneYTypeSegments(path, points) {
|
|
1597
|
-
return genCurveSegments(path, points);
|
|
1594
|
+
return genCurveSegments(path, points, 2);
|
|
1598
1595
|
}
|
|
1599
|
-
function genMonotoneYSegments(points) {
|
|
1600
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1596
|
+
function genMonotoneYSegments(points, params = {}) {
|
|
1601
1597
|
const {
|
|
1602
1598
|
direction: direction,
|
|
1603
1599
|
startPoint: startPoint
|
|
@@ -1609,9 +1605,7 @@ function genMonotoneYSegments(points) {
|
|
|
1609
1605
|
}
|
|
1610
1606
|
|
|
1611
1607
|
let Step$1 = class Step {
|
|
1612
|
-
constructor(context) {
|
|
1613
|
-
let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
|
|
1614
|
-
let startPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
1608
|
+
constructor(context, t = .5, startPoint) {
|
|
1615
1609
|
this.context = context, this._t = t, this.startPoint = startPoint;
|
|
1616
1610
|
}
|
|
1617
1611
|
areaStart() {
|
|
@@ -1652,8 +1646,7 @@ class StepClosed extends Step$1 {
|
|
|
1652
1646
|
this.context.closePath();
|
|
1653
1647
|
}
|
|
1654
1648
|
}
|
|
1655
|
-
function genStepSegments(points, t) {
|
|
1656
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1649
|
+
function genStepSegments(points, t, params = {}) {
|
|
1657
1650
|
const {
|
|
1658
1651
|
direction: direction,
|
|
1659
1652
|
startPoint: startPoint
|
|
@@ -1663,10 +1656,9 @@ function genStepSegments(points, t) {
|
|
|
1663
1656
|
return genStepTypeSegments(new Step$1(segContext, t, startPoint), points), segContext;
|
|
1664
1657
|
}
|
|
1665
1658
|
function genStepTypeSegments(path, points) {
|
|
1666
|
-
return genCurveSegments(path, points);
|
|
1659
|
+
return genCurveSegments(path, points, 1);
|
|
1667
1660
|
}
|
|
1668
|
-
function genStepClosedSegments(points, t) {
|
|
1669
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1661
|
+
function genStepClosedSegments(points, t, params = {}) {
|
|
1670
1662
|
const {
|
|
1671
1663
|
direction: direction,
|
|
1672
1664
|
startPoint: startPoint
|
|
@@ -1681,8 +1673,7 @@ class LinearClosed extends Linear {
|
|
|
1681
1673
|
this.context.closePath();
|
|
1682
1674
|
}
|
|
1683
1675
|
}
|
|
1684
|
-
function genLinearClosedSegments(points) {
|
|
1685
|
-
let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1676
|
+
function genLinearClosedSegments(points, params = {}) {
|
|
1686
1677
|
const {
|
|
1687
1678
|
direction: direction,
|
|
1688
1679
|
startPoint: startPoint
|
|
@@ -1692,7 +1683,7 @@ function genLinearClosedSegments(points) {
|
|
|
1692
1683
|
return genLinearClosedTypeSegments(new LinearClosed(segContext, startPoint), points), segContext;
|
|
1693
1684
|
}
|
|
1694
1685
|
function genLinearClosedTypeSegments(path, points) {
|
|
1695
|
-
return genCurveSegments(path, points);
|
|
1686
|
+
return genCurveSegments(path, points, 1);
|
|
1696
1687
|
}
|
|
1697
1688
|
|
|
1698
1689
|
function point$1(curveClass, x, y, defined, p) {
|
|
@@ -1713,9 +1704,7 @@ function point$1(curveClass, x, y, defined, p) {
|
|
|
1713
1704
|
curveClass.context.bezierCurveTo(x1, y1, x2, y2, curveClass._x2, curveClass._y2, defined, curveClass.lastPoint1);
|
|
1714
1705
|
}
|
|
1715
1706
|
class CatmullRom {
|
|
1716
|
-
constructor(context) {
|
|
1717
|
-
let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
|
|
1718
|
-
let startPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
1707
|
+
constructor(context, alpha = .5, startPoint) {
|
|
1719
1708
|
this.context = context, this.startPoint = startPoint, this._alpha = alpha;
|
|
1720
1709
|
}
|
|
1721
1710
|
areaStart() {
|
|
@@ -1769,8 +1758,7 @@ class CatmullRom {
|
|
|
1769
1758
|
}
|
|
1770
1759
|
}
|
|
1771
1760
|
function commonGenCatmullRomSegments(type, cons) {
|
|
1772
|
-
return function (points, alpha) {
|
|
1773
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1761
|
+
return function (points, alpha, params = {}) {
|
|
1774
1762
|
const {
|
|
1775
1763
|
direction: direction,
|
|
1776
1764
|
startPoint: startPoint
|
|
@@ -1779,15 +1767,13 @@ function commonGenCatmullRomSegments(type, cons) {
|
|
|
1779
1767
|
if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
|
|
1780
1768
|
const segContext = genSegContext(type, direction, points),
|
|
1781
1769
|
gatmullRom = new cons(segContext, alpha, startPoint);
|
|
1782
|
-
return genCurveSegments(gatmullRom, points), segContext;
|
|
1770
|
+
return genCurveSegments(gatmullRom, points, 2), segContext;
|
|
1783
1771
|
};
|
|
1784
1772
|
}
|
|
1785
1773
|
const genCatmullRomSegments = commonGenCatmullRomSegments("catmullRom", CatmullRom);
|
|
1786
1774
|
|
|
1787
1775
|
class CatmullRomClosed {
|
|
1788
|
-
constructor(context) {
|
|
1789
|
-
let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
|
|
1790
|
-
let startPoint = arguments.length > 2 ? arguments[2] : undefined;
|
|
1776
|
+
constructor(context, alpha = .5, startPoint) {
|
|
1791
1777
|
this.context = context, this.startPoint = startPoint, this._alpha = alpha;
|
|
1792
1778
|
}
|
|
1793
1779
|
areaStart() {
|
|
@@ -1851,6 +1837,55 @@ class CatmullRomClosed {
|
|
|
1851
1837
|
}
|
|
1852
1838
|
const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
1853
1839
|
|
|
1840
|
+
function divideQuad(curve, t) {
|
|
1841
|
+
const {
|
|
1842
|
+
p0: p0,
|
|
1843
|
+
p1: p1,
|
|
1844
|
+
p2: p2
|
|
1845
|
+
} = curve,
|
|
1846
|
+
pt = quadPointAt(p0, p1, p2, t),
|
|
1847
|
+
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1848
|
+
c2 = PointService.pointAtPP(p1, p2, t);
|
|
1849
|
+
return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
|
|
1850
|
+
}
|
|
1851
|
+
class QuadraticBezierCurve extends Curve {
|
|
1852
|
+
constructor(p0, p1, p2) {
|
|
1853
|
+
super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
|
|
1854
|
+
}
|
|
1855
|
+
_validPoint() {
|
|
1856
|
+
return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
|
|
1857
|
+
}
|
|
1858
|
+
getPointAt(t) {
|
|
1859
|
+
if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
|
|
1860
|
+
throw new Error("defined为false的点不能getPointAt");
|
|
1861
|
+
}
|
|
1862
|
+
calcLength() {
|
|
1863
|
+
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1864
|
+
}
|
|
1865
|
+
calcProjLength(direction) {
|
|
1866
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1867
|
+
}
|
|
1868
|
+
getAngleAt(t) {
|
|
1869
|
+
const minT = max(t - .01, 0),
|
|
1870
|
+
maxT = min(t + .01, 1),
|
|
1871
|
+
minP = this.getPointAt(minT),
|
|
1872
|
+
maxP = this.getPointAt(maxT);
|
|
1873
|
+
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1874
|
+
}
|
|
1875
|
+
draw(path, x, y, sx, sy, percent) {
|
|
1876
|
+
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.quadraticCurveTo(this.p1.x * sx + x, this.p1.y * sy + y, this.p2.x * sx + x, this.p2.y * sy + y);else if (percent > 0) {
|
|
1877
|
+
const [curve1] = divideQuad(this, percent);
|
|
1878
|
+
path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
getYAt(x) {
|
|
1882
|
+
throw new Error("QuadraticBezierCurve暂不支持getYAt");
|
|
1883
|
+
}
|
|
1884
|
+
includeX(x) {
|
|
1885
|
+
throw new Error("QuadraticBezierCurve暂不支持includeX");
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1854
1889
|
class CurveContext {
|
|
1855
1890
|
constructor(path) {
|
|
1856
1891
|
this.path = path, this._lastX = this._lastY = this._startX = this._startY = 0;
|
|
@@ -2048,11 +2083,7 @@ class CustomPath2D extends CurvePath {
|
|
|
2048
2083
|
cmd[1] = cmd[1] * sx + x, cmd[2] = cmd[2] * sy + y, cmd[3] = cmd[3] * (sx + sy) / 2;
|
|
2049
2084
|
}
|
|
2050
2085
|
closePathTransform() {}
|
|
2051
|
-
_runCommandStrList(commandStrList) {
|
|
2052
|
-
let l = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2053
|
-
let t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2054
|
-
let sX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
2055
|
-
let sY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
2086
|
+
_runCommandStrList(commandStrList, l = 0, t = 0, sX = 1, sY = 1) {
|
|
2056
2087
|
let current,
|
|
2057
2088
|
tempX,
|
|
2058
2089
|
tempY,
|
|
@@ -2126,11 +2157,7 @@ class CustomPath2D extends CurvePath {
|
|
|
2126
2157
|
previous = current;
|
|
2127
2158
|
}
|
|
2128
2159
|
}
|
|
2129
|
-
_runCommandList(commandList) {
|
|
2130
|
-
let l = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
2131
|
-
let t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
2132
|
-
let sX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
2133
|
-
let sY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
|
|
2160
|
+
_runCommandList(commandList, l = 0, t = 0, sX = 1, sY = 1) {
|
|
2134
2161
|
if (0 !== l || 0 !== t || 1 !== sX || 1 !== sY) for (let i = 0, len = commandList.length; i < len; ++i) {
|
|
2135
2162
|
const current = commandList[i].slice();
|
|
2136
2163
|
switch (current[0]) {
|
|
@@ -2541,9 +2568,6 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
|
|
|
2541
2568
|
opacity: 1
|
|
2542
2569
|
});
|
|
2543
2570
|
|
|
2544
|
-
class Application {}
|
|
2545
|
-
const application = new Application();
|
|
2546
|
-
|
|
2547
2571
|
const parse = function () {
|
|
2548
2572
|
const tokens = {
|
|
2549
2573
|
linearGradient: /^(linear\-gradient)/i,
|
|
@@ -2784,9 +2808,7 @@ function getScaledStroke(context, width, dpr) {
|
|
|
2784
2808
|
scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
|
|
2785
2809
|
return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
|
|
2786
2810
|
}
|
|
2787
|
-
function createColor(context, c, params) {
|
|
2788
|
-
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
2789
|
-
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
2811
|
+
function createColor(context, c, params, offsetX = 0, offsetY = 0) {
|
|
2790
2812
|
var _a, _b, _c, _d;
|
|
2791
2813
|
if (!c || !0 === c) return "black";
|
|
2792
2814
|
let result, color;
|
|
@@ -2925,8 +2947,7 @@ function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter)
|
|
|
2925
2947
|
}
|
|
2926
2948
|
return needTestLetter && (index = testLetter(desc, index)), index;
|
|
2927
2949
|
}
|
|
2928
|
-
function testLetter(string, index) {
|
|
2929
|
-
let negativeWrongMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
2950
|
+
function testLetter(string, index, negativeWrongMatch = !1) {
|
|
2930
2951
|
let i = index;
|
|
2931
2952
|
for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return negativeWrongMatch ? testLetter2(string, index) : index;
|
|
2932
2953
|
return i;
|
|
@@ -2936,8 +2957,7 @@ function testLetter2(string, index) {
|
|
|
2936
2957
|
for (; regLetter.test(string[i + 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i++, i >= string.length) return i;
|
|
2937
2958
|
return i + 1;
|
|
2938
2959
|
}
|
|
2939
|
-
function measureTextCanvas(text, character) {
|
|
2940
|
-
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
|
|
2960
|
+
function measureTextCanvas(text, character, mode = "actual") {
|
|
2941
2961
|
var _a;
|
|
2942
2962
|
if ("" === text) return {
|
|
2943
2963
|
ascent: 0,
|
|
@@ -3007,10 +3027,9 @@ let ATextMeasure = class {
|
|
|
3007
3027
|
}
|
|
3008
3028
|
return metrics;
|
|
3009
3029
|
}
|
|
3010
|
-
estimate(text,
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
} = _ref;
|
|
3030
|
+
estimate(text, {
|
|
3031
|
+
fontSize = DefaultTextAttribute.fontSize
|
|
3032
|
+
}) {
|
|
3014
3033
|
let eCharLen = 0,
|
|
3015
3034
|
cCharLen = 0;
|
|
3016
3035
|
for (let i = 0; i < text.length; i++) text.charCodeAt(i) < 128 ? eCharLen++ : cCharLen++;
|
|
@@ -3321,8 +3340,7 @@ let ATextMeasure = class {
|
|
|
3321
3340
|
});
|
|
3322
3341
|
});
|
|
3323
3342
|
}
|
|
3324
|
-
clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
|
|
3325
|
-
let forceSuffix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
3343
|
+
clipTextWithSuffix(text, options, width, suffix, wordBreak, position, forceSuffix = !1) {
|
|
3326
3344
|
if ("" === suffix) return this.clipText(text, options, width, wordBreak);
|
|
3327
3345
|
if (0 === text.length) return {
|
|
3328
3346
|
str: "",
|
|
@@ -3766,7 +3784,7 @@ class DefaultCanvasAllocate {
|
|
|
3766
3784
|
get length() {
|
|
3767
3785
|
return this.pools.length;
|
|
3768
3786
|
}
|
|
3769
|
-
release() {
|
|
3787
|
+
release(...params) {
|
|
3770
3788
|
this.pools = [];
|
|
3771
3789
|
}
|
|
3772
3790
|
}
|
|
@@ -3784,7 +3802,7 @@ var __decorate$N = undefined && undefined.__decorate || function (decorators, ta
|
|
|
3784
3802
|
};
|
|
3785
3803
|
const VWindow = Symbol.for("VWindow");
|
|
3786
3804
|
const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
|
|
3787
|
-
let DefaultWindow = class {
|
|
3805
|
+
let DefaultWindow = class extends EventListenerManager {
|
|
3788
3806
|
get width() {
|
|
3789
3807
|
if (this._handler) {
|
|
3790
3808
|
const wh = this._handler.getWH();
|
|
@@ -3803,7 +3821,7 @@ let DefaultWindow = class {
|
|
|
3803
3821
|
return this._handler.getDpr();
|
|
3804
3822
|
}
|
|
3805
3823
|
constructor() {
|
|
3806
|
-
this.hooks = {
|
|
3824
|
+
super(), this.hooks = {
|
|
3807
3825
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
3808
3826
|
}, this.active = () => {
|
|
3809
3827
|
const global = this.global;
|
|
@@ -3811,6 +3829,15 @@ let DefaultWindow = class {
|
|
|
3811
3829
|
container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
|
|
3812
3830
|
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
3813
3831
|
}
|
|
3832
|
+
_nativeAddEventListener(type, listener, options) {
|
|
3833
|
+
return this._handler.addEventListener(type, listener, options);
|
|
3834
|
+
}
|
|
3835
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
3836
|
+
return this._handler.removeEventListener(type, listener, options);
|
|
3837
|
+
}
|
|
3838
|
+
_nativeDispatchEvent(event) {
|
|
3839
|
+
return this._handler.dispatchEvent(event);
|
|
3840
|
+
}
|
|
3814
3841
|
postInit() {
|
|
3815
3842
|
this.global.hooks.onSetEnv.tap("window", this.active), this.active();
|
|
3816
3843
|
}
|
|
@@ -3850,7 +3877,7 @@ let DefaultWindow = class {
|
|
|
3850
3877
|
throw new Error("暂不支持");
|
|
3851
3878
|
}
|
|
3852
3879
|
release() {
|
|
3853
|
-
return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
|
|
3880
|
+
return this.global.hooks.onSetEnv.unTap("window", this.active), this.clearAllEventListeners(), this._handler.releaseWindow();
|
|
3854
3881
|
}
|
|
3855
3882
|
getContext() {
|
|
3856
3883
|
return this._handler.getContext();
|
|
@@ -3861,15 +3888,6 @@ let DefaultWindow = class {
|
|
|
3861
3888
|
getImageBuffer(type) {
|
|
3862
3889
|
return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
|
|
3863
3890
|
}
|
|
3864
|
-
addEventListener(type, listener, options) {
|
|
3865
|
-
return this._handler.addEventListener(type, listener, options);
|
|
3866
|
-
}
|
|
3867
|
-
removeEventListener(type, listener, options) {
|
|
3868
|
-
return this._handler.removeEventListener(type, listener, options);
|
|
3869
|
-
}
|
|
3870
|
-
dispatchEvent(event) {
|
|
3871
|
-
return this._handler.dispatchEvent(event);
|
|
3872
|
-
}
|
|
3873
3891
|
getBoundingClientRect() {
|
|
3874
3892
|
return this._handler.getBoundingClientRect();
|
|
3875
3893
|
}
|
|
@@ -3962,8 +3980,7 @@ let DefaultGraphicUtil = class {
|
|
|
3962
3980
|
bindTextMeasure(tm) {
|
|
3963
3981
|
this._textMeasure = tm;
|
|
3964
3982
|
}
|
|
3965
|
-
measureText(text, tc) {
|
|
3966
|
-
let method = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "native";
|
|
3983
|
+
measureText(text, tc, method = "native") {
|
|
3967
3984
|
var _a;
|
|
3968
3985
|
this.configure(this.global, this.global.env);
|
|
3969
3986
|
const m = this.global.measureTextMethod;
|
|
@@ -4146,8 +4163,7 @@ class Theme {
|
|
|
4146
4163
|
for (; group.parent;) if ((group = group.parent).theme) return group;
|
|
4147
4164
|
return null;
|
|
4148
4165
|
}
|
|
4149
|
-
applyTheme(group, pt) {
|
|
4150
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
4166
|
+
applyTheme(group, pt, force = !1) {
|
|
4151
4167
|
if (this.dirty) {
|
|
4152
4168
|
const parentGroup = this.getParentWithTheme(group);
|
|
4153
4169
|
if (parentGroup) {
|
|
@@ -4246,8 +4262,7 @@ class Node extends EventEmitter {
|
|
|
4246
4262
|
constructor() {
|
|
4247
4263
|
super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
|
|
4248
4264
|
}
|
|
4249
|
-
forEachChildren(cb) {
|
|
4250
|
-
let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4265
|
+
forEachChildren(cb, reverse = !1) {
|
|
4251
4266
|
if (reverse) {
|
|
4252
4267
|
let child = this._lastChild,
|
|
4253
4268
|
i = 0;
|
|
@@ -4264,8 +4279,7 @@ class Node extends EventEmitter {
|
|
|
4264
4279
|
}
|
|
4265
4280
|
}
|
|
4266
4281
|
}
|
|
4267
|
-
forEachChildrenAsync(cb) {
|
|
4268
|
-
let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4282
|
+
forEachChildrenAsync(cb, reverse = !1) {
|
|
4269
4283
|
return __awaiter$3(this, void 0, void 0, function* () {
|
|
4270
4284
|
if (reverse) {
|
|
4271
4285
|
let child = this._lastChild,
|
|
@@ -4289,13 +4303,12 @@ class Node extends EventEmitter {
|
|
|
4289
4303
|
forEach(cb) {
|
|
4290
4304
|
return this.forEachChildren(cb);
|
|
4291
4305
|
}
|
|
4292
|
-
appendChild(node) {
|
|
4293
|
-
let highPerformance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
4306
|
+
appendChild(node, highPerformance = !0) {
|
|
4294
4307
|
if (this._uid === node._uid) return null;
|
|
4295
4308
|
if (!highPerformance && node.isAncestorsOf(this)) throw new Error("【Node::appendChild】不能将父辈元素append为子元素");
|
|
4296
4309
|
return node.parent && node.parent.removeChild(node), node.parent = this, this._lastChild ? (this._lastChild._next = node, node._prev = this._lastChild, this._lastChild = node) : (this._firstChild = this._lastChild = node, node._prev = node._next = null), this._idMap || (this._idMap = new Map()), this._idMap.set(node._uid, node), this.setCount(node.count), this._structEdit = !0, node;
|
|
4297
4310
|
}
|
|
4298
|
-
appendChildArrHighPerformance(nodes) {
|
|
4311
|
+
appendChildArrHighPerformance(nodes, replace = !1) {
|
|
4299
4312
|
return console.error("暂不支持该函数"), nodes;
|
|
4300
4313
|
}
|
|
4301
4314
|
insertBefore(newNode, referenceNode) {
|
|
@@ -4363,8 +4376,7 @@ class Node extends EventEmitter {
|
|
|
4363
4376
|
replaceChild(newChild, oldChild) {
|
|
4364
4377
|
throw new Error("暂不支持");
|
|
4365
4378
|
}
|
|
4366
|
-
find(callback) {
|
|
4367
|
-
let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4379
|
+
find(callback, deep = !1) {
|
|
4368
4380
|
let target = null;
|
|
4369
4381
|
return this.forEachChildren((node, index) => !(node === this || !callback(node, index)) && (target = node, !0)), deep && this.forEachChildren(child => {
|
|
4370
4382
|
if (child.isContainer) {
|
|
@@ -4374,8 +4386,7 @@ class Node extends EventEmitter {
|
|
|
4374
4386
|
return !1;
|
|
4375
4387
|
}), target;
|
|
4376
4388
|
}
|
|
4377
|
-
findAll(callback) {
|
|
4378
|
-
let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4389
|
+
findAll(callback, deep = !1) {
|
|
4379
4390
|
let nodes = [];
|
|
4380
4391
|
return this.forEachChildren((node, index) => {
|
|
4381
4392
|
node !== this && callback(node, index) && nodes.push(node);
|
|
@@ -4404,8 +4415,7 @@ class Node extends EventEmitter {
|
|
|
4404
4415
|
getElementsByType(type) {
|
|
4405
4416
|
return this.findAll(node => node.type === type, !0);
|
|
4406
4417
|
}
|
|
4407
|
-
getChildByName(name) {
|
|
4408
|
-
let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4418
|
+
getChildByName(name, deep = !1) {
|
|
4409
4419
|
return this.find(node => node.name === name, deep);
|
|
4410
4420
|
}
|
|
4411
4421
|
getChildAt(idx) {
|
|
@@ -4524,10 +4534,7 @@ class Node extends EventEmitter {
|
|
|
4524
4534
|
removeAllListeners() {
|
|
4525
4535
|
return this.removeAllEventListeners();
|
|
4526
4536
|
}
|
|
4527
|
-
dispatchEvent(event) {
|
|
4528
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
4529
|
-
args[_key - 1] = arguments[_key];
|
|
4530
|
-
}
|
|
4537
|
+
dispatchEvent(event, ...args) {
|
|
4531
4538
|
return super.emit(event.type, event, ...args), !event.defaultPrevented;
|
|
4532
4539
|
}
|
|
4533
4540
|
emit(event, data) {
|
|
@@ -4922,8 +4929,7 @@ class SquareSymbol extends BaseSymbol {
|
|
|
4922
4929
|
}
|
|
4923
4930
|
var square$1 = new SquareSymbol();
|
|
4924
4931
|
|
|
4925
|
-
function trianglUpOffset(ctx, r, x, y) {
|
|
4926
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4932
|
+
function trianglUpOffset(ctx, r, x, y, offset = 0) {
|
|
4927
4933
|
return ctx.moveTo(x + r + 2 * offset, r + y + offset), ctx.lineTo(x - r - 2 * offset, r + y + offset), ctx.lineTo(x, y - r - 2 * offset), ctx.closePath(), !0;
|
|
4928
4934
|
}
|
|
4929
4935
|
class TriangleUpSymbol extends BaseSymbol {
|
|
@@ -5069,8 +5075,7 @@ class TriangleLeftSymbol extends BaseSymbol {
|
|
|
5069
5075
|
}
|
|
5070
5076
|
var triangleLeft = new TriangleLeftSymbol();
|
|
5071
5077
|
|
|
5072
|
-
function trianglRightOffset(ctx, r, x, y) {
|
|
5073
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
5078
|
+
function trianglRightOffset(ctx, r, x, y, offset = 0) {
|
|
5074
5079
|
return ctx.moveTo(x - r - offset, r + y + 2 * offset), ctx.lineTo(r + x + 2 * offset, y), ctx.lineTo(x - r - offset, y - r - 2 * offset), ctx.closePath(), !0;
|
|
5075
5080
|
}
|
|
5076
5081
|
class TriangleRightSymbol extends BaseSymbol {
|
|
@@ -5086,8 +5091,7 @@ class TriangleRightSymbol extends BaseSymbol {
|
|
|
5086
5091
|
}
|
|
5087
5092
|
var triangleRight = new TriangleRightSymbol();
|
|
5088
5093
|
|
|
5089
|
-
function trianglDownOffset(ctx, r, x, y) {
|
|
5090
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
5094
|
+
function trianglDownOffset(ctx, r, x, y, offset = 0) {
|
|
5091
5095
|
return ctx.moveTo(x - r - 2 * offset, y - r - offset), ctx.lineTo(x + r + 2 * offset, y - r - offset), ctx.lineTo(x, y + r + 2 * offset), ctx.closePath(), !0;
|
|
5092
5096
|
}
|
|
5093
5097
|
class TriangleDownSymbol extends BaseSymbol {
|
|
@@ -5304,8 +5308,7 @@ var rect = new RectSymbol();
|
|
|
5304
5308
|
|
|
5305
5309
|
const tempBounds = new AABBBounds();
|
|
5306
5310
|
class CustomSymbolClass {
|
|
5307
|
-
constructor(type, path) {
|
|
5308
|
-
let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
5311
|
+
constructor(type, path, isSvg = !1) {
|
|
5309
5312
|
this.pathStr = "", this.type = type, isArray(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
5310
5313
|
}
|
|
5311
5314
|
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
@@ -5327,10 +5330,9 @@ class CustomSymbolClass {
|
|
|
5327
5330
|
bounds(size, bounds) {
|
|
5328
5331
|
if (size = this.parseSize(size), this.isSvg) {
|
|
5329
5332
|
if (!this.svgCache) return;
|
|
5330
|
-
return bounds.clear(), void this.svgCache.forEach(
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
} = _ref;
|
|
5333
|
+
return bounds.clear(), void this.svgCache.forEach(({
|
|
5334
|
+
path: path
|
|
5335
|
+
}) => {
|
|
5334
5336
|
tempBounds.x1 = path.bounds.x1 * size, tempBounds.y1 = path.bounds.y1 * size, tempBounds.x2 = path.bounds.x2 * size, tempBounds.y2 = path.bounds.y2 * size, bounds.union(tempBounds);
|
|
5335
5337
|
});
|
|
5336
5338
|
}
|
|
@@ -5386,8 +5388,7 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
5386
5388
|
if (-1 === closingIndex) throw new Error(errMsg);
|
|
5387
5389
|
return closingIndex + str.length - 1;
|
|
5388
5390
|
}
|
|
5389
|
-
function tagExpWithClosingIndex(xmlData, i) {
|
|
5390
|
-
let closingChar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ">";
|
|
5391
|
+
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
5391
5392
|
let attrBoundary,
|
|
5392
5393
|
tagExp = "";
|
|
5393
5394
|
for (let index = i; index < xmlData.length; index++) {
|
|
@@ -5405,8 +5406,7 @@ function tagExpWithClosingIndex(xmlData, i) {
|
|
|
5405
5406
|
tagExp += ch;
|
|
5406
5407
|
}
|
|
5407
5408
|
}
|
|
5408
|
-
function readTagExp(xmlData, i, removeNSPrefix) {
|
|
5409
|
-
let closingChar = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ">";
|
|
5409
|
+
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
5410
5410
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
5411
5411
|
if (!result) return;
|
|
5412
5412
|
let tagExp = result.data;
|
|
@@ -5568,8 +5568,7 @@ undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator)
|
|
|
5568
5568
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5569
5569
|
});
|
|
5570
5570
|
};
|
|
5571
|
-
function boundStroke(bounds, halfW, miter) {
|
|
5572
|
-
let pad = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
5571
|
+
function boundStroke(bounds, halfW, miter, pad = 0) {
|
|
5573
5572
|
return bounds.expand(halfW + (pad / 2 + (miter ? miterAdjustment(miter, halfW) : 0))), bounds;
|
|
5574
5573
|
}
|
|
5575
5574
|
function miterAdjustment(miter, strokeWidth) {
|
|
@@ -5754,7 +5753,7 @@ class DefaultMatrixAllocate {
|
|
|
5754
5753
|
get length() {
|
|
5755
5754
|
return this.pools.length;
|
|
5756
5755
|
}
|
|
5757
|
-
release() {
|
|
5756
|
+
release(...params) {
|
|
5758
5757
|
this.pools = [];
|
|
5759
5758
|
}
|
|
5760
5759
|
}
|
|
@@ -5782,7 +5781,7 @@ class DefaultMat4Allocate {
|
|
|
5782
5781
|
get length() {
|
|
5783
5782
|
return this.pools.length;
|
|
5784
5783
|
}
|
|
5785
|
-
release() {
|
|
5784
|
+
release(...params) {
|
|
5786
5785
|
this.pools = [];
|
|
5787
5786
|
}
|
|
5788
5787
|
}
|
|
@@ -5817,8 +5816,7 @@ let EmptyContext2d = class {
|
|
|
5817
5816
|
getContext() {
|
|
5818
5817
|
throw new Error("不支持getContext");
|
|
5819
5818
|
}
|
|
5820
|
-
setTransformForCurrent() {
|
|
5821
|
-
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
5819
|
+
setTransformForCurrent(force = !1) {
|
|
5822
5820
|
!force && this.applyedMatrix.equalToMatrix(this.matrix) || (this.applyedMatrix = this.cloneMatrix(this.matrix));
|
|
5823
5821
|
}
|
|
5824
5822
|
get currentMatrix() {
|
|
@@ -5839,8 +5837,7 @@ let EmptyContext2d = class {
|
|
|
5839
5837
|
highPerformanceRestore() {
|
|
5840
5838
|
this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop());
|
|
5841
5839
|
}
|
|
5842
|
-
rotate(rad) {
|
|
5843
|
-
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5840
|
+
rotate(rad, setTransform = !0) {
|
|
5844
5841
|
this.matrix.rotate(rad), setTransform && this.setTransformForCurrent();
|
|
5845
5842
|
}
|
|
5846
5843
|
save() {
|
|
@@ -5851,55 +5848,41 @@ let EmptyContext2d = class {
|
|
|
5851
5848
|
const matrix = this.cloneMatrix(this.matrix);
|
|
5852
5849
|
this.stack.push(matrix);
|
|
5853
5850
|
}
|
|
5854
|
-
scale(sx, sy) {
|
|
5855
|
-
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5851
|
+
scale(sx, sy, setTransform = !0) {
|
|
5856
5852
|
this.matrix.scale(sx, sy), setTransform && this.setTransformForCurrent();
|
|
5857
5853
|
}
|
|
5858
|
-
setScale(sx, sy) {
|
|
5859
|
-
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5854
|
+
setScale(sx, sy, setTransform = !0) {
|
|
5860
5855
|
this.matrix.setScale(sx, sy), setTransform && this.setTransformForCurrent();
|
|
5861
5856
|
}
|
|
5862
|
-
scalePoint(sx, sy, px, py) {
|
|
5863
|
-
let setTransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
|
|
5857
|
+
scalePoint(sx, sy, px, py, setTransform = !0) {
|
|
5864
5858
|
this.translate(px, py, !1), this.scale(sx, sy, !1), this.translate(-px, -py, !1), setTransform && this.setTransformForCurrent();
|
|
5865
5859
|
}
|
|
5866
|
-
setTransform(a, b, c, d, e, f) {
|
|
5867
|
-
let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
5868
|
-
let dpr = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : this.dpr;
|
|
5860
|
+
setTransform(a, b, c, d, e, f, setTransform = !0, dpr = this.dpr) {
|
|
5869
5861
|
this.matrix.setValue(dpr * a, dpr * b, dpr * c, dpr * d, dpr * e, dpr * f), setTransform && this.setTransformForCurrent();
|
|
5870
5862
|
}
|
|
5871
|
-
setTransformFromMatrix(matrix) {
|
|
5872
|
-
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5873
|
-
let dpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.dpr;
|
|
5863
|
+
setTransformFromMatrix(matrix, setTransform = !0, dpr = this.dpr) {
|
|
5874
5864
|
this.matrix.setValue(matrix.a * dpr, matrix.b * dpr, matrix.c * dpr, matrix.d * dpr, matrix.e * dpr, matrix.f * dpr), setTransform && this.setTransformForCurrent();
|
|
5875
5865
|
}
|
|
5876
|
-
resetTransform() {
|
|
5877
|
-
let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
5878
|
-
let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
5866
|
+
resetTransform(setTransform = !0, dpr = this.dpr) {
|
|
5879
5867
|
this.setTransform(dpr, 0, 0, dpr, 0, 0), setTransform && this.setTransformForCurrent();
|
|
5880
5868
|
}
|
|
5881
|
-
transform(a, b, c, d, e, f) {
|
|
5882
|
-
let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
5869
|
+
transform(a, b, c, d, e, f, setTransform = !0) {
|
|
5883
5870
|
this.matrix.multiply(a, b, c, d, e, f), setTransform && this.setTransformForCurrent();
|
|
5884
5871
|
}
|
|
5885
5872
|
transformFromMatrix(matrix, setTransform) {
|
|
5886
5873
|
this.matrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), setTransform && this.setTransformForCurrent();
|
|
5887
5874
|
}
|
|
5888
|
-
translate(x, y) {
|
|
5889
|
-
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5875
|
+
translate(x, y, setTransform = !0) {
|
|
5890
5876
|
this.matrix.translate(x, y), setTransform && this.setTransformForCurrent();
|
|
5891
5877
|
}
|
|
5892
|
-
rotateDegrees(deg) {
|
|
5893
|
-
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5878
|
+
rotateDegrees(deg, setTransform = !0) {
|
|
5894
5879
|
const rad = deg * Math.PI / 180;
|
|
5895
5880
|
this.rotate(rad, setTransform);
|
|
5896
5881
|
}
|
|
5897
|
-
rotateAbout(rad, x, y) {
|
|
5898
|
-
let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
|
|
5882
|
+
rotateAbout(rad, x, y, setTransform = !0) {
|
|
5899
5883
|
this.translate(x, y, !1), this.rotate(rad, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
|
|
5900
5884
|
}
|
|
5901
|
-
rotateDegreesAbout(deg, x, y) {
|
|
5902
|
-
let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
|
|
5885
|
+
rotateDegreesAbout(deg, x, y, setTransform = !0) {
|
|
5903
5886
|
this.translate(x, y, !1), this.rotateDegrees(deg, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
|
|
5904
5887
|
}
|
|
5905
5888
|
beginPath() {
|
|
@@ -5993,19 +5976,16 @@ let EmptyContext2d = class {
|
|
|
5993
5976
|
setTextStyleWithoutAlignBaseline(params, defaultParams) {}
|
|
5994
5977
|
setTextStyle(params, defaultParams) {}
|
|
5995
5978
|
draw() {}
|
|
5996
|
-
clearMatrix() {
|
|
5997
|
-
let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
5998
|
-
let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
5979
|
+
clearMatrix(setTransform = !0, dpr = this.dpr) {
|
|
5999
5980
|
this.setTransformFromMatrix(initMatrix, setTransform, dpr);
|
|
6000
5981
|
}
|
|
6001
5982
|
setClearMatrix(a, b, c, d, e, f) {
|
|
6002
5983
|
this._clearMatrix.setValue(a, b, c, d, e, f);
|
|
6003
5984
|
}
|
|
6004
|
-
onlyTranslate() {
|
|
6005
|
-
let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
|
|
5985
|
+
onlyTranslate(dpr = this.dpr) {
|
|
6006
5986
|
return this.matrix.a === dpr && 0 === this.matrix.b && 0 === this.matrix.c && this.matrix.d === dpr;
|
|
6007
5987
|
}
|
|
6008
|
-
release() {
|
|
5988
|
+
release(...params) {
|
|
6009
5989
|
this.stack.forEach(m => matrixAllocate.free(m)), this.stack.length = 0;
|
|
6010
5990
|
}
|
|
6011
5991
|
};
|
|
@@ -6016,9 +5996,7 @@ var ColorType;
|
|
|
6016
5996
|
ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
|
|
6017
5997
|
}(ColorType || (ColorType = {}));
|
|
6018
5998
|
class ColorStore {
|
|
6019
|
-
static Get(str) {
|
|
6020
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
|
|
6021
|
-
let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
|
|
5999
|
+
static Get(str, size = ColorType.Color1, arr = [0, 0, 0, 1]) {
|
|
6022
6000
|
if (size === ColorType.Color1) {
|
|
6023
6001
|
const color = ColorStore.store1[str];
|
|
6024
6002
|
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
@@ -6046,8 +6024,7 @@ class ColorStore {
|
|
|
6046
6024
|
}
|
|
6047
6025
|
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
6048
6026
|
|
|
6049
|
-
function colorArrayToString(color) {
|
|
6050
|
-
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6027
|
+
function colorArrayToString(color, alphaChannel = !1) {
|
|
6051
6028
|
return Array.isArray(color) && isNumber(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
6052
6029
|
}
|
|
6053
6030
|
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
@@ -6231,11 +6208,14 @@ class Graphic extends Node {
|
|
|
6231
6208
|
get globalTransMatrix() {
|
|
6232
6209
|
return this.tryUpdateGlobalTransMatrix(!0);
|
|
6233
6210
|
}
|
|
6234
|
-
constructor() {
|
|
6235
|
-
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6211
|
+
constructor(params = {}) {
|
|
6236
6212
|
var _a;
|
|
6237
6213
|
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
6238
6214
|
}
|
|
6215
|
+
getGraphicService() {
|
|
6216
|
+
var _a, _b;
|
|
6217
|
+
return null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
|
|
6218
|
+
}
|
|
6239
6219
|
getAttributes() {
|
|
6240
6220
|
return this.attribute;
|
|
6241
6221
|
}
|
|
@@ -6248,8 +6228,7 @@ class Graphic extends Node {
|
|
|
6248
6228
|
set2dMode() {
|
|
6249
6229
|
this.in3dMode = !1;
|
|
6250
6230
|
}
|
|
6251
|
-
getOffsetXY(attr) {
|
|
6252
|
-
let includeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6231
|
+
getOffsetXY(attr, includeScroll = !1) {
|
|
6253
6232
|
var _a, _b;
|
|
6254
6233
|
const {
|
|
6255
6234
|
dx = attr.dx,
|
|
@@ -6265,13 +6244,12 @@ class Graphic extends Node {
|
|
|
6265
6244
|
this._emitCustomEvent("animate-bind", animate);
|
|
6266
6245
|
}
|
|
6267
6246
|
tryUpdateAABBBounds() {
|
|
6268
|
-
var _a, _b;
|
|
6269
6247
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
6270
6248
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6271
6249
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
6272
|
-
|
|
6250
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6273
6251
|
const bounds = this.doUpdateAABBBounds(full);
|
|
6274
|
-
return
|
|
6252
|
+
return this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6275
6253
|
}
|
|
6276
6254
|
tryUpdateOBBBounds() {
|
|
6277
6255
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
@@ -6361,7 +6339,7 @@ class Graphic extends Node {
|
|
|
6361
6339
|
const b = this.AABBBounds;
|
|
6362
6340
|
return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this._globalAABBBounds.empty() || this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
|
|
6363
6341
|
}
|
|
6364
|
-
tryUpdateGlobalTransMatrix() {
|
|
6342
|
+
tryUpdateGlobalTransMatrix(clearTag = !0) {
|
|
6365
6343
|
if (this._globalTransMatrix) {
|
|
6366
6344
|
if (this.parent) {
|
|
6367
6345
|
const m = this.parent.globalTransMatrix;
|
|
@@ -6373,12 +6351,11 @@ class Graphic extends Node {
|
|
|
6373
6351
|
shouldUpdateGlobalMatrix() {
|
|
6374
6352
|
return !0;
|
|
6375
6353
|
}
|
|
6376
|
-
tryUpdateLocalTransMatrix() {
|
|
6377
|
-
let clearTag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
6354
|
+
tryUpdateLocalTransMatrix(clearTag = !0) {
|
|
6378
6355
|
return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
|
|
6379
6356
|
}
|
|
6380
6357
|
shouldUpdateAABBBounds() {
|
|
6381
|
-
return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) &&
|
|
6358
|
+
return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) && this.getGraphicService().validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this) : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) && this.getGraphicService().validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this);
|
|
6382
6359
|
}
|
|
6383
6360
|
shouldSelfChangeUpdateAABBBounds() {
|
|
6384
6361
|
return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
|
|
@@ -6414,23 +6391,17 @@ class Graphic extends Node {
|
|
|
6414
6391
|
setWidthHeightWithoutTransform(aabbBounds) {
|
|
6415
6392
|
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
6416
6393
|
}
|
|
6417
|
-
setAttributesAndPreventAnimate(params) {
|
|
6418
|
-
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6419
|
-
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
6394
|
+
setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
|
|
6420
6395
|
this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
|
|
6421
6396
|
Object.keys(params).forEach(key => {
|
|
6422
6397
|
animate.preventAttr(key);
|
|
6423
6398
|
});
|
|
6424
6399
|
});
|
|
6425
6400
|
}
|
|
6426
|
-
setAttributes(params) {
|
|
6427
|
-
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6428
|
-
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
6401
|
+
setAttributes(params, forceUpdateTag = !1, context) {
|
|
6429
6402
|
(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);
|
|
6430
6403
|
}
|
|
6431
|
-
_setAttributes(params) {
|
|
6432
|
-
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6433
|
-
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
6404
|
+
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
6434
6405
|
const keys = Object.keys(params);
|
|
6435
6406
|
for (let i = 0; i < keys.length; i++) {
|
|
6436
6407
|
const key = keys[i];
|
|
@@ -6445,16 +6416,14 @@ class Graphic extends Node {
|
|
|
6445
6416
|
}, this.attribute, key, context);
|
|
6446
6417
|
params ? this._setAttributes(params, forceUpdateTag, context) : isNil(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
6447
6418
|
}
|
|
6448
|
-
needUpdateTags(keys) {
|
|
6449
|
-
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
|
|
6419
|
+
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
6450
6420
|
for (let i = 0; i < k.length; i++) {
|
|
6451
6421
|
const attrKey = k[i];
|
|
6452
6422
|
if (-1 !== keys.indexOf(attrKey)) return !0;
|
|
6453
6423
|
}
|
|
6454
6424
|
return !1;
|
|
6455
6425
|
}
|
|
6456
|
-
needUpdateTag(key) {
|
|
6457
|
-
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
|
|
6426
|
+
needUpdateTag(key, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
6458
6427
|
for (let i = 0; i < k.length; i++) {
|
|
6459
6428
|
if (key === k[i]) return !0;
|
|
6460
6429
|
}
|
|
@@ -6559,8 +6528,7 @@ class Graphic extends Node {
|
|
|
6559
6528
|
return this;
|
|
6560
6529
|
}
|
|
6561
6530
|
onAttributeUpdate(context) {
|
|
6562
|
-
|
|
6563
|
-
context && context.skipUpdateCallback || (null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6531
|
+
context && context.skipUpdateCallback || (this.getGraphicService().onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6564
6532
|
}
|
|
6565
6533
|
update(d) {
|
|
6566
6534
|
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
@@ -6597,6 +6565,9 @@ class Graphic extends Node {
|
|
|
6597
6565
|
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
6598
6566
|
type: AttributeUpdateType.STATE
|
|
6599
6567
|
});
|
|
6568
|
+
this._emitCustomEvent("afterStateUpdate", {
|
|
6569
|
+
type: AttributeUpdateType.STATE
|
|
6570
|
+
});
|
|
6600
6571
|
}
|
|
6601
6572
|
updateNormalAttrs(stateAttrs) {
|
|
6602
6573
|
const newNormalAttrs = {};
|
|
@@ -6608,8 +6579,7 @@ class Graphic extends Node {
|
|
|
6608
6579
|
newNormalAttrs[key] = this.getNormalAttribute(key);
|
|
6609
6580
|
}), this.normalAttrs = newNormalAttrs;
|
|
6610
6581
|
}
|
|
6611
|
-
stopStateAnimates() {
|
|
6612
|
-
let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "end";
|
|
6582
|
+
stopStateAnimates(type = "end") {
|
|
6613
6583
|
this.animates && this.animates.forEach(animate => {
|
|
6614
6584
|
animate.stateNames && (animate.stop(type), this.animates.delete(animate.id));
|
|
6615
6585
|
});
|
|
@@ -6747,7 +6717,6 @@ class Graphic extends Node {
|
|
|
6747
6717
|
}
|
|
6748
6718
|
}
|
|
6749
6719
|
setStage(stage, layer) {
|
|
6750
|
-
var _a;
|
|
6751
6720
|
if (this.stage !== stage) {
|
|
6752
6721
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
6753
6722
|
const timeline = stage.getTimeline();
|
|
@@ -6755,7 +6724,7 @@ class Graphic extends Node {
|
|
|
6755
6724
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
6756
6725
|
});
|
|
6757
6726
|
}
|
|
6758
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
6727
|
+
this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage);
|
|
6759
6728
|
}
|
|
6760
6729
|
}
|
|
6761
6730
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -6774,8 +6743,7 @@ class Graphic extends Node {
|
|
|
6774
6743
|
var _a;
|
|
6775
6744
|
return null !== (_a = this.attribute[name]) && void 0 !== _a ? _a : this.getDefaultAttribute(name);
|
|
6776
6745
|
}
|
|
6777
|
-
onSetStage(cb) {
|
|
6778
|
-
let immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6746
|
+
onSetStage(cb, immediate = !1) {
|
|
6779
6747
|
this._onSetStage = cb, immediate && this.stage && cb(this, this.stage);
|
|
6780
6748
|
}
|
|
6781
6749
|
attachShadow(shadowRoot) {
|
|
@@ -6796,8 +6764,7 @@ class Graphic extends Node {
|
|
|
6796
6764
|
createPathProxy(path) {
|
|
6797
6765
|
return isString(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
|
|
6798
6766
|
}
|
|
6799
|
-
loadImage(image) {
|
|
6800
|
-
let background = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6767
|
+
loadImage(image, background = !1) {
|
|
6801
6768
|
if (!image || background && backgroundNotImage(image)) return;
|
|
6802
6769
|
const url = image;
|
|
6803
6770
|
this.resources || (this.resources = new Map());
|
|
@@ -6827,8 +6794,7 @@ class Graphic extends Node {
|
|
|
6827
6794
|
animate.stop();
|
|
6828
6795
|
});
|
|
6829
6796
|
}
|
|
6830
|
-
stopAnimates() {
|
|
6831
|
-
let stopChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
6797
|
+
stopAnimates(stopChildren = !1) {
|
|
6832
6798
|
this._stopAnimates(this.animates), this.shadowRoot && this.shadowRoot.stopAnimates(!0), this.isContainer && stopChildren && this.forEachChildren(c => {
|
|
6833
6799
|
c.stopAnimates(stopChildren);
|
|
6834
6800
|
});
|
|
@@ -6903,12 +6869,11 @@ class Group extends Graphic {
|
|
|
6903
6869
|
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
6904
6870
|
}
|
|
6905
6871
|
tryUpdateAABBBounds() {
|
|
6906
|
-
var _a, _b;
|
|
6907
6872
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6908
|
-
|
|
6873
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6909
6874
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6910
6875
|
bounds = this.doUpdateAABBBounds();
|
|
6911
|
-
return this.addUpdateLayoutTag(),
|
|
6876
|
+
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6912
6877
|
}
|
|
6913
6878
|
doUpdateLocalMatrix() {
|
|
6914
6879
|
const {
|
|
@@ -6968,19 +6933,16 @@ class Group extends Graphic {
|
|
|
6968
6933
|
return this.theme.getTheme(this);
|
|
6969
6934
|
}
|
|
6970
6935
|
incrementalAppendChild(node) {
|
|
6971
|
-
var _a;
|
|
6972
6936
|
const data = super.appendChild(node);
|
|
6973
|
-
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(),
|
|
6937
|
+
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
6974
6938
|
}
|
|
6975
6939
|
incrementalClearChild() {
|
|
6976
|
-
|
|
6977
|
-
super.removeAllChild(), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onClearIncremental(this, this.stage);
|
|
6940
|
+
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
6978
6941
|
}
|
|
6979
6942
|
_updateChildToStage(child) {
|
|
6980
6943
|
return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
|
|
6981
6944
|
}
|
|
6982
|
-
appendChild(node) {
|
|
6983
|
-
let addStage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
6945
|
+
appendChild(node, addStage = !0) {
|
|
6984
6946
|
const data = super.appendChild(node);
|
|
6985
6947
|
return addStage && this.stage && data && data.setStage(this.stage, this.layer), this.addUpdateBoundTag(), data;
|
|
6986
6948
|
}
|
|
@@ -6994,20 +6956,16 @@ class Group extends Graphic {
|
|
|
6994
6956
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6995
6957
|
}
|
|
6996
6958
|
removeChild(child) {
|
|
6997
|
-
var _a;
|
|
6998
6959
|
const data = super.removeChild(child);
|
|
6999
|
-
return child.stage = null,
|
|
6960
|
+
return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
|
|
7000
6961
|
}
|
|
7001
|
-
removeAllChild() {
|
|
7002
|
-
let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
6962
|
+
removeAllChild(deep = !1) {
|
|
7003
6963
|
this.forEachChildren(child => {
|
|
7004
|
-
|
|
7005
|
-
null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
6964
|
+
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
7006
6965
|
}), super.removeAllChild(), this.addUpdateBoundTag();
|
|
7007
6966
|
}
|
|
7008
6967
|
setStage(stage, layer) {
|
|
7009
|
-
|
|
7010
|
-
this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage), this.forEachChildren(item => {
|
|
6968
|
+
this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage), this.forEachChildren(item => {
|
|
7011
6969
|
item.setStage(stage, this.layer);
|
|
7012
6970
|
}));
|
|
7013
6971
|
}
|
|
@@ -7021,8 +6979,7 @@ class Group extends Graphic {
|
|
|
7021
6979
|
g.isContainer && g.addUpdateGlobalPositionTag();
|
|
7022
6980
|
});
|
|
7023
6981
|
}
|
|
7024
|
-
tryUpdateGlobalTransMatrix() {
|
|
7025
|
-
let clearTag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
6982
|
+
tryUpdateGlobalTransMatrix(clearTag = !0) {
|
|
7026
6983
|
if (this.shouldUpdateGlobalMatrix()) {
|
|
7027
6984
|
if (this._globalTransMatrix) {
|
|
7028
6985
|
if (this.parent) {
|
|
@@ -7096,8 +7053,7 @@ class Layer extends Group {
|
|
|
7096
7053
|
zIndex: null !== (_a = params.zIndex) && void 0 !== _a ? _a : 0
|
|
7097
7054
|
}), this.layer = this, this.subLayers = new Map(), this.theme = new Theme(), this.background = "rgba(0, 0, 0, 0)", this.afterDrawCbs = [];
|
|
7098
7055
|
}
|
|
7099
|
-
combineSubLayer() {
|
|
7100
|
-
let removeIncrementalKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
7056
|
+
combineSubLayer(removeIncrementalKey = !0) {
|
|
7101
7057
|
const subLayers = Array.from(this.subLayers.values()).sort((a, b) => a.zIndex - b.zIndex);
|
|
7102
7058
|
this.layerHandler.merge(subLayers.map(l => (l.layer.subLayers.size && l.layer.combineSubLayer(removeIncrementalKey), l.layer.getNativeHandler()))), removeIncrementalKey && subLayers.forEach(l => {
|
|
7103
7059
|
l.group && (l.group.incremental = 0);
|
|
@@ -7206,10 +7162,9 @@ let DefaultLayerService = DefaultLayerService_1 = class {
|
|
|
7206
7162
|
let layerHandler;
|
|
7207
7163
|
return layerHandler = "static" === layerMode ? container.get(StaticLayerHandlerContribution) : "dynamic" === layerMode ? container.get(DynamicLayerHandlerContribution) : container.get(VirtualLayerHandlerContribution), layerHandler;
|
|
7208
7164
|
}
|
|
7209
|
-
createLayer(stage
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
};
|
|
7165
|
+
createLayer(stage, options = {
|
|
7166
|
+
main: !1
|
|
7167
|
+
}) {
|
|
7213
7168
|
var _a;
|
|
7214
7169
|
this.tryInit();
|
|
7215
7170
|
let layerMode = this.getRecommendedLayerType(options.layerMode);
|
|
@@ -7450,8 +7405,7 @@ const InteractiveSubRenderContribution = Symbol.for("InteractiveSubRenderContrib
|
|
|
7450
7405
|
function textDrawOffsetX(textAlign, width) {
|
|
7451
7406
|
return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
|
|
7452
7407
|
}
|
|
7453
|
-
function textLayoutOffsetY(baseline, lineHeight, fontSize) {
|
|
7454
|
-
let buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
7408
|
+
function textLayoutOffsetY(baseline, lineHeight, fontSize, buf = 0) {
|
|
7455
7409
|
return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
|
|
7456
7410
|
}
|
|
7457
7411
|
|
|
@@ -7634,7 +7588,7 @@ let DefaultGraphicService = class {
|
|
|
7634
7588
|
const {
|
|
7635
7589
|
visible = theme.visible
|
|
7636
7590
|
} = attribute;
|
|
7637
|
-
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix),
|
|
7591
|
+
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), this.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
|
|
7638
7592
|
}
|
|
7639
7593
|
updateTempAABBBounds(aabbBounds) {
|
|
7640
7594
|
const tb1 = this.tempAABBBounds1,
|
|
@@ -7665,10 +7619,9 @@ const updateBoundsOfCommonOuterBorder = (attribute, theme, aabbBounds) => {
|
|
|
7665
7619
|
|
|
7666
7620
|
const CIRCLE_UPDATE_TAG_KEY = ["radius", "startAngle", "endAngle", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
7667
7621
|
class Circle extends Graphic {
|
|
7668
|
-
constructor(
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
};
|
|
7622
|
+
constructor(params = {
|
|
7623
|
+
radius: 1
|
|
7624
|
+
}) {
|
|
7672
7625
|
super(params), this.type = "circle", this.numberType = CIRCLE_NUMBER_TYPE;
|
|
7673
7626
|
}
|
|
7674
7627
|
isValid() {
|
|
@@ -7750,10 +7703,7 @@ class CanvasTextLayout {
|
|
|
7750
7703
|
} else bbox.yOffset = -bbox.height;
|
|
7751
7704
|
return bbox;
|
|
7752
7705
|
}
|
|
7753
|
-
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
|
|
7754
|
-
let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
|
|
7755
|
-
let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
|
|
7756
|
-
let params = arguments.length > 6 ? arguments[6] : undefined;
|
|
7706
|
+
GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = "", wordBreak, params) {
|
|
7757
7707
|
const {
|
|
7758
7708
|
lineWidth: lineWidth,
|
|
7759
7709
|
suffixPosition = "end",
|
|
@@ -7876,11 +7826,10 @@ class Text extends Graphic {
|
|
|
7876
7826
|
get isMultiLine() {
|
|
7877
7827
|
return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
|
|
7878
7828
|
}
|
|
7879
|
-
constructor(
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
};
|
|
7829
|
+
constructor(params = {
|
|
7830
|
+
text: "",
|
|
7831
|
+
fontSize: 16
|
|
7832
|
+
}) {
|
|
7884
7833
|
super(params), this.type = "text", this.numberType = TEXT_NUMBER_TYPE, this.cache = {};
|
|
7885
7834
|
}
|
|
7886
7835
|
isValid() {
|
|
@@ -8212,12 +8161,10 @@ class Text extends Graphic {
|
|
|
8212
8161
|
var _a;
|
|
8213
8162
|
return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
8214
8163
|
}
|
|
8215
|
-
needUpdateTags(keys) {
|
|
8216
|
-
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
|
|
8164
|
+
needUpdateTags(keys, k = TEXT_UPDATE_TAG_KEY) {
|
|
8217
8165
|
return super.needUpdateTags(keys, k);
|
|
8218
8166
|
}
|
|
8219
|
-
needUpdateTag(key) {
|
|
8220
|
-
let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
|
|
8167
|
+
needUpdateTag(key, k = TEXT_UPDATE_TAG_KEY) {
|
|
8221
8168
|
return super.needUpdateTag(key, k);
|
|
8222
8169
|
}
|
|
8223
8170
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
|
|
@@ -8420,19 +8367,15 @@ const updateBoundsOfSymbolOuterBorder = (attribute, symbolTheme, aabbBounds) =>
|
|
|
8420
8367
|
|
|
8421
8368
|
const SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
8422
8369
|
let Symbol$1 = class Symbol extends Graphic {
|
|
8423
|
-
constructor(
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
};
|
|
8370
|
+
constructor(params = {
|
|
8371
|
+
symbolType: "circle"
|
|
8372
|
+
}) {
|
|
8427
8373
|
super(params), this.type = "symbol", this.numberType = SYMBOL_NUMBER_TYPE;
|
|
8428
8374
|
}
|
|
8429
8375
|
getParsedPath() {
|
|
8430
8376
|
return this.shouldUpdateShape() && (this._parsedPath = this.doUpdateParsedPath(), this.clearUpdateShapeTag()), this._parsedPath;
|
|
8431
8377
|
}
|
|
8432
|
-
getParsedPath2D() {
|
|
8433
|
-
let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8434
|
-
let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
8435
|
-
let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
8378
|
+
getParsedPath2D(x = 0, y = 0, size = 1) {
|
|
8436
8379
|
let path = null;
|
|
8437
8380
|
try {
|
|
8438
8381
|
path = new Path2D();
|
|
@@ -8517,8 +8460,7 @@ function createSymbol(attributes) {
|
|
|
8517
8460
|
|
|
8518
8461
|
const LINE_UPDATE_TAG_KEY = ["segments", "points", "curveType", "curveTension", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
8519
8462
|
let Line$1 = class Line extends Graphic {
|
|
8520
|
-
constructor() {
|
|
8521
|
-
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8463
|
+
constructor(params = {}) {
|
|
8522
8464
|
super(params), this.type = "line", this.numberType = LINE_NUMBER_TYPE;
|
|
8523
8465
|
}
|
|
8524
8466
|
isValid() {
|
|
@@ -9256,8 +9198,7 @@ class Wrapper {
|
|
|
9256
9198
|
line = new Line(this.frame.left, this[this.directionKey.width], this.y + maxAscent, maxAscent, maxDescent, this.lineBuffer, this.direction, "horizontal" === this.direction ? this.frame.isWidthMax : this.frame.isHeightMax);
|
|
9257
9199
|
this.frame.lines.push(line), this.frame.actualHeight += line.height, this.y += line.height, this.lineBuffer.length = 0, this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;
|
|
9258
9200
|
}
|
|
9259
|
-
deal(paragraph) {
|
|
9260
|
-
let singleLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
9201
|
+
deal(paragraph, singleLine = !1) {
|
|
9261
9202
|
paragraph instanceof RichTextIcon ? "horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : 0 === this.lineBuffer.length ? (this.store(paragraph), this.send()) : (this.send(), this.deal(paragraph)) : "number" != typeof this.width || this.width < 0 || (paragraph.newLine && this.send(), (0 !== paragraph.text.length || this.newLine) && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(), this.deal(paragraph)) : this.cut(paragraph, singleLine)));
|
|
9262
9203
|
}
|
|
9263
9204
|
cut(paragraph, singleLine) {
|
|
@@ -10568,9 +10509,7 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
|
|
|
10568
10509
|
const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
|
|
10569
10510
|
|
|
10570
10511
|
const halfPi = pi / 2;
|
|
10571
|
-
function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
10572
|
-
let roundCorner = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
10573
|
-
let edgeCb = arguments.length > 7 ? arguments[7] : undefined;
|
|
10512
|
+
function createRectPath(path, x, y, width, height, rectCornerRadius, roundCorner = !0, edgeCb) {
|
|
10574
10513
|
let cornerRadius;
|
|
10575
10514
|
if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
|
|
10576
10515
|
const cornerRadiusArr = rectCornerRadius;
|
|
@@ -10845,6 +10784,9 @@ class BaseRender {
|
|
|
10845
10784
|
init(contributions) {
|
|
10846
10785
|
contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke));
|
|
10847
10786
|
}
|
|
10787
|
+
reInit() {
|
|
10788
|
+
this.init(this.graphicRenderContributions);
|
|
10789
|
+
}
|
|
10848
10790
|
beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
10849
10791
|
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
|
|
10850
10792
|
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
@@ -10908,8 +10850,7 @@ class BaseRender {
|
|
|
10908
10850
|
doStroke: doStroke
|
|
10909
10851
|
};
|
|
10910
10852
|
}
|
|
10911
|
-
transform(graphic, graphicAttribute, context) {
|
|
10912
|
-
let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
10853
|
+
transform(graphic, graphicAttribute, context, use3dMatrixIn3dMode = !1) {
|
|
10913
10854
|
const {
|
|
10914
10855
|
x = graphicAttribute.x,
|
|
10915
10856
|
y = graphicAttribute.y,
|
|
@@ -11014,8 +10955,8 @@ var __decorate$G = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11014
10955
|
};
|
|
11015
10956
|
};
|
|
11016
10957
|
let DefaultCanvasArcRender = class extends BaseRender {
|
|
11017
|
-
constructor(
|
|
11018
|
-
super(), this.
|
|
10958
|
+
constructor(graphicRenderContributions) {
|
|
10959
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11019
10960
|
}
|
|
11020
10961
|
drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
|
|
11021
10962
|
const capAngle = _ea - _sa,
|
|
@@ -11122,7 +11063,7 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11122
11063
|
isFullStroke: isFullStroke,
|
|
11123
11064
|
stroke: arrayStroke
|
|
11124
11065
|
} = parseStroke(stroke);
|
|
11125
|
-
if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb), this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb)) : (this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb), this._runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb))), !isFullStroke && doStroke) {
|
|
11066
|
+
if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb), this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb)) : (this._runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb), this._runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb))), !isFullStroke && doStroke) {
|
|
11126
11067
|
context.beginPath();
|
|
11127
11068
|
drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
|
|
11128
11069
|
beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
|
|
@@ -11161,8 +11102,8 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11161
11102
|
_runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb) {
|
|
11162
11103
|
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
11163
11104
|
}
|
|
11164
|
-
_runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb) {
|
|
11165
|
-
doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
11105
|
+
_runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb) {
|
|
11106
|
+
doStroke && isFullStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
11166
11107
|
}
|
|
11167
11108
|
draw(arc, renderService, drawContext, params) {
|
|
11168
11109
|
const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
@@ -11187,8 +11128,8 @@ var __decorate$F = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11187
11128
|
};
|
|
11188
11129
|
};
|
|
11189
11130
|
let DefaultCanvasCircleRender = class extends BaseRender {
|
|
11190
|
-
constructor(
|
|
11191
|
-
super(), this.
|
|
11131
|
+
constructor(graphicRenderContributions) {
|
|
11132
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11192
11133
|
}
|
|
11193
11134
|
drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11194
11135
|
const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
|
|
@@ -11574,8 +11515,8 @@ var __decorate$D = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11574
11515
|
};
|
|
11575
11516
|
};
|
|
11576
11517
|
let DefaultCanvasAreaRender = class extends BaseRender {
|
|
11577
|
-
constructor(
|
|
11578
|
-
super(), this.
|
|
11518
|
+
constructor(graphicRenderContributions) {
|
|
11519
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
11579
11520
|
}
|
|
11580
11521
|
drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
11581
11522
|
var _a, _b, _c;
|
|
@@ -11818,8 +11759,8 @@ var __decorate$C = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11818
11759
|
};
|
|
11819
11760
|
};
|
|
11820
11761
|
let DefaultCanvasPathRender = class extends BaseRender {
|
|
11821
|
-
constructor(
|
|
11822
|
-
super(), this.
|
|
11762
|
+
constructor(graphicRenderContributions) {
|
|
11763
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11823
11764
|
}
|
|
11824
11765
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11825
11766
|
var _a, _b, _c;
|
|
@@ -11874,8 +11815,8 @@ var __decorate$B = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11874
11815
|
};
|
|
11875
11816
|
};
|
|
11876
11817
|
let DefaultCanvasRectRender = class extends BaseRender {
|
|
11877
|
-
constructor(
|
|
11878
|
-
super(), this.
|
|
11818
|
+
constructor(graphicRenderContributions) {
|
|
11819
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11879
11820
|
}
|
|
11880
11821
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
|
|
11881
11822
|
rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
@@ -11944,8 +11885,8 @@ var __decorate$A = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11944
11885
|
};
|
|
11945
11886
|
};
|
|
11946
11887
|
let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
11947
|
-
constructor(
|
|
11948
|
-
super(), this.
|
|
11888
|
+
constructor(graphicRenderContributions) {
|
|
11889
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
|
|
11949
11890
|
}
|
|
11950
11891
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
|
|
11951
11892
|
var _a;
|
|
@@ -12031,7 +11972,7 @@ class DefaultBoundsAllocate {
|
|
|
12031
11972
|
get length() {
|
|
12032
11973
|
return this.pools.length;
|
|
12033
11974
|
}
|
|
12034
|
-
release() {
|
|
11975
|
+
release(...params) {
|
|
12035
11976
|
this.pools = [];
|
|
12036
11977
|
}
|
|
12037
11978
|
}
|
|
@@ -12115,8 +12056,8 @@ var __decorate$z = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12115
12056
|
};
|
|
12116
12057
|
};
|
|
12117
12058
|
let DefaultCanvasTextRender = class extends BaseRender {
|
|
12118
|
-
constructor(
|
|
12119
|
-
super(), this.
|
|
12059
|
+
constructor(graphicRenderContributions) {
|
|
12060
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
12120
12061
|
}
|
|
12121
12062
|
drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12122
12063
|
var _a, _b, _c;
|
|
@@ -12251,11 +12192,12 @@ let DefaultCanvasTextRender = class extends BaseRender {
|
|
|
12251
12192
|
DefaultCanvasTextRender = __decorate$z([injectable(), __param$q(0, inject(ContributionProvider)), __param$q(0, named(TextRenderContribution)), __metadata$t("design:paramtypes", [Object])], DefaultCanvasTextRender);
|
|
12252
12193
|
|
|
12253
12194
|
function drawPolygon(path, points, x, y) {
|
|
12254
|
-
|
|
12255
|
-
|
|
12195
|
+
if (points && points.length) {
|
|
12196
|
+
path.moveTo(points[0].x + x, points[0].y + y);
|
|
12197
|
+
for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
|
|
12198
|
+
}
|
|
12256
12199
|
}
|
|
12257
|
-
function drawRoundedPolygon(path, points, x, y, cornerRadius) {
|
|
12258
|
-
let closePath = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !0;
|
|
12200
|
+
function drawRoundedPolygon(path, points, x, y, cornerRadius, closePath = !0) {
|
|
12259
12201
|
var _a;
|
|
12260
12202
|
if (points.length < 3) return void drawPolygon(path, points, x, y);
|
|
12261
12203
|
let startI = 0,
|
|
@@ -12320,8 +12262,8 @@ var __decorate$y = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12320
12262
|
};
|
|
12321
12263
|
};
|
|
12322
12264
|
let DefaultCanvasPolygonRender = class extends BaseRender {
|
|
12323
|
-
constructor(
|
|
12324
|
-
super(), this.
|
|
12265
|
+
constructor(graphicRenderContributions) {
|
|
12266
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
12325
12267
|
}
|
|
12326
12268
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12327
12269
|
const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
|
|
@@ -12376,6 +12318,9 @@ let DefaultCanvasGroupRender = class {
|
|
|
12376
12318
|
constructor(groupRenderContribitions) {
|
|
12377
12319
|
this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
|
|
12378
12320
|
}
|
|
12321
|
+
reInit() {
|
|
12322
|
+
this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
|
|
12323
|
+
}
|
|
12379
12324
|
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
|
|
12380
12325
|
const {
|
|
12381
12326
|
clip: clip,
|
|
@@ -12436,7 +12381,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12436
12381
|
});
|
|
12437
12382
|
}
|
|
12438
12383
|
draw(group, renderService, drawContext, params) {
|
|
12439
|
-
var _a;
|
|
12384
|
+
var _a, _b;
|
|
12440
12385
|
const {
|
|
12441
12386
|
context: context
|
|
12442
12387
|
} = drawContext;
|
|
@@ -12456,7 +12401,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12456
12401
|
height: height
|
|
12457
12402
|
} = group.attribute,
|
|
12458
12403
|
canvas = context.canvas,
|
|
12459
|
-
newCanvas =
|
|
12404
|
+
newCanvas = application.global.createCanvas({
|
|
12460
12405
|
width: canvas.width,
|
|
12461
12406
|
height: canvas.height,
|
|
12462
12407
|
dpr: 1
|
|
@@ -12481,7 +12426,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12481
12426
|
scrollY: scrollY
|
|
12482
12427
|
} = group.attribute;
|
|
12483
12428
|
let p;
|
|
12484
|
-
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(params.
|
|
12429
|
+
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(null === (_a = params.renderInGroupParams) || void 0 === _a ? void 0 : _a.skipSort, group, drawContext, null === (_b = params.renderInGroupParams) || void 0 === _b ? void 0 : _b.nextM)), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha = baseGlobalAlpha, drawMode > 0) {
|
|
12485
12430
|
const {
|
|
12486
12431
|
x: x,
|
|
12487
12432
|
y: y,
|
|
@@ -12518,8 +12463,8 @@ var __decorate$w = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12518
12463
|
};
|
|
12519
12464
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
12520
12465
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
12521
|
-
constructor(
|
|
12522
|
-
super(), this.
|
|
12466
|
+
constructor(graphicRenderContributions) {
|
|
12467
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
12523
12468
|
}
|
|
12524
12469
|
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12525
12470
|
const imageAttribute = getTheme(image).image,
|
|
@@ -12701,12 +12646,12 @@ let CommonDrawItemInterceptorContribution = class {
|
|
|
12701
12646
|
this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
|
|
12702
12647
|
}
|
|
12703
12648
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12704
|
-
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12649
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12705
12650
|
for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].afterDrawItem && this.interceptors[i].afterDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
|
|
12706
12651
|
return !1;
|
|
12707
12652
|
}
|
|
12708
12653
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12709
|
-
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12654
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12710
12655
|
for (let i = 0; i < this.interceptors.length; i++) if (this.interceptors[i].beforeDrawItem && this.interceptors[i].beforeDrawItem(graphic, renderService, drawContext, drawContribution, params)) return !0;
|
|
12711
12656
|
return !1;
|
|
12712
12657
|
}
|
|
@@ -12843,6 +12788,9 @@ let DefaultRenderService = class {
|
|
|
12843
12788
|
afterDraw(params) {
|
|
12844
12789
|
this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
|
|
12845
12790
|
}
|
|
12791
|
+
reInit() {
|
|
12792
|
+
this.drawContribution.reInit();
|
|
12793
|
+
}
|
|
12846
12794
|
render(groups, params) {
|
|
12847
12795
|
this.renderTreeRoots = groups, this.drawParams = params;
|
|
12848
12796
|
const updateBounds = params.updateBounds;
|
|
@@ -13007,7 +12955,7 @@ let DefaultPluginService = class {
|
|
|
13007
12955
|
unRegister(plugin) {
|
|
13008
12956
|
"onStartupFinished" === plugin.activeEvent ? this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1) : "onRegister" === plugin.activeEvent && this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(plugin), 1), plugin.deactivate(this);
|
|
13009
12957
|
}
|
|
13010
|
-
release() {
|
|
12958
|
+
release(...params) {
|
|
13011
12959
|
this.onStartupFinishedPlugin.forEach(plugin => {
|
|
13012
12960
|
plugin.deactivate(this);
|
|
13013
12961
|
}), this.onStartupFinishedPlugin = [], this.onRegisterPlugin.forEach(plugin => {
|
|
@@ -13154,9 +13102,7 @@ function parseChildMap(graphic, defaultZIndex, reverse) {
|
|
|
13154
13102
|
zIdxArray: zIdxArray
|
|
13155
13103
|
};
|
|
13156
13104
|
}
|
|
13157
|
-
function foreach(graphic, defaultZIndex, cb) {
|
|
13158
|
-
let reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
13159
|
-
let sort3d = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
|
|
13105
|
+
function foreach(graphic, defaultZIndex, cb, reverse = !1, sort3d = !1) {
|
|
13160
13106
|
let needSort = !1;
|
|
13161
13107
|
if (sort3d) needSort = !0;else {
|
|
13162
13108
|
let lastZIndex;
|
|
@@ -13187,14 +13133,12 @@ function foreach(graphic, defaultZIndex, cb) {
|
|
|
13187
13133
|
}
|
|
13188
13134
|
} else graphic.forEachChildren(cb, reverse);
|
|
13189
13135
|
}
|
|
13190
|
-
function foreachAsync(graphic, defaultZIndex, cb) {
|
|
13191
|
-
let reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
13136
|
+
function foreachAsync(graphic, defaultZIndex, cb, reverse = !1) {
|
|
13192
13137
|
return __awaiter$2(this, void 0, void 0, function* () {
|
|
13193
13138
|
yield graphic.forEachChildrenAsync(cb, reverse);
|
|
13194
13139
|
});
|
|
13195
13140
|
}
|
|
13196
|
-
function findNextGraphic(graphic, id, defaultZIndex) {
|
|
13197
|
-
let reverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
|
|
13141
|
+
function findNextGraphic(graphic, id, defaultZIndex, reverse = !1) {
|
|
13198
13142
|
let needSort = !1;
|
|
13199
13143
|
graphic.forEachChildren((item, i) => {
|
|
13200
13144
|
const {
|
|
@@ -13251,6 +13195,11 @@ let DefaultDrawContribution = class {
|
|
|
13251
13195
|
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
13252
13196
|
}, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray(this.contributions) || (this.contributions = [this.contributions]), this.init();
|
|
13253
13197
|
}
|
|
13198
|
+
reInit() {
|
|
13199
|
+
this.init(), this.contributions.forEach(item => {
|
|
13200
|
+
item.reInit();
|
|
13201
|
+
});
|
|
13202
|
+
}
|
|
13254
13203
|
init() {
|
|
13255
13204
|
this.contributions.forEach(item => {
|
|
13256
13205
|
if (item.style) {
|
|
@@ -14031,6 +13980,13 @@ class AbstractComponent extends Group {
|
|
|
14031
13980
|
changeEvent.manager = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem.manager;
|
|
14032
13981
|
this.dispatchEvent(changeEvent);
|
|
14033
13982
|
}
|
|
13983
|
+
eventPosToStagePos(e) {
|
|
13984
|
+
var _a, _b;
|
|
13985
|
+
const result = { x: 0, y: 0 };
|
|
13986
|
+
const stagePoints = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
13987
|
+
this.globalTransMatrix.transformPoint(stagePoints, result);
|
|
13988
|
+
return result;
|
|
13989
|
+
}
|
|
14034
13990
|
}
|
|
14035
13991
|
|
|
14036
13992
|
const MathPickerContribution = Symbol.for("MathPickerContribution");
|
|
@@ -14972,6 +14928,11 @@ class ScrollBar extends AbstractComponent {
|
|
|
14972
14928
|
constructor(attributes, options) {
|
|
14973
14929
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, ScrollBar.defaultAttributes, attributes));
|
|
14974
14930
|
this.name = 'scrollbar';
|
|
14931
|
+
this._handleTouchMove = (e) => {
|
|
14932
|
+
if (isValid(this._prePos)) {
|
|
14933
|
+
e.preventDefault();
|
|
14934
|
+
}
|
|
14935
|
+
};
|
|
14975
14936
|
this._onRailPointerDown = (e) => {
|
|
14976
14937
|
const { viewX, viewY } = e;
|
|
14977
14938
|
const { direction, width, height, range } = this.attribute;
|
|
@@ -15010,7 +14971,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15010
14971
|
});
|
|
15011
14972
|
const triggers = getEndTriggersOfDrag();
|
|
15012
14973
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15013
|
-
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true
|
|
14974
|
+
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15014
14975
|
triggers.forEach((trigger) => {
|
|
15015
14976
|
obj.addEventListener(trigger, this._onSliderPointerUp);
|
|
15016
14977
|
});
|
|
@@ -15035,7 +14996,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
15035
14996
|
return [currentPos, currentScrollValue];
|
|
15036
14997
|
};
|
|
15037
14998
|
this._onSliderPointerMove = (e) => {
|
|
15038
|
-
e.preventDefault();
|
|
15039
14999
|
const { stopSliderMovePropagation = true } = this.attribute;
|
|
15040
15000
|
if (stopSliderMovePropagation) {
|
|
15041
15001
|
e.stopPropagation();
|
|
@@ -15053,6 +15013,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15053
15013
|
const preScrollRange = this.getScrollRange();
|
|
15054
15014
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
15055
15015
|
const range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
|
|
15016
|
+
this._prePos = null;
|
|
15056
15017
|
this._dispatchEvent(SCROLLBAR_END_EVENT, {
|
|
15057
15018
|
pre: preRange,
|
|
15058
15019
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
@@ -15107,6 +15068,9 @@ class ScrollBar extends AbstractComponent {
|
|
|
15107
15068
|
if (this._slider) {
|
|
15108
15069
|
this._slider.addEventListener('pointerdown', this._onSliderPointerDown);
|
|
15109
15070
|
}
|
|
15071
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
15072
|
+
passive: false
|
|
15073
|
+
});
|
|
15110
15074
|
}
|
|
15111
15075
|
render() {
|
|
15112
15076
|
this._reset();
|
|
@@ -15193,7 +15157,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15193
15157
|
_clearDragEvents() {
|
|
15194
15158
|
const triggers = getEndTriggersOfDrag();
|
|
15195
15159
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15196
|
-
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true
|
|
15160
|
+
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15197
15161
|
triggers.forEach((trigger) => {
|
|
15198
15162
|
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15199
15163
|
});
|
|
@@ -15202,6 +15166,13 @@ class ScrollBar extends AbstractComponent {
|
|
|
15202
15166
|
this._sliderRenderBounds = null;
|
|
15203
15167
|
this._sliderLimitRange = null;
|
|
15204
15168
|
}
|
|
15169
|
+
release(all) {
|
|
15170
|
+
super.release(all);
|
|
15171
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
15172
|
+
passive: false
|
|
15173
|
+
});
|
|
15174
|
+
this._clearDragEvents();
|
|
15175
|
+
}
|
|
15205
15176
|
}
|
|
15206
15177
|
ScrollBar.defaultAttributes = {
|
|
15207
15178
|
direction: 'horizontal',
|
|
@@ -17628,7 +17599,7 @@ class AxisBase extends AnimateComponent {
|
|
|
17628
17599
|
getBoundsWithoutRender(attributes) {
|
|
17629
17600
|
const currentAttribute = cloneDeep(this.attribute);
|
|
17630
17601
|
currentAttribute.scale = this.attribute.scale;
|
|
17631
|
-
|
|
17602
|
+
this.attribute = attributes;
|
|
17632
17603
|
const offscreenGroup = graphicCreator.group({
|
|
17633
17604
|
x: this.attribute.x,
|
|
17634
17605
|
y: this.attribute.y
|
|
@@ -17991,7 +17962,7 @@ class AxisBase extends AnimateComponent {
|
|
|
17991
17962
|
var _a;
|
|
17992
17963
|
if (el.type !== 'group' && el.id) {
|
|
17993
17964
|
const oldEl = prevInnerView[el.id];
|
|
17994
|
-
el.
|
|
17965
|
+
el.setFinalAttributes(el.attribute);
|
|
17995
17966
|
if (oldEl) {
|
|
17996
17967
|
oldEl.release();
|
|
17997
17968
|
const oldAttrs = oldEl.attribute;
|
|
@@ -18722,9 +18693,10 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
18722
18693
|
function noop() {}
|
|
18723
18694
|
class Step {
|
|
18724
18695
|
constructor(type, props, duration, easing) {
|
|
18696
|
+
var _a;
|
|
18725
18697
|
this._startTime = 0, this._hasFirstRun = !1, this._syncAttributeUpdate = () => {
|
|
18726
18698
|
this.target.setAttributes(this.target.attribute);
|
|
18727
|
-
}, this.type = type, this.props = props, this.duration = duration, this.easing = easing ? "function" == typeof easing ? easing : Easing[easing] : Easing.linear, "wait" === type && (this.onUpdate = noop), this.id = Generator.GenAutoIncrementId(), this.syncAttributeUpdate = noop;
|
|
18699
|
+
}, this.type = type, this.props = props, this.duration = duration, this.easing = easing ? "function" == typeof easing ? easing : null !== (_a = Easing[easing]) && void 0 !== _a ? _a : Easing.linear : Easing.linear, "wait" === type && (this.onUpdate = noop), this.id = Generator.GenAutoIncrementId(), this.syncAttributeUpdate = noop;
|
|
18728
18700
|
}
|
|
18729
18701
|
bind(target, animate) {
|
|
18730
18702
|
this.target = target, this.animate = animate, this.onBind(), this.syncAttributeUpdate();
|
|
@@ -18741,8 +18713,7 @@ class Step {
|
|
|
18741
18713
|
getLastProps() {
|
|
18742
18714
|
return this.prev ? this.prev.props || {} : this.animate.getStartProps();
|
|
18743
18715
|
}
|
|
18744
|
-
setDuration(duration) {
|
|
18745
|
-
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18716
|
+
setDuration(duration, updateDownstream = !0) {
|
|
18746
18717
|
this.duration = duration, updateDownstream && this.updateDownstreamStartTimes();
|
|
18747
18718
|
}
|
|
18748
18719
|
getDuration() {
|
|
@@ -18763,8 +18734,7 @@ class Step {
|
|
|
18763
18734
|
} else interpolateUpdateStore[key] ? funcs.push(interpolateUpdateStore[key]) : funcs.push(commonInterpolateUpdate);
|
|
18764
18735
|
}), this.interpolateUpdateFunctions = funcs;
|
|
18765
18736
|
}
|
|
18766
|
-
setStartTime(time) {
|
|
18767
|
-
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18737
|
+
setStartTime(time, updateDownstream = !0) {
|
|
18768
18738
|
this._startTime = time, updateDownstream && this.updateDownstreamStartTimes();
|
|
18769
18739
|
}
|
|
18770
18740
|
getStartTime() {
|
|
@@ -18846,12 +18816,12 @@ class WaitStep extends Step {
|
|
|
18846
18816
|
determineInterpolateUpdateFunction() {}
|
|
18847
18817
|
}
|
|
18848
18818
|
|
|
18849
|
-
class DefaultTimeline {
|
|
18819
|
+
class DefaultTimeline extends EventEmitter {
|
|
18850
18820
|
get animateCount() {
|
|
18851
18821
|
return this._animateCount;
|
|
18852
18822
|
}
|
|
18853
18823
|
constructor() {
|
|
18854
|
-
this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
|
|
18824
|
+
super(), this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
|
|
18855
18825
|
}
|
|
18856
18826
|
isRunning() {
|
|
18857
18827
|
return !this.paused && this._animateCount > 0;
|
|
@@ -18883,15 +18853,14 @@ class DefaultTimeline {
|
|
|
18883
18853
|
const scaledDelta = delta * this._playSpeed;
|
|
18884
18854
|
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18885
18855
|
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
18886
|
-
});
|
|
18856
|
+
}), 0 === this._animateCount && this.emit("animationEnd");
|
|
18887
18857
|
}
|
|
18888
18858
|
clear() {
|
|
18889
18859
|
this.forEachAccessAnimate(animate => {
|
|
18890
18860
|
animate.release();
|
|
18891
18861
|
}), this.head = null, this.tail = null, this.animateMap.clear(), this._animateCount = 0, this._totalDuration = 0;
|
|
18892
18862
|
}
|
|
18893
|
-
removeAnimate(animate) {
|
|
18894
|
-
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18863
|
+
removeAnimate(animate, release = !0) {
|
|
18895
18864
|
const node = this.animateMap.get(animate);
|
|
18896
18865
|
node && (release && (animate._onRemove && animate._onRemove.forEach(cb => cb()), animate.release()), node.prev ? node.prev.next = node.next : this.head = node.next, node.next ? node.next.prev = node.prev : this.tail = node.prev, this.animateMap.delete(animate), this._animateCount--, animate.getStartTime() + animate.getDuration() >= this._totalDuration && this.recalculateTotalDuration());
|
|
18897
18866
|
}
|
|
@@ -18929,10 +18898,7 @@ const defaultTimeline = new DefaultTimeline();
|
|
|
18929
18898
|
defaultTimeline.isGlobal = !0;
|
|
18930
18899
|
|
|
18931
18900
|
class Animate {
|
|
18932
|
-
constructor() {
|
|
18933
|
-
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
18934
|
-
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
18935
|
-
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
18901
|
+
constructor(id = Generator.GenAutoIncrementId(), timeline = defaultTimeline, slience) {
|
|
18936
18902
|
this.id = id, this.status = AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
|
|
18937
18903
|
}
|
|
18938
18904
|
getStartProps() {
|
|
@@ -18953,9 +18919,7 @@ class Animate {
|
|
|
18953
18919
|
bind(target) {
|
|
18954
18920
|
return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
18955
18921
|
}
|
|
18956
|
-
to(props) {
|
|
18957
|
-
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
18958
|
-
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
18922
|
+
to(props, duration = 300, easing = "linear") {
|
|
18959
18923
|
const step = new Step(AnimateStepType.to, props, duration, easing);
|
|
18960
18924
|
return step.bind(this.target, this), this.updateStepAfterAppend(step), this;
|
|
18961
18925
|
}
|
|
@@ -18985,9 +18949,7 @@ class Animate {
|
|
|
18985
18949
|
this._endProps[key] = currentStep.props[key];
|
|
18986
18950
|
}), currentStep = currentStep.next;
|
|
18987
18951
|
}
|
|
18988
|
-
from(props) {
|
|
18989
|
-
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
18990
|
-
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
18952
|
+
from(props, duration = 300, easing = "linear") {
|
|
18991
18953
|
const step = new Step(AnimateStepType.from, props, duration, easing);
|
|
18992
18954
|
return this._firstStep ? (this._lastStep.append(step), this._lastStep = step) : (this._firstStep = step, this._lastStep = step), this.updateDuration(), this;
|
|
18993
18955
|
}
|
|
@@ -19126,6 +19088,227 @@ class Animate {
|
|
|
19126
19088
|
}
|
|
19127
19089
|
}
|
|
19128
19090
|
|
|
19091
|
+
const performanceRAF = new PerformanceRAF();
|
|
19092
|
+
class RAFTickHandler {
|
|
19093
|
+
constructor() {
|
|
19094
|
+
this.released = !1;
|
|
19095
|
+
}
|
|
19096
|
+
tick(interval, cb) {
|
|
19097
|
+
performanceRAF.addAnimationFrameCb(() => {
|
|
19098
|
+
if (!this.released) return cb(this);
|
|
19099
|
+
});
|
|
19100
|
+
}
|
|
19101
|
+
release() {
|
|
19102
|
+
this.released = !0;
|
|
19103
|
+
}
|
|
19104
|
+
getTime() {
|
|
19105
|
+
return Date.now();
|
|
19106
|
+
}
|
|
19107
|
+
}
|
|
19108
|
+
class DefaultTicker extends EventEmitter {
|
|
19109
|
+
constructor(stage) {
|
|
19110
|
+
super(), this.timelines = [], this.frameTimeHistory = [], this.handleTick = (handler, params) => {
|
|
19111
|
+
const {
|
|
19112
|
+
once = !1
|
|
19113
|
+
} = null != params ? params : {};
|
|
19114
|
+
if (this.ifCanStop()) return this.stop(), !1;
|
|
19115
|
+
const currentTime = handler.getTime();
|
|
19116
|
+
this._lastTickTime = currentTime, this.lastFrameTime < 0 && (this.lastFrameTime = currentTime - this.interval + this.timeOffset, this.frameTimeHistory.push(this.lastFrameTime));
|
|
19117
|
+
const delta = currentTime - this.lastFrameTime,
|
|
19118
|
+
skip = this.checkSkip(delta);
|
|
19119
|
+
return skip || (this._handlerTick(delta), this.lastFrameTime = currentTime, this.frameTimeHistory.push(this.lastFrameTime)), once || handler.tick(this.interval, this.handleTick), !skip;
|
|
19120
|
+
}, this._handlerTick = delta => {
|
|
19121
|
+
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
19122
|
+
timeline.tick(delta);
|
|
19123
|
+
}), this.emit("tick", delta));
|
|
19124
|
+
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
19125
|
+
}
|
|
19126
|
+
bindStage(stage) {
|
|
19127
|
+
this.stage = stage;
|
|
19128
|
+
}
|
|
19129
|
+
computeTimeOffsetAndJitter() {
|
|
19130
|
+
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
19131
|
+
}
|
|
19132
|
+
init() {
|
|
19133
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
|
|
19134
|
+
this.initHandler();
|
|
19135
|
+
}), application.global.env && this.initHandler();
|
|
19136
|
+
}
|
|
19137
|
+
addTimeline(timeline) {
|
|
19138
|
+
this.timelines.push(timeline);
|
|
19139
|
+
}
|
|
19140
|
+
remTimeline(timeline) {
|
|
19141
|
+
this.timelines = this.timelines.filter(t => t !== timeline);
|
|
19142
|
+
}
|
|
19143
|
+
getTimelines() {
|
|
19144
|
+
return this.timelines;
|
|
19145
|
+
}
|
|
19146
|
+
initHandler() {
|
|
19147
|
+
this.setupTickHandler();
|
|
19148
|
+
}
|
|
19149
|
+
setupTickHandler() {
|
|
19150
|
+
const handler = new RAFTickHandler();
|
|
19151
|
+
return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
|
|
19152
|
+
}
|
|
19153
|
+
setInterval(interval) {
|
|
19154
|
+
this.interval = interval, this.computeTimeOffsetAndJitter();
|
|
19155
|
+
}
|
|
19156
|
+
getInterval() {
|
|
19157
|
+
return this.interval;
|
|
19158
|
+
}
|
|
19159
|
+
setFPS(fps) {
|
|
19160
|
+
this.setInterval(Math.floor(1e3 / fps));
|
|
19161
|
+
}
|
|
19162
|
+
getFPS() {
|
|
19163
|
+
return 1e3 / this.interval;
|
|
19164
|
+
}
|
|
19165
|
+
tick(interval) {
|
|
19166
|
+
this.tickerHandler.tick(interval, handler => this.handleTick(handler, {
|
|
19167
|
+
once: !0
|
|
19168
|
+
}));
|
|
19169
|
+
}
|
|
19170
|
+
tickTo(t) {
|
|
19171
|
+
this.tickerHandler.tickTo && this.tickerHandler.tickTo(t, handler => {
|
|
19172
|
+
this.handleTick(handler, {
|
|
19173
|
+
once: !0
|
|
19174
|
+
});
|
|
19175
|
+
});
|
|
19176
|
+
}
|
|
19177
|
+
pause() {
|
|
19178
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.PAUSE, !0);
|
|
19179
|
+
}
|
|
19180
|
+
resume() {
|
|
19181
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.RUNNING, !0);
|
|
19182
|
+
}
|
|
19183
|
+
ifCanStop() {
|
|
19184
|
+
if (this.autoStop) {
|
|
19185
|
+
if (!this.timelines.length) return !0;
|
|
19186
|
+
if (this.timelines.every(timeline => !timeline.isRunning())) return !0;
|
|
19187
|
+
}
|
|
19188
|
+
return !1;
|
|
19189
|
+
}
|
|
19190
|
+
start(force = !1) {
|
|
19191
|
+
if (this.status === STATUS$1.RUNNING) return !1;
|
|
19192
|
+
if (!this.tickerHandler) return !1;
|
|
19193
|
+
if (!force) {
|
|
19194
|
+
if (this.status === STATUS$1.PAUSE) return !1;
|
|
19195
|
+
if (this.ifCanStop()) return !1;
|
|
19196
|
+
}
|
|
19197
|
+
return this.status = STATUS$1.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
|
|
19198
|
+
}
|
|
19199
|
+
stop() {
|
|
19200
|
+
this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
19201
|
+
}
|
|
19202
|
+
trySyncTickStatus() {
|
|
19203
|
+
this.status === STATUS$1.INITIAL && this.timelines.some(timeline => timeline.isRunning()) ? this.start() : this.status === STATUS$1.RUNNING && this.timelines.every(timeline => !timeline.isRunning()) && this.stop();
|
|
19204
|
+
}
|
|
19205
|
+
release() {
|
|
19206
|
+
var _a;
|
|
19207
|
+
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
19208
|
+
}
|
|
19209
|
+
checkSkip(delta) {
|
|
19210
|
+
if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
|
|
19211
|
+
return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
|
|
19212
|
+
}
|
|
19213
|
+
}
|
|
19214
|
+
|
|
19215
|
+
class AnimationTransitionRegistry {
|
|
19216
|
+
constructor() {
|
|
19217
|
+
this.transitions = new Map(), this.registerDefaultTransitions();
|
|
19218
|
+
}
|
|
19219
|
+
static getInstance() {
|
|
19220
|
+
return AnimationTransitionRegistry.instance || (AnimationTransitionRegistry.instance = new AnimationTransitionRegistry()), AnimationTransitionRegistry.instance;
|
|
19221
|
+
}
|
|
19222
|
+
registerDefaultTransitions() {
|
|
19223
|
+
this.registerTransition("appear", "*", () => ({
|
|
19224
|
+
allowTransition: !0,
|
|
19225
|
+
stopOriginalTransition: !1
|
|
19226
|
+
})), this.registerTransition("appear", "appear", () => ({
|
|
19227
|
+
allowTransition: !1,
|
|
19228
|
+
stopOriginalTransition: !1
|
|
19229
|
+
})), this.registerTransition("appear", "disappear", () => ({
|
|
19230
|
+
allowTransition: !0,
|
|
19231
|
+
stopOriginalTransition: !0
|
|
19232
|
+
})), this.registerTransition("appear", "exit", () => ({
|
|
19233
|
+
allowTransition: !0,
|
|
19234
|
+
stopOriginalTransition: !0
|
|
19235
|
+
})), this.registerTransition("normal", "*", () => ({
|
|
19236
|
+
allowTransition: !0,
|
|
19237
|
+
stopOriginalTransition: !1
|
|
19238
|
+
})), this.registerTransition("normal", "normal", () => ({
|
|
19239
|
+
allowTransition: !1,
|
|
19240
|
+
stopOriginalTransition: !1
|
|
19241
|
+
})), this.registerTransition("normal", "disappear", () => ({
|
|
19242
|
+
allowTransition: !0,
|
|
19243
|
+
stopOriginalTransition: !0
|
|
19244
|
+
})), this.registerTransition("normal", "exit", () => ({
|
|
19245
|
+
allowTransition: !0,
|
|
19246
|
+
stopOriginalTransition: !0
|
|
19247
|
+
})), this.registerTransition("exit", "*", () => ({
|
|
19248
|
+
allowTransition: !1,
|
|
19249
|
+
stopOriginalTransition: !1
|
|
19250
|
+
})), this.registerTransition("exit", "disappear", () => ({
|
|
19251
|
+
allowTransition: !0,
|
|
19252
|
+
stopOriginalTransition: !0
|
|
19253
|
+
})), this.registerTransition("exit", "enter", () => ({
|
|
19254
|
+
allowTransition: !0,
|
|
19255
|
+
stopOriginalTransition: !0
|
|
19256
|
+
})), this.registerTransition("exit", "exit", () => ({
|
|
19257
|
+
allowTransition: !1,
|
|
19258
|
+
stopOriginalTransition: !1
|
|
19259
|
+
})), this.registerTransition("enter", "*", () => ({
|
|
19260
|
+
allowTransition: !0,
|
|
19261
|
+
stopOriginalTransition: !1
|
|
19262
|
+
})), this.registerTransition("enter", "enter", () => ({
|
|
19263
|
+
allowTransition: !1,
|
|
19264
|
+
stopOriginalTransition: !1
|
|
19265
|
+
})), this.registerTransition("enter", "disappear", () => ({
|
|
19266
|
+
allowTransition: !0,
|
|
19267
|
+
stopOriginalTransition: !0
|
|
19268
|
+
})), this.registerTransition("enter", "exit", () => ({
|
|
19269
|
+
allowTransition: !0,
|
|
19270
|
+
stopOriginalTransition: !0
|
|
19271
|
+
})), this.registerTransition("disappear", "*", () => ({
|
|
19272
|
+
allowTransition: !1,
|
|
19273
|
+
stopOriginalTransition: !1
|
|
19274
|
+
})), this.registerTransition("disappear", "appear", () => ({
|
|
19275
|
+
allowTransition: !0,
|
|
19276
|
+
stopOriginalTransition: !0
|
|
19277
|
+
})), this.registerTransition("update", "*", () => ({
|
|
19278
|
+
allowTransition: !0,
|
|
19279
|
+
stopOriginalTransition: !1
|
|
19280
|
+
})), this.registerTransition("update", "disappear", () => ({
|
|
19281
|
+
allowTransition: !0,
|
|
19282
|
+
stopOriginalTransition: !0
|
|
19283
|
+
})), this.registerTransition("update", "exit", () => ({
|
|
19284
|
+
allowTransition: !0,
|
|
19285
|
+
stopOriginalTransition: !0
|
|
19286
|
+
})), this.registerTransition("state", "*", () => ({
|
|
19287
|
+
allowTransition: !0,
|
|
19288
|
+
stopOriginalTransition: !1
|
|
19289
|
+
})), this.registerTransition("state", "disappear", () => ({
|
|
19290
|
+
allowTransition: !0,
|
|
19291
|
+
stopOriginalTransition: !0
|
|
19292
|
+
})), this.registerTransition("state", "exit", () => ({
|
|
19293
|
+
allowTransition: !0,
|
|
19294
|
+
stopOriginalTransition: !0
|
|
19295
|
+
}));
|
|
19296
|
+
}
|
|
19297
|
+
isTransitionAllowed(fromState, toState, graphic) {
|
|
19298
|
+
var _a, _b, _c, _d;
|
|
19299
|
+
let func = null === (_a = this.transitions.get(fromState)) || void 0 === _a ? void 0 : _a.get(toState);
|
|
19300
|
+
return func ? func(graphic, fromState) : (func = null === (_b = this.transitions.get(fromState)) || void 0 === _b ? void 0 : _b.get("*"), func ? func(graphic, fromState) : (func = null === (_c = this.transitions.get("*")) || void 0 === _c ? void 0 : _c.get(toState), func ? func(graphic, fromState) : (func = null === (_d = this.transitions.get("*")) || void 0 === _d ? void 0 : _d.get("*"), func ? func(graphic, fromState) : {
|
|
19301
|
+
allowTransition: !0,
|
|
19302
|
+
stopOriginalTransition: !0
|
|
19303
|
+
})));
|
|
19304
|
+
}
|
|
19305
|
+
registerTransition(fromState, toState, transition) {
|
|
19306
|
+
let fromStateMap = this.transitions.get(fromState);
|
|
19307
|
+
fromStateMap || (fromStateMap = new Map(), this.transitions.set(fromState, fromStateMap)), fromStateMap.set(toState, transition);
|
|
19308
|
+
}
|
|
19309
|
+
}
|
|
19310
|
+
AnimationTransitionRegistry.getInstance();
|
|
19311
|
+
|
|
19129
19312
|
class AnimateExecutor {
|
|
19130
19313
|
static registerBuiltInAnimate(name, animate) {
|
|
19131
19314
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
@@ -19364,14 +19547,10 @@ class AnimateExecutor {
|
|
|
19364
19547
|
var _a, _b;
|
|
19365
19548
|
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
|
|
19366
19549
|
}
|
|
19367
|
-
executeItem(params, graphic) {
|
|
19368
|
-
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
19369
|
-
let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
19550
|
+
executeItem(params, graphic, index = 0, count = 1) {
|
|
19370
19551
|
return Array.isArray(params) ? params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean) : [this._executeItem(params, graphic, index, count)].filter(Boolean);
|
|
19371
19552
|
}
|
|
19372
|
-
_executeItem(params, graphic) {
|
|
19373
|
-
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
19374
|
-
let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
19553
|
+
_executeItem(params, graphic, index = 0, count = 1) {
|
|
19375
19554
|
if (!graphic) return null;
|
|
19376
19555
|
const isTimeline = ("timeSlices" in params);
|
|
19377
19556
|
let animate = null;
|
|
@@ -19388,6 +19567,211 @@ class AnimateExecutor {
|
|
|
19388
19567
|
}
|
|
19389
19568
|
AnimateExecutor.builtInAnimateMap = {};
|
|
19390
19569
|
|
|
19570
|
+
const AnimationStates = {
|
|
19571
|
+
APPEAR: "appear",
|
|
19572
|
+
DISAPPEAR: "disappear",
|
|
19573
|
+
UPDATE: "update",
|
|
19574
|
+
HIGHLIGHT: "highlight",
|
|
19575
|
+
UNHIGHLIGHT: "unhighlight",
|
|
19576
|
+
SELECT: "select",
|
|
19577
|
+
UNSELECT: "unselect",
|
|
19578
|
+
HOVER: "hover",
|
|
19579
|
+
UNHOVER: "unhover",
|
|
19580
|
+
ACTIVE: "active",
|
|
19581
|
+
INACTIVE: "inactive"
|
|
19582
|
+
};
|
|
19583
|
+
class AnimationStateStore {
|
|
19584
|
+
constructor(graphic) {
|
|
19585
|
+
this.graphic = graphic;
|
|
19586
|
+
}
|
|
19587
|
+
registerState(state) {
|
|
19588
|
+
this.states || (this.states = new Map()), this.states.set(state.name, state);
|
|
19589
|
+
}
|
|
19590
|
+
clearStates() {
|
|
19591
|
+
var _a;
|
|
19592
|
+
null === (_a = this.states) || void 0 === _a || _a.clear();
|
|
19593
|
+
}
|
|
19594
|
+
}
|
|
19595
|
+
class AnimationStateManager {
|
|
19596
|
+
constructor(graphic) {
|
|
19597
|
+
this.stateList = null, this.graphic = graphic;
|
|
19598
|
+
}
|
|
19599
|
+
applyState(nextState, animationConfig, callback) {
|
|
19600
|
+
const registry = AnimationTransitionRegistry.getInstance(),
|
|
19601
|
+
shouldStopState = [],
|
|
19602
|
+
shouldApplyState = [];
|
|
19603
|
+
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
19604
|
+
const result = {
|
|
19605
|
+
allowTransition: !0,
|
|
19606
|
+
stopOriginalTransition: !0
|
|
19607
|
+
};
|
|
19608
|
+
this.stateList.forEach(currState => {
|
|
19609
|
+
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
19610
|
+
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
19611
|
+
}), result.allowTransition && (shouldApplyState.push({
|
|
19612
|
+
state: state,
|
|
19613
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19614
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19615
|
+
}), this.stateList.forEach(currState => {
|
|
19616
|
+
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
19617
|
+
}));
|
|
19618
|
+
}) : nextState.forEach((state, index) => {
|
|
19619
|
+
shouldApplyState.push({
|
|
19620
|
+
state: state,
|
|
19621
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19622
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19623
|
+
});
|
|
19624
|
+
}), shouldStopState.forEach(state => {
|
|
19625
|
+
state.executor.stop();
|
|
19626
|
+
}), shouldApplyState.length) {
|
|
19627
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
19628
|
+
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
19629
|
+
const nextState = shouldApplyState[i + 1],
|
|
19630
|
+
currentState = shouldApplyState[i];
|
|
19631
|
+
currentState.executor.onEnd(() => {
|
|
19632
|
+
nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
19633
|
+
});
|
|
19634
|
+
}
|
|
19635
|
+
} else callback && callback(!0);
|
|
19636
|
+
this.stateList ? this.stateList = this.stateList.filter(state => !shouldStopState.includes(state)) : this.stateList = [], this.stateList.push(...shouldApplyState);
|
|
19637
|
+
}
|
|
19638
|
+
applyAppearState(animationConfig, callback) {
|
|
19639
|
+
this.applyState([AnimationStates.APPEAR], [{
|
|
19640
|
+
name: AnimationStates.APPEAR,
|
|
19641
|
+
animation: animationConfig
|
|
19642
|
+
}], callback);
|
|
19643
|
+
}
|
|
19644
|
+
applyDisappearState(animationConfig, callback) {
|
|
19645
|
+
this.applyState([AnimationStates.DISAPPEAR], [{
|
|
19646
|
+
name: AnimationStates.DISAPPEAR,
|
|
19647
|
+
animation: animationConfig
|
|
19648
|
+
}], callback);
|
|
19649
|
+
}
|
|
19650
|
+
applyUpdateState(animationConfig, callback) {
|
|
19651
|
+
this.applyState([AnimationStates.UPDATE], [{
|
|
19652
|
+
name: AnimationStates.UPDATE,
|
|
19653
|
+
animation: animationConfig
|
|
19654
|
+
}], callback);
|
|
19655
|
+
}
|
|
19656
|
+
applyHighlightState(animationConfig, callback) {
|
|
19657
|
+
this.applyState([AnimationStates.HIGHLIGHT], [{
|
|
19658
|
+
name: AnimationStates.HIGHLIGHT,
|
|
19659
|
+
animation: animationConfig
|
|
19660
|
+
}], callback);
|
|
19661
|
+
}
|
|
19662
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19663
|
+
this.applyState([AnimationStates.UNHIGHLIGHT], [{
|
|
19664
|
+
name: AnimationStates.UNHIGHLIGHT,
|
|
19665
|
+
animation: animationConfig
|
|
19666
|
+
}], callback);
|
|
19667
|
+
}
|
|
19668
|
+
stopState(state, type) {
|
|
19669
|
+
var _a;
|
|
19670
|
+
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
19671
|
+
stateInfo && stateInfo.executor.stop(type);
|
|
19672
|
+
}
|
|
19673
|
+
clearState() {
|
|
19674
|
+
var _a;
|
|
19675
|
+
null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
|
|
19676
|
+
state.executor.stop();
|
|
19677
|
+
}), this.stateList = null;
|
|
19678
|
+
}
|
|
19679
|
+
}
|
|
19680
|
+
|
|
19681
|
+
class GraphicStateExtension {
|
|
19682
|
+
_getAnimationStateManager(graphic) {
|
|
19683
|
+
return graphic._animationStateManager || (graphic._animationStateManager = new AnimationStateManager(graphic)), graphic._animationStateManager;
|
|
19684
|
+
}
|
|
19685
|
+
_getAnimationStateStore(graphic) {
|
|
19686
|
+
return graphic._animationStateStore || (graphic._animationStateStore = new AnimationStateStore(graphic)), graphic._animationStateStore;
|
|
19687
|
+
}
|
|
19688
|
+
registerAnimationState(state) {
|
|
19689
|
+
return this._getAnimationStateStore(this).registerState(state), this;
|
|
19690
|
+
}
|
|
19691
|
+
applyAnimationState(state, animationConfig, callback) {
|
|
19692
|
+
return this._getAnimationStateManager(this).applyState(state, animationConfig, callback), this;
|
|
19693
|
+
}
|
|
19694
|
+
applyAppearState(animationConfig, callback) {
|
|
19695
|
+
return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback), this;
|
|
19696
|
+
}
|
|
19697
|
+
applyDisappearState(animationConfig, callback) {
|
|
19698
|
+
return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback), this;
|
|
19699
|
+
}
|
|
19700
|
+
applyUpdateState(animationConfig, callback) {
|
|
19701
|
+
return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback), this;
|
|
19702
|
+
}
|
|
19703
|
+
applyHighlightState(animationConfig, callback) {
|
|
19704
|
+
return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback), this;
|
|
19705
|
+
}
|
|
19706
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19707
|
+
return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
|
|
19708
|
+
}
|
|
19709
|
+
stopAnimationState(state, type) {
|
|
19710
|
+
return this._getAnimationStateManager(this).stopState(state, type), this;
|
|
19711
|
+
}
|
|
19712
|
+
clearAnimationStates() {
|
|
19713
|
+
return this._getAnimationStateManager(this).clearState(), this;
|
|
19714
|
+
}
|
|
19715
|
+
static extend(graphic) {
|
|
19716
|
+
return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
|
|
19717
|
+
}
|
|
19718
|
+
}
|
|
19719
|
+
|
|
19720
|
+
class AnimateExtension {
|
|
19721
|
+
getAttributes(final = !1) {
|
|
19722
|
+
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
19723
|
+
}
|
|
19724
|
+
animate(params) {
|
|
19725
|
+
var _a, _b, _c;
|
|
19726
|
+
this.animates || (this.animates = new Map());
|
|
19727
|
+
const animate = new Animate(null == params ? void 0 : params.id, null !== (_b = null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline()) && void 0 !== _b ? _b : defaultTimeline, null == params ? void 0 : params.slience);
|
|
19728
|
+
if (animate.bind(this), params) {
|
|
19729
|
+
const {
|
|
19730
|
+
onStart: onStart,
|
|
19731
|
+
onEnd: onEnd,
|
|
19732
|
+
onRemove: onRemove
|
|
19733
|
+
} = params;
|
|
19734
|
+
null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
|
|
19735
|
+
}
|
|
19736
|
+
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
19737
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
19738
|
+
}), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
|
|
19739
|
+
}
|
|
19740
|
+
createTimeline() {
|
|
19741
|
+
return new DefaultTimeline();
|
|
19742
|
+
}
|
|
19743
|
+
createTicker(stage) {
|
|
19744
|
+
return new DefaultTicker(stage);
|
|
19745
|
+
}
|
|
19746
|
+
setFinalAttributes(finalAttribute) {
|
|
19747
|
+
this.finalAttribute || (this.finalAttribute = {}), Object.assign(this.finalAttribute, finalAttribute);
|
|
19748
|
+
}
|
|
19749
|
+
initFinalAttributes(finalAttribute) {
|
|
19750
|
+
this.finalAttribute = finalAttribute;
|
|
19751
|
+
}
|
|
19752
|
+
initAnimateExecutor() {
|
|
19753
|
+
this._animateExecutor || (this._animateExecutor = new AnimateExecutor(this));
|
|
19754
|
+
}
|
|
19755
|
+
executeAnimation(config) {
|
|
19756
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
19757
|
+
}
|
|
19758
|
+
executeAnimations(configs) {
|
|
19759
|
+
return this.initAnimateExecutor(), configs.forEach(config => {
|
|
19760
|
+
this._animateExecutor.execute(config);
|
|
19761
|
+
}), this;
|
|
19762
|
+
}
|
|
19763
|
+
getFinalAttribute() {
|
|
19764
|
+
return this.finalAttribute;
|
|
19765
|
+
}
|
|
19766
|
+
getGraphicAttribute(key, prev = !1) {
|
|
19767
|
+
return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
|
|
19768
|
+
}
|
|
19769
|
+
}
|
|
19770
|
+
|
|
19771
|
+
function registerAnimate() {
|
|
19772
|
+
mixin(Graphic, GraphicStateExtension), mixin(Graphic, AnimateExtension);
|
|
19773
|
+
}
|
|
19774
|
+
|
|
19391
19775
|
class ACustomAnimate extends Step {
|
|
19392
19776
|
constructor(customFrom, customTo, duration, easing, params) {
|
|
19393
19777
|
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
|
|
@@ -19461,6 +19845,99 @@ function createComponentAnimator(component) {
|
|
|
19461
19845
|
return new ComponentAnimator(component);
|
|
19462
19846
|
}
|
|
19463
19847
|
|
|
19848
|
+
class IncreaseCount extends ACustomAnimate {
|
|
19849
|
+
constructor(from, to, duration, easing, params) {
|
|
19850
|
+
super(from, to, duration, easing, params), this.formatTemplate = null, this.decimalLength = null == params ? void 0 : params.decimalLength, (null == params ? void 0 : params.formatTemplate) && params.formatTemplate.includes("{{var}}") && (this.formatTemplate = params.formatTemplate);
|
|
19851
|
+
}
|
|
19852
|
+
onFirstRun() {
|
|
19853
|
+
var _a, _b, _c;
|
|
19854
|
+
const fromProps = this.getLastProps(),
|
|
19855
|
+
toProps = this.getEndProps(),
|
|
19856
|
+
fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : 0,
|
|
19857
|
+
toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : 0;
|
|
19858
|
+
this.valid = !0;
|
|
19859
|
+
let fromNum = 0,
|
|
19860
|
+
toNum = 0,
|
|
19861
|
+
fromFormat = "",
|
|
19862
|
+
toFormat = "",
|
|
19863
|
+
maxDecimalLength = 0;
|
|
19864
|
+
if ("number" == typeof fromText) {
|
|
19865
|
+
fromNum = fromText;
|
|
19866
|
+
const decimalPart = fromText.toString().split(".")[1] || "";
|
|
19867
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
19868
|
+
} else {
|
|
19869
|
+
if ("string" != typeof fromText) return void (this.valid = !1);
|
|
19870
|
+
if (fromText.endsWith("%")) {
|
|
19871
|
+
fromFormat = "%";
|
|
19872
|
+
const cleanNumStr = fromText.substring(0, fromText.length - 1).replace(/,/g, "");
|
|
19873
|
+
if (fromNum = parseFloat(cleanNumStr) / 100, isNaN(fromNum)) return void (this.valid = !1);
|
|
19874
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
19875
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
19876
|
+
} else {
|
|
19877
|
+
const cleanNumStr = fromText.replace(/,/g, "");
|
|
19878
|
+
if (fromNum = parseFloat(cleanNumStr), isNaN(fromNum)) return void (this.valid = !1);
|
|
19879
|
+
fromText.includes(",") && (fromFormat = ",");
|
|
19880
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
19881
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
19882
|
+
}
|
|
19883
|
+
}
|
|
19884
|
+
if ("number" == typeof toText) {
|
|
19885
|
+
toNum = toText;
|
|
19886
|
+
const decimalPart = toText.toString().split(".")[1] || "";
|
|
19887
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
19888
|
+
} else {
|
|
19889
|
+
if ("string" != typeof toText) return void (this.valid = !1);
|
|
19890
|
+
if (toText.endsWith("%")) {
|
|
19891
|
+
toFormat = "%";
|
|
19892
|
+
const cleanNumStr = toText.substring(0, toText.length - 1).replace(/,/g, "");
|
|
19893
|
+
if (toNum = parseFloat(cleanNumStr) / 100, isNaN(toNum)) return void (this.valid = !1);
|
|
19894
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
19895
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
19896
|
+
} else {
|
|
19897
|
+
const cleanNumStr = toText.replace(/,/g, "");
|
|
19898
|
+
if (toNum = parseFloat(cleanNumStr), isNaN(toNum)) return void (this.valid = !1);
|
|
19899
|
+
toText.includes(",") && (toFormat = ",");
|
|
19900
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
19901
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
19902
|
+
}
|
|
19903
|
+
}
|
|
19904
|
+
if (null === (_c = this.params) || void 0 === _c ? void 0 : _c.format) {
|
|
19905
|
+
switch (this.params.format) {
|
|
19906
|
+
case "percent":
|
|
19907
|
+
this.format = "%";
|
|
19908
|
+
break;
|
|
19909
|
+
case "thousandth":
|
|
19910
|
+
this.format = ",";
|
|
19911
|
+
break;
|
|
19912
|
+
case "none":
|
|
19913
|
+
this.format = "";
|
|
19914
|
+
break;
|
|
19915
|
+
default:
|
|
19916
|
+
this.format = toFormat || fromFormat;
|
|
19917
|
+
}
|
|
19918
|
+
"%" === this.format && "%" !== toFormat && "%" !== fromFormat && void 0 === this.decimalLength && (this.decimalLength = 2), "%" === this.format || "%" !== toFormat && "%" !== fromFormat || (fromNum *= 100, toNum *= 100);
|
|
19919
|
+
} else this.format = toFormat || fromFormat;
|
|
19920
|
+
this.fromNumber = fromNum, this.toNumber = toNum, void 0 === this.decimalLength && (this.decimalLength = maxDecimalLength);
|
|
19921
|
+
}
|
|
19922
|
+
onEnd(cb) {
|
|
19923
|
+
super.onEnd(cb), cb || this.props && this.target.setAttributes(this.props);
|
|
19924
|
+
}
|
|
19925
|
+
onUpdate(end, ratio, out) {
|
|
19926
|
+
if (!this.valid) return;
|
|
19927
|
+
const currentNumber = this.fromNumber + (this.toNumber - this.fromNumber) * ratio;
|
|
19928
|
+
let formattedText = "";
|
|
19929
|
+
const format = this.format,
|
|
19930
|
+
numberWithDecimals = ("%" === format ? 100 * currentNumber : currentNumber).toFixed(this.decimalLength);
|
|
19931
|
+
let formattedWithBasicFormat,
|
|
19932
|
+
formattedNumber = numberWithDecimals;
|
|
19933
|
+
if (parseFloat(numberWithDecimals) === Math.floor(parseFloat(numberWithDecimals)) && (formattedNumber = Math.floor(parseFloat(numberWithDecimals))), "%" === format) formattedWithBasicFormat = `${formattedNumber}%`;else if ("," === format) {
|
|
19934
|
+
const parts = formattedNumber.toString().split(".");
|
|
19935
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
|
|
19936
|
+
} else formattedWithBasicFormat = formattedNumber;
|
|
19937
|
+
formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
|
|
19938
|
+
}
|
|
19939
|
+
}
|
|
19940
|
+
|
|
19464
19941
|
class AxisEnter extends AComponentAnimate {
|
|
19465
19942
|
onBind() {
|
|
19466
19943
|
var _a;
|
|
@@ -21672,6 +22149,7 @@ class LabelEnter extends AComponentAnimate {
|
|
|
21672
22149
|
}
|
|
21673
22150
|
}
|
|
21674
22151
|
function registerLabelAnimate() {
|
|
22152
|
+
AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
|
|
21675
22153
|
AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
|
|
21676
22154
|
AnimateExecutor.registerBuiltInAnimate('labelEnter', LabelEnter);
|
|
21677
22155
|
}
|
|
@@ -22393,19 +22871,20 @@ class LabelBase extends AnimateComponent {
|
|
|
22393
22871
|
if (showLabelLine) {
|
|
22394
22872
|
labelLine = this._createLabelLine(text, relatedGraphic);
|
|
22395
22873
|
}
|
|
22874
|
+
const currentLabel = labelLine ? { text, labelLine } : { text };
|
|
22396
22875
|
if (syncState) {
|
|
22397
|
-
this.updateStatesOfLabels([
|
|
22876
|
+
this.updateStatesOfLabels([currentLabel], (_a = relatedGraphic.currentStates) !== null && _a !== void 0 ? _a : []);
|
|
22398
22877
|
}
|
|
22399
22878
|
if (state === 'enter') {
|
|
22400
22879
|
texts.push(text);
|
|
22401
|
-
currentTextMap.set(textKey,
|
|
22402
|
-
this._addLabel(
|
|
22880
|
+
currentTextMap.set(textKey, currentLabel);
|
|
22881
|
+
this._addLabel(currentLabel, texts, labelLines, index);
|
|
22403
22882
|
}
|
|
22404
22883
|
else if (state === 'update') {
|
|
22405
22884
|
const prevLabel = prevTextMap.get(textKey);
|
|
22406
22885
|
prevTextMap.delete(textKey);
|
|
22407
22886
|
currentTextMap.set(textKey, prevLabel);
|
|
22408
|
-
this._updateLabel(prevLabel,
|
|
22887
|
+
this._updateLabel(prevLabel, currentLabel);
|
|
22409
22888
|
}
|
|
22410
22889
|
});
|
|
22411
22890
|
this._removeLabel(prevTextMap);
|
|
@@ -22429,31 +22908,29 @@ class LabelBase extends AnimateComponent {
|
|
|
22429
22908
|
]));
|
|
22430
22909
|
}
|
|
22431
22910
|
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
22432
|
-
if (this._enableAnimation === false || !this._animationConfig.update) {
|
|
22433
|
-
return;
|
|
22434
|
-
}
|
|
22435
22911
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
22436
22912
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
22437
|
-
const { duration, easing } = this._animationConfig.update;
|
|
22438
22913
|
prevText.applyAnimationState(['update'], [
|
|
22439
22914
|
{
|
|
22440
22915
|
name: 'update',
|
|
22441
|
-
animation: {
|
|
22442
|
-
type: 'labelUpdate',
|
|
22443
|
-
duration,
|
|
22444
|
-
easing,
|
|
22445
|
-
customParameters: {
|
|
22916
|
+
animation: Object.assign(Object.assign({ type: 'labelUpdate' }, this._animationConfig.update), { customParameters: {
|
|
22446
22917
|
prevText,
|
|
22447
22918
|
curText,
|
|
22448
22919
|
prevLabelLine,
|
|
22449
22920
|
curLabelLine
|
|
22450
|
-
}
|
|
22451
|
-
}
|
|
22921
|
+
} })
|
|
22452
22922
|
}
|
|
22453
22923
|
]);
|
|
22454
22924
|
}
|
|
22925
|
+
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
22926
|
+
if (this.attribute.syncState && relatedGraphic) {
|
|
22927
|
+
relatedGraphic.on('afterStateUpdate', this._handleRelatedGraphicSetState);
|
|
22928
|
+
}
|
|
22929
|
+
}
|
|
22455
22930
|
_addLabel(label, texts, labelLines, index) {
|
|
22456
22931
|
const { text, labelLine } = label;
|
|
22932
|
+
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
22933
|
+
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
22457
22934
|
if (text) {
|
|
22458
22935
|
this.add(text);
|
|
22459
22936
|
}
|
|
@@ -22465,7 +22942,7 @@ class LabelBase extends AnimateComponent {
|
|
|
22465
22942
|
_updateLabel(prevLabel, currentLabel) {
|
|
22466
22943
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
22467
22944
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
22468
|
-
if (this._enableAnimation === false ||
|
|
22945
|
+
if (this._enableAnimation === false || this._animationConfig.update === false) {
|
|
22469
22946
|
prevLabel.text.setAttributes(curText.attribute);
|
|
22470
22947
|
if (prevLabelLine && curLabelLine) {
|
|
22471
22948
|
prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
@@ -24219,13 +24696,14 @@ class DataZoom extends AbstractComponent {
|
|
|
24219
24696
|
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24220
24697
|
const triggers = getEndTriggersOfDrag();
|
|
24221
24698
|
evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24222
|
-
this.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24699
|
+
this.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24700
|
+
capture: true
|
|
24701
|
+
});
|
|
24223
24702
|
triggers.forEach((trigger) => {
|
|
24224
24703
|
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
24225
24704
|
});
|
|
24226
24705
|
};
|
|
24227
24706
|
this._pointerMove = (e) => {
|
|
24228
|
-
e.preventDefault();
|
|
24229
24707
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
24230
24708
|
const pos = this.eventPosToStagePos(e);
|
|
24231
24709
|
const { attPos, max } = this._layoutCache;
|
|
@@ -24367,10 +24845,6 @@ class DataZoom extends AbstractComponent {
|
|
|
24367
24845
|
this.state.end = end;
|
|
24368
24846
|
shouldRender && this.setAttributes({ start, end });
|
|
24369
24847
|
}
|
|
24370
|
-
eventPosToStagePos(e) {
|
|
24371
|
-
var _a, _b;
|
|
24372
|
-
return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
24373
|
-
}
|
|
24374
24848
|
_clearDragEvents() {
|
|
24375
24849
|
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24376
24850
|
const triggers = getEndTriggersOfDrag();
|
|
@@ -24378,7 +24852,9 @@ class DataZoom extends AbstractComponent {
|
|
|
24378
24852
|
triggers.forEach((trigger) => {
|
|
24379
24853
|
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
24380
24854
|
});
|
|
24381
|
-
this.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24855
|
+
this.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24856
|
+
capture: true
|
|
24857
|
+
});
|
|
24382
24858
|
}
|
|
24383
24859
|
_onHandlerPointerEnter(e) {
|
|
24384
24860
|
this._showText = true;
|
|
@@ -24552,10 +25028,12 @@ class DataZoom extends AbstractComponent {
|
|
|
24552
25028
|
if (new Bounds().set(x1, y1, x2, y2).intersects(endTextBounds)) {
|
|
24553
25029
|
const direction = this.attribute.orient === 'bottom' || this.attribute.orient === 'right' ? -1 : 1;
|
|
24554
25030
|
if (this._isHorizontal) {
|
|
24555
|
-
|
|
25031
|
+
const boundsYDiff = Math.abs(endTextBounds.y1 - endTextBounds.y2);
|
|
25032
|
+
this._startText.setAttribute('dy', startTextDy + direction * (Number.isFinite(boundsYDiff) ? boundsYDiff : 0));
|
|
24556
25033
|
}
|
|
24557
25034
|
else {
|
|
24558
|
-
|
|
25035
|
+
const boundsXDiff = Math.abs(endTextBounds.x1 - endTextBounds.x2);
|
|
25036
|
+
this._startText.setAttribute('dx', startTextDx + direction * (Number.isFinite(boundsXDiff) ? boundsXDiff : 0));
|
|
24559
25037
|
}
|
|
24560
25038
|
}
|
|
24561
25039
|
else {
|
|
@@ -24965,22 +25443,27 @@ var IMarkPointItemPosition;
|
|
|
24965
25443
|
function loadBaseMarker() {
|
|
24966
25444
|
registerGroup();
|
|
24967
25445
|
loadTagComponent();
|
|
25446
|
+
registerAnimate();
|
|
24968
25447
|
}
|
|
24969
25448
|
function loadMarkLineComponent() {
|
|
24970
25449
|
loadBaseMarker();
|
|
24971
25450
|
loadSegmentComponent();
|
|
25451
|
+
registerAnimate();
|
|
24972
25452
|
}
|
|
24973
25453
|
function loadMarkArcLineComponent() {
|
|
24974
25454
|
loadBaseMarker();
|
|
24975
25455
|
loadArcSegmentComponent();
|
|
25456
|
+
registerAnimate();
|
|
24976
25457
|
}
|
|
24977
25458
|
function loadMarkAreaComponent() {
|
|
24978
25459
|
loadBaseMarker();
|
|
24979
25460
|
registerPolygon();
|
|
25461
|
+
registerAnimate();
|
|
24980
25462
|
}
|
|
24981
25463
|
function loadMarkArcAreaComponent() {
|
|
24982
25464
|
loadBaseMarker();
|
|
24983
25465
|
registerArc();
|
|
25466
|
+
registerAnimate();
|
|
24984
25467
|
}
|
|
24985
25468
|
function loadMarkPointComponent() {
|
|
24986
25469
|
loadBaseMarker();
|
|
@@ -24989,6 +25472,7 @@ function loadMarkPointComponent() {
|
|
|
24989
25472
|
registerSymbol();
|
|
24990
25473
|
registerImage();
|
|
24991
25474
|
registerLine();
|
|
25475
|
+
registerAnimate();
|
|
24992
25476
|
}
|
|
24993
25477
|
|
|
24994
25478
|
class Marker extends AbstractComponent {
|
|
@@ -25892,25 +26376,7 @@ const DEFAULT_MARK_POINT_THEME = {
|
|
|
25892
26376
|
itemContent: {
|
|
25893
26377
|
type: 'text',
|
|
25894
26378
|
position: 'middle',
|
|
25895
|
-
refX: 10
|
|
25896
|
-
symbolStyle: {
|
|
25897
|
-
symbolType: 'star',
|
|
25898
|
-
fill: 'rgb(48, 115, 242)',
|
|
25899
|
-
fillOpacity: 0.8,
|
|
25900
|
-
size: 20
|
|
25901
|
-
},
|
|
25902
|
-
textStyle: {
|
|
25903
|
-
dx: 0,
|
|
25904
|
-
dy: 0
|
|
25905
|
-
},
|
|
25906
|
-
imageStyle: {
|
|
25907
|
-
width: 80,
|
|
25908
|
-
height: 80
|
|
25909
|
-
},
|
|
25910
|
-
richTextStyle: {
|
|
25911
|
-
width: 100,
|
|
25912
|
-
height: 100
|
|
25913
|
-
}
|
|
26379
|
+
refX: 10
|
|
25914
26380
|
}
|
|
25915
26381
|
};
|
|
25916
26382
|
const DEFAULT_MARK_POINT_TEXT_STYLE_MAP = {
|
|
@@ -26441,7 +26907,7 @@ class MarkPoint extends Marker {
|
|
|
26441
26907
|
if (!item) {
|
|
26442
26908
|
return;
|
|
26443
26909
|
}
|
|
26444
|
-
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0,
|
|
26910
|
+
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, style, position: positionType = IMarkPointItemPosition.middle } = itemContent;
|
|
26445
26911
|
const { state } = this.attribute;
|
|
26446
26912
|
const lineEndAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
26447
26913
|
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle - Math.PI / 2);
|
|
@@ -26449,24 +26915,24 @@ class MarkPoint extends Marker {
|
|
|
26449
26915
|
if (itemType === 'text') {
|
|
26450
26916
|
const offsetX = newItemPosition.x - newPosition.x;
|
|
26451
26917
|
const offsetY = newItemPosition.y - newPosition.y;
|
|
26452
|
-
item.setAttributes(Object.assign(Object.assign({},
|
|
26918
|
+
item.setAttributes(Object.assign(Object.assign({}, style), { textStyle: Object.assign(Object.assign({}, this.getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, (_b = itemContent.position) !== null && _b !== void 0 ? _b : 'end')), style.textStyle), state: {
|
|
26453
26919
|
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.textBackground),
|
|
26454
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26920
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26455
26921
|
} }));
|
|
26456
26922
|
}
|
|
26457
26923
|
else if (itemType === 'richText') {
|
|
26458
26924
|
item.setAttributes({
|
|
26459
|
-
dx: this.getItemDx(item, positionType,
|
|
26460
|
-
dy: this.getItemDy(item, positionType,
|
|
26925
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
26926
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26461
26927
|
});
|
|
26462
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26928
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26463
26929
|
}
|
|
26464
26930
|
else if (itemType === 'image') {
|
|
26465
26931
|
item.setAttributes({
|
|
26466
|
-
dx: this.getItemDx(item, positionType,
|
|
26467
|
-
dy: this.getItemDy(item, positionType,
|
|
26932
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
26933
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26468
26934
|
});
|
|
26469
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26935
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26470
26936
|
}
|
|
26471
26937
|
const itemAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle - Math.PI;
|
|
26472
26938
|
item.setAttributes({
|
|
@@ -26499,29 +26965,29 @@ class MarkPoint extends Marker {
|
|
|
26499
26965
|
}
|
|
26500
26966
|
initItem(itemContent, newPosition, newItemPosition) {
|
|
26501
26967
|
const { state } = this.attribute;
|
|
26502
|
-
const { type = 'text',
|
|
26968
|
+
const { type = 'text', style, renderCustomCallback } = itemContent;
|
|
26503
26969
|
let item;
|
|
26504
26970
|
if (type === 'symbol') {
|
|
26505
|
-
item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition),
|
|
26506
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26971
|
+
item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition), style));
|
|
26972
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26507
26973
|
}
|
|
26508
26974
|
else if (type === 'text') {
|
|
26509
26975
|
item = new Tag(Object.assign(Object.assign({}, newItemPosition), { state: {
|
|
26510
26976
|
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.textBackground),
|
|
26511
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26977
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26512
26978
|
} }));
|
|
26513
26979
|
}
|
|
26514
26980
|
else if (type === 'richText') {
|
|
26515
|
-
item = graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition),
|
|
26516
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26981
|
+
item = graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition), style));
|
|
26982
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26517
26983
|
}
|
|
26518
26984
|
else if (type === 'image') {
|
|
26519
|
-
item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition),
|
|
26520
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26985
|
+
item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition), style));
|
|
26986
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26521
26987
|
}
|
|
26522
26988
|
else if (type === 'custom' && renderCustomCallback) {
|
|
26523
26989
|
item = renderCustomCallback();
|
|
26524
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26990
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26525
26991
|
}
|
|
26526
26992
|
item.name = `mark-point-${type}`;
|
|
26527
26993
|
this.setItemAttributes(item, itemContent, newPosition, newItemPosition, type);
|
|
@@ -26709,7 +27175,7 @@ class MarkPoint extends Marker {
|
|
|
26709
27175
|
const { itemContent = {}, targetSymbol, itemLine } = this.attribute;
|
|
26710
27176
|
const { offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0 } = itemContent;
|
|
26711
27177
|
const { offset: targetSymbolOffset = 0, style: targetSymbolStyle, visible: targetItemvisible = false, size: targetSymbolSize } = targetSymbol;
|
|
26712
|
-
const targetSize = targetItemvisible ? (_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20 : 0;
|
|
27178
|
+
const targetSize = targetItemvisible ? ((_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20) : 0;
|
|
26713
27179
|
let targetOffsetAngle;
|
|
26714
27180
|
if (itemLine.type === 'type-do') {
|
|
26715
27181
|
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX / 2);
|
|
@@ -28432,14 +28898,13 @@ class Slider extends AbstractComponent {
|
|
|
28432
28898
|
this._prePos = this._isHorizontal ? x : y;
|
|
28433
28899
|
const triggers = getEndTriggersOfDrag();
|
|
28434
28900
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28435
|
-
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true
|
|
28901
|
+
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
28436
28902
|
triggers.forEach((trigger) => {
|
|
28437
28903
|
obj.addEventListener(trigger, this._onHandlerPointerUp);
|
|
28438
28904
|
});
|
|
28439
28905
|
};
|
|
28440
28906
|
this._onHandlerPointerMove = (e) => {
|
|
28441
28907
|
var _a, _b;
|
|
28442
|
-
e.preventDefault();
|
|
28443
28908
|
this._isChanging = true;
|
|
28444
28909
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
28445
28910
|
if (max === min) {
|
|
@@ -28491,13 +28956,12 @@ class Slider extends AbstractComponent {
|
|
|
28491
28956
|
this._prePos = this._isHorizontal ? x : y;
|
|
28492
28957
|
const triggers = getEndTriggersOfDrag();
|
|
28493
28958
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28494
|
-
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true
|
|
28959
|
+
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
28495
28960
|
triggers.forEach((trigger) => {
|
|
28496
28961
|
obj.addEventListener(trigger, this._onTrackPointerUp);
|
|
28497
28962
|
});
|
|
28498
28963
|
};
|
|
28499
28964
|
this._onTrackPointerMove = (e) => {
|
|
28500
|
-
e.preventDefault();
|
|
28501
28965
|
this._isChanging = true;
|
|
28502
28966
|
const { railWidth, railHeight, min, max, inverse } = this.attribute;
|
|
28503
28967
|
if (max === min) {
|
|
@@ -28947,11 +29411,11 @@ class Slider extends AbstractComponent {
|
|
|
28947
29411
|
_clearAllDragEvents() {
|
|
28948
29412
|
const triggers = getEndTriggersOfDrag();
|
|
28949
29413
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28950
|
-
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true
|
|
29414
|
+
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
28951
29415
|
triggers.forEach((trigger) => {
|
|
28952
29416
|
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
28953
29417
|
});
|
|
28954
|
-
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true
|
|
29418
|
+
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
28955
29419
|
triggers.forEach((trigger) => {
|
|
28956
29420
|
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
28957
29421
|
});
|
|
@@ -30841,6 +31305,7 @@ class Brush extends AbstractComponent {
|
|
|
30841
31305
|
constructor(attributes, options) {
|
|
30842
31306
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, Brush.defaultAttributes, attributes));
|
|
30843
31307
|
this.name = 'brush';
|
|
31308
|
+
this._activeBrushState = false;
|
|
30844
31309
|
this._activeDrawState = false;
|
|
30845
31310
|
this._cacheDrawPoints = [];
|
|
30846
31311
|
this._activeMoveState = false;
|
|
@@ -30851,13 +31316,6 @@ class Brush extends AbstractComponent {
|
|
|
30851
31316
|
this._brushMaskAABBBoundsDict = {};
|
|
30852
31317
|
this._firstUpdate = true;
|
|
30853
31318
|
this._onBrushStart = (e) => {
|
|
30854
|
-
if (this._outOfInteractiveRange(e)) {
|
|
30855
|
-
if (!this._isEmptyMask()) {
|
|
30856
|
-
this._clearMask();
|
|
30857
|
-
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30858
|
-
}
|
|
30859
|
-
return;
|
|
30860
|
-
}
|
|
30861
31319
|
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
|
|
30862
31320
|
array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
|
|
30863
31321
|
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
@@ -30921,9 +31379,7 @@ class Brush extends AbstractComponent {
|
|
|
30921
31379
|
brushMode === 'single' && this._clearMask();
|
|
30922
31380
|
this._addBrushMask();
|
|
30923
31381
|
this._dispatchBrushEvent(IOperateType.drawStart, e);
|
|
30924
|
-
|
|
30925
|
-
this._dispatchBrushEvent(IOperateType.brushActive, e);
|
|
30926
|
-
}
|
|
31382
|
+
this._activeBrushState = false;
|
|
30927
31383
|
}
|
|
30928
31384
|
_initMove(e) {
|
|
30929
31385
|
var _a, _b;
|
|
@@ -30945,7 +31401,7 @@ class Brush extends AbstractComponent {
|
|
|
30945
31401
|
_drawing(e) {
|
|
30946
31402
|
var _a;
|
|
30947
31403
|
const pos = this.eventPosToStagePos(e);
|
|
30948
|
-
const { brushType } = this.attribute;
|
|
31404
|
+
const { brushType, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
|
|
30949
31405
|
const cacheLength = this._cacheDrawPoints.length;
|
|
30950
31406
|
if (cacheLength > 0) {
|
|
30951
31407
|
const lastPos = (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) !== null && _a !== void 0 ? _a : {};
|
|
@@ -30961,7 +31417,17 @@ class Brush extends AbstractComponent {
|
|
|
30961
31417
|
}
|
|
30962
31418
|
const maskPoints = this._computeMaskPoints();
|
|
30963
31419
|
this._operatingMask.setAttribute('points', maskPoints);
|
|
30964
|
-
this.
|
|
31420
|
+
const { x: x1, y: y1 } = this._startPos;
|
|
31421
|
+
const { x: x2, y: y2 } = this.eventPosToStagePos(e);
|
|
31422
|
+
if (Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold) {
|
|
31423
|
+
if (Object.keys(this._brushMaskAABBBoundsDict).length === 1 && !this._activeBrushState) {
|
|
31424
|
+
this._activeBrushState = true;
|
|
31425
|
+
this._dispatchBrushEvent(IOperateType.brushActive, e);
|
|
31426
|
+
}
|
|
31427
|
+
else {
|
|
31428
|
+
this._dispatchBrushEvent(IOperateType.drawing, e);
|
|
31429
|
+
}
|
|
31430
|
+
}
|
|
30965
31431
|
}
|
|
30966
31432
|
_moving(e) {
|
|
30967
31433
|
const startPos = this._cacheMovePoint;
|
|
@@ -31103,7 +31569,7 @@ class Brush extends AbstractComponent {
|
|
|
31103
31569
|
_addBrushMask() {
|
|
31104
31570
|
var _a;
|
|
31105
31571
|
const { brushStyle, hasMask } = this.attribute;
|
|
31106
|
-
const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (
|
|
31572
|
+
const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
|
|
31107
31573
|
brushMask.name = `brush-${Date.now()}`;
|
|
31108
31574
|
this._operatingMask = brushMask;
|
|
31109
31575
|
this._container.add(brushMask);
|
|
@@ -31136,9 +31602,6 @@ class Brush extends AbstractComponent {
|
|
|
31136
31602
|
}
|
|
31137
31603
|
return false;
|
|
31138
31604
|
}
|
|
31139
|
-
eventPosToStagePos(e) {
|
|
31140
|
-
return this.stage.eventPointTransform(e);
|
|
31141
|
-
}
|
|
31142
31605
|
_dispatchBrushEvent(operateType, e) {
|
|
31143
31606
|
this._dispatchEvent(operateType, {
|
|
31144
31607
|
operateMask: this._operatingMask,
|
|
@@ -31148,7 +31611,7 @@ class Brush extends AbstractComponent {
|
|
|
31148
31611
|
}
|
|
31149
31612
|
_clearMask() {
|
|
31150
31613
|
this._brushMaskAABBBoundsDict = {};
|
|
31151
|
-
this._container.
|
|
31614
|
+
this._container.removeAllChild();
|
|
31152
31615
|
this._operatingMask = null;
|
|
31153
31616
|
}
|
|
31154
31617
|
_isEmptyMask() {
|
|
@@ -32605,6 +33068,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
32605
33068
|
theme: 'default'
|
|
32606
33069
|
};
|
|
32607
33070
|
|
|
32608
|
-
const version = "1.0.
|
|
33071
|
+
const version = "1.0.1";
|
|
32609
33072
|
|
|
32610
33073
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|