@visactor/vrender-components 1.0.0-alpha.12 → 1.0.0-alpha.14
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/axis/line.js +2 -1
- package/cjs/brush/config.js +1 -2
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/marker/point.js +15 -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/dist/index.es.js +529 -98
- package/es/axis/line.js +2 -1
- package/es/brush/config.js +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/marker/point.js +15 -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/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -577,6 +577,9 @@ const EnvContribution = Symbol.for("EnvContribution");
|
|
|
577
577
|
const VGlobal = Symbol.for("VGlobal");
|
|
578
578
|
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
579
|
|
|
580
|
+
class Application {}
|
|
581
|
+
const application = new Application();
|
|
582
|
+
|
|
580
583
|
class PerformanceRAF {
|
|
581
584
|
constructor() {
|
|
582
585
|
this.nextAnimationFrameCbs = [], this._rafHandle = null, this.runAnimationFrame = time => {
|
|
@@ -585,7 +588,7 @@ class PerformanceRAF {
|
|
|
585
588
|
this.nextAnimationFrameCbs = [];
|
|
586
589
|
for (let i = 0; i < cbs.length; i++) cbs[i] && cbs[i](time);
|
|
587
590
|
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
588
|
-
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.length && (this._rafHandle =
|
|
591
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.length && (this._rafHandle = application.global.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
589
592
|
};
|
|
590
593
|
}
|
|
591
594
|
addAnimationFrameCb(callback) {
|
|
@@ -830,6 +833,11 @@ var AnimateMode;
|
|
|
830
833
|
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
831
834
|
}(AnimateMode || (AnimateMode = {}));
|
|
832
835
|
|
|
836
|
+
var STATUS$1;
|
|
837
|
+
!function (STATUS) {
|
|
838
|
+
STATUS[STATUS.INITIAL = 0] = "INITIAL", STATUS[STATUS.RUNNING = 1] = "RUNNING", STATUS[STATUS.PAUSE = 2] = "PAUSE";
|
|
839
|
+
}(STATUS$1 || (STATUS$1 = {}));
|
|
840
|
+
|
|
833
841
|
var AnimateStepType;
|
|
834
842
|
!function (AnimateStepType) {
|
|
835
843
|
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
@@ -1147,44 +1155,6 @@ function quadLength(p0, p1, p2, iterationCount) {
|
|
|
1147
1155
|
return snapLength([p0.x, p1.x, p2.x], [p0.y, p1.y, p2.y]);
|
|
1148
1156
|
}
|
|
1149
1157
|
|
|
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
1158
|
function divideCubic(curve, t) {
|
|
1189
1159
|
const {
|
|
1190
1160
|
p0: p0,
|
|
@@ -1200,17 +1170,6 @@ function divideCubic(curve, t) {
|
|
|
1200
1170
|
c23 = PointService.pointAtPP(c2, c3, t);
|
|
1201
1171
|
return [new CubicBezierCurve(p0, c1, c12, pt), new CubicBezierCurve(pt, c23, c3, p3)];
|
|
1202
1172
|
}
|
|
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
1173
|
class CubicBezierCurve extends Curve {
|
|
1215
1174
|
constructor(p0, p1, p2, p3) {
|
|
1216
1175
|
super(), this.type = CurveTypeEnum.CubicBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2, this.p3 = p3;
|
|
@@ -1851,6 +1810,55 @@ class CatmullRomClosed {
|
|
|
1851
1810
|
}
|
|
1852
1811
|
const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
1853
1812
|
|
|
1813
|
+
function divideQuad(curve, t) {
|
|
1814
|
+
const {
|
|
1815
|
+
p0: p0,
|
|
1816
|
+
p1: p1,
|
|
1817
|
+
p2: p2
|
|
1818
|
+
} = curve,
|
|
1819
|
+
pt = quadPointAt(p0, p1, p2, t),
|
|
1820
|
+
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1821
|
+
c2 = PointService.pointAtPP(p1, p2, t);
|
|
1822
|
+
return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
|
|
1823
|
+
}
|
|
1824
|
+
class QuadraticBezierCurve extends Curve {
|
|
1825
|
+
constructor(p0, p1, p2) {
|
|
1826
|
+
super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
|
|
1827
|
+
}
|
|
1828
|
+
_validPoint() {
|
|
1829
|
+
return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
|
|
1830
|
+
}
|
|
1831
|
+
getPointAt(t) {
|
|
1832
|
+
if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
|
|
1833
|
+
throw new Error("defined为false的点不能getPointAt");
|
|
1834
|
+
}
|
|
1835
|
+
calcLength() {
|
|
1836
|
+
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1837
|
+
}
|
|
1838
|
+
calcProjLength(direction) {
|
|
1839
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1840
|
+
}
|
|
1841
|
+
getAngleAt(t) {
|
|
1842
|
+
const minT = max(t - .01, 0),
|
|
1843
|
+
maxT = min(t + .01, 1),
|
|
1844
|
+
minP = this.getPointAt(minT),
|
|
1845
|
+
maxP = this.getPointAt(maxT);
|
|
1846
|
+
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1847
|
+
}
|
|
1848
|
+
draw(path, x, y, sx, sy, percent) {
|
|
1849
|
+
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) {
|
|
1850
|
+
const [curve1] = divideQuad(this, percent);
|
|
1851
|
+
path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
getYAt(x) {
|
|
1855
|
+
throw new Error("QuadraticBezierCurve暂不支持getYAt");
|
|
1856
|
+
}
|
|
1857
|
+
includeX(x) {
|
|
1858
|
+
throw new Error("QuadraticBezierCurve暂不支持includeX");
|
|
1859
|
+
}
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1854
1862
|
class CurveContext {
|
|
1855
1863
|
constructor(path) {
|
|
1856
1864
|
this.path = path, this._lastX = this._lastY = this._startX = this._startY = 0;
|
|
@@ -2541,9 +2549,6 @@ const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImag
|
|
|
2541
2549
|
opacity: 1
|
|
2542
2550
|
});
|
|
2543
2551
|
|
|
2544
|
-
class Application {}
|
|
2545
|
-
const application = new Application();
|
|
2546
|
-
|
|
2547
2552
|
const parse = function () {
|
|
2548
2553
|
const tokens = {
|
|
2549
2554
|
linearGradient: /^(linear\-gradient)/i,
|
|
@@ -6236,6 +6241,10 @@ class Graphic extends Node {
|
|
|
6236
6241
|
var _a;
|
|
6237
6242
|
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
6243
|
}
|
|
6244
|
+
getGraphicService() {
|
|
6245
|
+
var _a, _b;
|
|
6246
|
+
return null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
|
|
6247
|
+
}
|
|
6239
6248
|
getAttributes() {
|
|
6240
6249
|
return this.attribute;
|
|
6241
6250
|
}
|
|
@@ -6265,13 +6274,12 @@ class Graphic extends Node {
|
|
|
6265
6274
|
this._emitCustomEvent("animate-bind", animate);
|
|
6266
6275
|
}
|
|
6267
6276
|
tryUpdateAABBBounds() {
|
|
6268
|
-
var _a, _b;
|
|
6269
6277
|
const full = "imprecise" === this.attribute.boundsMode;
|
|
6270
6278
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6271
6279
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
6272
|
-
|
|
6280
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6273
6281
|
const bounds = this.doUpdateAABBBounds(full);
|
|
6274
|
-
return
|
|
6282
|
+
return this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6275
6283
|
}
|
|
6276
6284
|
tryUpdateOBBBounds() {
|
|
6277
6285
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
@@ -6378,7 +6386,7 @@ class Graphic extends Node {
|
|
|
6378
6386
|
return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
|
|
6379
6387
|
}
|
|
6380
6388
|
shouldUpdateAABBBounds() {
|
|
6381
|
-
return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) &&
|
|
6389
|
+
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
6390
|
}
|
|
6383
6391
|
shouldSelfChangeUpdateAABBBounds() {
|
|
6384
6392
|
return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
|
|
@@ -6559,8 +6567,7 @@ class Graphic extends Node {
|
|
|
6559
6567
|
return this;
|
|
6560
6568
|
}
|
|
6561
6569
|
onAttributeUpdate(context) {
|
|
6562
|
-
|
|
6563
|
-
context && context.skipUpdateCallback || (null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6570
|
+
context && context.skipUpdateCallback || (this.getGraphicService().onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6564
6571
|
}
|
|
6565
6572
|
update(d) {
|
|
6566
6573
|
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
@@ -6750,7 +6757,6 @@ class Graphic extends Node {
|
|
|
6750
6757
|
}
|
|
6751
6758
|
}
|
|
6752
6759
|
setStage(stage, layer) {
|
|
6753
|
-
var _a;
|
|
6754
6760
|
if (this.stage !== stage) {
|
|
6755
6761
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
6756
6762
|
const timeline = stage.getTimeline();
|
|
@@ -6758,7 +6764,7 @@ class Graphic extends Node {
|
|
|
6758
6764
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
6759
6765
|
});
|
|
6760
6766
|
}
|
|
6761
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
6767
|
+
this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage);
|
|
6762
6768
|
}
|
|
6763
6769
|
}
|
|
6764
6770
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -6906,12 +6912,11 @@ class Group extends Graphic {
|
|
|
6906
6912
|
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
6907
6913
|
}
|
|
6908
6914
|
tryUpdateAABBBounds() {
|
|
6909
|
-
var _a, _b;
|
|
6910
6915
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6911
|
-
|
|
6916
|
+
this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6912
6917
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
6913
6918
|
bounds = this.doUpdateAABBBounds();
|
|
6914
|
-
return this.addUpdateLayoutTag(),
|
|
6919
|
+
return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6915
6920
|
}
|
|
6916
6921
|
doUpdateLocalMatrix() {
|
|
6917
6922
|
const {
|
|
@@ -6971,13 +6976,11 @@ class Group extends Graphic {
|
|
|
6971
6976
|
return this.theme.getTheme(this);
|
|
6972
6977
|
}
|
|
6973
6978
|
incrementalAppendChild(node) {
|
|
6974
|
-
var _a;
|
|
6975
6979
|
const data = super.appendChild(node);
|
|
6976
|
-
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(),
|
|
6980
|
+
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
|
|
6977
6981
|
}
|
|
6978
6982
|
incrementalClearChild() {
|
|
6979
|
-
|
|
6980
|
-
super.removeAllChild(), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onClearIncremental(this, this.stage);
|
|
6983
|
+
super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
|
|
6981
6984
|
}
|
|
6982
6985
|
_updateChildToStage(child) {
|
|
6983
6986
|
return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
|
|
@@ -6997,20 +7000,17 @@ class Group extends Graphic {
|
|
|
6997
7000
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6998
7001
|
}
|
|
6999
7002
|
removeChild(child) {
|
|
7000
|
-
var _a;
|
|
7001
7003
|
const data = super.removeChild(child);
|
|
7002
|
-
return child.stage = null,
|
|
7004
|
+
return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
|
|
7003
7005
|
}
|
|
7004
7006
|
removeAllChild() {
|
|
7005
7007
|
let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
7006
7008
|
this.forEachChildren(child => {
|
|
7007
|
-
|
|
7008
|
-
null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
7009
|
+
this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
7009
7010
|
}), super.removeAllChild(), this.addUpdateBoundTag();
|
|
7010
7011
|
}
|
|
7011
7012
|
setStage(stage, layer) {
|
|
7012
|
-
|
|
7013
|
-
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 => {
|
|
7013
|
+
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 => {
|
|
7014
7014
|
item.setStage(stage, this.layer);
|
|
7015
7015
|
}));
|
|
7016
7016
|
}
|
|
@@ -7637,7 +7637,7 @@ let DefaultGraphicService = class {
|
|
|
7637
7637
|
const {
|
|
7638
7638
|
visible = theme.visible
|
|
7639
7639
|
} = attribute;
|
|
7640
|
-
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix),
|
|
7640
|
+
return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), this.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
|
|
7641
7641
|
}
|
|
7642
7642
|
updateTempAABBBounds(aabbBounds) {
|
|
7643
7643
|
const tb1 = this.tempAABBBounds1,
|
|
@@ -12459,7 +12459,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12459
12459
|
height: height
|
|
12460
12460
|
} = group.attribute,
|
|
12461
12461
|
canvas = context.canvas,
|
|
12462
|
-
newCanvas =
|
|
12462
|
+
newCanvas = application.global.createCanvas({
|
|
12463
12463
|
width: canvas.width,
|
|
12464
12464
|
height: canvas.height,
|
|
12465
12465
|
dpr: 1
|
|
@@ -19129,6 +19129,228 @@ class Animate {
|
|
|
19129
19129
|
}
|
|
19130
19130
|
}
|
|
19131
19131
|
|
|
19132
|
+
const performanceRAF = new PerformanceRAF();
|
|
19133
|
+
class RAFTickHandler {
|
|
19134
|
+
constructor() {
|
|
19135
|
+
this.released = !1;
|
|
19136
|
+
}
|
|
19137
|
+
tick(interval, cb) {
|
|
19138
|
+
performanceRAF.addAnimationFrameCb(() => {
|
|
19139
|
+
if (!this.released) return cb(this);
|
|
19140
|
+
});
|
|
19141
|
+
}
|
|
19142
|
+
release() {
|
|
19143
|
+
this.released = !0;
|
|
19144
|
+
}
|
|
19145
|
+
getTime() {
|
|
19146
|
+
return Date.now();
|
|
19147
|
+
}
|
|
19148
|
+
}
|
|
19149
|
+
class DefaultTicker extends EventEmitter {
|
|
19150
|
+
constructor(stage) {
|
|
19151
|
+
super(), this.timelines = [], this.frameTimeHistory = [], this.handleTick = (handler, params) => {
|
|
19152
|
+
const {
|
|
19153
|
+
once = !1
|
|
19154
|
+
} = null != params ? params : {};
|
|
19155
|
+
if (this.ifCanStop()) return this.stop(), !1;
|
|
19156
|
+
const currentTime = handler.getTime();
|
|
19157
|
+
this._lastTickTime = currentTime, this.lastFrameTime < 0 && (this.lastFrameTime = currentTime - this.interval + this.timeOffset, this.frameTimeHistory.push(this.lastFrameTime));
|
|
19158
|
+
const delta = currentTime - this.lastFrameTime,
|
|
19159
|
+
skip = this.checkSkip(delta);
|
|
19160
|
+
return skip || (this._handlerTick(delta), this.lastFrameTime = currentTime, this.frameTimeHistory.push(this.lastFrameTime)), once || handler.tick(this.interval, this.handleTick), !skip;
|
|
19161
|
+
}, this._handlerTick = delta => {
|
|
19162
|
+
this.status === STATUS$1.RUNNING && (this.tickCounts++, this.timelines.forEach(timeline => {
|
|
19163
|
+
timeline.tick(delta);
|
|
19164
|
+
}), this.emit("tick", delta));
|
|
19165
|
+
}, this.init(), this.lastFrameTime = -1, this.tickCounts = 0, this.stage = stage, this.autoStop = !0, this.interval = 16, this.computeTimeOffsetAndJitter();
|
|
19166
|
+
}
|
|
19167
|
+
bindStage(stage) {
|
|
19168
|
+
this.stage = stage;
|
|
19169
|
+
}
|
|
19170
|
+
computeTimeOffsetAndJitter() {
|
|
19171
|
+
this.timeOffset = Math.floor(Math.random() * this.interval), this._jitter = Math.min(Math.max(.2 * this.interval, 6), .7 * this.interval);
|
|
19172
|
+
}
|
|
19173
|
+
init() {
|
|
19174
|
+
this.interval = 16, this.status = STATUS$1.INITIAL, application.global.hooks.onSetEnv.tap("graph-ticker", () => {
|
|
19175
|
+
this.initHandler();
|
|
19176
|
+
}), application.global.env && this.initHandler();
|
|
19177
|
+
}
|
|
19178
|
+
addTimeline(timeline) {
|
|
19179
|
+
this.timelines.push(timeline);
|
|
19180
|
+
}
|
|
19181
|
+
remTimeline(timeline) {
|
|
19182
|
+
this.timelines = this.timelines.filter(t => t !== timeline);
|
|
19183
|
+
}
|
|
19184
|
+
getTimelines() {
|
|
19185
|
+
return this.timelines;
|
|
19186
|
+
}
|
|
19187
|
+
initHandler() {
|
|
19188
|
+
this.setupTickHandler();
|
|
19189
|
+
}
|
|
19190
|
+
setupTickHandler() {
|
|
19191
|
+
const handler = new RAFTickHandler();
|
|
19192
|
+
return this.tickerHandler && this.tickerHandler.release(), this.tickerHandler = handler, !0;
|
|
19193
|
+
}
|
|
19194
|
+
setInterval(interval) {
|
|
19195
|
+
this.interval = interval, this.computeTimeOffsetAndJitter();
|
|
19196
|
+
}
|
|
19197
|
+
getInterval() {
|
|
19198
|
+
return this.interval;
|
|
19199
|
+
}
|
|
19200
|
+
setFPS(fps) {
|
|
19201
|
+
this.setInterval(Math.floor(1e3 / fps));
|
|
19202
|
+
}
|
|
19203
|
+
getFPS() {
|
|
19204
|
+
return 1e3 / this.interval;
|
|
19205
|
+
}
|
|
19206
|
+
tick(interval) {
|
|
19207
|
+
this.tickerHandler.tick(interval, handler => this.handleTick(handler, {
|
|
19208
|
+
once: !0
|
|
19209
|
+
}));
|
|
19210
|
+
}
|
|
19211
|
+
tickTo(t) {
|
|
19212
|
+
this.tickerHandler.tickTo && this.tickerHandler.tickTo(t, handler => {
|
|
19213
|
+
this.handleTick(handler, {
|
|
19214
|
+
once: !0
|
|
19215
|
+
});
|
|
19216
|
+
});
|
|
19217
|
+
}
|
|
19218
|
+
pause() {
|
|
19219
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.PAUSE, !0);
|
|
19220
|
+
}
|
|
19221
|
+
resume() {
|
|
19222
|
+
return this.status !== STATUS$1.INITIAL && (this.status = STATUS$1.RUNNING, !0);
|
|
19223
|
+
}
|
|
19224
|
+
ifCanStop() {
|
|
19225
|
+
if (this.autoStop) {
|
|
19226
|
+
if (!this.timelines.length) return !0;
|
|
19227
|
+
if (this.timelines.every(timeline => !timeline.isRunning())) return !0;
|
|
19228
|
+
}
|
|
19229
|
+
return !1;
|
|
19230
|
+
}
|
|
19231
|
+
start() {
|
|
19232
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
19233
|
+
if (this.status === STATUS$1.RUNNING) return !1;
|
|
19234
|
+
if (!this.tickerHandler) return !1;
|
|
19235
|
+
if (!force) {
|
|
19236
|
+
if (this.status === STATUS$1.PAUSE) return !1;
|
|
19237
|
+
if (this.ifCanStop()) return !1;
|
|
19238
|
+
}
|
|
19239
|
+
return this.status = STATUS$1.RUNNING, this.tickerHandler.tick(0, this.handleTick), !0;
|
|
19240
|
+
}
|
|
19241
|
+
stop() {
|
|
19242
|
+
this.status = STATUS$1.INITIAL, this.setupTickHandler(), this.lastFrameTime = -1;
|
|
19243
|
+
}
|
|
19244
|
+
trySyncTickStatus() {
|
|
19245
|
+
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();
|
|
19246
|
+
}
|
|
19247
|
+
release() {
|
|
19248
|
+
var _a;
|
|
19249
|
+
this.stop(), this.timelines = [], null === (_a = this.tickerHandler) || void 0 === _a || _a.release(), this.tickerHandler = null, this.lastFrameTime = -1;
|
|
19250
|
+
}
|
|
19251
|
+
checkSkip(delta) {
|
|
19252
|
+
if ("performance" === this.stage.params.optimize.tickRenderMode) return !1;
|
|
19253
|
+
return delta < this.interval + 2 * (Math.random() - .5) * this._jitter;
|
|
19254
|
+
}
|
|
19255
|
+
}
|
|
19256
|
+
|
|
19257
|
+
class AnimationTransitionRegistry {
|
|
19258
|
+
constructor() {
|
|
19259
|
+
this.transitions = new Map(), this.registerDefaultTransitions();
|
|
19260
|
+
}
|
|
19261
|
+
static getInstance() {
|
|
19262
|
+
return AnimationTransitionRegistry.instance || (AnimationTransitionRegistry.instance = new AnimationTransitionRegistry()), AnimationTransitionRegistry.instance;
|
|
19263
|
+
}
|
|
19264
|
+
registerDefaultTransitions() {
|
|
19265
|
+
this.registerTransition("appear", "*", () => ({
|
|
19266
|
+
allowTransition: !0,
|
|
19267
|
+
stopOriginalTransition: !1
|
|
19268
|
+
})), this.registerTransition("appear", "appear", () => ({
|
|
19269
|
+
allowTransition: !1,
|
|
19270
|
+
stopOriginalTransition: !1
|
|
19271
|
+
})), this.registerTransition("appear", "disappear", () => ({
|
|
19272
|
+
allowTransition: !0,
|
|
19273
|
+
stopOriginalTransition: !0
|
|
19274
|
+
})), this.registerTransition("appear", "exit", () => ({
|
|
19275
|
+
allowTransition: !0,
|
|
19276
|
+
stopOriginalTransition: !0
|
|
19277
|
+
})), this.registerTransition("normal", "*", () => ({
|
|
19278
|
+
allowTransition: !0,
|
|
19279
|
+
stopOriginalTransition: !1
|
|
19280
|
+
})), this.registerTransition("normal", "normal", () => ({
|
|
19281
|
+
allowTransition: !1,
|
|
19282
|
+
stopOriginalTransition: !1
|
|
19283
|
+
})), this.registerTransition("normal", "disappear", () => ({
|
|
19284
|
+
allowTransition: !0,
|
|
19285
|
+
stopOriginalTransition: !0
|
|
19286
|
+
})), this.registerTransition("normal", "exit", () => ({
|
|
19287
|
+
allowTransition: !0,
|
|
19288
|
+
stopOriginalTransition: !0
|
|
19289
|
+
})), this.registerTransition("exit", "*", () => ({
|
|
19290
|
+
allowTransition: !1,
|
|
19291
|
+
stopOriginalTransition: !1
|
|
19292
|
+
})), this.registerTransition("exit", "disappear", () => ({
|
|
19293
|
+
allowTransition: !0,
|
|
19294
|
+
stopOriginalTransition: !0
|
|
19295
|
+
})), this.registerTransition("exit", "enter", () => ({
|
|
19296
|
+
allowTransition: !0,
|
|
19297
|
+
stopOriginalTransition: !0
|
|
19298
|
+
})), this.registerTransition("exit", "exit", () => ({
|
|
19299
|
+
allowTransition: !1,
|
|
19300
|
+
stopOriginalTransition: !1
|
|
19301
|
+
})), this.registerTransition("enter", "*", () => ({
|
|
19302
|
+
allowTransition: !0,
|
|
19303
|
+
stopOriginalTransition: !1
|
|
19304
|
+
})), this.registerTransition("enter", "enter", () => ({
|
|
19305
|
+
allowTransition: !1,
|
|
19306
|
+
stopOriginalTransition: !1
|
|
19307
|
+
})), this.registerTransition("enter", "disappear", () => ({
|
|
19308
|
+
allowTransition: !0,
|
|
19309
|
+
stopOriginalTransition: !0
|
|
19310
|
+
})), this.registerTransition("enter", "exit", () => ({
|
|
19311
|
+
allowTransition: !0,
|
|
19312
|
+
stopOriginalTransition: !0
|
|
19313
|
+
})), this.registerTransition("disappear", "*", () => ({
|
|
19314
|
+
allowTransition: !1,
|
|
19315
|
+
stopOriginalTransition: !1
|
|
19316
|
+
})), this.registerTransition("disappear", "appear", () => ({
|
|
19317
|
+
allowTransition: !0,
|
|
19318
|
+
stopOriginalTransition: !0
|
|
19319
|
+
})), this.registerTransition("update", "*", () => ({
|
|
19320
|
+
allowTransition: !0,
|
|
19321
|
+
stopOriginalTransition: !1
|
|
19322
|
+
})), this.registerTransition("update", "disappear", () => ({
|
|
19323
|
+
allowTransition: !0,
|
|
19324
|
+
stopOriginalTransition: !0
|
|
19325
|
+
})), this.registerTransition("update", "exit", () => ({
|
|
19326
|
+
allowTransition: !0,
|
|
19327
|
+
stopOriginalTransition: !0
|
|
19328
|
+
})), this.registerTransition("state", "*", () => ({
|
|
19329
|
+
allowTransition: !0,
|
|
19330
|
+
stopOriginalTransition: !1
|
|
19331
|
+
})), this.registerTransition("state", "disappear", () => ({
|
|
19332
|
+
allowTransition: !0,
|
|
19333
|
+
stopOriginalTransition: !0
|
|
19334
|
+
})), this.registerTransition("state", "exit", () => ({
|
|
19335
|
+
allowTransition: !0,
|
|
19336
|
+
stopOriginalTransition: !0
|
|
19337
|
+
}));
|
|
19338
|
+
}
|
|
19339
|
+
isTransitionAllowed(fromState, toState, graphic) {
|
|
19340
|
+
var _a, _b, _c, _d;
|
|
19341
|
+
let func = null === (_a = this.transitions.get(fromState)) || void 0 === _a ? void 0 : _a.get(toState);
|
|
19342
|
+
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) : {
|
|
19343
|
+
allowTransition: !0,
|
|
19344
|
+
stopOriginalTransition: !0
|
|
19345
|
+
})));
|
|
19346
|
+
}
|
|
19347
|
+
registerTransition(fromState, toState, transition) {
|
|
19348
|
+
let fromStateMap = this.transitions.get(fromState);
|
|
19349
|
+
fromStateMap || (fromStateMap = new Map(), this.transitions.set(fromState, fromStateMap)), fromStateMap.set(toState, transition);
|
|
19350
|
+
}
|
|
19351
|
+
}
|
|
19352
|
+
AnimationTransitionRegistry.getInstance();
|
|
19353
|
+
|
|
19132
19354
|
class AnimateExecutor {
|
|
19133
19355
|
static registerBuiltInAnimate(name, animate) {
|
|
19134
19356
|
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
@@ -19391,6 +19613,213 @@ class AnimateExecutor {
|
|
|
19391
19613
|
}
|
|
19392
19614
|
AnimateExecutor.builtInAnimateMap = {};
|
|
19393
19615
|
|
|
19616
|
+
const AnimationStates = {
|
|
19617
|
+
APPEAR: "appear",
|
|
19618
|
+
DISAPPEAR: "disappear",
|
|
19619
|
+
UPDATE: "update",
|
|
19620
|
+
HIGHLIGHT: "highlight",
|
|
19621
|
+
UNHIGHLIGHT: "unhighlight",
|
|
19622
|
+
SELECT: "select",
|
|
19623
|
+
UNSELECT: "unselect",
|
|
19624
|
+
HOVER: "hover",
|
|
19625
|
+
UNHOVER: "unhover",
|
|
19626
|
+
ACTIVE: "active",
|
|
19627
|
+
INACTIVE: "inactive"
|
|
19628
|
+
};
|
|
19629
|
+
class AnimationStateStore {
|
|
19630
|
+
constructor(graphic) {
|
|
19631
|
+
this.graphic = graphic;
|
|
19632
|
+
}
|
|
19633
|
+
registerState(state) {
|
|
19634
|
+
this.states || (this.states = new Map()), this.states.set(state.name, state);
|
|
19635
|
+
}
|
|
19636
|
+
clearStates() {
|
|
19637
|
+
var _a;
|
|
19638
|
+
null === (_a = this.states) || void 0 === _a || _a.clear();
|
|
19639
|
+
}
|
|
19640
|
+
}
|
|
19641
|
+
class AnimationStateManager {
|
|
19642
|
+
constructor(graphic) {
|
|
19643
|
+
this.stateList = null, this.graphic = graphic;
|
|
19644
|
+
}
|
|
19645
|
+
applyState(nextState, animationConfig, callback) {
|
|
19646
|
+
const registry = AnimationTransitionRegistry.getInstance(),
|
|
19647
|
+
shouldStopState = [],
|
|
19648
|
+
shouldApplyState = [];
|
|
19649
|
+
if (this.stateList && this.stateList.length ? nextState.forEach((state, index) => {
|
|
19650
|
+
const result = {
|
|
19651
|
+
allowTransition: !0,
|
|
19652
|
+
stopOriginalTransition: !0
|
|
19653
|
+
};
|
|
19654
|
+
this.stateList.forEach(currState => {
|
|
19655
|
+
const _result = registry.isTransitionAllowed(currState.state, state, this.graphic);
|
|
19656
|
+
result.allowTransition = result.allowTransition && _result.allowTransition;
|
|
19657
|
+
}), result.allowTransition && (shouldApplyState.push({
|
|
19658
|
+
state: state,
|
|
19659
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19660
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19661
|
+
}), this.stateList.forEach(currState => {
|
|
19662
|
+
registry.isTransitionAllowed(currState.state, state, this.graphic).stopOriginalTransition && shouldStopState.push(currState);
|
|
19663
|
+
}));
|
|
19664
|
+
}) : nextState.forEach((state, index) => {
|
|
19665
|
+
shouldApplyState.push({
|
|
19666
|
+
state: state,
|
|
19667
|
+
animationConfig: isArray(animationConfig[index]) ? animationConfig[index].map(item => item.animation) : animationConfig[index].animation,
|
|
19668
|
+
executor: new AnimateExecutor(this.graphic)
|
|
19669
|
+
});
|
|
19670
|
+
}), shouldStopState.forEach(state => {
|
|
19671
|
+
state.executor.stop();
|
|
19672
|
+
}), shouldApplyState.length) {
|
|
19673
|
+
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
19674
|
+
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
19675
|
+
const nextState = shouldApplyState[i + 1],
|
|
19676
|
+
currentState = shouldApplyState[i];
|
|
19677
|
+
currentState.executor.onEnd(() => {
|
|
19678
|
+
nextState && nextState.executor.execute(nextState.animationConfig), this.stateList = this.stateList.filter(state => state !== currentState), i === shouldApplyState.length - 1 && callback && callback(!1);
|
|
19679
|
+
});
|
|
19680
|
+
}
|
|
19681
|
+
} else callback && callback(!0);
|
|
19682
|
+
this.stateList ? this.stateList = this.stateList.filter(state => !shouldStopState.includes(state)) : this.stateList = [], this.stateList.push(...shouldApplyState);
|
|
19683
|
+
}
|
|
19684
|
+
applyAppearState(animationConfig, callback) {
|
|
19685
|
+
this.applyState([AnimationStates.APPEAR], [{
|
|
19686
|
+
name: AnimationStates.APPEAR,
|
|
19687
|
+
animation: animationConfig
|
|
19688
|
+
}], callback);
|
|
19689
|
+
}
|
|
19690
|
+
applyDisappearState(animationConfig, callback) {
|
|
19691
|
+
this.applyState([AnimationStates.DISAPPEAR], [{
|
|
19692
|
+
name: AnimationStates.DISAPPEAR,
|
|
19693
|
+
animation: animationConfig
|
|
19694
|
+
}], callback);
|
|
19695
|
+
}
|
|
19696
|
+
applyUpdateState(animationConfig, callback) {
|
|
19697
|
+
this.applyState([AnimationStates.UPDATE], [{
|
|
19698
|
+
name: AnimationStates.UPDATE,
|
|
19699
|
+
animation: animationConfig
|
|
19700
|
+
}], callback);
|
|
19701
|
+
}
|
|
19702
|
+
applyHighlightState(animationConfig, callback) {
|
|
19703
|
+
this.applyState([AnimationStates.HIGHLIGHT], [{
|
|
19704
|
+
name: AnimationStates.HIGHLIGHT,
|
|
19705
|
+
animation: animationConfig
|
|
19706
|
+
}], callback);
|
|
19707
|
+
}
|
|
19708
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19709
|
+
this.applyState([AnimationStates.UNHIGHLIGHT], [{
|
|
19710
|
+
name: AnimationStates.UNHIGHLIGHT,
|
|
19711
|
+
animation: animationConfig
|
|
19712
|
+
}], callback);
|
|
19713
|
+
}
|
|
19714
|
+
stopState(state, type) {
|
|
19715
|
+
var _a;
|
|
19716
|
+
const stateInfo = null === (_a = this.stateList) || void 0 === _a ? void 0 : _a.find(stateInfo => stateInfo.state === state);
|
|
19717
|
+
stateInfo && stateInfo.executor.stop(type);
|
|
19718
|
+
}
|
|
19719
|
+
clearState() {
|
|
19720
|
+
var _a;
|
|
19721
|
+
null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
|
|
19722
|
+
state.executor.stop();
|
|
19723
|
+
}), this.stateList = null;
|
|
19724
|
+
}
|
|
19725
|
+
}
|
|
19726
|
+
|
|
19727
|
+
class GraphicStateExtension {
|
|
19728
|
+
_getAnimationStateManager(graphic) {
|
|
19729
|
+
return graphic._animationStateManager || (graphic._animationStateManager = new AnimationStateManager(graphic)), graphic._animationStateManager;
|
|
19730
|
+
}
|
|
19731
|
+
_getAnimationStateStore(graphic) {
|
|
19732
|
+
return graphic._animationStateStore || (graphic._animationStateStore = new AnimationStateStore(graphic)), graphic._animationStateStore;
|
|
19733
|
+
}
|
|
19734
|
+
registerAnimationState(state) {
|
|
19735
|
+
return this._getAnimationStateStore(this).registerState(state), this;
|
|
19736
|
+
}
|
|
19737
|
+
applyAnimationState(state, animationConfig, callback) {
|
|
19738
|
+
return this._getAnimationStateManager(this).applyState(state, animationConfig, callback), this;
|
|
19739
|
+
}
|
|
19740
|
+
applyAppearState(animationConfig, callback) {
|
|
19741
|
+
return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback), this;
|
|
19742
|
+
}
|
|
19743
|
+
applyDisappearState(animationConfig, callback) {
|
|
19744
|
+
return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback), this;
|
|
19745
|
+
}
|
|
19746
|
+
applyUpdateState(animationConfig, callback) {
|
|
19747
|
+
return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback), this;
|
|
19748
|
+
}
|
|
19749
|
+
applyHighlightState(animationConfig, callback) {
|
|
19750
|
+
return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback), this;
|
|
19751
|
+
}
|
|
19752
|
+
applyUnhighlightState(animationConfig, callback) {
|
|
19753
|
+
return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback), this;
|
|
19754
|
+
}
|
|
19755
|
+
stopAnimationState(state, type) {
|
|
19756
|
+
return this._getAnimationStateManager(this).stopState(state, type), this;
|
|
19757
|
+
}
|
|
19758
|
+
clearAnimationStates() {
|
|
19759
|
+
return this._getAnimationStateManager(this).clearState(), this;
|
|
19760
|
+
}
|
|
19761
|
+
static extend(graphic) {
|
|
19762
|
+
return new GraphicStateExtension()._getAnimationStateManager(graphic), graphic;
|
|
19763
|
+
}
|
|
19764
|
+
}
|
|
19765
|
+
|
|
19766
|
+
class AnimateExtension {
|
|
19767
|
+
getAttributes() {
|
|
19768
|
+
let final = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
19769
|
+
return final && this.finalAttribute ? this.finalAttribute : this.attribute;
|
|
19770
|
+
}
|
|
19771
|
+
animate(params) {
|
|
19772
|
+
var _a, _b, _c;
|
|
19773
|
+
this.animates || (this.animates = new Map());
|
|
19774
|
+
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);
|
|
19775
|
+
if (animate.bind(this), params) {
|
|
19776
|
+
const {
|
|
19777
|
+
onStart: onStart,
|
|
19778
|
+
onEnd: onEnd,
|
|
19779
|
+
onRemove: onRemove
|
|
19780
|
+
} = params;
|
|
19781
|
+
null != onStart && animate.onStart(onStart), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove);
|
|
19782
|
+
}
|
|
19783
|
+
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
19784
|
+
animate.stop(), this.animates.delete(animate.id);
|
|
19785
|
+
}), null === (_c = this.stage) || void 0 === _c || _c.ticker.start(), animate;
|
|
19786
|
+
}
|
|
19787
|
+
createTimeline() {
|
|
19788
|
+
return new DefaultTimeline();
|
|
19789
|
+
}
|
|
19790
|
+
createTicker(stage) {
|
|
19791
|
+
return new DefaultTicker(stage);
|
|
19792
|
+
}
|
|
19793
|
+
setFinalAttribute(finalAttribute) {
|
|
19794
|
+
this.finalAttribute || (this.finalAttribute = {}), Object.assign(this.finalAttribute, finalAttribute);
|
|
19795
|
+
}
|
|
19796
|
+
initFinalAttribute(finalAttribute) {
|
|
19797
|
+
this.finalAttribute = finalAttribute;
|
|
19798
|
+
}
|
|
19799
|
+
initAnimateExecutor() {
|
|
19800
|
+
this._animateExecutor || (this._animateExecutor = new AnimateExecutor(this));
|
|
19801
|
+
}
|
|
19802
|
+
executeAnimation(config) {
|
|
19803
|
+
return this.initAnimateExecutor(), this._animateExecutor.execute(config), this;
|
|
19804
|
+
}
|
|
19805
|
+
executeAnimations(configs) {
|
|
19806
|
+
return this.initAnimateExecutor(), configs.forEach(config => {
|
|
19807
|
+
this._animateExecutor.execute(config);
|
|
19808
|
+
}), this;
|
|
19809
|
+
}
|
|
19810
|
+
getFinalAttribute() {
|
|
19811
|
+
return this.finalAttribute;
|
|
19812
|
+
}
|
|
19813
|
+
getGraphicAttribute(key) {
|
|
19814
|
+
let prev = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
19815
|
+
return !prev && this.finalAttribute ? this.finalAttribute[key] : this.attribute[key];
|
|
19816
|
+
}
|
|
19817
|
+
}
|
|
19818
|
+
|
|
19819
|
+
function registerAnimate() {
|
|
19820
|
+
mixin(Graphic, GraphicStateExtension), mixin(Graphic, AnimateExtension);
|
|
19821
|
+
}
|
|
19822
|
+
|
|
19394
19823
|
class ACustomAnimate extends Step {
|
|
19395
19824
|
constructor(customFrom, customTo, duration, easing, params) {
|
|
19396
19825
|
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
|
|
@@ -24975,22 +25404,27 @@ var IMarkPointItemPosition;
|
|
|
24975
25404
|
function loadBaseMarker() {
|
|
24976
25405
|
registerGroup();
|
|
24977
25406
|
loadTagComponent();
|
|
25407
|
+
registerAnimate();
|
|
24978
25408
|
}
|
|
24979
25409
|
function loadMarkLineComponent() {
|
|
24980
25410
|
loadBaseMarker();
|
|
24981
25411
|
loadSegmentComponent();
|
|
25412
|
+
registerAnimate();
|
|
24982
25413
|
}
|
|
24983
25414
|
function loadMarkArcLineComponent() {
|
|
24984
25415
|
loadBaseMarker();
|
|
24985
25416
|
loadArcSegmentComponent();
|
|
25417
|
+
registerAnimate();
|
|
24986
25418
|
}
|
|
24987
25419
|
function loadMarkAreaComponent() {
|
|
24988
25420
|
loadBaseMarker();
|
|
24989
25421
|
registerPolygon();
|
|
25422
|
+
registerAnimate();
|
|
24990
25423
|
}
|
|
24991
25424
|
function loadMarkArcAreaComponent() {
|
|
24992
25425
|
loadBaseMarker();
|
|
24993
25426
|
registerArc();
|
|
25427
|
+
registerAnimate();
|
|
24994
25428
|
}
|
|
24995
25429
|
function loadMarkPointComponent() {
|
|
24996
25430
|
loadBaseMarker();
|
|
@@ -24999,6 +25433,7 @@ function loadMarkPointComponent() {
|
|
|
24999
25433
|
registerSymbol();
|
|
25000
25434
|
registerImage();
|
|
25001
25435
|
registerLine();
|
|
25436
|
+
registerAnimate();
|
|
25002
25437
|
}
|
|
25003
25438
|
|
|
25004
25439
|
class Marker extends AbstractComponent {
|
|
@@ -26451,7 +26886,7 @@ class MarkPoint extends Marker {
|
|
|
26451
26886
|
if (!item) {
|
|
26452
26887
|
return;
|
|
26453
26888
|
}
|
|
26454
|
-
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0,
|
|
26889
|
+
const { autoRotate = true, refX = 0, refY = 0, refAngle = 0, style, position: positionType = IMarkPointItemPosition.middle } = itemContent;
|
|
26455
26890
|
const { state } = this.attribute;
|
|
26456
26891
|
const lineEndAngle = ((_a = this._line) === null || _a === void 0 ? void 0 : _a.getEndAngle()) || 0;
|
|
26457
26892
|
const itemRefOffsetX = refX * Math.cos(lineEndAngle) + refY * Math.cos(lineEndAngle - Math.PI / 2);
|
|
@@ -26459,24 +26894,24 @@ class MarkPoint extends Marker {
|
|
|
26459
26894
|
if (itemType === 'text') {
|
|
26460
26895
|
const offsetX = newItemPosition.x - newPosition.x;
|
|
26461
26896
|
const offsetY = newItemPosition.y - newPosition.y;
|
|
26462
|
-
item.setAttributes(Object.assign(Object.assign({},
|
|
26897
|
+
item.setAttributes(Object.assign(Object.assign({}, style), { style: Object.assign(Object.assign({}, this.getTextAlignAttr(autoRotate, offsetX, offsetY, lineEndAngle, (_b = itemContent.position) !== null && _b !== void 0 ? _b : 'end')), style.textStyle), state: {
|
|
26463
26898
|
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.textBackground),
|
|
26464
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26899
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26465
26900
|
} }));
|
|
26466
26901
|
}
|
|
26467
26902
|
else if (itemType === 'richText') {
|
|
26468
26903
|
item.setAttributes({
|
|
26469
|
-
dx: this.getItemDx(item, positionType,
|
|
26470
|
-
dy: this.getItemDy(item, positionType,
|
|
26904
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
26905
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26471
26906
|
});
|
|
26472
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26907
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26473
26908
|
}
|
|
26474
26909
|
else if (itemType === 'image') {
|
|
26475
26910
|
item.setAttributes({
|
|
26476
|
-
dx: this.getItemDx(item, positionType,
|
|
26477
|
-
dy: this.getItemDy(item, positionType,
|
|
26911
|
+
dx: this.getItemDx(item, positionType, style) + (style.dx || 0),
|
|
26912
|
+
dy: this.getItemDy(item, positionType, style) + (style.dy || 0)
|
|
26478
26913
|
});
|
|
26479
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26914
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26480
26915
|
}
|
|
26481
26916
|
const itemAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle - Math.PI;
|
|
26482
26917
|
item.setAttributes({
|
|
@@ -26509,29 +26944,25 @@ class MarkPoint extends Marker {
|
|
|
26509
26944
|
}
|
|
26510
26945
|
initItem(itemContent, newPosition, newItemPosition) {
|
|
26511
26946
|
const { state } = this.attribute;
|
|
26512
|
-
const { type = 'text',
|
|
26947
|
+
const { type = 'text', style, renderCustomCallback } = itemContent;
|
|
26513
26948
|
let item;
|
|
26514
26949
|
if (type === 'symbol') {
|
|
26515
|
-
item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition),
|
|
26516
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26950
|
+
item = graphicCreator.symbol(Object.assign(Object.assign({}, newItemPosition), style));
|
|
26951
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26517
26952
|
}
|
|
26518
26953
|
else if (type === 'text') {
|
|
26519
26954
|
item = new Tag(Object.assign(Object.assign({}, newItemPosition), { state: {
|
|
26520
26955
|
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.textBackground),
|
|
26521
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26956
|
+
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent)
|
|
26522
26957
|
} }));
|
|
26523
26958
|
}
|
|
26524
|
-
else if (type === 'richText') {
|
|
26525
|
-
item = graphicCreator.richtext(Object.assign(Object.assign({}, newItemPosition), richTextStyle));
|
|
26526
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.richText);
|
|
26527
|
-
}
|
|
26528
26959
|
else if (type === 'image') {
|
|
26529
|
-
item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition),
|
|
26530
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26960
|
+
item = graphicCreator.image(Object.assign(Object.assign({}, newItemPosition), style));
|
|
26961
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26531
26962
|
}
|
|
26532
26963
|
else if (type === 'custom' && renderCustomCallback) {
|
|
26533
26964
|
item = renderCustomCallback();
|
|
26534
|
-
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.
|
|
26965
|
+
item.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.itemContent);
|
|
26535
26966
|
}
|
|
26536
26967
|
item.name = `mark-point-${type}`;
|
|
26537
26968
|
this.setItemAttributes(item, itemContent, newPosition, newItemPosition, type);
|
|
@@ -26719,7 +27150,7 @@ class MarkPoint extends Marker {
|
|
|
26719
27150
|
const { itemContent = {}, targetSymbol, itemLine } = this.attribute;
|
|
26720
27151
|
const { offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0 } = itemContent;
|
|
26721
27152
|
const { offset: targetSymbolOffset = 0, style: targetSymbolStyle, visible: targetItemvisible = false, size: targetSymbolSize } = targetSymbol;
|
|
26722
|
-
const targetSize = targetItemvisible ? (_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20 : 0;
|
|
27153
|
+
const targetSize = targetItemvisible ? ((_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20) : 0;
|
|
26723
27154
|
let targetOffsetAngle;
|
|
26724
27155
|
if (itemLine.type === 'type-do') {
|
|
26725
27156
|
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX / 2);
|
|
@@ -32615,6 +33046,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
32615
33046
|
theme: 'default'
|
|
32616
33047
|
};
|
|
32617
33048
|
|
|
32618
|
-
const version = "1.0.0-alpha.
|
|
33049
|
+
const version = "1.0.0-alpha.14";
|
|
32619
33050
|
|
|
32620
33051
|
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 };
|