@visactor/vrender-components 1.0.0-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animation/label-animate.js +1 -0
- package/cjs/animation/label-animate.js.map +1 -1
- package/cjs/axis/base.js +1 -1
- package/cjs/axis/base.js.map +1 -1
- package/cjs/data-zoom/data-zoom.js +0 -1
- 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 +810 -205
- package/es/animation/label-animate.js +3 -2
- package/es/animation/label-animate.js.map +1 -1
- package/es/axis/base.js +1 -1
- package/es/axis/base.js.map +1 -1
- package/es/data-zoom/data-zoom.js +0 -1
- 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 +4 -4
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,11 +489,14 @@ 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
502
|
bind(ContributionProvider).toDynamicValue(_ref => {
|
|
@@ -511,6 +514,20 @@ function bindContributionProviderNoSingletonScope(bind, id) {
|
|
|
511
514
|
return new ContributionProviderCache(id, container);
|
|
512
515
|
}).whenTargetNamed(id);
|
|
513
516
|
}
|
|
517
|
+
class ContributionStore {
|
|
518
|
+
static getStore(id) {
|
|
519
|
+
return this.store.get(id);
|
|
520
|
+
}
|
|
521
|
+
static setStore(id, cache) {
|
|
522
|
+
this.store.set(id, cache);
|
|
523
|
+
}
|
|
524
|
+
static refreshAllContributions() {
|
|
525
|
+
this.store.forEach(cache => {
|
|
526
|
+
cache.refresh();
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
ContributionStore.store = new Map();
|
|
514
531
|
|
|
515
532
|
class Hook {
|
|
516
533
|
constructor(args, name) {
|
|
@@ -577,22 +594,67 @@ const EnvContribution = Symbol.for("EnvContribution");
|
|
|
577
594
|
const VGlobal = Symbol.for("VGlobal");
|
|
578
595
|
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
596
|
|
|
597
|
+
class Application {}
|
|
598
|
+
const application = new Application();
|
|
599
|
+
|
|
600
|
+
let idx = 0;
|
|
580
601
|
class PerformanceRAF {
|
|
581
602
|
constructor() {
|
|
582
|
-
this.nextAnimationFrameCbs =
|
|
603
|
+
this.nextAnimationFrameCbs = new Map(), this._rafHandle = null, this.runAnimationFrame = time => {
|
|
583
604
|
this._rafHandle = null;
|
|
584
605
|
const cbs = this.nextAnimationFrameCbs;
|
|
585
|
-
this.nextAnimationFrameCbs =
|
|
586
|
-
for (let i = 0; i < cbs.length; i++) cbs[i] && cbs[i](time);
|
|
606
|
+
this.nextAnimationFrameCbs = new Map(), cbs.forEach(cb => cb(time));
|
|
587
607
|
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
588
|
-
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.
|
|
608
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.size && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
589
609
|
};
|
|
590
610
|
}
|
|
591
611
|
addAnimationFrameCb(callback) {
|
|
592
|
-
return this.nextAnimationFrameCbs.
|
|
612
|
+
return this.nextAnimationFrameCbs.set(++idx, callback), this.tryRunAnimationFrameNextFrame(), idx;
|
|
593
613
|
}
|
|
594
614
|
removeAnimationFrameCb(index) {
|
|
595
|
-
return
|
|
615
|
+
return !!this.nextAnimationFrameCbs.has(index) && (this.nextAnimationFrameCbs.delete(index), !0);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
class EventListenerManager {
|
|
620
|
+
constructor() {
|
|
621
|
+
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
622
|
+
}
|
|
623
|
+
setEventListenerTransformer(transformer) {
|
|
624
|
+
this._eventListenerTransformer = transformer || (event => event);
|
|
625
|
+
}
|
|
626
|
+
addEventListener(type, listener, options) {
|
|
627
|
+
if (!listener) return;
|
|
628
|
+
const wrappedListener = event => {
|
|
629
|
+
const transformedEvent = this._eventListenerTransformer(event);
|
|
630
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
631
|
+
};
|
|
632
|
+
this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
|
|
633
|
+
}
|
|
634
|
+
removeEventListener(type, listener, options) {
|
|
635
|
+
var _a;
|
|
636
|
+
if (!listener) return;
|
|
637
|
+
const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
|
|
638
|
+
wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
|
|
639
|
+
}
|
|
640
|
+
dispatchEvent(event) {
|
|
641
|
+
return this._nativeDispatchEvent(event);
|
|
642
|
+
}
|
|
643
|
+
clearAllEventListeners() {
|
|
644
|
+
this._listenerMap.forEach((listenersMap, type) => {
|
|
645
|
+
listenersMap.forEach((wrappedListener, originalListener) => {
|
|
646
|
+
this._nativeRemoveEventListener(type, wrappedListener, void 0);
|
|
647
|
+
});
|
|
648
|
+
}), this._listenerMap.clear();
|
|
649
|
+
}
|
|
650
|
+
_nativeAddEventListener(type, listener, options) {
|
|
651
|
+
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
652
|
+
}
|
|
653
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
654
|
+
throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
|
|
655
|
+
}
|
|
656
|
+
_nativeDispatchEvent(event) {
|
|
657
|
+
throw new Error("_nativeDispatchEvent must be implemented by derived classes");
|
|
596
658
|
}
|
|
597
659
|
}
|
|
598
660
|
|
|
@@ -636,7 +698,7 @@ var __decorate$Q = undefined && undefined.__decorate || function (decorators, ta
|
|
|
636
698
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
637
699
|
});
|
|
638
700
|
};
|
|
639
|
-
let DefaultGlobal = class {
|
|
701
|
+
let DefaultGlobal = class extends EventListenerManager {
|
|
640
702
|
get env() {
|
|
641
703
|
return this._env;
|
|
642
704
|
}
|
|
@@ -680,10 +742,19 @@ let DefaultGlobal = class {
|
|
|
680
742
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
681
743
|
}
|
|
682
744
|
constructor(contributions) {
|
|
683
|
-
this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
745
|
+
super(), this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
684
746
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
685
747
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
686
748
|
}
|
|
749
|
+
_nativeAddEventListener(type, listener, options) {
|
|
750
|
+
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
751
|
+
}
|
|
752
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
753
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
754
|
+
}
|
|
755
|
+
_nativeDispatchEvent(event) {
|
|
756
|
+
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
757
|
+
}
|
|
687
758
|
bindContribution(params) {
|
|
688
759
|
const promiseArr = [];
|
|
689
760
|
if (this.contributions.getContributions().forEach(contribution => {
|
|
@@ -724,15 +795,6 @@ let DefaultGlobal = class {
|
|
|
724
795
|
releaseCanvas(canvas) {
|
|
725
796
|
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
726
797
|
}
|
|
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
798
|
getRequestAnimationFrame() {
|
|
737
799
|
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
738
800
|
}
|
|
@@ -830,6 +892,11 @@ var AnimateMode;
|
|
|
830
892
|
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
831
893
|
}(AnimateMode || (AnimateMode = {}));
|
|
832
894
|
|
|
895
|
+
var STATUS$1;
|
|
896
|
+
!function (STATUS) {
|
|
897
|
+
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
898
|
+
}(STATUS$1 || (STATUS$1 = {}));
|
|
899
|
+
|
|
833
900
|
var AnimateStepType;
|
|
834
901
|
!function (AnimateStepType) {
|
|
835
902
|
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
@@ -1147,44 +1214,6 @@ function quadLength(p0, p1, p2, iterationCount) {
|
|
|
1147
1214
|
return snapLength([p0.x, p1.x, p2.x], [p0.y, p1.y, p2.y]);
|
|
1148
1215
|
}
|
|
1149
1216
|
|
|
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
1217
|
function divideCubic(curve, t) {
|
|
1189
1218
|
const {
|
|
1190
1219
|
p0: p0,
|
|
@@ -1200,17 +1229,6 @@ function divideCubic(curve, t) {
|
|
|
1200
1229
|
c23 = PointService.pointAtPP(c2, c3, t);
|
|
1201
1230
|
return [new CubicBezierCurve(p0, c1, c12, pt), new CubicBezierCurve(pt, c23, c3, p3)];
|
|
1202
1231
|
}
|
|
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
1232
|
class CubicBezierCurve extends Curve {
|
|
1215
1233
|
constructor(p0, p1, p2, p3) {
|
|
1216
1234
|
super(), this.type = CurveTypeEnum.CubicBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2, this.p3 = p3;
|
|
@@ -1851,6 +1869,55 @@ class CatmullRomClosed {
|
|
|
1851
1869
|
}
|
|
1852
1870
|
const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
1853
1871
|
|
|
1872
|
+
function divideQuad(curve, t) {
|
|
1873
|
+
const {
|
|
1874
|
+
p0: p0,
|
|
1875
|
+
p1: p1,
|
|
1876
|
+
p2: p2
|
|
1877
|
+
} = curve,
|
|
1878
|
+
pt = quadPointAt(p0, p1, p2, t),
|
|
1879
|
+
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1880
|
+
c2 = PointService.pointAtPP(p1, p2, t);
|
|
1881
|
+
return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
|
|
1882
|
+
}
|
|
1883
|
+
class QuadraticBezierCurve extends Curve {
|
|
1884
|
+
constructor(p0, p1, p2) {
|
|
1885
|
+
super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
|
|
1886
|
+
}
|
|
1887
|
+
_validPoint() {
|
|
1888
|
+
return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
|
|
1889
|
+
}
|
|
1890
|
+
getPointAt(t) {
|
|
1891
|
+
if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
|
|
1892
|
+
throw new Error("defined为false的点不能getPointAt");
|
|
1893
|
+
}
|
|
1894
|
+
calcLength() {
|
|
1895
|
+
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1896
|
+
}
|
|
1897
|
+
calcProjLength(direction) {
|
|
1898
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1899
|
+
}
|
|
1900
|
+
getAngleAt(t) {
|
|
1901
|
+
const minT = max(t - .01, 0),
|
|
1902
|
+
maxT = min(t + .01, 1),
|
|
1903
|
+
minP = this.getPointAt(minT),
|
|
1904
|
+
maxP = this.getPointAt(maxT);
|
|
1905
|
+
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1906
|
+
}
|
|
1907
|
+
draw(path, x, y, sx, sy, percent) {
|
|
1908
|
+
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) {
|
|
1909
|
+
const [curve1] = divideQuad(this, percent);
|
|
1910
|
+
path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
getYAt(x) {
|
|
1914
|
+
throw new Error("QuadraticBezierCurve暂不支持getYAt");
|
|
1915
|
+
}
|
|
1916
|
+
includeX(x) {
|
|
1917
|
+
throw new Error("QuadraticBezierCurve暂不支持includeX");
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1854
1921
|
class CurveContext {
|
|
1855
1922
|
constructor(path) {
|
|
1856
1923
|
this.path = path, this._lastX = this._lastY = this._startX = this._startY = 0;
|
|
@@ -2541,9 +2608,6 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
|
|
|
2541
2608
|
opacity: 1
|
|
2542
2609
|
});
|
|
2543
2610
|
|
|
2544
|
-
class Application {}
|
|
2545
|
-
const application = new Application();
|
|
2546
|
-
|
|
2547
2611
|
const parse = function () {
|
|
2548
2612
|
const tokens = {
|
|
2549
2613
|
linearGradient: /^(linear\-gradient)/i,
|
|
@@ -3784,7 +3848,7 @@ var __decorate$N = undefined && undefined.__decorate || function (decorators, ta
|
|
|
3784
3848
|
};
|
|
3785
3849
|
const VWindow = Symbol.for("VWindow");
|
|
3786
3850
|
const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
|
|
3787
|
-
let DefaultWindow = class {
|
|
3851
|
+
let DefaultWindow = class extends EventListenerManager {
|
|
3788
3852
|
get width() {
|
|
3789
3853
|
if (this._handler) {
|
|
3790
3854
|
const wh = this._handler.getWH();
|
|
@@ -3803,7 +3867,7 @@ let DefaultWindow = class {
|
|
|
3803
3867
|
return this._handler.getDpr();
|
|
3804
3868
|
}
|
|
3805
3869
|
constructor() {
|
|
3806
|
-
this.hooks = {
|
|
3870
|
+
super(), this.hooks = {
|
|
3807
3871
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
3808
3872
|
}, this.active = () => {
|
|
3809
3873
|
const global = this.global;
|
|
@@ -3811,6 +3875,15 @@ let DefaultWindow = class {
|
|
|
3811
3875
|
container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
|
|
3812
3876
|
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
3813
3877
|
}
|
|
3878
|
+
_nativeAddEventListener(type, listener, options) {
|
|
3879
|
+
return this._handler.addEventListener(type, listener, options);
|
|
3880
|
+
}
|
|
3881
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
3882
|
+
return this._handler.removeEventListener(type, listener, options);
|
|
3883
|
+
}
|
|
3884
|
+
_nativeDispatchEvent(event) {
|
|
3885
|
+
return this._handler.dispatchEvent(event);
|
|
3886
|
+
}
|
|
3814
3887
|
postInit() {
|
|
3815
3888
|
this.global.hooks.onSetEnv.tap("window", this.active), this.active();
|
|
3816
3889
|
}
|
|
@@ -3850,7 +3923,7 @@ let DefaultWindow = class {
|
|
|
3850
3923
|
throw new Error("暂不支持");
|
|
3851
3924
|
}
|
|
3852
3925
|
release() {
|
|
3853
|
-
return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
|
|
3926
|
+
return this.global.hooks.onSetEnv.unTap("window", this.active), this.clearAllEventListeners(), this._handler.releaseWindow();
|
|
3854
3927
|
}
|
|
3855
3928
|
getContext() {
|
|
3856
3929
|
return this._handler.getContext();
|
|
@@ -3861,15 +3934,6 @@ let DefaultWindow = class {
|
|
|
3861
3934
|
getImageBuffer(type) {
|
|
3862
3935
|
return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
|
|
3863
3936
|
}
|
|
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
3937
|
getBoundingClientRect() {
|
|
3874
3938
|
return this._handler.getBoundingClientRect();
|
|
3875
3939
|
}
|
|
@@ -6236,6 +6300,10 @@ class Graphic extends Node {
|
|
|
6236
6300
|
var _a;
|
|
6237
6301
|
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
6302
|
}
|
|
6303
|
+
getGraphicService() {
|
|
6304
|
+
var _a, _b;
|
|
6305
|
+
return null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
|
|
6306
|
+
}
|
|
6239
6307
|
getAttributes() {
|
|
6240
6308
|
return this.attribute;
|
|
6241
6309
|
}
|
|
@@ -6265,13 +6333,12 @@ class Graphic extends Node {
|
|
|
6265
6333
|
this._emitCustomEvent("animate-bind", animate);
|
|
6266
6334
|
}
|
|
6267
6335
|
tryUpdateAABBBounds() {
|
|
6268
|
-
var _a, _b;
|
|
6269
6336
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
6270
6337
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6271
6338
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
6272
|
-
|
|
6339
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6273
6340
|
const bounds = this.doUpdateAABBBounds(full);
|
|
6274
|
-
return
|
|
6341
|
+
return this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6275
6342
|
}
|
|
6276
6343
|
tryUpdateOBBBounds() {
|
|
6277
6344
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
@@ -6378,7 +6445,7 @@ class Graphic extends Node {
|
|
|
6378
6445
|
return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
|
|
6379
6446
|
}
|
|
6380
6447
|
shouldUpdateAABBBounds() {
|
|
6381
|
-
return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) &&
|
|
6448
|
+
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
6449
|
}
|
|
6383
6450
|
shouldSelfChangeUpdateAABBBounds() {
|
|
6384
6451
|
return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
|
|
@@ -6559,8 +6626,7 @@ class Graphic extends Node {
|
|
|
6559
6626
|
return this;
|
|
6560
6627
|
}
|
|
6561
6628
|
onAttributeUpdate(context) {
|
|
6562
|
-
|
|
6563
|
-
context && context.skipUpdateCallback || (null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6629
|
+
context && context.skipUpdateCallback || (this.getGraphicService().onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6564
6630
|
}
|
|
6565
6631
|
update(d) {
|
|
6566
6632
|
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
@@ -6597,6 +6663,9 @@ class Graphic extends Node {
|
|
|
6597
6663
|
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
6598
6664
|
type: AttributeUpdateType.STATE
|
|
6599
6665
|
});
|
|
6666
|
+
this._emitCustomEvent("afterStateUpdate", {
|
|
6667
|
+
type: AttributeUpdateType.STATE
|
|
6668
|
+
});
|
|
6600
6669
|
}
|
|
6601
6670
|
updateNormalAttrs(stateAttrs) {
|
|
6602
6671
|
const newNormalAttrs = {};
|
|
@@ -6747,7 +6816,6 @@ class Graphic extends Node {
|
|
|
6747
6816
|
}
|
|
6748
6817
|
}
|
|
6749
6818
|
setStage(stage, layer) {
|
|
6750
|
-
var _a;
|
|
6751
6819
|
if (this.stage !== stage) {
|
|
6752
6820
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
6753
6821
|
const timeline = stage.getTimeline();
|
|
@@ -6755,7 +6823,7 @@ class Graphic extends Node {
|
|
|
6755
6823
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
6756
6824
|
});
|
|
6757
6825
|
}
|
|
6758
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
6826
|
+
this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage);
|
|
6759
6827
|
}
|
|
6760
6828
|
}
|
|
6761
6829
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -6903,12 +6971,11 @@ class Group extends Graphic {
|
|
|
6903
6971
|
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
6904
6972
|
}
|
|
6905
6973
|
tryUpdateAABBBounds() {
|
|
6906
|
-
var _a, _b;
|
|
6907
6974
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6908
|
-
|
|
6975
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6909
6976
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6910
6977
|
bounds = this.doUpdateAABBBounds();
|
|
6911
|
-
return this.addUpdateLayoutTag(),
|
|
6978
|
+
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6912
6979
|
}
|
|
6913
6980
|
doUpdateLocalMatrix() {
|
|
6914
6981
|
const {
|
|
@@ -6968,13 +7035,11 @@ class Group extends Graphic {
|
|
|
6968
7035
|
return this.theme.getTheme(this);
|
|
6969
7036
|
}
|
|
6970
7037
|
incrementalAppendChild(node) {
|
|
6971
|
-
var _a;
|
|
6972
7038
|
const data = super.appendChild(node);
|
|
6973
|
-
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(),
|
|
7039
|
+
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
6974
7040
|
}
|
|
6975
7041
|
incrementalClearChild() {
|
|
6976
|
-
|
|
6977
|
-
super.removeAllChild(), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onClearIncremental(this, this.stage);
|
|
7042
|
+
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
6978
7043
|
}
|
|
6979
7044
|
_updateChildToStage(child) {
|
|
6980
7045
|
return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
|
|
@@ -6994,20 +7059,17 @@ class Group extends Graphic {
|
|
|
6994
7059
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6995
7060
|
}
|
|
6996
7061
|
removeChild(child) {
|
|
6997
|
-
var _a;
|
|
6998
7062
|
const data = super.removeChild(child);
|
|
6999
|
-
return child.stage = null,
|
|
7063
|
+
return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
|
|
7000
7064
|
}
|
|
7001
7065
|
removeAllChild() {
|
|
7002
7066
|
let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
7003
7067
|
this.forEachChildren(child => {
|
|
7004
|
-
|
|
7005
|
-
null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
7068
|
+
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
7006
7069
|
}), super.removeAllChild(), this.addUpdateBoundTag();
|
|
7007
7070
|
}
|
|
7008
7071
|
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 => {
|
|
7072
|
+
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
7073
|
item.setStage(stage, this.layer);
|
|
7012
7074
|
}));
|
|
7013
7075
|
}
|
|
@@ -7634,7 +7696,7 @@ let DefaultGraphicService = class {
|
|
|
7634
7696
|
const {
|
|
7635
7697
|
visible = theme.visible
|
|
7636
7698
|
} = attribute;
|
|
7637
|
-
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix),
|
|
7699
|
+
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), this.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
|
|
7638
7700
|
}
|
|
7639
7701
|
updateTempAABBBounds(aabbBounds) {
|
|
7640
7702
|
const tb1 = this.tempAABBBounds1,
|
|
@@ -10845,6 +10907,9 @@ class BaseRender {
|
|
|
10845
10907
|
init(contributions) {
|
|
10846
10908
|
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
10909
|
}
|
|
10910
|
+
reInit() {
|
|
10911
|
+
this.init(this.graphicRenderContributions);
|
|
10912
|
+
}
|
|
10848
10913
|
beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
10849
10914
|
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
|
|
10850
10915
|
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
@@ -11014,8 +11079,8 @@ var __decorate$G = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11014
11079
|
};
|
|
11015
11080
|
};
|
|
11016
11081
|
let DefaultCanvasArcRender = class extends BaseRender {
|
|
11017
|
-
constructor(
|
|
11018
|
-
super(), this.
|
|
11082
|
+
constructor(graphicRenderContributions) {
|
|
11083
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11019
11084
|
}
|
|
11020
11085
|
drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
|
|
11021
11086
|
const capAngle = _ea - _sa,
|
|
@@ -11122,7 +11187,7 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11122
11187
|
isFullStroke: isFullStroke,
|
|
11123
11188
|
stroke: arrayStroke
|
|
11124
11189
|
} = 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) {
|
|
11190
|
+
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
11191
|
context.beginPath();
|
|
11127
11192
|
drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
|
|
11128
11193
|
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 +11226,8 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11161
11226
|
_runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb) {
|
|
11162
11227
|
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
11163
11228
|
}
|
|
11164
|
-
_runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb) {
|
|
11165
|
-
doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
11229
|
+
_runStroke(arc, context, x, y, arcAttribute, doStroke, isFullStroke, sVisible, strokeCb) {
|
|
11230
|
+
doStroke && isFullStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
11166
11231
|
}
|
|
11167
11232
|
draw(arc, renderService, drawContext, params) {
|
|
11168
11233
|
const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
@@ -11187,8 +11252,8 @@ var __decorate$F = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11187
11252
|
};
|
|
11188
11253
|
};
|
|
11189
11254
|
let DefaultCanvasCircleRender = class extends BaseRender {
|
|
11190
|
-
constructor(
|
|
11191
|
-
super(), this.
|
|
11255
|
+
constructor(graphicRenderContributions) {
|
|
11256
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11192
11257
|
}
|
|
11193
11258
|
drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11194
11259
|
const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
|
|
@@ -11574,8 +11639,8 @@ var __decorate$D = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11574
11639
|
};
|
|
11575
11640
|
};
|
|
11576
11641
|
let DefaultCanvasAreaRender = class extends BaseRender {
|
|
11577
|
-
constructor(
|
|
11578
|
-
super(), this.
|
|
11642
|
+
constructor(graphicRenderContributions) {
|
|
11643
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
11579
11644
|
}
|
|
11580
11645
|
drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
11581
11646
|
var _a, _b, _c;
|
|
@@ -11818,8 +11883,8 @@ var __decorate$C = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11818
11883
|
};
|
|
11819
11884
|
};
|
|
11820
11885
|
let DefaultCanvasPathRender = class extends BaseRender {
|
|
11821
|
-
constructor(
|
|
11822
|
-
super(), this.
|
|
11886
|
+
constructor(graphicRenderContributions) {
|
|
11887
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11823
11888
|
}
|
|
11824
11889
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11825
11890
|
var _a, _b, _c;
|
|
@@ -11874,8 +11939,8 @@ var __decorate$B = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11874
11939
|
};
|
|
11875
11940
|
};
|
|
11876
11941
|
let DefaultCanvasRectRender = class extends BaseRender {
|
|
11877
|
-
constructor(
|
|
11878
|
-
super(), this.
|
|
11942
|
+
constructor(graphicRenderContributions) {
|
|
11943
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
|
|
11879
11944
|
}
|
|
11880
11945
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
|
|
11881
11946
|
rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
@@ -11944,8 +12009,8 @@ var __decorate$A = undefined && undefined.__decorate || function (decorators, ta
|
|
|
11944
12009
|
};
|
|
11945
12010
|
};
|
|
11946
12011
|
let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
11947
|
-
constructor(
|
|
11948
|
-
super(), this.
|
|
12012
|
+
constructor(graphicRenderContributions) {
|
|
12013
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
|
|
11949
12014
|
}
|
|
11950
12015
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
|
|
11951
12016
|
var _a;
|
|
@@ -12115,8 +12180,8 @@ var __decorate$z = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12115
12180
|
};
|
|
12116
12181
|
};
|
|
12117
12182
|
let DefaultCanvasTextRender = class extends BaseRender {
|
|
12118
|
-
constructor(
|
|
12119
|
-
super(), this.
|
|
12183
|
+
constructor(graphicRenderContributions) {
|
|
12184
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
12120
12185
|
}
|
|
12121
12186
|
drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12122
12187
|
var _a, _b, _c;
|
|
@@ -12251,8 +12316,10 @@ let DefaultCanvasTextRender = class extends BaseRender {
|
|
|
12251
12316
|
DefaultCanvasTextRender = __decorate$z([injectable(), __param$q(0, inject(ContributionProvider)), __param$q(0, named(TextRenderContribution)), __metadata$t("design:paramtypes", [Object])], DefaultCanvasTextRender);
|
|
12252
12317
|
|
|
12253
12318
|
function drawPolygon(path, points, x, y) {
|
|
12254
|
-
|
|
12255
|
-
|
|
12319
|
+
if (points && points.length) {
|
|
12320
|
+
path.moveTo(points[0].x + x, points[0].y + y);
|
|
12321
|
+
for (let i = 1; i < points.length; i++) path.lineTo(points[i].x + x, points[i].y + y);
|
|
12322
|
+
}
|
|
12256
12323
|
}
|
|
12257
12324
|
function drawRoundedPolygon(path, points, x, y, cornerRadius) {
|
|
12258
12325
|
let closePath = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : !0;
|
|
@@ -12320,8 +12387,8 @@ var __decorate$y = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12320
12387
|
};
|
|
12321
12388
|
};
|
|
12322
12389
|
let DefaultCanvasPolygonRender = class extends BaseRender {
|
|
12323
|
-
constructor(
|
|
12324
|
-
super(), this.
|
|
12390
|
+
constructor(graphicRenderContributions) {
|
|
12391
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
12325
12392
|
}
|
|
12326
12393
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12327
12394
|
const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
|
|
@@ -12376,6 +12443,9 @@ let DefaultCanvasGroupRender = class {
|
|
|
12376
12443
|
constructor(groupRenderContribitions) {
|
|
12377
12444
|
this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
|
|
12378
12445
|
}
|
|
12446
|
+
reInit() {
|
|
12447
|
+
this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
|
|
12448
|
+
}
|
|
12379
12449
|
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
|
|
12380
12450
|
const {
|
|
12381
12451
|
clip: clip,
|
|
@@ -12436,7 +12506,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12436
12506
|
});
|
|
12437
12507
|
}
|
|
12438
12508
|
draw(group, renderService, drawContext, params) {
|
|
12439
|
-
var _a;
|
|
12509
|
+
var _a, _b;
|
|
12440
12510
|
const {
|
|
12441
12511
|
context: context
|
|
12442
12512
|
} = drawContext;
|
|
@@ -12456,7 +12526,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12456
12526
|
height: height
|
|
12457
12527
|
} = group.attribute,
|
|
12458
12528
|
canvas = context.canvas,
|
|
12459
|
-
newCanvas =
|
|
12529
|
+
newCanvas = application.global.createCanvas({
|
|
12460
12530
|
width: canvas.width,
|
|
12461
12531
|
height: canvas.height,
|
|
12462
12532
|
dpr: 1
|
|
@@ -12481,7 +12551,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12481
12551
|
scrollY: scrollY
|
|
12482
12552
|
} = group.attribute;
|
|
12483
12553
|
let p;
|
|
12484
|
-
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(params.
|
|
12554
|
+
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
12555
|
const {
|
|
12486
12556
|
x: x,
|
|
12487
12557
|
y: y,
|
|
@@ -12518,8 +12588,8 @@ var __decorate$w = undefined && undefined.__decorate || function (decorators, ta
|
|
|
12518
12588
|
};
|
|
12519
12589
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
12520
12590
|
let DefaultCanvasImageRender = class extends BaseRender {
|
|
12521
|
-
constructor(
|
|
12522
|
-
super(), this.
|
|
12591
|
+
constructor(graphicRenderContributions) {
|
|
12592
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
12523
12593
|
}
|
|
12524
12594
|
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12525
12595
|
const imageAttribute = getTheme(image).image,
|
|
@@ -12701,12 +12771,12 @@ let CommonDrawItemInterceptorContribution = class {
|
|
|
12701
12771
|
this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
|
|
12702
12772
|
}
|
|
12703
12773
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12704
|
-
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12774
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12705
12775
|
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
12776
|
return !1;
|
|
12707
12777
|
}
|
|
12708
12778
|
beforeDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12709
|
-
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12779
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !graphic.attribute._debug_bounds && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12710
12780
|
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
12781
|
return !1;
|
|
12712
12782
|
}
|
|
@@ -12843,6 +12913,9 @@ let DefaultRenderService = class {
|
|
|
12843
12913
|
afterDraw(params) {
|
|
12844
12914
|
this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
|
|
12845
12915
|
}
|
|
12916
|
+
reInit() {
|
|
12917
|
+
this.drawContribution.reInit();
|
|
12918
|
+
}
|
|
12846
12919
|
render(groups, params) {
|
|
12847
12920
|
this.renderTreeRoots = groups, this.drawParams = params;
|
|
12848
12921
|
const updateBounds = params.updateBounds;
|
|
@@ -13251,6 +13324,11 @@ let DefaultDrawContribution = class {
|
|
|
13251
13324
|
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
13252
13325
|
}, 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
13326
|
}
|
|
13327
|
+
reInit() {
|
|
13328
|
+
this.init(), this.contributions.forEach(item => {
|
|
13329
|
+
item.reInit();
|
|
13330
|
+
});
|
|
13331
|
+
}
|
|
13254
13332
|
init() {
|
|
13255
13333
|
this.contributions.forEach(item => {
|
|
13256
13334
|
if (item.style) {
|
|
@@ -14972,6 +15050,11 @@ class ScrollBar extends AbstractComponent {
|
|
|
14972
15050
|
constructor(attributes, options) {
|
|
14973
15051
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, ScrollBar.defaultAttributes, attributes));
|
|
14974
15052
|
this.name = 'scrollbar';
|
|
15053
|
+
this._handleTouchMove = (e) => {
|
|
15054
|
+
if (isValid(this._prePos)) {
|
|
15055
|
+
e.preventDefault();
|
|
15056
|
+
}
|
|
15057
|
+
};
|
|
14975
15058
|
this._onRailPointerDown = (e) => {
|
|
14976
15059
|
const { viewX, viewY } = e;
|
|
14977
15060
|
const { direction, width, height, range } = this.attribute;
|
|
@@ -15010,7 +15093,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15010
15093
|
});
|
|
15011
15094
|
const triggers = getEndTriggersOfDrag();
|
|
15012
15095
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15013
|
-
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true
|
|
15096
|
+
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15014
15097
|
triggers.forEach((trigger) => {
|
|
15015
15098
|
obj.addEventListener(trigger, this._onSliderPointerUp);
|
|
15016
15099
|
});
|
|
@@ -15035,7 +15118,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
15035
15118
|
return [currentPos, currentScrollValue];
|
|
15036
15119
|
};
|
|
15037
15120
|
this._onSliderPointerMove = (e) => {
|
|
15038
|
-
e.preventDefault();
|
|
15039
15121
|
const { stopSliderMovePropagation = true } = this.attribute;
|
|
15040
15122
|
if (stopSliderMovePropagation) {
|
|
15041
15123
|
e.stopPropagation();
|
|
@@ -15053,6 +15135,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15053
15135
|
const preScrollRange = this.getScrollRange();
|
|
15054
15136
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
15055
15137
|
const range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
|
|
15138
|
+
this._prePos = null;
|
|
15056
15139
|
this._dispatchEvent(SCROLLBAR_END_EVENT, {
|
|
15057
15140
|
pre: preRange,
|
|
15058
15141
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
@@ -15107,6 +15190,9 @@ class ScrollBar extends AbstractComponent {
|
|
|
15107
15190
|
if (this._slider) {
|
|
15108
15191
|
this._slider.addEventListener('pointerdown', this._onSliderPointerDown);
|
|
15109
15192
|
}
|
|
15193
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
15194
|
+
passive: false
|
|
15195
|
+
});
|
|
15110
15196
|
}
|
|
15111
15197
|
render() {
|
|
15112
15198
|
this._reset();
|
|
@@ -15193,7 +15279,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
15193
15279
|
_clearDragEvents() {
|
|
15194
15280
|
const triggers = getEndTriggersOfDrag();
|
|
15195
15281
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15196
|
-
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true
|
|
15282
|
+
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15197
15283
|
triggers.forEach((trigger) => {
|
|
15198
15284
|
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15199
15285
|
});
|
|
@@ -15202,6 +15288,13 @@ class ScrollBar extends AbstractComponent {
|
|
|
15202
15288
|
this._sliderRenderBounds = null;
|
|
15203
15289
|
this._sliderLimitRange = null;
|
|
15204
15290
|
}
|
|
15291
|
+
release(all) {
|
|
15292
|
+
super.release(all);
|
|
15293
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
15294
|
+
passive: false
|
|
15295
|
+
});
|
|
15296
|
+
this._clearDragEvents();
|
|
15297
|
+
}
|
|
15205
15298
|
}
|
|
15206
15299
|
ScrollBar.defaultAttributes = {
|
|
15207
15300
|
direction: 'horizontal',
|
|
@@ -17991,7 +18084,7 @@ class AxisBase extends AnimateComponent {
|
|
|
17991
18084
|
var _a;
|
|
17992
18085
|
if (el.type !== 'group' && el.id) {
|
|
17993
18086
|
const oldEl = prevInnerView[el.id];
|
|
17994
|
-
el.
|
|
18087
|
+
el.setFinalAttributes(el.attribute);
|
|
17995
18088
|
if (oldEl) {
|
|
17996
18089
|
oldEl.release();
|
|
17997
18090
|
const oldAttrs = oldEl.attribute;
|
|
@@ -18722,9 +18815,10 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
18722
18815
|
function noop() {}
|
|
18723
18816
|
class Step {
|
|
18724
18817
|
constructor(type, props, duration, easing) {
|
|
18818
|
+
var _a;
|
|
18725
18819
|
this._startTime = 0, this._hasFirstRun = !1, this._syncAttributeUpdate = () => {
|
|
18726
18820
|
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;
|
|
18821
|
+
}, 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
18822
|
}
|
|
18729
18823
|
bind(target, animate) {
|
|
18730
18824
|
this.target = target, this.animate = animate, this.onBind(), this.syncAttributeUpdate();
|
|
@@ -18846,12 +18940,12 @@ class WaitStep extends Step {
|
|
|
18846
18940
|
determineInterpolateUpdateFunction() {}
|
|
18847
18941
|
}
|
|
18848
18942
|
|
|
18849
|
-
class DefaultTimeline {
|
|
18943
|
+
class DefaultTimeline extends EventEmitter {
|
|
18850
18944
|
get animateCount() {
|
|
18851
18945
|
return this._animateCount;
|
|
18852
18946
|
}
|
|
18853
18947
|
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;
|
|
18948
|
+
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
18949
|
}
|
|
18856
18950
|
isRunning() {
|
|
18857
18951
|
return !this.paused && this._animateCount > 0;
|
|
@@ -18883,7 +18977,7 @@ class DefaultTimeline {
|
|
|
18883
18977
|
const scaledDelta = delta * this._playSpeed;
|
|
18884
18978
|
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18885
18979
|
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
18886
|
-
});
|
|
18980
|
+
}), 0 === this._animateCount && this.emit("animationEnd");
|
|
18887
18981
|
}
|
|
18888
18982
|
clear() {
|
|
18889
18983
|
this.forEachAccessAnimate(animate => {
|
|
@@ -19126,6 +19220,228 @@ class Animate {
|
|
|
19126
19220
|
}
|
|
19127
19221
|
}
|
|
19128
19222
|
|
|
19223
|
+
const performanceRAF = new PerformanceRAF();
|
|
19224
|
+
class RAFTickHandler {
|
|
19225
|
+
constructor() {
|
|
19226
|
+
this.released = !1;
|
|
19227
|
+
}
|
|
19228
|
+
tick(interval, cb) {
|
|
19229
|
+
performanceRAF.addAnimationFrameCb(() => {
|
|
19230
|
+
if (!this.released) return cb(this);
|
|
19231
|
+
});
|
|
19232
|
+
}
|
|
19233
|
+
release() {
|
|
19234
|
+
this.released = !0;
|
|
19235
|
+
}
|
|
19236
|
+
getTime() {
|
|
19237
|
+
return Date.now();
|
|
19238
|
+
}
|
|
19239
|
+
}
|
|
19240
|
+
class DefaultTicker extends EventEmitter {
|
|
19241
|
+
constructor(stage) {
|
|
19242
|
+
super(), this.timelines = [], this.frameTimeHistory = [], this.handleTick = (handler, params) => {
|
|
19243
|
+
const {
|
|
19244
|
+
once = !1
|
|
19245
|
+
} = null != params ? params : {};
|
|
19246
|
+
if (this.ifCanStop()) return this.stop(), !1;
|
|
19247
|
+
const currentTime = handler.getTime();
|
|
19248
|
+
this._lastTickTime = currentTime, this.lastFrameTime < 0 && (this.lastFrameTime = currentTime - this.interval + this.timeOffset, this.frameTimeHistory.push(this.lastFrameTime));
|
|
19249
|
+
const delta = currentTime - this.lastFrameTime,
|
|
19250
|
+
skip = this.checkSkip(delta);
|
|
19251
|
+
return skip || (this._handlerTick(delta), this.lastFrameTime = currentTime, this.frameTimeHistory.push(this.lastFrameTime)), once || handler.tick(this.interval, this.handleTick), !skip;
|
|
19252
|
+
}, this._handlerTick = delta => {
|
|
19253
|
+
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
19254
|
+
timeline.tick(delta);
|
|
19255
|
+
}), this.emit("tick", delta));
|
|
19256
|
+
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
19257
|
+
}
|
|
19258
|
+
bindStage(stage) {
|
|
19259
|
+
this.stage = stage;
|
|
19260
|
+
}
|
|
19261
|
+
computeTimeOffsetAndJitter() {
|
|
19262
|
+
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
19263
|
+
}
|
|
19264
|
+
init() {
|
|
19265
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
|
|
19266
|
+
this.initHandler();
|
|
19267
|
+
}), application.global.env && this.initHandler();
|
|
19268
|
+
}
|
|
19269
|
+
addTimeline(timeline) {
|
|
19270
|
+
this.timelines.push(timeline);
|
|
19271
|
+
}
|
|
19272
|
+
remTimeline(timeline) {
|
|
19273
|
+
this.timelines = this.timelines.filter(t => t !== timeline);
|
|
19274
|
+
}
|
|
19275
|
+
getTimelines() {
|
|
19276
|
+
return this.timelines;
|
|
19277
|
+
}
|
|
19278
|
+
initHandler() {
|
|
19279
|
+
this.setupTickHandler();
|
|
19280
|
+
}
|
|
19281
|
+
setupTickHandler() {
|
|
19282
|
+
const handler = new RAFTickHandler();
|
|
19283
|
+
return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
|
|
19284
|
+
}
|
|
19285
|
+
setInterval(interval) {
|
|
19286
|
+
this.interval = interval, this.computeTimeOffsetAndJitter();
|
|
19287
|
+
}
|
|
19288
|
+
getInterval() {
|
|
19289
|
+
return this.interval;
|
|
19290
|
+
}
|
|
19291
|
+
setFPS(fps) {
|
|
19292
|
+
this.setInterval(Math.floor(1e3 / fps));
|
|
19293
|
+
}
|
|
19294
|
+
getFPS() {
|
|
19295
|
+
return 1e3 / this.interval;
|
|
19296
|
+
}
|
|
19297
|
+
tick(interval) {
|
|
19298
|
+
this.tickerHandler.tick(interval, handler => this.handleTick(handler, {
|
|
19299
|
+
once: !0
|
|
19300
|
+
}));
|
|
19301
|
+
}
|
|
19302
|
+
tickTo(t) {
|
|
19303
|
+
this.tickerHandler.tickTo && this.tickerHandler.tickTo(t, handler => {
|
|
19304
|
+
this.handleTick(handler, {
|
|
19305
|
+
once: !0
|
|
19306
|
+
});
|
|
19307
|
+
});
|
|
19308
|
+
}
|
|
19309
|
+
pause() {
|
|
19310
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.PAUSE, !0);
|
|
19311
|
+
}
|
|
19312
|
+
resume() {
|
|
19313
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.RUNNING, !0);
|
|
19314
|
+
}
|
|
19315
|
+
ifCanStop() {
|
|
19316
|
+
if (this.autoStop) {
|
|
19317
|
+
if (!this.timelines.length) return !0;
|
|
19318
|
+
if (this.timelines.every(timeline => !timeline.isRunning())) return !0;
|
|
19319
|
+
}
|
|
19320
|
+
return !1;
|
|
19321
|
+
}
|
|
19322
|
+
start() {
|
|
19323
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
19324
|
+
if (this.status === STATUS$1.RUNNING) return !1;
|
|
19325
|
+
if (!this.tickerHandler) return !1;
|
|
19326
|
+
if (!force) {
|
|
19327
|
+
if (this.status === STATUS$1.PAUSE) return !1;
|
|
19328
|
+
if (this.ifCanStop()) return !1;
|
|
19329
|
+
}
|
|
19330
|
+
return this.status = STATUS$1.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
|
|
19331
|
+
}
|
|
19332
|
+
stop() {
|
|
19333
|
+
this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
19334
|
+
}
|
|
19335
|
+
trySyncTickStatus() {
|
|
19336
|
+
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();
|
|
19337
|
+
}
|
|
19338
|
+
release() {
|
|
19339
|
+
var _a;
|
|
19340
|
+
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
19341
|
+
}
|
|
19342
|
+
checkSkip(delta) {
|
|
19343
|
+
if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
|
|
19344
|
+
return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
|
|
19345
|
+
}
|
|
19346
|
+
}
|
|
19347
|
+
|
|
19348
|
+
class AnimationTransitionRegistry {
|
|
19349
|
+
constructor() {
|
|
19350
|
+
this.transitions = new Map(), this.registerDefaultTransitions();
|
|
19351
|
+
}
|
|
19352
|
+
static getInstance() {
|
|
19353
|
+
return AnimationTransitionRegistry.instance || (AnimationTransitionRegistry.instance = new AnimationTransitionRegistry()), AnimationTransitionRegistry.instance;
|
|
19354
|
+
}
|
|
19355
|
+
registerDefaultTransitions() {
|
|
19356
|
+
this.registerTransition("appear", "*", () => ({
|
|
19357
|
+
allowTransition: !0,
|
|
19358
|
+
stopOriginalTransition: !1
|
|
19359
|
+
})), this.registerTransition("appear", "appear", () => ({
|
|
19360
|
+
allowTransition: !1,
|
|
19361
|
+
stopOriginalTransition: !1
|
|
19362
|
+
})), this.registerTransition("appear", "disappear", () => ({
|
|
19363
|
+
allowTransition: !0,
|
|
19364
|
+
stopOriginalTransition: !0
|
|
19365
|
+
})), this.registerTransition("appear", "exit", () => ({
|
|
19366
|
+
allowTransition: !0,
|
|
19367
|
+
stopOriginalTransition: !0
|
|
19368
|
+
})), this.registerTransition("normal", "*", () => ({
|
|
19369
|
+
allowTransition: !0,
|
|
19370
|
+
stopOriginalTransition: !1
|
|
19371
|
+
})), this.registerTransition("normal", "normal", () => ({
|
|
19372
|
+
allowTransition: !1,
|
|
19373
|
+
stopOriginalTransition: !1
|
|
19374
|
+
})), this.registerTransition("normal", "disappear", () => ({
|
|
19375
|
+
allowTransition: !0,
|
|
19376
|
+
stopOriginalTransition: !0
|
|
19377
|
+
})), this.registerTransition("normal", "exit", () => ({
|
|
19378
|
+
allowTransition: !0,
|
|
19379
|
+
stopOriginalTransition: !0
|
|
19380
|
+
})), this.registerTransition("exit", "*", () => ({
|
|
19381
|
+
allowTransition: !1,
|
|
19382
|
+
stopOriginalTransition: !1
|
|
19383
|
+
})), this.registerTransition("exit", "disappear", () => ({
|
|
19384
|
+
allowTransition: !0,
|
|
19385
|
+
stopOriginalTransition: !0
|
|
19386
|
+
})), this.registerTransition("exit", "enter", () => ({
|
|
19387
|
+
allowTransition: !0,
|
|
19388
|
+
stopOriginalTransition: !0
|
|
19389
|
+
})), this.registerTransition("exit", "exit", () => ({
|
|
19390
|
+
allowTransition: !1,
|
|
19391
|
+
stopOriginalTransition: !1
|
|
19392
|
+
})), this.registerTransition("enter", "*", () => ({
|
|
19393
|
+
allowTransition: !0,
|
|
19394
|
+
stopOriginalTransition: !1
|
|
19395
|
+
})), this.registerTransition("enter", "enter", () => ({
|
|
19396
|
+
allowTransition: !1,
|
|
19397
|
+
stopOriginalTransition: !1
|
|
19398
|
+
})), this.registerTransition("enter", "disappear", () => ({
|
|
19399
|
+
allowTransition: !0,
|
|
19400
|
+
stopOriginalTransition: !0
|
|
19401
|
+
})), this.registerTransition("enter", "exit", () => ({
|
|
19402
|
+
allowTransition: !0,
|
|
19403
|
+
stopOriginalTransition: !0
|
|
19404
|
+
})), this.registerTransition("disappear", "*", () => ({
|
|
19405
|
+
allowTransition: !1,
|
|
19406
|
+
stopOriginalTransition: !1
|
|
19407
|
+
})), this.registerTransition("disappear", "appear", () => ({
|
|
19408
|
+
allowTransition: !0,
|
|
19409
|
+
stopOriginalTransition: !0
|
|
19410
|
+
})), this.registerTransition("update", "*", () => ({
|
|
19411
|
+
allowTransition: !0,
|
|
19412
|
+
stopOriginalTransition: !1
|
|
19413
|
+
})), this.registerTransition("update", "disappear", () => ({
|
|
19414
|
+
allowTransition: !0,
|
|
19415
|
+
stopOriginalTransition: !0
|
|
19416
|
+
})), this.registerTransition("update", "exit", () => ({
|
|
19417
|
+
allowTransition: !0,
|
|
19418
|
+
stopOriginalTransition: !0
|
|
19419
|
+
})), this.registerTransition("state", "*", () => ({
|
|
19420
|
+
allowTransition: !0,
|
|
19421
|
+
stopOriginalTransition: !1
|
|
19422
|
+
})), this.registerTransition("state", "disappear", () => ({
|
|
19423
|
+
allowTransition: !0,
|
|
19424
|
+
stopOriginalTransition: !0
|
|
19425
|
+
})), this.registerTransition("state", "exit", () => ({
|
|
19426
|
+
allowTransition: !0,
|
|
19427
|
+
stopOriginalTransition: !0
|
|
19428
|
+
}));
|
|
19429
|
+
}
|
|
19430
|
+
isTransitionAllowed(fromState, toState, graphic) {
|
|
19431
|
+
var _a, _b, _c, _d;
|
|
19432
|
+
let func = null === (_a = this.transitions.get(fromState)) || void 0 === _a ? void 0 : _a.get(toState);
|
|
19433
|
+
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) : {
|
|
19434
|
+
allowTransition: !0,
|
|
19435
|
+
stopOriginalTransition: !0
|
|
19436
|
+
})));
|
|
19437
|
+
}
|
|
19438
|
+
registerTransition(fromState, toState, transition) {
|
|
19439
|
+
let fromStateMap = this.transitions.get(fromState);
|
|
19440
|
+
fromStateMap || (fromStateMap = new Map(), this.transitions.set(fromState, fromStateMap)), fromStateMap.set(toState, transition);
|
|
19441
|
+
}
|
|
19442
|
+
}
|
|
19443
|
+
AnimationTransitionRegistry.getInstance();
|
|
19444
|
+
|
|
19129
19445
|
class AnimateExecutor {
|
|
19130
19446
|
static registerBuiltInAnimate(name, animate) {
|
|
19131
19447
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
@@ -19388,6 +19704,213 @@ class AnimateExecutor {
|
|
|
19388
19704
|
}
|
|
19389
19705
|
AnimateExecutor.builtInAnimateMap = {};
|
|
19390
19706
|
|
|
19707
|
+
const AnimationStates = {
|
|
19708
|
+
APPEAR: "appear",
|
|
19709
|
+
DISAPPEAR: "disappear",
|
|
19710
|
+
UPDATE: "update",
|
|
19711
|
+
HIGHLIGHT: "highlight",
|
|
19712
|
+
UNHIGHLIGHT: "unhighlight",
|
|
19713
|
+
SELECT: "select",
|
|
19714
|
+
UNSELECT: "unselect",
|
|
19715
|
+
HOVER: "hover",
|
|
19716
|
+
UNHOVER: "unhover",
|
|
19717
|
+
ACTIVE: "active",
|
|
19718
|
+
INACTIVE: "inactive"
|
|
19719
|
+
};
|
|
19720
|
+
class AnimationStateStore {
|
|
19721
|
+
constructor(graphic) {
|
|
19722
|
+
this.graphic = graphic;
|
|
19723
|
+
}
|
|
19724
|
+
registerState(state) {
|
|
19725
|
+
this.states || (this.states = new Map()), this.states.set(state.name, state);
|
|
19726
|
+
}
|
|
19727
|
+
clearStates() {
|
|
19728
|
+
var _a;
|
|
19729
|
+
null === (_a = this.states) || void 0 === _a || _a.clear();
|
|
19730
|
+
}
|
|
19731
|
+
}
|
|
19732
|
+
class AnimationStateManager {
|
|
19733
|
+
constructor(graphic) {
|
|
19734
|
+
this.stateList = null, this.graphic = graphic;
|
|
19735
|
+
}
|
|
19736
|
+
applyState(nextState, animationConfig, callback) {
|
|
19737
|
+
const registry = AnimationTransitionRegistry.getInstance(),
|
|
19738
|
+
shouldStopState = [],
|
|
19739
|
+
shouldApplyState = [];
|
|
19740
|
+
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
19741
|
+
const result = {
|
|
19742
|
+
allowTransition: !0,
|
|
19743
|
+
stopOriginalTransition: !0
|
|
19744
|
+
};
|
|
19745
|
+
this.stateList.forEach(currState => {
|
|
19746
|
+
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
19747
|
+
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
19748
|
+
}), result.allowTransition && (shouldApplyState.push({
|
|
19749
|
+
state: state,
|
|
19750
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19751
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19752
|
+
}), this.stateList.forEach(currState => {
|
|
19753
|
+
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
19754
|
+
}));
|
|
19755
|
+
}) : nextState.forEach((state, index) => {
|
|
19756
|
+
shouldApplyState.push({
|
|
19757
|
+
state: state,
|
|
19758
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19759
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19760
|
+
});
|
|
19761
|
+
}), shouldStopState.forEach(state => {
|
|
19762
|
+
state.executor.stop();
|
|
19763
|
+
}), shouldApplyState.length) {
|
|
19764
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
19765
|
+
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
19766
|
+
const nextState = shouldApplyState[i + 1],
|
|
19767
|
+
currentState = shouldApplyState[i];
|
|
19768
|
+
currentState.executor.onEnd(() => {
|
|
19769
|
+
nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
19770
|
+
});
|
|
19771
|
+
}
|
|
19772
|
+
} else callback && callback(!0);
|
|
19773
|
+
this.stateList ? this.stateList = this.stateList.filter(state => !shouldStopState.includes(state)) : this.stateList = [], this.stateList.push(...shouldApplyState);
|
|
19774
|
+
}
|
|
19775
|
+
applyAppearState(animationConfig, callback) {
|
|
19776
|
+
this.applyState([AnimationStates.APPEAR], [{
|
|
19777
|
+
name: AnimationStates.APPEAR,
|
|
19778
|
+
animation: animationConfig
|
|
19779
|
+
}], callback);
|
|
19780
|
+
}
|
|
19781
|
+
applyDisappearState(animationConfig, callback) {
|
|
19782
|
+
this.applyState([AnimationStates.DISAPPEAR], [{
|
|
19783
|
+
name: AnimationStates.DISAPPEAR,
|
|
19784
|
+
animation: animationConfig
|
|
19785
|
+
}], callback);
|
|
19786
|
+
}
|
|
19787
|
+
applyUpdateState(animationConfig, callback) {
|
|
19788
|
+
this.applyState([AnimationStates.UPDATE], [{
|
|
19789
|
+
name: AnimationStates.UPDATE,
|
|
19790
|
+
animation: animationConfig
|
|
19791
|
+
}], callback);
|
|
19792
|
+
}
|
|
19793
|
+
applyHighlightState(animationConfig, callback) {
|
|
19794
|
+
this.applyState([AnimationStates.HIGHLIGHT], [{
|
|
19795
|
+
name: AnimationStates.HIGHLIGHT,
|
|
19796
|
+
animation: animationConfig
|
|
19797
|
+
}], callback);
|
|
19798
|
+
}
|
|
19799
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19800
|
+
this.applyState([AnimationStates.UNHIGHLIGHT], [{
|
|
19801
|
+
name: AnimationStates.UNHIGHLIGHT,
|
|
19802
|
+
animation: animationConfig
|
|
19803
|
+
}], callback);
|
|
19804
|
+
}
|
|
19805
|
+
stopState(state, type) {
|
|
19806
|
+
var _a;
|
|
19807
|
+
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
19808
|
+
stateInfo && stateInfo.executor.stop(type);
|
|
19809
|
+
}
|
|
19810
|
+
clearState() {
|
|
19811
|
+
var _a;
|
|
19812
|
+
null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
|
|
19813
|
+
state.executor.stop();
|
|
19814
|
+
}), this.stateList = null;
|
|
19815
|
+
}
|
|
19816
|
+
}
|
|
19817
|
+
|
|
19818
|
+
class GraphicStateExtension {
|
|
19819
|
+
_getAnimationStateManager(graphic) {
|
|
19820
|
+
return graphic._animationStateManager || (graphic._animationStateManager = new AnimationStateManager(graphic)), graphic._animationStateManager;
|
|
19821
|
+
}
|
|
19822
|
+
_getAnimationStateStore(graphic) {
|
|
19823
|
+
return graphic._animationStateStore || (graphic._animationStateStore = new AnimationStateStore(graphic)), graphic._animationStateStore;
|
|
19824
|
+
}
|
|
19825
|
+
registerAnimationState(state) {
|
|
19826
|
+
return this._getAnimationStateStore(this).registerState(state), this;
|
|
19827
|
+
}
|
|
19828
|
+
applyAnimationState(state, animationConfig, callback) {
|
|
19829
|
+
return this._getAnimationStateManager(this).applyState(state, animationConfig, callback), this;
|
|
19830
|
+
}
|
|
19831
|
+
applyAppearState(animationConfig, callback) {
|
|
19832
|
+
return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback), this;
|
|
19833
|
+
}
|
|
19834
|
+
applyDisappearState(animationConfig, callback) {
|
|
19835
|
+
return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback), this;
|
|
19836
|
+
}
|
|
19837
|
+
applyUpdateState(animationConfig, callback) {
|
|
19838
|
+
return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback), this;
|
|
19839
|
+
}
|
|
19840
|
+
applyHighlightState(animationConfig, callback) {
|
|
19841
|
+
return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback), this;
|
|
19842
|
+
}
|
|
19843
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19844
|
+
return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
|
|
19845
|
+
}
|
|
19846
|
+
stopAnimationState(state, type) {
|
|
19847
|
+
return this._getAnimationStateManager(this).stopState(state, type), this;
|
|
19848
|
+
}
|
|
19849
|
+
clearAnimationStates() {
|
|
19850
|
+
return this._getAnimationStateManager(this).clearState(), this;
|
|
19851
|
+
}
|
|
19852
|
+
static extend(graphic) {
|
|
19853
|
+
return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
|
|
19854
|
+
}
|
|
19855
|
+
}
|
|
19856
|
+
|
|
19857
|
+
class AnimateExtension {
|
|
19858
|
+
getAttributes() {
|
|
19859
|
+
let final = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
19860
|
+
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
19861
|
+
}
|
|
19862
|
+
animate(params) {
|
|
19863
|
+
var _a, _b, _c;
|
|
19864
|
+
this.animates || (this.animates = new Map());
|
|
19865
|
+
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);
|
|
19866
|
+
if (animate.bind(this), params) {
|
|
19867
|
+
const {
|
|
19868
|
+
onStart: onStart,
|
|
19869
|
+
onEnd: onEnd,
|
|
19870
|
+
onRemove: onRemove
|
|
19871
|
+
} = params;
|
|
19872
|
+
null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
|
|
19873
|
+
}
|
|
19874
|
+
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
19875
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
19876
|
+
}), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
|
|
19877
|
+
}
|
|
19878
|
+
createTimeline() {
|
|
19879
|
+
return new DefaultTimeline();
|
|
19880
|
+
}
|
|
19881
|
+
createTicker(stage) {
|
|
19882
|
+
return new DefaultTicker(stage);
|
|
19883
|
+
}
|
|
19884
|
+
setFinalAttributes(finalAttribute) {
|
|
19885
|
+
this.finalAttribute || (this.finalAttribute = {}), Object.assign(this.finalAttribute, finalAttribute);
|
|
19886
|
+
}
|
|
19887
|
+
initFinalAttributes(finalAttribute) {
|
|
19888
|
+
this.finalAttribute = finalAttribute;
|
|
19889
|
+
}
|
|
19890
|
+
initAnimateExecutor() {
|
|
19891
|
+
this._animateExecutor || (this._animateExecutor = new AnimateExecutor(this));
|
|
19892
|
+
}
|
|
19893
|
+
executeAnimation(config) {
|
|
19894
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
19895
|
+
}
|
|
19896
|
+
executeAnimations(configs) {
|
|
19897
|
+
return this.initAnimateExecutor(), configs.forEach(config => {
|
|
19898
|
+
this._animateExecutor.execute(config);
|
|
19899
|
+
}), this;
|
|
19900
|
+
}
|
|
19901
|
+
getFinalAttribute() {
|
|
19902
|
+
return this.finalAttribute;
|
|
19903
|
+
}
|
|
19904
|
+
getGraphicAttribute(key) {
|
|
19905
|
+
let prev = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
19906
|
+
return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
|
|
19907
|
+
}
|
|
19908
|
+
}
|
|
19909
|
+
|
|
19910
|
+
function registerAnimate() {
|
|
19911
|
+
mixin(Graphic, GraphicStateExtension), mixin(Graphic, AnimateExtension);
|
|
19912
|
+
}
|
|
19913
|
+
|
|
19391
19914
|
class ACustomAnimate extends Step {
|
|
19392
19915
|
constructor(customFrom, customTo, duration, easing, params) {
|
|
19393
19916
|
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
|
|
@@ -19461,6 +19984,99 @@ function createComponentAnimator(component) {
|
|
|
19461
19984
|
return new ComponentAnimator(component);
|
|
19462
19985
|
}
|
|
19463
19986
|
|
|
19987
|
+
class IncreaseCount extends ACustomAnimate {
|
|
19988
|
+
constructor(from, to, duration, easing, params) {
|
|
19989
|
+
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);
|
|
19990
|
+
}
|
|
19991
|
+
onFirstRun() {
|
|
19992
|
+
var _a, _b, _c;
|
|
19993
|
+
const fromProps = this.getLastProps(),
|
|
19994
|
+
toProps = this.getEndProps(),
|
|
19995
|
+
fromText = null !== (_a = fromProps.text) && void 0 !== _a ? _a : 0,
|
|
19996
|
+
toText = null !== (_b = toProps.text) && void 0 !== _b ? _b : 0;
|
|
19997
|
+
this.valid = !0;
|
|
19998
|
+
let fromNum = 0,
|
|
19999
|
+
toNum = 0,
|
|
20000
|
+
fromFormat = "",
|
|
20001
|
+
toFormat = "",
|
|
20002
|
+
maxDecimalLength = 0;
|
|
20003
|
+
if ("number" == typeof fromText) {
|
|
20004
|
+
fromNum = fromText;
|
|
20005
|
+
const decimalPart = fromText.toString().split(".")[1] || "";
|
|
20006
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
20007
|
+
} else {
|
|
20008
|
+
if ("string" != typeof fromText) return void (this.valid = !1);
|
|
20009
|
+
if (fromText.endsWith("%")) {
|
|
20010
|
+
fromFormat = "%";
|
|
20011
|
+
const cleanNumStr = fromText.substring(0, fromText.length - 1).replace(/,/g, "");
|
|
20012
|
+
if (fromNum = parseFloat(cleanNumStr) / 100, isNaN(fromNum)) return void (this.valid = !1);
|
|
20013
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
20014
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
20015
|
+
} else {
|
|
20016
|
+
const cleanNumStr = fromText.replace(/,/g, "");
|
|
20017
|
+
if (fromNum = parseFloat(cleanNumStr), isNaN(fromNum)) return void (this.valid = !1);
|
|
20018
|
+
fromText.includes(",") && (fromFormat = ",");
|
|
20019
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
20020
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
20021
|
+
}
|
|
20022
|
+
}
|
|
20023
|
+
if ("number" == typeof toText) {
|
|
20024
|
+
toNum = toText;
|
|
20025
|
+
const decimalPart = toText.toString().split(".")[1] || "";
|
|
20026
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
20027
|
+
} else {
|
|
20028
|
+
if ("string" != typeof toText) return void (this.valid = !1);
|
|
20029
|
+
if (toText.endsWith("%")) {
|
|
20030
|
+
toFormat = "%";
|
|
20031
|
+
const cleanNumStr = toText.substring(0, toText.length - 1).replace(/,/g, "");
|
|
20032
|
+
if (toNum = parseFloat(cleanNumStr) / 100, isNaN(toNum)) return void (this.valid = !1);
|
|
20033
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
20034
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length + 2);
|
|
20035
|
+
} else {
|
|
20036
|
+
const cleanNumStr = toText.replace(/,/g, "");
|
|
20037
|
+
if (toNum = parseFloat(cleanNumStr), isNaN(toNum)) return void (this.valid = !1);
|
|
20038
|
+
toText.includes(",") && (toFormat = ",");
|
|
20039
|
+
const decimalPart = cleanNumStr.split(".")[1] || "";
|
|
20040
|
+
maxDecimalLength = Math.max(maxDecimalLength, decimalPart.length);
|
|
20041
|
+
}
|
|
20042
|
+
}
|
|
20043
|
+
if (null === (_c = this.params) || void 0 === _c ? void 0 : _c.format) {
|
|
20044
|
+
switch (this.params.format) {
|
|
20045
|
+
case "percent":
|
|
20046
|
+
this.format = "%";
|
|
20047
|
+
break;
|
|
20048
|
+
case "thousandth":
|
|
20049
|
+
this.format = ",";
|
|
20050
|
+
break;
|
|
20051
|
+
case "none":
|
|
20052
|
+
this.format = "";
|
|
20053
|
+
break;
|
|
20054
|
+
default:
|
|
20055
|
+
this.format = toFormat || fromFormat;
|
|
20056
|
+
}
|
|
20057
|
+
"%" === this.format && "%" !== toFormat && "%" !== fromFormat && void 0 === this.decimalLength && (this.decimalLength = 2), "%" === this.format || "%" !== toFormat && "%" !== fromFormat || (fromNum *= 100, toNum *= 100);
|
|
20058
|
+
} else this.format = toFormat || fromFormat;
|
|
20059
|
+
this.fromNumber = fromNum, this.toNumber = toNum, void 0 === this.decimalLength && (this.decimalLength = maxDecimalLength);
|
|
20060
|
+
}
|
|
20061
|
+
onEnd(cb) {
|
|
20062
|
+
super.onEnd(cb), cb || this.props && this.target.setAttributes(this.props);
|
|
20063
|
+
}
|
|
20064
|
+
onUpdate(end, ratio, out) {
|
|
20065
|
+
if (!this.valid) return;
|
|
20066
|
+
const currentNumber = this.fromNumber + (this.toNumber - this.fromNumber) * ratio;
|
|
20067
|
+
let formattedText = "";
|
|
20068
|
+
const format = this.format,
|
|
20069
|
+
numberWithDecimals = ("%" === format ? 100 * currentNumber : currentNumber).toFixed(this.decimalLength);
|
|
20070
|
+
let formattedWithBasicFormat,
|
|
20071
|
+
formattedNumber = numberWithDecimals;
|
|
20072
|
+
if (parseFloat(numberWithDecimals) === Math.floor(parseFloat(numberWithDecimals)) && (formattedNumber = Math.floor(parseFloat(numberWithDecimals))), "%" === format) formattedWithBasicFormat = `${formattedNumber}%`;else if ("," === format) {
|
|
20073
|
+
const parts = formattedNumber.toString().split(".");
|
|
20074
|
+
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","), formattedWithBasicFormat = parts.join(".");
|
|
20075
|
+
} else formattedWithBasicFormat = formattedNumber;
|
|
20076
|
+
formattedText = this.formatTemplate ? this.formatTemplate.replace("{{var}}", formattedWithBasicFormat.toString()) : formattedWithBasicFormat, this.target.setAttribute("text", formattedText);
|
|
20077
|
+
}
|
|
20078
|
+
}
|
|
20079
|
+
|
|
19464
20080
|
class AxisEnter extends AComponentAnimate {
|
|
19465
20081
|
onBind() {
|
|
19466
20082
|
var _a;
|
|
@@ -21672,6 +22288,7 @@ class LabelEnter extends AComponentAnimate {
|
|
|
21672
22288
|
}
|
|
21673
22289
|
}
|
|
21674
22290
|
function registerLabelAnimate() {
|
|
22291
|
+
AnimateExecutor.registerBuiltInAnimate('increaseCount', IncreaseCount);
|
|
21675
22292
|
AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
|
|
21676
22293
|
AnimateExecutor.registerBuiltInAnimate('labelEnter', LabelEnter);
|
|
21677
22294
|
}
|
|
@@ -22393,19 +23010,20 @@ class LabelBase extends AnimateComponent {
|
|
|
22393
23010
|
if (showLabelLine) {
|
|
22394
23011
|
labelLine = this._createLabelLine(text, relatedGraphic);
|
|
22395
23012
|
}
|
|
23013
|
+
const currentLabel = labelLine ? { text, labelLine } : { text };
|
|
22396
23014
|
if (syncState) {
|
|
22397
|
-
this.updateStatesOfLabels([
|
|
23015
|
+
this.updateStatesOfLabels([currentLabel], (_a = relatedGraphic.currentStates) !== null && _a !== void 0 ? _a : []);
|
|
22398
23016
|
}
|
|
22399
23017
|
if (state === 'enter') {
|
|
22400
23018
|
texts.push(text);
|
|
22401
|
-
currentTextMap.set(textKey,
|
|
22402
|
-
this._addLabel(
|
|
23019
|
+
currentTextMap.set(textKey, currentLabel);
|
|
23020
|
+
this._addLabel(currentLabel, texts, labelLines, index);
|
|
22403
23021
|
}
|
|
22404
23022
|
else if (state === 'update') {
|
|
22405
23023
|
const prevLabel = prevTextMap.get(textKey);
|
|
22406
23024
|
prevTextMap.delete(textKey);
|
|
22407
23025
|
currentTextMap.set(textKey, prevLabel);
|
|
22408
|
-
this._updateLabel(prevLabel,
|
|
23026
|
+
this._updateLabel(prevLabel, currentLabel);
|
|
22409
23027
|
}
|
|
22410
23028
|
});
|
|
22411
23029
|
this._removeLabel(prevTextMap);
|
|
@@ -22429,31 +23047,29 @@ class LabelBase extends AnimateComponent {
|
|
|
22429
23047
|
]));
|
|
22430
23048
|
}
|
|
22431
23049
|
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
22432
|
-
if (this._enableAnimation === false || !this._animationConfig.update) {
|
|
22433
|
-
return;
|
|
22434
|
-
}
|
|
22435
23050
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
22436
23051
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
22437
|
-
const { duration, easing } = this._animationConfig.update;
|
|
22438
23052
|
prevText.applyAnimationState(['update'], [
|
|
22439
23053
|
{
|
|
22440
23054
|
name: 'update',
|
|
22441
|
-
animation: {
|
|
22442
|
-
type: 'labelUpdate',
|
|
22443
|
-
duration,
|
|
22444
|
-
easing,
|
|
22445
|
-
customParameters: {
|
|
23055
|
+
animation: Object.assign(Object.assign({ type: 'labelUpdate' }, this._animationConfig.update), { customParameters: {
|
|
22446
23056
|
prevText,
|
|
22447
23057
|
curText,
|
|
22448
23058
|
prevLabelLine,
|
|
22449
23059
|
curLabelLine
|
|
22450
|
-
}
|
|
22451
|
-
}
|
|
23060
|
+
} })
|
|
22452
23061
|
}
|
|
22453
23062
|
]);
|
|
22454
23063
|
}
|
|
23064
|
+
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
23065
|
+
if (this.attribute.syncState && relatedGraphic) {
|
|
23066
|
+
relatedGraphic.on('afterStateUpdate', this._handleRelatedGraphicSetState);
|
|
23067
|
+
}
|
|
23068
|
+
}
|
|
22455
23069
|
_addLabel(label, texts, labelLines, index) {
|
|
22456
23070
|
const { text, labelLine } = label;
|
|
23071
|
+
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
23072
|
+
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
22457
23073
|
if (text) {
|
|
22458
23074
|
this.add(text);
|
|
22459
23075
|
}
|
|
@@ -22465,7 +23081,7 @@ class LabelBase extends AnimateComponent {
|
|
|
22465
23081
|
_updateLabel(prevLabel, currentLabel) {
|
|
22466
23082
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
22467
23083
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
22468
|
-
if (this._enableAnimation === false ||
|
|
23084
|
+
if (this._enableAnimation === false || this._animationConfig.update === false) {
|
|
22469
23085
|
prevLabel.text.setAttributes(curText.attribute);
|
|
22470
23086
|
if (prevLabelLine && curLabelLine) {
|
|
22471
23087
|
prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
@@ -24219,13 +24835,14 @@ class DataZoom extends AbstractComponent {
|
|
|
24219
24835
|
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24220
24836
|
const triggers = getEndTriggersOfDrag();
|
|
24221
24837
|
evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24222
|
-
this.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24838
|
+
this.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24839
|
+
capture: true
|
|
24840
|
+
});
|
|
24223
24841
|
triggers.forEach((trigger) => {
|
|
24224
24842
|
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
24225
24843
|
});
|
|
24226
24844
|
};
|
|
24227
24845
|
this._pointerMove = (e) => {
|
|
24228
|
-
e.preventDefault();
|
|
24229
24846
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
24230
24847
|
const pos = this.eventPosToStagePos(e);
|
|
24231
24848
|
const { attPos, max } = this._layoutCache;
|
|
@@ -24378,7 +24995,9 @@ class DataZoom extends AbstractComponent {
|
|
|
24378
24995
|
triggers.forEach((trigger) => {
|
|
24379
24996
|
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
24380
24997
|
});
|
|
24381
|
-
this.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24998
|
+
this.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
24999
|
+
capture: true
|
|
25000
|
+
});
|
|
24382
25001
|
}
|
|
24383
25002
|
_onHandlerPointerEnter(e) {
|
|
24384
25003
|
this._showText = true;
|
|
@@ -24965,22 +25584,27 @@ var IMarkPointItemPosition;
|
|
|
24965
25584
|
function loadBaseMarker() {
|
|
24966
25585
|
registerGroup();
|
|
24967
25586
|
loadTagComponent();
|
|
25587
|
+
registerAnimate();
|
|
24968
25588
|
}
|
|
24969
25589
|
function loadMarkLineComponent() {
|
|
24970
25590
|
loadBaseMarker();
|
|
24971
25591
|
loadSegmentComponent();
|
|
25592
|
+
registerAnimate();
|
|
24972
25593
|
}
|
|
24973
25594
|
function loadMarkArcLineComponent() {
|
|
24974
25595
|
loadBaseMarker();
|
|
24975
25596
|
loadArcSegmentComponent();
|
|
25597
|
+
registerAnimate();
|
|
24976
25598
|
}
|
|
24977
25599
|
function loadMarkAreaComponent() {
|
|
24978
25600
|
loadBaseMarker();
|
|
24979
25601
|
registerPolygon();
|
|
25602
|
+
registerAnimate();
|
|
24980
25603
|
}
|
|
24981
25604
|
function loadMarkArcAreaComponent() {
|
|
24982
25605
|
loadBaseMarker();
|
|
24983
25606
|
registerArc();
|
|
25607
|
+
registerAnimate();
|
|
24984
25608
|
}
|
|
24985
25609
|
function loadMarkPointComponent() {
|
|
24986
25610
|
loadBaseMarker();
|
|
@@ -24989,6 +25613,7 @@ function loadMarkPointComponent() {
|
|
|
24989
25613
|
registerSymbol();
|
|
24990
25614
|
registerImage();
|
|
24991
25615
|
registerLine();
|
|
25616
|
+
registerAnimate();
|
|
24992
25617
|
}
|
|
24993
25618
|
|
|
24994
25619
|
class Marker extends AbstractComponent {
|
|
@@ -25892,25 +26517,7 @@ const DEFAULT_MARK_POINT_THEME = {
|
|
|
25892
26517
|
itemContent: {
|
|
25893
26518
|
type: 'text',
|
|
25894
26519
|
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
|
-
}
|
|
26520
|
+
refX: 10
|
|
25914
26521
|
}
|
|
25915
26522
|
};
|
|
25916
26523
|
const DEFAULT_MARK_POINT_TEXT_STYLE_MAP = {
|
|
@@ -26441,7 +27048,7 @@ class MarkPoint extends Marker {
|
|
|
26441
27048
|
if (!item) {
|
|
26442
27049
|
return;
|
|
26443
27050
|
}
|
|
26444
|
-
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0,
|
|
27051
|
+
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, style, position: positionType = IMarkPointItemPosition.middle } = itemContent;
|
|
26445
27052
|
const { state } = this.attribute;
|
|
26446
27053
|
const lineEndAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
26447
27054
|
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle - Math.PI / 2);
|
|
@@ -26449,24 +27056,24 @@ class MarkPoint extends Marker {
|
|
|
26449
27056
|
if (itemType === 'text') {
|
|
26450
27057
|
const offsetX = newItemPosition.x - newPosition.x;
|
|
26451
27058
|
const offsetY = newItemPosition.y - newPosition.y;
|
|
26452
|
-
item.setAttributes(Object.assign(Object.assign({},
|
|
27059
|
+
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
27060
|
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.
|
|
27061
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26455
27062
|
} }));
|
|
26456
27063
|
}
|
|
26457
27064
|
else if (itemType === 'richText') {
|
|
26458
27065
|
item.setAttributes({
|
|
26459
|
-
dx: this.getItemDx(item, positionType,
|
|
26460
|
-
dy: this.getItemDy(item, positionType,
|
|
27066
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
27067
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26461
27068
|
});
|
|
26462
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
27069
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26463
27070
|
}
|
|
26464
27071
|
else if (itemType === 'image') {
|
|
26465
27072
|
item.setAttributes({
|
|
26466
|
-
dx: this.getItemDx(item, positionType,
|
|
26467
|
-
dy: this.getItemDy(item, positionType,
|
|
27073
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
27074
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26468
27075
|
});
|
|
26469
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
27076
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26470
27077
|
}
|
|
26471
27078
|
const itemAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle - Math.PI;
|
|
26472
27079
|
item.setAttributes({
|
|
@@ -26499,29 +27106,29 @@ class MarkPoint extends Marker {
|
|
|
26499
27106
|
}
|
|
26500
27107
|
initItem(itemContent, newPosition, newItemPosition) {
|
|
26501
27108
|
const { state } = this.attribute;
|
|
26502
|
-
const { type = 'text',
|
|
27109
|
+
const { type = 'text', style, renderCustomCallback } = itemContent;
|
|
26503
27110
|
let item;
|
|
26504
27111
|
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.
|
|
27112
|
+
item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition), style));
|
|
27113
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26507
27114
|
}
|
|
26508
27115
|
else if (type === 'text') {
|
|
26509
27116
|
item = new Tag(Object.assign(Object.assign({}, newItemPosition), { state: {
|
|
26510
27117
|
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.
|
|
27118
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26512
27119
|
} }));
|
|
26513
27120
|
}
|
|
26514
27121
|
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.
|
|
27122
|
+
item = graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition), style));
|
|
27123
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26517
27124
|
}
|
|
26518
27125
|
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.
|
|
27126
|
+
item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition), style));
|
|
27127
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26521
27128
|
}
|
|
26522
27129
|
else if (type === 'custom' && renderCustomCallback) {
|
|
26523
27130
|
item = renderCustomCallback();
|
|
26524
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
27131
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26525
27132
|
}
|
|
26526
27133
|
item.name = `mark-point-${type}`;
|
|
26527
27134
|
this.setItemAttributes(item, itemContent, newPosition, newItemPosition, type);
|
|
@@ -26709,7 +27316,7 @@ class MarkPoint extends Marker {
|
|
|
26709
27316
|
const { itemContent = {}, targetSymbol, itemLine } = this.attribute;
|
|
26710
27317
|
const { offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0 } = itemContent;
|
|
26711
27318
|
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;
|
|
27319
|
+
const targetSize = targetItemvisible ? ((_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20) : 0;
|
|
26713
27320
|
let targetOffsetAngle;
|
|
26714
27321
|
if (itemLine.type === 'type-do') {
|
|
26715
27322
|
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX / 2);
|
|
@@ -28432,14 +29039,13 @@ class Slider extends AbstractComponent {
|
|
|
28432
29039
|
this._prePos = this._isHorizontal ? x : y;
|
|
28433
29040
|
const triggers = getEndTriggersOfDrag();
|
|
28434
29041
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28435
|
-
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true
|
|
29042
|
+
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
28436
29043
|
triggers.forEach((trigger) => {
|
|
28437
29044
|
obj.addEventListener(trigger, this._onHandlerPointerUp);
|
|
28438
29045
|
});
|
|
28439
29046
|
};
|
|
28440
29047
|
this._onHandlerPointerMove = (e) => {
|
|
28441
29048
|
var _a, _b;
|
|
28442
|
-
e.preventDefault();
|
|
28443
29049
|
this._isChanging = true;
|
|
28444
29050
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
28445
29051
|
if (max === min) {
|
|
@@ -28491,13 +29097,12 @@ class Slider extends AbstractComponent {
|
|
|
28491
29097
|
this._prePos = this._isHorizontal ? x : y;
|
|
28492
29098
|
const triggers = getEndTriggersOfDrag();
|
|
28493
29099
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28494
|
-
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true
|
|
29100
|
+
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
28495
29101
|
triggers.forEach((trigger) => {
|
|
28496
29102
|
obj.addEventListener(trigger, this._onTrackPointerUp);
|
|
28497
29103
|
});
|
|
28498
29104
|
};
|
|
28499
29105
|
this._onTrackPointerMove = (e) => {
|
|
28500
|
-
e.preventDefault();
|
|
28501
29106
|
this._isChanging = true;
|
|
28502
29107
|
const { railWidth, railHeight, min, max, inverse } = this.attribute;
|
|
28503
29108
|
if (max === min) {
|
|
@@ -28947,11 +29552,11 @@ class Slider extends AbstractComponent {
|
|
|
28947
29552
|
_clearAllDragEvents() {
|
|
28948
29553
|
const triggers = getEndTriggersOfDrag();
|
|
28949
29554
|
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28950
|
-
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true
|
|
29555
|
+
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
28951
29556
|
triggers.forEach((trigger) => {
|
|
28952
29557
|
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
28953
29558
|
});
|
|
28954
|
-
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true
|
|
29559
|
+
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
28955
29560
|
triggers.forEach((trigger) => {
|
|
28956
29561
|
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
28957
29562
|
});
|
|
@@ -32605,6 +33210,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
32605
33210
|
theme: 'default'
|
|
32606
33211
|
};
|
|
32607
33212
|
|
|
32608
|
-
const version = "1.0.0
|
|
33213
|
+
const version = "1.0.0";
|
|
32609
33214
|
|
|
32610
33215
|
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 };
|