@visactor/vrender-components 0.22.7-alpha.3 → 0.23.0-alpha.3
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/animate/group-transition.d.ts +1 -1
- package/cjs/axis/animate/group-transition.js +3 -3
- package/cjs/axis/animate/group-transition.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/animate/animate.js +4 -10
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/arc.js +6 -6
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +3 -4
- package/cjs/label/base.js +62 -98
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +1 -1
- package/cjs/label/index.js +1 -1
- package/cjs/label/line.js +1 -1
- package/cjs/label/overlap/scaler.js +3 -3
- package/cjs/label/overlap/scaler.js.map +1 -1
- package/cjs/label/polygon.js +1 -1
- package/cjs/label-item/index.js +1 -1
- package/cjs/label-item/label-item.d.ts +9 -20
- package/cjs/label-item/label-item.js +2 -104
- package/cjs/label-item/label-item.js.map +1 -1
- package/cjs/label-item/register.js +1 -1
- package/cjs/label-item/type.js +1 -1
- package/cjs/poptip/poptip.d.ts +0 -9
- package/cjs/poptip/poptip.js +1 -37
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +0 -1
- package/cjs/scrollbar/scrollbar.js +10 -17
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/slider/slider.d.ts +0 -1
- package/cjs/slider/slider.js +22 -30
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/tag/tag.js +56 -60
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/weather/weather-box.d.ts +2 -1
- package/cjs/weather/weather-box.js +5 -5
- package/cjs/weather/weather-box.js.map +1 -1
- package/dist/index.es.js +1271 -1455
- package/es/axis/animate/group-transition.d.ts +1 -1
- package/es/axis/animate/group-transition.js +1 -1
- package/es/axis/animate/group-transition.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/animate/animate.js +3 -9
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/arc.js +6 -6
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +3 -4
- package/es/label/base.js +65 -100
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +1 -1
- package/es/label/index.js +1 -1
- package/es/label/line.js +1 -1
- package/es/label/overlap/scaler.js +1 -1
- package/es/label/overlap/scaler.js.map +1 -1
- package/es/label/polygon.js +1 -1
- package/es/label-item/index.js +1 -1
- package/es/label-item/label-item.d.ts +9 -20
- package/es/label-item/label-item.js +1 -105
- package/es/label-item/label-item.js.map +1 -1
- package/es/label-item/register.js +1 -1
- package/es/label-item/type.js +1 -1
- package/es/poptip/poptip.d.ts +0 -9
- package/es/poptip/poptip.js +0 -38
- package/es/poptip/poptip.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +0 -1
- package/es/scrollbar/scrollbar.js +9 -18
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/slider/slider.d.ts +0 -1
- package/es/slider/slider.js +21 -31
- package/es/slider/slider.js.map +1 -1
- package/es/tag/tag.js +56 -59
- package/es/tag/tag.js.map +1 -1
- package/es/weather/weather-box.d.ts +2 -1
- package/es/weather/weather-box.js +1 -1
- package/es/weather/weather-box.js.map +1 -1
- package/package.json +5 -4
- package/cjs/util/event.d.ts +0 -1
- package/cjs/util/event.js +0 -14
- package/cjs/util/event.js.map +0 -1
- package/es/util/event.d.ts +0 -1
- package/es/util/event.js +0 -6
- package/es/util/event.js.map +0 -1
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, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, Color, isNumber, cos, sin, isString, pointAt, sqrt, OBBBounds, isNil, has, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, array, isRotateAABBIntersect, isLess, isGreater, cloneDeep, get, last, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Generator {
|
|
@@ -577,6 +577,25 @@ 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 PerformanceRAF {
|
|
581
|
+
constructor() {
|
|
582
|
+
this.nextAnimationFrameCbs = [], this._rafHandle = null, this.runAnimationFrame = time => {
|
|
583
|
+
this._rafHandle = null;
|
|
584
|
+
const cbs = this.nextAnimationFrameCbs;
|
|
585
|
+
this.nextAnimationFrameCbs = [];
|
|
586
|
+
for (let i = 0; i < cbs.length; i++) cbs[i] && cbs[i](time);
|
|
587
|
+
}, this.tryRunAnimationFrameNextFrame = () => {
|
|
588
|
+
null === this._rafHandle && 0 !== this.nextAnimationFrameCbs.length && (this._rafHandle = vglobal.getRequestAnimationFrame()(this.runAnimationFrame));
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
addAnimationFrameCb(callback) {
|
|
592
|
+
return this.nextAnimationFrameCbs.push(callback), this.tryRunAnimationFrameNextFrame(), this.nextAnimationFrameCbs.length - 1;
|
|
593
|
+
}
|
|
594
|
+
removeAnimationFrameCb(index) {
|
|
595
|
+
return index >= 0 && index < this.nextAnimationFrameCbs.length && (this.nextAnimationFrameCbs[index] = null, !0);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
|
|
580
599
|
var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
581
600
|
var d,
|
|
582
601
|
c = arguments.length,
|
|
@@ -661,7 +680,7 @@ let DefaultGlobal = class {
|
|
|
661
680
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
662
681
|
}
|
|
663
682
|
constructor(contributions) {
|
|
664
|
-
this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
683
|
+
this.contributions = contributions, this._isImageAnonymous = !0, this._performanceRAFList = [], this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
665
684
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
666
685
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
667
686
|
}
|
|
@@ -717,6 +736,16 @@ let DefaultGlobal = class {
|
|
|
717
736
|
getRequestAnimationFrame() {
|
|
718
737
|
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
719
738
|
}
|
|
739
|
+
getSpecifiedRequestAnimationFrame(id) {
|
|
740
|
+
this._env || this.setEnv("browser"), this._performanceRAFList[id] || (this._performanceRAFList[id] = new PerformanceRAF());
|
|
741
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
742
|
+
return callback => performanceRAF.addAnimationFrameCb(callback);
|
|
743
|
+
}
|
|
744
|
+
getSpecifiedCancelAnimationFrame(id) {
|
|
745
|
+
if (this._env || this.setEnv("browser"), !this._performanceRAFList[id]) return () => !1;
|
|
746
|
+
const performanceRAF = this._performanceRAFList[id];
|
|
747
|
+
return handle => performanceRAF.removeAnimationFrameCb(handle);
|
|
748
|
+
}
|
|
720
749
|
getCancelAnimationFrame() {
|
|
721
750
|
return this._env || this.setEnv("browser"), this.envContribution.getCancelAnimationFrame();
|
|
722
751
|
}
|
|
@@ -938,22 +967,22 @@ var AttributeUpdateType;
|
|
|
938
967
|
!function (AttributeUpdateType) {
|
|
939
968
|
AttributeUpdateType[AttributeUpdateType.INIT = 0] = "INIT", AttributeUpdateType[AttributeUpdateType.DEFAULT = 1] = "DEFAULT", AttributeUpdateType[AttributeUpdateType.STATE = 2] = "STATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_BIND = 10] = "ANIMATE_BIND", AttributeUpdateType[AttributeUpdateType.ANIMATE_PLAY = 11] = "ANIMATE_PLAY", AttributeUpdateType[AttributeUpdateType.ANIMATE_START = 12] = "ANIMATE_START", AttributeUpdateType[AttributeUpdateType.ANIMATE_UPDATE = 13] = "ANIMATE_UPDATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_END = 14] = "ANIMATE_END", AttributeUpdateType[AttributeUpdateType.TRANSLATE = 20] = "TRANSLATE", AttributeUpdateType[AttributeUpdateType.TRANSLATE_TO = 21] = "TRANSLATE_TO", AttributeUpdateType[AttributeUpdateType.SCALE = 22] = "SCALE", AttributeUpdateType[AttributeUpdateType.SCALE_TO = 23] = "SCALE_TO", AttributeUpdateType[AttributeUpdateType.ROTATE = 24] = "ROTATE", AttributeUpdateType[AttributeUpdateType.ROTATE_TO = 25] = "ROTATE_TO";
|
|
940
969
|
}(AttributeUpdateType || (AttributeUpdateType = {}));
|
|
941
|
-
var AnimateStatus;
|
|
970
|
+
var AnimateStatus$1;
|
|
942
971
|
!function (AnimateStatus) {
|
|
943
972
|
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
944
|
-
}(AnimateStatus || (AnimateStatus = {}));
|
|
945
|
-
var AnimateMode;
|
|
973
|
+
}(AnimateStatus$1 || (AnimateStatus$1 = {}));
|
|
974
|
+
var AnimateMode$1;
|
|
946
975
|
!function (AnimateMode) {
|
|
947
976
|
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
948
|
-
}(AnimateMode || (AnimateMode = {}));
|
|
949
|
-
var AnimateStepType;
|
|
977
|
+
}(AnimateMode$1 || (AnimateMode$1 = {}));
|
|
978
|
+
var AnimateStepType$1;
|
|
950
979
|
!function (AnimateStepType) {
|
|
951
980
|
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
952
|
-
}(AnimateStepType || (AnimateStepType = {}));
|
|
953
|
-
var Direction
|
|
981
|
+
}(AnimateStepType$1 || (AnimateStepType$1 = {}));
|
|
982
|
+
var Direction;
|
|
954
983
|
!function (Direction) {
|
|
955
984
|
Direction[Direction.ROW = 1] = "ROW", Direction[Direction.COLUMN = 2] = "COLUMN";
|
|
956
|
-
}(Direction
|
|
985
|
+
}(Direction || (Direction = {}));
|
|
957
986
|
var CurveTypeEnum;
|
|
958
987
|
!function (CurveTypeEnum) {
|
|
959
988
|
CurveTypeEnum[CurveTypeEnum.CubicBezierCurve = 0] = "CubicBezierCurve", CurveTypeEnum[CurveTypeEnum.QuadraticBezierCurve = 1] = "QuadraticBezierCurve", CurveTypeEnum[CurveTypeEnum.ArcCurve = 2] = "ArcCurve", CurveTypeEnum[CurveTypeEnum.LineCurve = 3] = "LineCurve", CurveTypeEnum[CurveTypeEnum.EllipseCurve = 4] = "EllipseCurve", CurveTypeEnum[CurveTypeEnum.MoveCurve = 5] = "MoveCurve";
|
|
@@ -1126,7 +1155,7 @@ class QuadraticBezierCurve extends Curve {
|
|
|
1126
1155
|
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1127
1156
|
}
|
|
1128
1157
|
calcProjLength(direction) {
|
|
1129
|
-
return direction === Direction
|
|
1158
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1130
1159
|
}
|
|
1131
1160
|
getAngleAt(t) {
|
|
1132
1161
|
const minT = max(t - .01, 0),
|
|
@@ -1190,7 +1219,7 @@ class CubicBezierCurve extends Curve {
|
|
|
1190
1219
|
return this._validPoint() ? cubicLength(this.p0, this.p1, this.p2, this.p3) : 60;
|
|
1191
1220
|
}
|
|
1192
1221
|
calcProjLength(direction) {
|
|
1193
|
-
return direction === Direction
|
|
1222
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p3.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p3.y) : 0;
|
|
1194
1223
|
}
|
|
1195
1224
|
getAngleAt(t) {
|
|
1196
1225
|
const minT = max(t - .01, 0),
|
|
@@ -1243,7 +1272,7 @@ class LineCurve extends Curve {
|
|
|
1243
1272
|
return this._validPoint() ? PointService.distancePP(this.p0, this.p1) : 60;
|
|
1244
1273
|
}
|
|
1245
1274
|
calcProjLength(direction) {
|
|
1246
|
-
return direction === Direction
|
|
1275
|
+
return direction === Direction.ROW ? abs(this.p0.x - this.p1.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p1.y) : 0;
|
|
1247
1276
|
}
|
|
1248
1277
|
draw(path, x, y, sx, sy, percent) {
|
|
1249
1278
|
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.lineTo(this.p1.x * sx + x, this.p1.y * sy + y);else if (percent > 0) {
|
|
@@ -1319,14 +1348,14 @@ class SegContext {
|
|
|
1319
1348
|
}
|
|
1320
1349
|
getLength(direction) {
|
|
1321
1350
|
var _a, _b;
|
|
1322
|
-
if (direction === Direction
|
|
1351
|
+
if (direction === Direction.COLUMN) {
|
|
1323
1352
|
if (!this.curves.length) return 0;
|
|
1324
1353
|
const sc = this.curves[0],
|
|
1325
1354
|
ec = this.curves[this.curves.length - 1],
|
|
1326
1355
|
endP = null !== (_a = ec.p3) && void 0 !== _a ? _a : ec.p1;
|
|
1327
1356
|
return abs(sc.p0.y - endP.y);
|
|
1328
1357
|
}
|
|
1329
|
-
if (direction === Direction
|
|
1358
|
+
if (direction === Direction.ROW) {
|
|
1330
1359
|
if (!this.curves.length) return 0;
|
|
1331
1360
|
const sc = this.curves[0],
|
|
1332
1361
|
ec = this.curves[this.curves.length - 1],
|
|
@@ -1356,7 +1385,7 @@ function genCurveSegments(path, points) {
|
|
|
1356
1385
|
for (let i = 0, n = points.length; i <= n; i++) i >= n === defined0 && ((defined0 = !defined0) ? path.lineStart() : path.lineEnd()), defined0 && path.point(points[i]);
|
|
1357
1386
|
}
|
|
1358
1387
|
function genSegContext(curveType, direction, points) {
|
|
1359
|
-
const curveDirection = null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction
|
|
1388
|
+
const curveDirection = null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction.ROW : Direction.COLUMN;
|
|
1360
1389
|
return "monotoneY" === curveType ? new ReflectSegContext(curveType, curveDirection) : new SegContext(curveType, curveDirection);
|
|
1361
1390
|
}
|
|
1362
1391
|
|
|
@@ -1618,7 +1647,7 @@ function genStepSegments(points, t) {
|
|
|
1618
1647
|
startPoint: startPoint
|
|
1619
1648
|
} = params;
|
|
1620
1649
|
if (points.length < 2 - Number(!!startPoint)) return null;
|
|
1621
|
-
const segContext = new SegContext("step", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction
|
|
1650
|
+
const segContext = new SegContext("step", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction.ROW : Direction.COLUMN);
|
|
1622
1651
|
return genStepTypeSegments(new Step$1(segContext, t, startPoint), points), segContext;
|
|
1623
1652
|
}
|
|
1624
1653
|
function genStepTypeSegments(path, points) {
|
|
@@ -1949,7 +1978,7 @@ class CustomPath2D extends CurvePath {
|
|
|
1949
1978
|
} = line.attribute;
|
|
1950
1979
|
if (!points) return;
|
|
1951
1980
|
const cache = calcLineCache(points, curveType);
|
|
1952
|
-
"x" === clipRangeByDimension ? this.direction = Direction
|
|
1981
|
+
"x" === clipRangeByDimension ? this.direction = Direction.ROW : "y" === clipRangeByDimension ? this.direction = Direction.COLUMN : "auto" === clipRangeByDimension && (this.direction = cache.direction), this._curves = cache.curves;
|
|
1953
1982
|
}
|
|
1954
1983
|
fromCustomPath2D(path, x, y, sX, sY) {
|
|
1955
1984
|
return this.clear(), this._runCommandList(path.commandList, x, y, sX, sY), this._updateBounds(), this;
|
|
@@ -2111,13 +2140,13 @@ class CustomPath2D extends CurvePath {
|
|
|
2111
2140
|
this.commandList = [], this._boundsContext = null, this._ctx = null;
|
|
2112
2141
|
}
|
|
2113
2142
|
getLength() {
|
|
2114
|
-
if (this.direction === Direction
|
|
2143
|
+
if (this.direction === Direction.COLUMN) {
|
|
2115
2144
|
if (!this._curves.length) return 0;
|
|
2116
2145
|
const sc = this._curves[0],
|
|
2117
2146
|
ec = this._curves[this._curves.length - 1];
|
|
2118
2147
|
return abs(sc.p0.y - ec.p1.y);
|
|
2119
2148
|
}
|
|
2120
|
-
if (this.direction === Direction
|
|
2149
|
+
if (this.direction === Direction.ROW) {
|
|
2121
2150
|
if (!this._curves.length) return 0;
|
|
2122
2151
|
const sc = this._curves[0],
|
|
2123
2152
|
ec = this._curves[this._curves.length - 1];
|
|
@@ -4212,801 +4241,97 @@ const EventTarget = {
|
|
|
4212
4241
|
}
|
|
4213
4242
|
};
|
|
4214
4243
|
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
static
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
return 0
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
}
|
|
4238
|
-
static getPowInOut(pow) {
|
|
4239
|
-
return function (t) {
|
|
4240
|
-
return (t *= 2) < 1 ? .5 * Math.pow(t, pow) : 1 - .5 * Math.abs(Math.pow(2 - t, pow));
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
|
-
static getBackIn(amount) {
|
|
4244
|
-
return function (t) {
|
|
4245
|
-
return t * t * ((amount + 1) * t - amount);
|
|
4246
|
-
};
|
|
4247
|
-
}
|
|
4248
|
-
static getBackOut(amount) {
|
|
4249
|
-
return function (t) {
|
|
4250
|
-
return --t * t * ((amount + 1) * t + amount) + 1;
|
|
4251
|
-
};
|
|
4252
|
-
}
|
|
4253
|
-
static getBackInOut(amount) {
|
|
4254
|
-
return amount *= 1.525, function (t) {
|
|
4255
|
-
return (t *= 2) < 1 ? t * t * ((amount + 1) * t - amount) * .5 : .5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
|
|
4256
|
-
};
|
|
4257
|
-
}
|
|
4258
|
-
static sineIn(t) {
|
|
4259
|
-
return 1 - Math.cos(t * Math.PI / 2);
|
|
4260
|
-
}
|
|
4261
|
-
static sineOut(t) {
|
|
4262
|
-
return Math.sin(t * Math.PI / 2);
|
|
4263
|
-
}
|
|
4264
|
-
static sineInOut(t) {
|
|
4265
|
-
return -(Math.cos(Math.PI * t) - 1) / 2;
|
|
4266
|
-
}
|
|
4267
|
-
static expoIn(t) {
|
|
4268
|
-
return 0 === t ? 0 : Math.pow(2, 10 * t - 10);
|
|
4269
|
-
}
|
|
4270
|
-
static expoOut(t) {
|
|
4271
|
-
return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
|
|
4272
|
-
}
|
|
4273
|
-
static expoInOut(t) {
|
|
4274
|
-
return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? Math.pow(2, 20 * t - 10) / 2 : (2 - Math.pow(2, -20 * t + 10)) / 2;
|
|
4275
|
-
}
|
|
4276
|
-
static circIn(t) {
|
|
4277
|
-
return -(Math.sqrt(1 - t * t) - 1);
|
|
4278
|
-
}
|
|
4279
|
-
static circOut(t) {
|
|
4280
|
-
return Math.sqrt(1 - --t * t);
|
|
4281
|
-
}
|
|
4282
|
-
static circInOut(t) {
|
|
4283
|
-
return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
|
|
4284
|
-
}
|
|
4285
|
-
static bounceOut(t) {
|
|
4286
|
-
return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
|
|
4287
|
-
}
|
|
4288
|
-
static bounceIn(t) {
|
|
4289
|
-
return 1 - Easing.bounceOut(1 - t);
|
|
4290
|
-
}
|
|
4291
|
-
static bounceInOut(t) {
|
|
4292
|
-
return t < .5 ? .5 * Easing.bounceIn(2 * t) : .5 * Easing.bounceOut(2 * t - 1) + .5;
|
|
4293
|
-
}
|
|
4294
|
-
static getElasticIn(amplitude, period) {
|
|
4295
|
-
return function (t) {
|
|
4296
|
-
if (0 === t || 1 === t) return t;
|
|
4297
|
-
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
4298
|
-
return -amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period);
|
|
4299
|
-
};
|
|
4300
|
-
}
|
|
4301
|
-
static getElasticOut(amplitude, period) {
|
|
4302
|
-
return function (t) {
|
|
4303
|
-
if (0 === t || 1 === t) return t;
|
|
4304
|
-
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
4305
|
-
return amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1;
|
|
4306
|
-
};
|
|
4307
|
-
}
|
|
4308
|
-
static getElasticInOut(amplitude, period) {
|
|
4309
|
-
return function (t) {
|
|
4310
|
-
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
4311
|
-
return (t *= 2) < 1 ? amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * -.5 : amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * .5 + 1;
|
|
4312
|
-
};
|
|
4244
|
+
var ColorType;
|
|
4245
|
+
!function (ColorType) {
|
|
4246
|
+
ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
|
|
4247
|
+
}(ColorType || (ColorType = {}));
|
|
4248
|
+
class ColorStore {
|
|
4249
|
+
static Get(str) {
|
|
4250
|
+
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
|
|
4251
|
+
let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
|
|
4252
|
+
if (size === ColorType.Color1) {
|
|
4253
|
+
const color = ColorStore.store1[str];
|
|
4254
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
4255
|
+
const c = Color.parseColorString(str);
|
|
4256
|
+
if (c) {
|
|
4257
|
+
const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
|
|
4258
|
+
ColorStore.store1[str] = data, ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = data[0], arr[1] = data[1], arr[2] = data[2], arr[3] = data[3];
|
|
4259
|
+
}
|
|
4260
|
+
return arr;
|
|
4261
|
+
}
|
|
4262
|
+
const color = ColorStore.store255[str];
|
|
4263
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
4264
|
+
const c = Color.parseColorString(str);
|
|
4265
|
+
return c && (ColorStore.store1[str] = [c.r / 255, c.g / 255, c.b / 255, c.opacity], ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = c.r, arr[1] = c.g, arr[2] = c.b, arr[3] = c.opacity), arr;
|
|
4313
4266
|
}
|
|
4314
|
-
static
|
|
4315
|
-
|
|
4267
|
+
static Set(str, size, arr) {
|
|
4268
|
+
if (size === ColorType.Color1) {
|
|
4269
|
+
if (ColorStore.store1[str]) return;
|
|
4270
|
+
ColorStore.store1[str] = arr, ColorStore.store255[str] = [Math.floor(255 * arr[0]), Math.floor(255 * arr[1]), Math.floor(255 * arr[2]), Math.floor(255 * arr[3])];
|
|
4271
|
+
} else {
|
|
4272
|
+
if (ColorStore.store255[str]) return;
|
|
4273
|
+
ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
|
|
4274
|
+
}
|
|
4316
4275
|
}
|
|
4317
4276
|
}
|
|
4318
|
-
|
|
4319
|
-
const step = 1 / n;
|
|
4320
|
-
let flag = 1;
|
|
4321
|
-
for (; t > step;) t -= step, flag *= -1;
|
|
4322
|
-
const v = flag * t / step;
|
|
4323
|
-
return v > 0 ? v : 1 + v;
|
|
4324
|
-
}
|
|
4325
|
-
Easing.quadIn = Easing.getPowIn(2), Easing.quadOut = Easing.getPowOut(2), Easing.quadInOut = Easing.getPowInOut(2), Easing.cubicIn = Easing.getPowIn(3), Easing.cubicOut = Easing.getPowOut(3), Easing.cubicInOut = Easing.getPowInOut(3), Easing.quartIn = Easing.getPowIn(4), Easing.quartOut = Easing.getPowOut(4), Easing.quartInOut = Easing.getPowInOut(4), Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easing.quintInOut = Easing.getPowInOut(5), Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7), Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3), Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5), Easing.easeInOutQuad = t => (t /= .5) < 1 ? .5 * Math.pow(t, 2) : -.5 * ((t -= 2) * t - 2), Easing.easeOutElastic = x => {
|
|
4326
|
-
const c4 = 2 * Math.PI / 3;
|
|
4327
|
-
return 0 === x ? 0 : 1 === x ? 1 : Math.pow(2, -10 * x) * Math.sin((10 * x - .75) * c4) + 1;
|
|
4328
|
-
}, Easing.easeInOutElastic = x => {
|
|
4329
|
-
const c5 = 2 * Math.PI / 4.5;
|
|
4330
|
-
return 0 === x ? 0 : 1 === x ? 1 : x < .5 ? -Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1;
|
|
4331
|
-
};
|
|
4332
|
-
for (let i = 0; i < 10; i++) Easing[`flicker${i}`] = t => flicker(t, i);
|
|
4333
|
-
for (let i = 2; i < 10; i++) Easing[`aIn${i}`] = t => i * t * t + (1 - i) * t;
|
|
4277
|
+
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
4334
4278
|
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
}
|
|
4339
|
-
addAnimate(animate) {
|
|
4340
|
-
this.animateTail ? (this.animateTail.nextAnimate = animate, animate.prevAnimate = this.animateTail, this.animateTail = animate, animate.nextAnimate = null) : (this.animateHead = animate, this.animateTail = animate), this.animateCount++;
|
|
4341
|
-
}
|
|
4342
|
-
pause() {
|
|
4343
|
-
this.paused = !0;
|
|
4344
|
-
}
|
|
4345
|
-
resume() {
|
|
4346
|
-
this.paused = !1;
|
|
4347
|
-
}
|
|
4348
|
-
tick(delta) {
|
|
4349
|
-
if (this.paused) return;
|
|
4350
|
-
let animate = this.animateHead;
|
|
4351
|
-
for (this.animateCount = 0; animate;) animate.status === AnimateStatus.END ? this.removeAnimate(animate) : animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL ? (this.animateCount++, animate.advance(delta)) : animate.status === AnimateStatus.PAUSED && this.animateCount++, animate = animate.nextAnimate;
|
|
4352
|
-
}
|
|
4353
|
-
clear() {
|
|
4354
|
-
let animate = this.animateHead;
|
|
4355
|
-
for (; animate;) animate.release(), animate = animate.nextAnimate;
|
|
4356
|
-
this.animateHead = null, this.animateTail = null, this.animateCount = 0;
|
|
4357
|
-
}
|
|
4358
|
-
removeAnimate(animate) {
|
|
4359
|
-
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
4360
|
-
animate._onRemove && animate._onRemove.forEach(cb => cb()), animate === this.animateHead ? (this.animateHead = animate.nextAnimate, animate === this.animateTail ? this.animateTail = null : this.animateHead.prevAnimate = null) : animate === this.animateTail ? (this.animateTail = animate.prevAnimate, this.animateTail.nextAnimate = null) : (animate.prevAnimate.nextAnimate = animate.nextAnimate, animate.nextAnimate.prevAnimate = animate.prevAnimate), release && animate.release();
|
|
4361
|
-
}
|
|
4279
|
+
function colorArrayToString(color) {
|
|
4280
|
+
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4281
|
+
return Array.isArray(color) && isNumber(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
4362
4282
|
}
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
constructor(from, to, duration, easing, params) {
|
|
4367
|
-
this.from = from, this.to = to, this.duration = duration, this.easing = easing, this.params = params, this.updateCount = 0;
|
|
4368
|
-
}
|
|
4369
|
-
bind(target, subAni) {
|
|
4370
|
-
this.target = target, this.subAnimate = subAni, this.onBind();
|
|
4371
|
-
}
|
|
4372
|
-
onBind() {}
|
|
4373
|
-
onFirstRun() {}
|
|
4374
|
-
onStart() {}
|
|
4375
|
-
onEnd() {}
|
|
4376
|
-
getEndProps() {
|
|
4377
|
-
return this.to;
|
|
4378
|
-
}
|
|
4379
|
-
getFromProps() {
|
|
4380
|
-
return this.from;
|
|
4381
|
-
}
|
|
4382
|
-
getMergedEndProps() {
|
|
4383
|
-
var _a;
|
|
4384
|
-
const thisEndProps = this.getEndProps();
|
|
4385
|
-
return thisEndProps ? this._endProps === thisEndProps ? this._mergedEndProps : (this._endProps = thisEndProps, void (this._mergedEndProps = Object.assign({}, null !== (_a = this.step.prev.getLastProps()) && void 0 !== _a ? _a : {}, thisEndProps))) : this.step.prev ? this.step.prev.getLastProps() : thisEndProps;
|
|
4283
|
+
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
4284
|
+
if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
|
|
4285
|
+
return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray(from) ? from[index] : from, isArray(to) ? to[index] : to, ratio, alphaChannel));
|
|
4386
4286
|
}
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4287
|
+
return _interpolateColor(from, to, ratio, alphaChannel, cb);
|
|
4288
|
+
}
|
|
4289
|
+
function _interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
4290
|
+
if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
|
|
4291
|
+
let fromArray,
|
|
4292
|
+
toArray,
|
|
4293
|
+
fromGradient = !1,
|
|
4294
|
+
toGradient = !1;
|
|
4295
|
+
if (Array.isArray(from) ? fromArray = from : "string" == typeof from ? fromArray = ColorStore.Get(from, ColorType.Color255) : fromGradient = !0, Array.isArray(to) ? toArray = to : "string" == typeof to ? toArray = ColorStore.Get(to, ColorType.Color255) : toGradient = !0, fromGradient !== toGradient) {
|
|
4296
|
+
const gradient = fromGradient ? from : to,
|
|
4297
|
+
pure = fromGradient ? to : from,
|
|
4298
|
+
gradientFromPure = Object.assign(Object.assign({}, gradient), {
|
|
4299
|
+
stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
|
|
4300
|
+
color: colorArrayToString(pure)
|
|
4301
|
+
}))
|
|
4393
4302
|
});
|
|
4303
|
+
return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
|
|
4304
|
+
}
|
|
4305
|
+
if (fromGradient) {
|
|
4306
|
+
if (from.gradient === to.gradient) {
|
|
4307
|
+
const fc = from,
|
|
4308
|
+
tc = to,
|
|
4309
|
+
fromStops = fc.stops,
|
|
4310
|
+
toStops = tc.stops;
|
|
4311
|
+
if (fromStops.length !== toStops.length) return !1;
|
|
4312
|
+
if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
|
|
4313
|
+
if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
|
|
4314
|
+
if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
|
|
4394
4315
|
}
|
|
4395
|
-
|
|
4316
|
+
return !1;
|
|
4396
4317
|
}
|
|
4318
|
+
cb && cb(fromArray, toArray);
|
|
4319
|
+
return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
|
|
4397
4320
|
}
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
this.id = id, this.timeline = timeline || defaultTimeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
4413
|
-
}
|
|
4414
|
-
setTimeline(timeline) {
|
|
4415
|
-
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
4416
|
-
}
|
|
4417
|
-
getStartTime() {
|
|
4418
|
-
return this._startTime;
|
|
4419
|
-
}
|
|
4420
|
-
getDuration() {
|
|
4421
|
-
return this.subAnimates.reduce((t, subAnimate) => t + subAnimate.totalDuration, 0);
|
|
4422
|
-
}
|
|
4423
|
-
after(animate) {
|
|
4424
|
-
const t = animate.getDuration();
|
|
4425
|
-
return this._startTime = t, this;
|
|
4426
|
-
}
|
|
4427
|
-
afterAll(list) {
|
|
4428
|
-
let maxT = -1 / 0;
|
|
4429
|
-
return list.forEach(a => {
|
|
4430
|
-
maxT = max(a.getDuration(), maxT);
|
|
4431
|
-
}), this._startTime = maxT, this;
|
|
4432
|
-
}
|
|
4433
|
-
parallel(animate) {
|
|
4434
|
-
return this._startTime = animate.getStartTime(), this;
|
|
4435
|
-
}
|
|
4436
|
-
static AddInterpolate(name, cb) {
|
|
4437
|
-
Animate.interpolateMap.set(name, cb);
|
|
4438
|
-
}
|
|
4439
|
-
play(customAnimate) {
|
|
4440
|
-
if (this.tailAnimate.play(customAnimate), this.target) {
|
|
4441
|
-
const stage = this.target.stage;
|
|
4442
|
-
stage && stage.renderNextFrame();
|
|
4443
|
-
}
|
|
4444
|
-
return 1 === this.subAnimates.length && this.tailAnimate.totalDuration === customAnimate.duration && this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode), this;
|
|
4445
|
-
}
|
|
4446
|
-
trySetAttribute(attr) {
|
|
4447
|
-
let mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Animate.mode;
|
|
4448
|
-
attr && mode & AnimateMode.SET_ATTR_IMMEDIATELY && this.target.setAttributes && this.target.setAttributes(attr, !1, {
|
|
4449
|
-
type: AttributeUpdateType.ANIMATE_PLAY
|
|
4450
|
-
});
|
|
4451
|
-
}
|
|
4452
|
-
runCb(cb) {
|
|
4453
|
-
const customAnimate = new CbAnimate(() => {
|
|
4454
|
-
cb(this, customAnimate.step.prev);
|
|
4455
|
-
});
|
|
4456
|
-
return this.tailAnimate.play(customAnimate), this;
|
|
4457
|
-
}
|
|
4458
|
-
customInterpolate(key, ratio, from, to, target, ret) {
|
|
4459
|
-
const func = Animate.interpolateMap.get(key) || Animate.interpolateMap.get("");
|
|
4460
|
-
return !!func && func(key, ratio, from, to, target, ret);
|
|
4461
|
-
}
|
|
4462
|
-
pause() {
|
|
4463
|
-
this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.PAUSED);
|
|
4464
|
-
}
|
|
4465
|
-
resume() {
|
|
4466
|
-
this.status === AnimateStatus.PAUSED && (this.status = AnimateStatus.RUNNING);
|
|
4467
|
-
}
|
|
4468
|
-
to(props, duration, easing, params) {
|
|
4469
|
-
if (this.tailAnimate.to(props, duration, easing, params), this.target) {
|
|
4470
|
-
const stage = this.target.stage;
|
|
4471
|
-
stage && stage.renderNextFrame();
|
|
4472
|
-
}
|
|
4473
|
-
return this;
|
|
4474
|
-
}
|
|
4475
|
-
from(props, duration, easing, params) {
|
|
4476
|
-
if (this.tailAnimate.from(props, duration, easing, params), this.target) {
|
|
4477
|
-
const stage = this.target.stage;
|
|
4478
|
-
stage && stage.renderNextFrame();
|
|
4479
|
-
}
|
|
4480
|
-
return this;
|
|
4481
|
-
}
|
|
4482
|
-
wait(duration) {
|
|
4483
|
-
if (this.tailAnimate.wait(duration), this.target) {
|
|
4484
|
-
const stage = this.target.stage;
|
|
4485
|
-
stage && stage.renderNextFrame();
|
|
4486
|
-
}
|
|
4487
|
-
return this;
|
|
4488
|
-
}
|
|
4489
|
-
startAt(t) {
|
|
4490
|
-
if (this.tailAnimate.startAt(t), this.target) {
|
|
4491
|
-
const stage = this.target.stage;
|
|
4492
|
-
stage && stage.renderNextFrame();
|
|
4493
|
-
}
|
|
4494
|
-
return this;
|
|
4495
|
-
}
|
|
4496
|
-
loop(l) {
|
|
4497
|
-
if (this.tailAnimate.loop = l, this.target) {
|
|
4498
|
-
const stage = this.target.stage;
|
|
4499
|
-
stage && stage.renderNextFrame();
|
|
4500
|
-
}
|
|
4501
|
-
return this;
|
|
4502
|
-
}
|
|
4503
|
-
reversed(r) {
|
|
4504
|
-
if (this.tailAnimate.reversed = r, this.target) {
|
|
4505
|
-
const stage = this.target.stage;
|
|
4506
|
-
stage && stage.renderNextFrame();
|
|
4507
|
-
}
|
|
4508
|
-
return this;
|
|
4509
|
-
}
|
|
4510
|
-
bounce(b) {
|
|
4511
|
-
if (this.tailAnimate.bounce = b, this.target) {
|
|
4512
|
-
const stage = this.target.stage;
|
|
4513
|
-
stage && stage.renderNextFrame();
|
|
4514
|
-
}
|
|
4515
|
-
return this;
|
|
4516
|
-
}
|
|
4517
|
-
subAnimate() {
|
|
4518
|
-
const sa = new SubAnimate(this, this.tailAnimate);
|
|
4519
|
-
return this.tailAnimate = sa, this.subAnimates.push(sa), sa.bind(this.target), this;
|
|
4520
|
-
}
|
|
4521
|
-
getStartProps() {
|
|
4522
|
-
return this.subAnimates[0].getStartProps();
|
|
4523
|
-
}
|
|
4524
|
-
getEndProps() {
|
|
4525
|
-
return this.tailAnimate.getEndProps();
|
|
4526
|
-
}
|
|
4527
|
-
depreventAttr(key) {
|
|
4528
|
-
this._preventAttrs && this._preventAttrs.delete(key);
|
|
4529
|
-
}
|
|
4530
|
-
preventAttr(key) {
|
|
4531
|
-
this._preventAttrs || (this._preventAttrs = new Set()), this._preventAttrs.add(key);
|
|
4532
|
-
}
|
|
4533
|
-
preventAttrs(keys) {
|
|
4534
|
-
keys.forEach(key => this.preventAttr(key));
|
|
4535
|
-
}
|
|
4536
|
-
validAttr(key) {
|
|
4537
|
-
return !this._preventAttrs || !this._preventAttrs.has(key);
|
|
4538
|
-
}
|
|
4539
|
-
bind(target) {
|
|
4540
|
-
return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.subAnimates.forEach(sa => {
|
|
4541
|
-
sa.bind(target);
|
|
4542
|
-
}), this;
|
|
4543
|
-
}
|
|
4544
|
-
advance(delta) {
|
|
4545
|
-
if (this._duringTime < this._startTime) {
|
|
4546
|
-
if (this._duringTime + delta * this.timeScale < this._startTime) return void (this._duringTime += delta * this.timeScale);
|
|
4547
|
-
delta = this._duringTime + delta * this.timeScale - this._startTime, this._duringTime = this._startTime;
|
|
4548
|
-
}
|
|
4549
|
-
this.status === AnimateStatus.INITIAL && (this.status = AnimateStatus.RUNNING, this._onStart && this._onStart.forEach(cb => cb()));
|
|
4550
|
-
this.setPosition(Math.max(this.rawPosition, 0) + delta * this.timeScale) && this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.END, this._onEnd && this._onEnd.forEach(cb => cb()));
|
|
4551
|
-
}
|
|
4552
|
-
setPosition(rawPosition) {
|
|
4553
|
-
let sa,
|
|
4554
|
-
d = 0;
|
|
4555
|
-
const prevRawPos = this.rawPosition,
|
|
4556
|
-
maxRawPos = this.subAnimates.reduce((a, b) => a + b.totalDuration, 0);
|
|
4557
|
-
rawPosition < 0 && (rawPosition = 0);
|
|
4558
|
-
const end = rawPosition >= maxRawPos;
|
|
4559
|
-
if (end && (rawPosition = maxRawPos), rawPosition === prevRawPos) return end;
|
|
4560
|
-
for (let i = 0; i < this.subAnimates.length && (sa = this.subAnimates[i], !(d + sa.totalDuration >= rawPosition)); i++) d += sa.totalDuration, sa = void 0;
|
|
4561
|
-
return this.rawPosition = rawPosition, sa.setPosition(rawPosition - d), end;
|
|
4562
|
-
}
|
|
4563
|
-
onStart(cb) {
|
|
4564
|
-
this._onStart || (this._onStart = []), this._onStart.push(cb);
|
|
4565
|
-
}
|
|
4566
|
-
onEnd(cb) {
|
|
4567
|
-
this._onEnd || (this._onEnd = []), this._onEnd.push(cb);
|
|
4568
|
-
}
|
|
4569
|
-
onRemove(cb) {
|
|
4570
|
-
this._onRemove || (this._onRemove = []), this._onRemove.push(cb);
|
|
4571
|
-
}
|
|
4572
|
-
onFrame(cb) {
|
|
4573
|
-
this._onFrame || (this._onFrame = []), this._onFrame.push(cb);
|
|
4574
|
-
}
|
|
4575
|
-
release() {
|
|
4576
|
-
this.status = AnimateStatus.END;
|
|
4577
|
-
}
|
|
4578
|
-
stop(nextVal) {
|
|
4579
|
-
nextVal || this.target.onStop(), "start" === nextVal ? this.target.onStop(this.getStartProps()) : "end" === nextVal ? this.target.onStop(this.getEndProps()) : this.target.onStop(nextVal), this.release();
|
|
4580
|
-
}
|
|
4581
|
-
}
|
|
4582
|
-
Animate.mode = AnimateMode.NORMAL, Animate.interpolateMap = new Map();
|
|
4583
|
-
class SubAnimate {
|
|
4584
|
-
get totalDuration() {
|
|
4585
|
-
return this.calcAttr(), this._totalDuration + this._startAt;
|
|
4586
|
-
}
|
|
4587
|
-
constructor(animate, lastSubAnimate) {
|
|
4588
|
-
this.rawPosition = -1, this.position = 0, this.loop = 0, this.duration = 0, this.animate = animate, this.stepHead = new Step(0, 0, lastSubAnimate ? Object.assign({}, lastSubAnimate.stepTail.props) : {}), this.stepTail = this.stepHead, this.dirty = !0, this._startAt = 0;
|
|
4589
|
-
}
|
|
4590
|
-
calcAttr() {
|
|
4591
|
-
this.dirty && (this._totalDuration = this.duration * (this.loop + 1));
|
|
4592
|
-
}
|
|
4593
|
-
bind(target) {
|
|
4594
|
-
return this.target = target, this;
|
|
4595
|
-
}
|
|
4596
|
-
play(customAnimate) {
|
|
4597
|
-
let duration = customAnimate.duration;
|
|
4598
|
-
(null == duration || duration < 0) && (duration = 0);
|
|
4599
|
-
const easing = customAnimate.easing,
|
|
4600
|
-
easingFunc = "string" == typeof easing ? Easing[easing] : easing,
|
|
4601
|
-
step = this._addStep(duration, null, easingFunc);
|
|
4602
|
-
return step.type = AnimateStepType.customAnimate, this._appendProps(customAnimate.getEndProps(), step, !1), this._appendCustomAnimate(customAnimate, step), this;
|
|
4603
|
-
}
|
|
4604
|
-
to(props, duration, easing, params) {
|
|
4605
|
-
(null == duration || duration < 0) && (duration = 0);
|
|
4606
|
-
const easingFunc = "string" == typeof easing ? Easing[easing] : easing,
|
|
4607
|
-
step = this._addStep(duration, null, easingFunc);
|
|
4608
|
-
return step.type = AnimateStepType.to, this._appendProps(props, step, !!params && params.tempProps), step.propKeys || (step.propKeys = Object.keys(step.props)), params && params.noPreventAttrs || this.target.animates && this.target.animates.forEach(a => {
|
|
4609
|
-
a.id !== this.animate.id && a.preventAttrs(step.propKeys);
|
|
4610
|
-
}), this;
|
|
4611
|
-
}
|
|
4612
|
-
from(props, duration, easing, params) {
|
|
4613
|
-
this.to(props, 0, easing, params);
|
|
4614
|
-
const toProps = {};
|
|
4615
|
-
this.stepTail.propKeys || (this.stepTail.propKeys = Object.keys(this.stepTail.props)), this.stepTail.propKeys.forEach(k => {
|
|
4616
|
-
toProps[k] = this.getLastPropByName(k, this.stepTail);
|
|
4617
|
-
}), this.to(toProps, duration, easing, params), this.stepTail.type = AnimateStepType.from;
|
|
4618
|
-
}
|
|
4619
|
-
startAt(t) {
|
|
4620
|
-
return t < 0 && (t = 0), this._startAt = t, this;
|
|
4621
|
-
}
|
|
4622
|
-
getStartProps() {
|
|
4623
|
-
var _a;
|
|
4624
|
-
return null === (_a = this.stepHead) || void 0 === _a ? void 0 : _a.props;
|
|
4625
|
-
}
|
|
4626
|
-
getEndProps() {
|
|
4627
|
-
return this.stepTail.props;
|
|
4628
|
-
}
|
|
4629
|
-
getLastStep() {
|
|
4630
|
-
return this._lastStep;
|
|
4631
|
-
}
|
|
4632
|
-
wait(duration) {
|
|
4633
|
-
if (duration > 0) {
|
|
4634
|
-
const step = this._addStep(+duration, null);
|
|
4635
|
-
step.type = AnimateStepType.wait, step.prev.customAnimate ? step.props = step.prev.customAnimate.getEndProps() : step.props = step.prev.props, this.target.onAddStep && this.target.onAddStep(step);
|
|
4636
|
-
}
|
|
4637
|
-
return this;
|
|
4638
|
-
}
|
|
4639
|
-
_addStep(duration, props, easingFunc) {
|
|
4640
|
-
const step = new Step(this.duration, duration, props, easingFunc);
|
|
4641
|
-
return this.duration += duration, this.stepTail.append(step), this.stepTail = step, step;
|
|
4642
|
-
}
|
|
4643
|
-
_appendProps(props, step, tempProps) {
|
|
4644
|
-
step.props = tempProps ? props : Object.assign({}, props);
|
|
4645
|
-
let lastStep = step.prev;
|
|
4646
|
-
const _props = step.props;
|
|
4647
|
-
for (step.propKeys || (step.propKeys = Object.keys(step.props)), step.propKeys.forEach(k => {
|
|
4648
|
-
void 0 === step.props[k] && (step.props[k] = this.target.getDefaultAttribute(k));
|
|
4649
|
-
}); lastStep.prev;) lastStep.props && (lastStep.propKeys || (lastStep.propKeys = Object.keys(lastStep.props)), lastStep.propKeys.forEach(key => {
|
|
4650
|
-
void 0 === _props[key] && (_props[key] = lastStep.props[key]);
|
|
4651
|
-
})), step.propKeys = Object.keys(step.props), lastStep = lastStep.prev;
|
|
4652
|
-
const initProps = this.stepHead.props;
|
|
4653
|
-
step.propKeys || (step.propKeys = Object.keys(_props)), step.propKeys.forEach(key => {
|
|
4654
|
-
if (void 0 === initProps[key]) {
|
|
4655
|
-
const parentAnimateInitProps = this.animate.getStartProps();
|
|
4656
|
-
initProps[key] = parentAnimateInitProps[key] = this.target.getComputedAttribute(key);
|
|
4657
|
-
}
|
|
4658
|
-
}), this.target.onAddStep && this.target.onAddStep(step);
|
|
4659
|
-
}
|
|
4660
|
-
_appendCustomAnimate(customAnimate, step) {
|
|
4661
|
-
step.customAnimate = customAnimate, customAnimate.step = step, customAnimate.bind(this.target, this);
|
|
4662
|
-
}
|
|
4663
|
-
setPosition(rawPosition) {
|
|
4664
|
-
var _a;
|
|
4665
|
-
const d = this.duration,
|
|
4666
|
-
loopCount = this.loop,
|
|
4667
|
-
prevRawPos = this.rawPosition;
|
|
4668
|
-
let loop,
|
|
4669
|
-
position,
|
|
4670
|
-
end = !1;
|
|
4671
|
-
const startAt = null !== (_a = this._startAt) && void 0 !== _a ? _a : 0;
|
|
4672
|
-
if (rawPosition < 0 && (rawPosition = 0), rawPosition < startAt) return this.rawPosition = rawPosition, !1;
|
|
4673
|
-
if (rawPosition -= startAt, d <= 0 && (end = !0, d < 0)) return end;
|
|
4674
|
-
if (loop = Math.floor(rawPosition / d), position = rawPosition - loop * d, end = rawPosition >= loopCount * d + d, end && (position = d, loop = loopCount, rawPosition = position * loop + d), rawPosition === prevRawPos) return end;
|
|
4675
|
-
const rev = !this.reversed != !(this.bounce && loop % 2);
|
|
4676
|
-
return rev && (position = d - position), this._deltaPosition = position - this.position, this.position = position, this.rawPosition = rawPosition + startAt, this.updatePosition(end, rev), end;
|
|
4677
|
-
}
|
|
4678
|
-
updatePosition(end, rev) {
|
|
4679
|
-
if (!this.stepHead) return;
|
|
4680
|
-
let step = this.stepHead.next;
|
|
4681
|
-
const position = this.position,
|
|
4682
|
-
duration = this.duration;
|
|
4683
|
-
if (this.target && step) {
|
|
4684
|
-
let stepNext = step.next;
|
|
4685
|
-
for (; stepNext && stepNext.position <= position;) step = stepNext, stepNext = step.next;
|
|
4686
|
-
let ratio = end ? 0 === duration ? 1 : position / duration : (position - step.position) / step.duration;
|
|
4687
|
-
step.easing && (ratio = step.easing(ratio)), this.tryCallCustomAnimateLifeCycle(step, this._lastStep || (rev ? this.stepTail : this.stepHead), rev), this.updateTarget(step, ratio, end), this._lastStep = step, this.animate._onFrame && this.animate._onFrame.forEach(cb => cb(step, ratio));
|
|
4688
|
-
}
|
|
4689
|
-
}
|
|
4690
|
-
tryCallCustomAnimateLifeCycle(step, lastStep, rev) {
|
|
4691
|
-
if (step !== lastStep) if (rev) {
|
|
4692
|
-
let _step = lastStep.prev;
|
|
4693
|
-
for (; _step && _step !== step;) _step.customAnimate && (_step.customAnimate.onStart && _step.customAnimate.onStart(), _step.customAnimate.onEnd && _step.customAnimate.onEnd()), _step = step.prev;
|
|
4694
|
-
lastStep && lastStep.customAnimate && lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd(), step && step.customAnimate && step.customAnimate.onStart && step.customAnimate.onStart();
|
|
4695
|
-
} else {
|
|
4696
|
-
let _step = lastStep.next;
|
|
4697
|
-
for (; _step && _step !== step;) _step.customAnimate && (_step.customAnimate.onStart && _step.customAnimate.onStart(), _step.customAnimate.onEnd && _step.customAnimate.onEnd()), _step = _step.next;
|
|
4698
|
-
lastStep && lastStep.customAnimate && lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd(), step && step.customAnimate && step.customAnimate.onStart && step.customAnimate.onStart();
|
|
4699
|
-
}
|
|
4700
|
-
}
|
|
4701
|
-
getLastPropByName(name, step) {
|
|
4702
|
-
let lastStep = step.prev;
|
|
4703
|
-
for (; lastStep;) {
|
|
4704
|
-
if (lastStep.props && void 0 !== lastStep.props[name]) return lastStep.props[name];
|
|
4705
|
-
if (lastStep.customAnimate) {
|
|
4706
|
-
const val = lastStep.customAnimate.getEndProps()[name];
|
|
4707
|
-
if (void 0 !== val) return val;
|
|
4708
|
-
}
|
|
4709
|
-
lastStep = lastStep.prev;
|
|
4710
|
-
}
|
|
4711
|
-
return Logger.getInstance().warn("未知错误,step中找不到属性"), step.props[name];
|
|
4712
|
-
}
|
|
4713
|
-
updateTarget(step, ratio, end) {
|
|
4714
|
-
null == step.props && null == step.customAnimate || this.target.onStep(this, this.animate, step, ratio, end);
|
|
4715
|
-
}
|
|
4716
|
-
}
|
|
4717
|
-
class Step {
|
|
4718
|
-
constructor(position, duration, props, easing) {
|
|
4719
|
-
this.duration = duration, this.position = position, this.props = props, this.easing = easing;
|
|
4720
|
-
}
|
|
4721
|
-
append(step) {
|
|
4722
|
-
step.prev = this, step.next = this.next, this.next = step;
|
|
4723
|
-
}
|
|
4724
|
-
getLastProps() {
|
|
4725
|
-
let step = this.prev;
|
|
4726
|
-
for (; step;) {
|
|
4727
|
-
if (step.props) return step.props;
|
|
4728
|
-
if (step.customAnimate) return step.customAnimate.getMergedEndProps();
|
|
4729
|
-
step = step.prev;
|
|
4730
|
-
}
|
|
4731
|
-
return null;
|
|
4732
|
-
}
|
|
4733
|
-
}
|
|
4734
|
-
|
|
4735
|
-
const DefaultStateAnimateConfig = {
|
|
4736
|
-
duration: 200,
|
|
4737
|
-
easing: "cubicOut"
|
|
4738
|
-
};
|
|
4739
|
-
|
|
4740
|
-
var Edge;
|
|
4741
|
-
!function (Edge) {
|
|
4742
|
-
Edge[Edge.Top = 1] = "Top", Edge[Edge.Right = 2] = "Right", Edge[Edge.Bottom = 4] = "Bottom", Edge[Edge.Left = 8] = "Left", Edge[Edge.ALL = 15] = "ALL";
|
|
4743
|
-
}(Edge || (Edge = {}));
|
|
4744
|
-
const _strokeVec4 = [!1, !1, !1, !1];
|
|
4745
|
-
const parseStroke = stroke => {
|
|
4746
|
-
var _a;
|
|
4747
|
-
let isFullStroke = !0;
|
|
4748
|
-
if (isBoolean(stroke, !0)) {
|
|
4749
|
-
for (let i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
4750
|
-
isFullStroke = stroke;
|
|
4751
|
-
} else if (Array.isArray(stroke)) for (let i = 0; i < 4; i++) _strokeVec4[i] = !!stroke[i], isFullStroke && (isFullStroke = !!_strokeVec4[i]);else _strokeVec4[0] = !1, _strokeVec4[1] = !1, _strokeVec4[2] = !1, _strokeVec4[3] = !1;
|
|
4752
|
-
return {
|
|
4753
|
-
isFullStroke: isFullStroke,
|
|
4754
|
-
stroke: _strokeVec4
|
|
4755
|
-
};
|
|
4756
|
-
};
|
|
4757
|
-
const _paddingVec4 = [0, 0, 0, 0];
|
|
4758
|
-
const parsePadding = padding => padding ? isArray(padding) ? 0 === padding.length ? 0 : 1 === padding.length ? padding[0] : 2 === padding.length ? (_paddingVec4[0] = padding[0], _paddingVec4[2] = padding[0], _paddingVec4[1] = padding[1], _paddingVec4[3] = padding[1], _paddingVec4) : padding : padding : 0;
|
|
4759
|
-
const _coords = [{
|
|
4760
|
-
x: 0,
|
|
4761
|
-
y: 0
|
|
4762
|
-
}, {
|
|
4763
|
-
x: 0,
|
|
4764
|
-
y: 0
|
|
4765
|
-
}, {
|
|
4766
|
-
x: 0,
|
|
4767
|
-
y: 0
|
|
4768
|
-
}, {
|
|
4769
|
-
x: 0,
|
|
4770
|
-
y: 0
|
|
4771
|
-
}],
|
|
4772
|
-
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
4773
|
-
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
4774
|
-
for (; startAngle >= pi2;) startAngle -= pi2;
|
|
4775
|
-
for (; startAngle < 0;) startAngle += pi2;
|
|
4776
|
-
for (; startAngle > endAngle;) endAngle += pi2;
|
|
4777
|
-
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
4778
|
-
const startIdx = Math.ceil(startAngle / halfPi$1) % 4,
|
|
4779
|
-
endIdx = Math.ceil(endAngle / halfPi$1) % 4;
|
|
4780
|
-
if (bounds.add(cos(startAngle) * radius, sin(startAngle) * radius), bounds.add(cos(endAngle) * radius, sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > pi) {
|
|
4781
|
-
let match = !1;
|
|
4782
|
-
for (let i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
4783
|
-
if (match && endIdx === indexList[i]) break;
|
|
4784
|
-
if (match) {
|
|
4785
|
-
const p = _coords[indexList[i]];
|
|
4786
|
-
bounds.add(p.x, p.y);
|
|
4787
|
-
}
|
|
4788
|
-
} else {
|
|
4789
|
-
match = !0;
|
|
4790
|
-
const p = _coords[startIdx];
|
|
4791
|
-
bounds.add(p.x, p.y);
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
}
|
|
4795
|
-
function pointInterpolation(pointA, pointB, ratio) {
|
|
4796
|
-
const {
|
|
4797
|
-
x: x,
|
|
4798
|
-
y: y
|
|
4799
|
-
} = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
4800
|
-
{
|
|
4801
|
-
x: x1,
|
|
4802
|
-
y: y1
|
|
4803
|
-
} = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
4804
|
-
point = new Point(x, y, x1, y1);
|
|
4805
|
-
return point.defined = pointB.defined, point;
|
|
4806
|
-
}
|
|
4807
|
-
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
4808
|
-
if (!pointsA || !pointsB) return [];
|
|
4809
|
-
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
4810
|
-
let points = [];
|
|
4811
|
-
if (pointsA.length > pointsB.length) {
|
|
4812
|
-
points = pointsB.map(point => {
|
|
4813
|
-
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
4814
|
-
return p.defined = point.defined, p;
|
|
4815
|
-
});
|
|
4816
|
-
for (let i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
4817
|
-
} else {
|
|
4818
|
-
points = pointsB.map(point => {
|
|
4819
|
-
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
4820
|
-
return p.defined = point.defined, p;
|
|
4821
|
-
});
|
|
4822
|
-
for (let i = 0; i < pointsA.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
4823
|
-
}
|
|
4824
|
-
return points;
|
|
4825
|
-
}
|
|
4826
|
-
function getAttributeFromDefaultAttrList(attr, key) {
|
|
4827
|
-
if (isArray(attr)) {
|
|
4828
|
-
let val;
|
|
4829
|
-
for (let i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
4830
|
-
return val;
|
|
4831
|
-
}
|
|
4832
|
-
return attr[key];
|
|
4833
|
-
}
|
|
4834
|
-
const _calculateLineHeight = (lineHeight, fontSize) => {
|
|
4835
|
-
if (isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
4836
|
-
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
4837
|
-
}
|
|
4838
|
-
return lineHeight;
|
|
4839
|
-
};
|
|
4840
|
-
const calculateLineHeight = (lineHeight, fontSize) => {
|
|
4841
|
-
const _lh = _calculateLineHeight(lineHeight, fontSize);
|
|
4842
|
-
return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
|
|
4843
|
-
};
|
|
4844
|
-
|
|
4845
|
-
class IncreaseCount extends ACustomAnimate {
|
|
4846
|
-
constructor(from, to, duration, easing, params) {
|
|
4847
|
-
super(from, to, duration, easing, params);
|
|
4848
|
-
}
|
|
4849
|
-
getEndProps() {
|
|
4850
|
-
return !1 === this.valid ? {} : {
|
|
4851
|
-
text: this.to
|
|
4852
|
-
};
|
|
4853
|
-
}
|
|
4854
|
-
onBind() {
|
|
4855
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4856
|
-
this.fromNumber = isNumber(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
|
|
4857
|
-
}
|
|
4858
|
-
onEnd() {}
|
|
4859
|
-
onUpdate(end, ratio, out) {
|
|
4860
|
-
var _a;
|
|
4861
|
-
!1 !== this.valid && (out.text = end ? null === (_a = this.to) || void 0 === _a ? void 0 : _a.text : (this.fromNumber + (this.toNumber - this.fromNumber) * ratio).toFixed(this.decimalLength));
|
|
4862
|
-
}
|
|
4863
|
-
}
|
|
4864
|
-
var Direction;
|
|
4865
|
-
!function (Direction) {
|
|
4866
|
-
Direction[Direction.LEFT_TO_RIGHT = 0] = "LEFT_TO_RIGHT", Direction[Direction.RIGHT_TO_LEFT = 1] = "RIGHT_TO_LEFT", Direction[Direction.TOP_TO_BOTTOM = 2] = "TOP_TO_BOTTOM", Direction[Direction.BOTTOM_TO_TOP = 3] = "BOTTOM_TO_TOP", Direction[Direction.STROKE = 4] = "STROKE";
|
|
4867
|
-
}(Direction || (Direction = {}));
|
|
4868
|
-
class InputText extends ACustomAnimate {
|
|
4869
|
-
constructor() {
|
|
4870
|
-
super(...arguments), this.fromText = "", this.toText = "";
|
|
4871
|
-
}
|
|
4872
|
-
getEndProps() {
|
|
4873
|
-
return !1 === this.valid ? {} : {
|
|
4874
|
-
text: this.to
|
|
4875
|
-
};
|
|
4876
|
-
}
|
|
4877
|
-
onBind() {
|
|
4878
|
-
var _a, _b, _c;
|
|
4879
|
-
this.fromText = null !== (_b = null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) && void 0 !== _b ? _b : "", this.toText = (null === (_c = this.to) || void 0 === _c ? void 0 : _c.text) || "", (!this.toText || isArray(this.toText) && 0 === this.toText.length) && (this.valid = !1), isArray(this.toText) && (this.toText = this.toText.map(item => (item || "").toString()));
|
|
4880
|
-
}
|
|
4881
|
-
onEnd() {
|
|
4882
|
-
this.target.detachShadow();
|
|
4883
|
-
}
|
|
4884
|
-
onUpdate(end, ratio, out) {
|
|
4885
|
-
if (!1 === this.valid) return;
|
|
4886
|
-
const fromCount = this.fromText.length,
|
|
4887
|
-
toTextIsArray = isArray(this.toText),
|
|
4888
|
-
toCount = toTextIsArray ? this.toText.reduce((c, t) => c + (t || "").length, 0) : this.toText.length,
|
|
4889
|
-
count = Math.ceil(fromCount + (toCount - fromCount) * ratio);
|
|
4890
|
-
if (toTextIsArray) {
|
|
4891
|
-
out.text = [];
|
|
4892
|
-
let len = 0;
|
|
4893
|
-
this.toText.forEach(t => {
|
|
4894
|
-
len + t.length > count ? (out.text.push(t.substr(0, count - len)), len = count) : (out.text.push(t), len += t.length);
|
|
4895
|
-
});
|
|
4896
|
-
} else out.text = this.toText.substr(0, count);
|
|
4897
|
-
}
|
|
4898
|
-
}
|
|
4899
|
-
|
|
4900
|
-
const normalizeRectAttributes = attribute => {
|
|
4901
|
-
if (!attribute) return {
|
|
4902
|
-
x: 0,
|
|
4903
|
-
y: 0,
|
|
4904
|
-
width: 0,
|
|
4905
|
-
height: 0
|
|
4906
|
-
};
|
|
4907
|
-
let width = isNil(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
|
|
4908
|
-
height = isNil(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
|
|
4909
|
-
x = 0,
|
|
4910
|
-
y = 0;
|
|
4911
|
-
return width < 0 ? (x = width, width = -width) : Number.isNaN(width) && (width = 0), height < 0 ? (y = height, height = -height) : Number.isNaN(height) && (height = 0), {
|
|
4912
|
-
x: x,
|
|
4913
|
-
y: y,
|
|
4914
|
-
width: width,
|
|
4915
|
-
height: height
|
|
4916
|
-
};
|
|
4917
|
-
};
|
|
4918
|
-
|
|
4919
|
-
var ColorType;
|
|
4920
|
-
!function (ColorType) {
|
|
4921
|
-
ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
|
|
4922
|
-
}(ColorType || (ColorType = {}));
|
|
4923
|
-
class ColorStore {
|
|
4924
|
-
static Get(str) {
|
|
4925
|
-
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
|
|
4926
|
-
let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
|
|
4927
|
-
if (size === ColorType.Color1) {
|
|
4928
|
-
const color = ColorStore.store1[str];
|
|
4929
|
-
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
4930
|
-
const c = Color.parseColorString(str);
|
|
4931
|
-
if (c) {
|
|
4932
|
-
const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
|
|
4933
|
-
ColorStore.store1[str] = data, ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = data[0], arr[1] = data[1], arr[2] = data[2], arr[3] = data[3];
|
|
4934
|
-
}
|
|
4935
|
-
return arr;
|
|
4936
|
-
}
|
|
4937
|
-
const color = ColorStore.store255[str];
|
|
4938
|
-
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
4939
|
-
const c = Color.parseColorString(str);
|
|
4940
|
-
return c && (ColorStore.store1[str] = [c.r / 255, c.g / 255, c.b / 255, c.opacity], ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = c.r, arr[1] = c.g, arr[2] = c.b, arr[3] = c.opacity), arr;
|
|
4941
|
-
}
|
|
4942
|
-
static Set(str, size, arr) {
|
|
4943
|
-
if (size === ColorType.Color1) {
|
|
4944
|
-
if (ColorStore.store1[str]) return;
|
|
4945
|
-
ColorStore.store1[str] = arr, ColorStore.store255[str] = [Math.floor(255 * arr[0]), Math.floor(255 * arr[1]), Math.floor(255 * arr[2]), Math.floor(255 * arr[3])];
|
|
4946
|
-
} else {
|
|
4947
|
-
if (ColorStore.store255[str]) return;
|
|
4948
|
-
ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
|
|
4949
|
-
}
|
|
4950
|
-
}
|
|
4951
|
-
}
|
|
4952
|
-
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
4953
|
-
|
|
4954
|
-
function colorArrayToString(color) {
|
|
4955
|
-
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
4956
|
-
return Array.isArray(color) && isNumber(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
4957
|
-
}
|
|
4958
|
-
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
4959
|
-
if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
|
|
4960
|
-
return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray(from) ? from[index] : from, isArray(to) ? to[index] : to, ratio, alphaChannel));
|
|
4961
|
-
}
|
|
4962
|
-
return _interpolateColor(from, to, ratio, alphaChannel, cb);
|
|
4963
|
-
}
|
|
4964
|
-
function _interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
4965
|
-
if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
|
|
4966
|
-
let fromArray,
|
|
4967
|
-
toArray,
|
|
4968
|
-
fromGradient = !1,
|
|
4969
|
-
toGradient = !1;
|
|
4970
|
-
if (Array.isArray(from) ? fromArray = from : "string" == typeof from ? fromArray = ColorStore.Get(from, ColorType.Color255) : fromGradient = !0, Array.isArray(to) ? toArray = to : "string" == typeof to ? toArray = ColorStore.Get(to, ColorType.Color255) : toGradient = !0, fromGradient !== toGradient) {
|
|
4971
|
-
const gradient = fromGradient ? from : to,
|
|
4972
|
-
pure = fromGradient ? to : from,
|
|
4973
|
-
gradientFromPure = Object.assign(Object.assign({}, gradient), {
|
|
4974
|
-
stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
|
|
4975
|
-
color: colorArrayToString(pure)
|
|
4976
|
-
}))
|
|
4977
|
-
});
|
|
4978
|
-
return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
|
|
4979
|
-
}
|
|
4980
|
-
if (fromGradient) {
|
|
4981
|
-
if (from.gradient === to.gradient) {
|
|
4982
|
-
const fc = from,
|
|
4983
|
-
tc = to,
|
|
4984
|
-
fromStops = fc.stops,
|
|
4985
|
-
toStops = tc.stops;
|
|
4986
|
-
if (fromStops.length !== toStops.length) return !1;
|
|
4987
|
-
if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
|
|
4988
|
-
if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
|
|
4989
|
-
if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
|
|
4990
|
-
}
|
|
4991
|
-
return !1;
|
|
4992
|
-
}
|
|
4993
|
-
cb && cb(fromArray, toArray);
|
|
4994
|
-
return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
|
|
4995
|
-
}
|
|
4996
|
-
function interpolateGradientLinearColor(fc, tc, ratio) {
|
|
4997
|
-
const fStops = fc.stops,
|
|
4998
|
-
tStops = tc.stops;
|
|
4999
|
-
return {
|
|
5000
|
-
gradient: "linear",
|
|
5001
|
-
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
5002
|
-
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
5003
|
-
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
5004
|
-
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
5005
|
-
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
5006
|
-
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
5007
|
-
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
5008
|
-
}))
|
|
5009
|
-
};
|
|
4321
|
+
function interpolateGradientLinearColor(fc, tc, ratio) {
|
|
4322
|
+
const fStops = fc.stops,
|
|
4323
|
+
tStops = tc.stops;
|
|
4324
|
+
return {
|
|
4325
|
+
gradient: "linear",
|
|
4326
|
+
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
4327
|
+
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
4328
|
+
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
4329
|
+
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
4330
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
4331
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
4332
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
4333
|
+
}))
|
|
4334
|
+
};
|
|
5010
4335
|
}
|
|
5011
4336
|
function interpolateGradientRadialColor(fc, tc, ratio) {
|
|
5012
4337
|
const fStops = fc.stops,
|
|
@@ -5043,6 +4368,9 @@ function interpolateGradientConicalColor(fc, tc, ratio) {
|
|
|
5043
4368
|
function interpolatePureColorArray(from, to, ratio) {
|
|
5044
4369
|
return [from[0] + (to[0] - from[0]) * ratio, from[1] + (to[1] - from[1]) * ratio, from[2] + (to[2] - from[2]) * ratio, from[3] + (to[3] - from[3]) * ratio];
|
|
5045
4370
|
}
|
|
4371
|
+
function interpolatePureColorArrayToStr(from, to, ratio) {
|
|
4372
|
+
return `rgba(${from[0] + (to[0] - from[0]) * ratio},${from[1] + (to[1] - from[1]) * ratio},${from[2] + (to[2] - from[2]) * ratio},${from[3] + (to[3] - from[3]) * ratio})`;
|
|
4373
|
+
}
|
|
5046
4374
|
const _fromColorRGB = [0, 0, 0, 0],
|
|
5047
4375
|
_toColorRGB = [0, 0, 0, 0];
|
|
5048
4376
|
function colorStringInterpolationToStr(fromColor, toColor, ratio) {
|
|
@@ -5137,6 +4465,111 @@ function getIndex(url, arr) {
|
|
|
5137
4465
|
}
|
|
5138
4466
|
ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
|
|
5139
4467
|
|
|
4468
|
+
var Edge;
|
|
4469
|
+
!function (Edge) {
|
|
4470
|
+
Edge[Edge.Top = 1] = "Top", Edge[Edge.Right = 2] = "Right", Edge[Edge.Bottom = 4] = "Bottom", Edge[Edge.Left = 8] = "Left", Edge[Edge.ALL = 15] = "ALL";
|
|
4471
|
+
}(Edge || (Edge = {}));
|
|
4472
|
+
const _strokeVec4 = [!1, !1, !1, !1];
|
|
4473
|
+
const parseStroke = stroke => {
|
|
4474
|
+
var _a;
|
|
4475
|
+
let isFullStroke = !0;
|
|
4476
|
+
if (isBoolean(stroke, !0)) {
|
|
4477
|
+
for (let i = 0; i < 4; i++) _strokeVec4[i] = stroke, isFullStroke && (isFullStroke = !(null !== (_a = _strokeVec4[i]) && void 0 !== _a && !_a));
|
|
4478
|
+
isFullStroke = stroke;
|
|
4479
|
+
} else if (Array.isArray(stroke)) for (let i = 0; i < 4; i++) _strokeVec4[i] = !!stroke[i], isFullStroke && (isFullStroke = !!_strokeVec4[i]);else _strokeVec4[0] = !1, _strokeVec4[1] = !1, _strokeVec4[2] = !1, _strokeVec4[3] = !1;
|
|
4480
|
+
return {
|
|
4481
|
+
isFullStroke: isFullStroke,
|
|
4482
|
+
stroke: _strokeVec4
|
|
4483
|
+
};
|
|
4484
|
+
};
|
|
4485
|
+
const _paddingVec4 = [0, 0, 0, 0];
|
|
4486
|
+
const parsePadding = padding => padding ? isArray(padding) ? 0 === padding.length ? 0 : 1 === padding.length ? padding[0] : 2 === padding.length ? (_paddingVec4[0] = padding[0], _paddingVec4[2] = padding[0], _paddingVec4[1] = padding[1], _paddingVec4[3] = padding[1], _paddingVec4) : padding : padding : 0;
|
|
4487
|
+
const _coords = [{
|
|
4488
|
+
x: 0,
|
|
4489
|
+
y: 0
|
|
4490
|
+
}, {
|
|
4491
|
+
x: 0,
|
|
4492
|
+
y: 0
|
|
4493
|
+
}, {
|
|
4494
|
+
x: 0,
|
|
4495
|
+
y: 0
|
|
4496
|
+
}, {
|
|
4497
|
+
x: 0,
|
|
4498
|
+
y: 0
|
|
4499
|
+
}],
|
|
4500
|
+
indexList = [1, 2, 3, 0, 1, 2, 3, 0];
|
|
4501
|
+
function circleBounds(startAngle, endAngle, radius, bounds) {
|
|
4502
|
+
for (; startAngle >= pi2;) startAngle -= pi2;
|
|
4503
|
+
for (; startAngle < 0;) startAngle += pi2;
|
|
4504
|
+
for (; startAngle > endAngle;) endAngle += pi2;
|
|
4505
|
+
_coords[0].x = radius, _coords[1].y = radius, _coords[2].x = -radius, _coords[3].y = -radius;
|
|
4506
|
+
const startIdx = Math.ceil(startAngle / halfPi$1) % 4,
|
|
4507
|
+
endIdx = Math.ceil(endAngle / halfPi$1) % 4;
|
|
4508
|
+
if (bounds.add(cos(startAngle) * radius, sin(startAngle) * radius), bounds.add(cos(endAngle) * radius, sin(endAngle) * radius), startIdx !== endIdx || endAngle - startAngle > pi) {
|
|
4509
|
+
let match = !1;
|
|
4510
|
+
for (let i = 0; i < indexList.length; i++) if (match || startIdx !== indexList[i]) {
|
|
4511
|
+
if (match && endIdx === indexList[i]) break;
|
|
4512
|
+
if (match) {
|
|
4513
|
+
const p = _coords[indexList[i]];
|
|
4514
|
+
bounds.add(p.x, p.y);
|
|
4515
|
+
}
|
|
4516
|
+
} else {
|
|
4517
|
+
match = !0;
|
|
4518
|
+
const p = _coords[startIdx];
|
|
4519
|
+
bounds.add(p.x, p.y);
|
|
4520
|
+
}
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
function pointInterpolation(pointA, pointB, ratio) {
|
|
4524
|
+
const {
|
|
4525
|
+
x: x,
|
|
4526
|
+
y: y
|
|
4527
|
+
} = pointAt(pointA.x, pointA.y, pointB.x, pointB.y, ratio),
|
|
4528
|
+
{
|
|
4529
|
+
x: x1,
|
|
4530
|
+
y: y1
|
|
4531
|
+
} = pointAt(pointA.x1, pointA.y1, pointB.x1, pointB.y1, ratio),
|
|
4532
|
+
point = new Point(x, y, x1, y1);
|
|
4533
|
+
return point.defined = pointB.defined, point;
|
|
4534
|
+
}
|
|
4535
|
+
function pointsInterpolation(pointsA, pointsB, ratio) {
|
|
4536
|
+
if (!pointsA || !pointsB) return [];
|
|
4537
|
+
Array.isArray(pointsA) || (pointsA = [pointsA]), Array.isArray(pointsB) || (pointsB = [pointsB]);
|
|
4538
|
+
let points = [];
|
|
4539
|
+
if (pointsA.length > pointsB.length) {
|
|
4540
|
+
points = pointsB.map(point => {
|
|
4541
|
+
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
4542
|
+
return p.defined = point.defined, p;
|
|
4543
|
+
});
|
|
4544
|
+
for (let i = 0; i < pointsB.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
4545
|
+
} else {
|
|
4546
|
+
points = pointsB.map(point => {
|
|
4547
|
+
const p = new Point(point.x, point.y, point.x1, point.y1);
|
|
4548
|
+
return p.defined = point.defined, p;
|
|
4549
|
+
});
|
|
4550
|
+
for (let i = 0; i < pointsA.length; i++) points[i] = pointInterpolation(pointsA[i], pointsB[i], ratio);
|
|
4551
|
+
}
|
|
4552
|
+
return points;
|
|
4553
|
+
}
|
|
4554
|
+
function getAttributeFromDefaultAttrList(attr, key) {
|
|
4555
|
+
if (isArray(attr)) {
|
|
4556
|
+
let val;
|
|
4557
|
+
for (let i = 0; i < attr.length && void 0 === val; i++) val = attr[i][key];
|
|
4558
|
+
return val;
|
|
4559
|
+
}
|
|
4560
|
+
return attr[key];
|
|
4561
|
+
}
|
|
4562
|
+
const _calculateLineHeight = (lineHeight, fontSize) => {
|
|
4563
|
+
if (isString(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
4564
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
4565
|
+
}
|
|
4566
|
+
return lineHeight;
|
|
4567
|
+
};
|
|
4568
|
+
const calculateLineHeight = (lineHeight, fontSize) => {
|
|
4569
|
+
const _lh = _calculateLineHeight(lineHeight, fontSize);
|
|
4570
|
+
return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
|
|
4571
|
+
};
|
|
4572
|
+
|
|
5140
4573
|
class BaseSymbol {
|
|
5141
4574
|
bounds(size, bounds) {
|
|
5142
4575
|
if (isNumber(size)) {
|
|
@@ -5945,6 +5378,11 @@ const SVG_PARSE_ATTRIBUTE_MAP = {
|
|
|
5945
5378
|
};
|
|
5946
5379
|
const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
|
|
5947
5380
|
|
|
5381
|
+
const DefaultStateAnimateConfig = {
|
|
5382
|
+
duration: 200,
|
|
5383
|
+
easing: "cubicOut"
|
|
5384
|
+
};
|
|
5385
|
+
|
|
5948
5386
|
const _tempBounds = new AABBBounds(),
|
|
5949
5387
|
tempMatrix = new Matrix(),
|
|
5950
5388
|
tempBounds = new AABBBounds();
|
|
@@ -6011,6 +5449,9 @@ class Graphic extends Node {
|
|
|
6011
5449
|
var _a;
|
|
6012
5450
|
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);
|
|
6013
5451
|
}
|
|
5452
|
+
getAttributes() {
|
|
5453
|
+
return this.attribute;
|
|
5454
|
+
}
|
|
6014
5455
|
setMode(mode) {
|
|
6015
5456
|
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
6016
5457
|
}
|
|
@@ -6317,23 +5758,6 @@ class Graphic extends Node {
|
|
|
6317
5758
|
skewTo(b, c) {
|
|
6318
5759
|
return this;
|
|
6319
5760
|
}
|
|
6320
|
-
animate(params) {
|
|
6321
|
-
var _a;
|
|
6322
|
-
this.animates || (this.animates = new Map());
|
|
6323
|
-
const animate = new Animate(null == params ? void 0 : params.id, null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline(), null == params ? void 0 : params.slience);
|
|
6324
|
-
if (animate.bind(this), params) {
|
|
6325
|
-
const {
|
|
6326
|
-
onStart: onStart,
|
|
6327
|
-
onFrame: onFrame,
|
|
6328
|
-
onEnd: onEnd,
|
|
6329
|
-
onRemove: onRemove
|
|
6330
|
-
} = params;
|
|
6331
|
-
null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
|
|
6332
|
-
}
|
|
6333
|
-
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
6334
|
-
animate.stop(), this.animates.delete(animate.id);
|
|
6335
|
-
}), animate;
|
|
6336
|
-
}
|
|
6337
5761
|
onAttributeUpdate(context) {
|
|
6338
5762
|
context && context.skipUpdateCallback || (application.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
6339
5763
|
}
|
|
@@ -6348,7 +5772,7 @@ class Graphic extends Node {
|
|
|
6348
5772
|
return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
|
|
6349
5773
|
}
|
|
6350
5774
|
applyStateAttrs(attrs, stateNames, hasAnimation, isClear) {
|
|
6351
|
-
var _a, _b
|
|
5775
|
+
var _a, _b;
|
|
6352
5776
|
if (hasAnimation) {
|
|
6353
5777
|
const keys = Object.keys(attrs),
|
|
6354
5778
|
noWorkAttrs = this.getNoWorkAnimateAttr(),
|
|
@@ -6357,10 +5781,16 @@ class Graphic extends Node {
|
|
|
6357
5781
|
keys.forEach(key => {
|
|
6358
5782
|
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
|
|
6359
5783
|
});
|
|
6360
|
-
const
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
5784
|
+
const stateAnimateConfig = null !== (_b = null !== (_a = this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
5785
|
+
this.applyAnimationState(["state"], [{
|
|
5786
|
+
name: "state",
|
|
5787
|
+
animation: {
|
|
5788
|
+
type: "state",
|
|
5789
|
+
to: animateAttrs,
|
|
5790
|
+
duration: stateAnimateConfig.duration,
|
|
5791
|
+
easing: stateAnimateConfig.easing
|
|
5792
|
+
}
|
|
5793
|
+
}]), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
|
|
6364
5794
|
type: AttributeUpdateType.STATE
|
|
6365
5795
|
});
|
|
6366
5796
|
} else this.stopStateAnimates(), this.setAttributes(attrs, !1, {
|
|
@@ -6536,7 +5966,7 @@ class Graphic extends Node {
|
|
|
6536
5966
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
6537
5967
|
const timeline = stage.getTimeline();
|
|
6538
5968
|
this.animates.forEach(a => {
|
|
6539
|
-
a.timeline
|
|
5969
|
+
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
6540
5970
|
});
|
|
6541
5971
|
}
|
|
6542
5972
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -8606,6 +8036,25 @@ function createLine(attributes) {
|
|
|
8606
8036
|
return new Line$1(attributes);
|
|
8607
8037
|
}
|
|
8608
8038
|
|
|
8039
|
+
const normalizeRectAttributes = attribute => {
|
|
8040
|
+
if (!attribute) return {
|
|
8041
|
+
x: 0,
|
|
8042
|
+
y: 0,
|
|
8043
|
+
width: 0,
|
|
8044
|
+
height: 0
|
|
8045
|
+
};
|
|
8046
|
+
let width = isNil(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
|
|
8047
|
+
height = isNil(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
|
|
8048
|
+
x = 0,
|
|
8049
|
+
y = 0;
|
|
8050
|
+
return width < 0 ? (x = width, width = -width) : Number.isNaN(width) && (width = 0), height < 0 ? (y = height, height = -height) : Number.isNaN(height) && (height = 0), {
|
|
8051
|
+
x: x,
|
|
8052
|
+
y: y,
|
|
8053
|
+
width: width,
|
|
8054
|
+
height: height
|
|
8055
|
+
};
|
|
8056
|
+
};
|
|
8057
|
+
|
|
8609
8058
|
const RECT_UPDATE_TAG_KEY = ["width", "x1", "y1", "height", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
8610
8059
|
class Rect extends Graphic {
|
|
8611
8060
|
constructor(params) {
|
|
@@ -10952,7 +10401,7 @@ class BaseRender {
|
|
|
10952
10401
|
const p = context.project(x, y, z);
|
|
10953
10402
|
context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
|
|
10954
10403
|
}
|
|
10955
|
-
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
|
|
10404
|
+
_draw(graphic, defaultAttr, computed3dMatrix, drawContext, params, themeAttribute) {
|
|
10956
10405
|
const {
|
|
10957
10406
|
context: context
|
|
10958
10407
|
} = drawContext;
|
|
@@ -10969,7 +10418,7 @@ class BaseRender {
|
|
|
10969
10418
|
z: z,
|
|
10970
10419
|
lastModelMatrix: lastModelMatrix
|
|
10971
10420
|
} = data;
|
|
10972
|
-
this.z = z, this.drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
|
|
10421
|
+
this.z = z, this.drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params, null, null, themeAttribute), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
|
|
10973
10422
|
}
|
|
10974
10423
|
}
|
|
10975
10424
|
|
|
@@ -11054,9 +10503,9 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11054
10503
|
} else context.lineTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
11055
10504
|
return collapsedToLine;
|
|
11056
10505
|
}
|
|
11057
|
-
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11058
|
-
|
|
11059
|
-
|
|
10506
|
+
drawShape(arc, context, x, y, drawContext, params, fillCb, strokeCb, arcAttribute) {
|
|
10507
|
+
arcAttribute = null != arcAttribute ? arcAttribute : getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
10508
|
+
const {
|
|
11060
10509
|
fill = arcAttribute.fill,
|
|
11061
10510
|
stroke = arcAttribute.stroke,
|
|
11062
10511
|
x: originX = arcAttribute.x,
|
|
@@ -11097,17 +10546,7 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11097
10546
|
isFullStroke: isFullStroke,
|
|
11098
10547
|
stroke: arrayStroke
|
|
11099
10548
|
} = parseStroke(stroke);
|
|
11100
|
-
if (doFill || isFullStroke) {
|
|
11101
|
-
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);
|
|
11102
|
-
const _runFill = () => {
|
|
11103
|
-
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
11104
|
-
},
|
|
11105
|
-
_runStroke = () => {
|
|
11106
|
-
doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
|
|
11107
|
-
};
|
|
11108
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
|
|
11109
|
-
}
|
|
11110
|
-
if (!isFullStroke && doStroke) {
|
|
10549
|
+
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) {
|
|
11111
10550
|
context.beginPath();
|
|
11112
10551
|
drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
|
|
11113
10552
|
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());
|
|
@@ -11143,9 +10582,15 @@ let DefaultCanvasArcRender = class extends BaseRender {
|
|
|
11143
10582
|
}
|
|
11144
10583
|
this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
|
|
11145
10584
|
}
|
|
10585
|
+
_runFill(arc, context, x, y, arcAttribute, doFill, fVisible, originX, originY, fillCb) {
|
|
10586
|
+
doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
|
|
10587
|
+
}
|
|
10588
|
+
_runStroke(arc, context, x, y, arcAttribute, doStroke, sVisible, strokeCb) {
|
|
10589
|
+
doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
|
|
10590
|
+
}
|
|
11146
10591
|
draw(arc, renderService, drawContext, params) {
|
|
11147
10592
|
const arcAttribute = getTheme(arc, null == params ? void 0 : params.theme).arc;
|
|
11148
|
-
this._draw(arc, arcAttribute, !1, drawContext, params);
|
|
10593
|
+
this._draw(arc, arcAttribute, !1, drawContext, params, arcAttribute);
|
|
11149
10594
|
}
|
|
11150
10595
|
};
|
|
11151
10596
|
DefaultCanvasArcRender = __decorate$G([injectable(), __param$w(0, inject(ContributionProvider)), __param$w(0, named(ArcRenderContribution)), __metadata$z("design:paramtypes", [Object])], DefaultCanvasArcRender);
|
|
@@ -11266,7 +10711,7 @@ function drawSegments(path, segPath, percent, clipRangeByDimension, params) {
|
|
|
11266
10711
|
}
|
|
11267
10712
|
if (percent <= 0) return;
|
|
11268
10713
|
let direction;
|
|
11269
|
-
"x" === clipRangeByDimension ? direction = Direction
|
|
10714
|
+
"x" === clipRangeByDimension ? direction = Direction.ROW : "y" === clipRangeByDimension ? direction = Direction.COLUMN : "auto" === clipRangeByDimension && (direction = segPath.direction);
|
|
11270
10715
|
const totalDrawLength = percent * segPath.tryUpdateLength(direction);
|
|
11271
10716
|
let drawedLengthUntilLast = 0,
|
|
11272
10717
|
defined0 = !0,
|
|
@@ -11499,8 +10944,8 @@ function drawAreaSegments(path, segPath, percent, params) {
|
|
|
11499
10944
|
endP = null !== (_a = topCurves[topCurves.length - 1].p3) && void 0 !== _a ? _a : topCurves[topCurves.length - 1].p1,
|
|
11500
10945
|
xTotalLength = abs(endP.x - topCurves[0].p0.x),
|
|
11501
10946
|
yTotalLength = abs(endP.y - topCurves[0].p0.y);
|
|
11502
|
-
direction = null != direction ? direction : xTotalLength > yTotalLength ? Direction
|
|
11503
|
-
const totalDrawLength = percent * (direction === Direction
|
|
10947
|
+
direction = null != direction ? direction : xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN, Number.isFinite(xTotalLength) || (direction = Direction.COLUMN), Number.isFinite(yTotalLength) || (direction = Direction.ROW);
|
|
10948
|
+
const totalDrawLength = percent * (direction === Direction.ROW ? xTotalLength : yTotalLength);
|
|
11504
10949
|
let drawedLengthUntilLast = 0,
|
|
11505
10950
|
lastDefined = !0;
|
|
11506
10951
|
const topList = [],
|
|
@@ -11741,14 +11186,14 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11741
11186
|
} = area.attribute;
|
|
11742
11187
|
let endP,
|
|
11743
11188
|
startP,
|
|
11744
|
-
direction = Direction
|
|
11189
|
+
direction = Direction.ROW;
|
|
11745
11190
|
if (segments) {
|
|
11746
11191
|
const endSeg = segments[segments.length - 1];
|
|
11747
11192
|
startP = segments[0].points[0], endP = endSeg.points[endSeg.points.length - 1];
|
|
11748
11193
|
} else startP = points[0], endP = points[points.length - 1];
|
|
11749
11194
|
const xTotalLength = abs(endP.x - startP.x),
|
|
11750
11195
|
yTotalLength = abs(endP.y - startP.y);
|
|
11751
|
-
direction = null == endP.x1 ? Direction
|
|
11196
|
+
direction = null == endP.x1 ? Direction.ROW : null == endP.y1 ? Direction.COLUMN : Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
|
|
11752
11197
|
offsetX: offsetX,
|
|
11753
11198
|
offsetY: offsetY,
|
|
11754
11199
|
offsetZ: offsetZ,
|
|
@@ -11767,7 +11212,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11767
11212
|
const {
|
|
11768
11213
|
stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
|
|
11769
11214
|
} = attribute;
|
|
11770
|
-
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction
|
|
11215
|
+
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction.ROW ? "x" : "y", {
|
|
11771
11216
|
offsetX: offsetX,
|
|
11772
11217
|
offsetY: offsetY,
|
|
11773
11218
|
offsetZ: offsetZ
|
|
@@ -11856,26 +11301,25 @@ let DefaultCanvasRectRender = class extends BaseRender {
|
|
|
11856
11301
|
constructor(rectRenderContribitions) {
|
|
11857
11302
|
super(), this.rectRenderContribitions = rectRenderContribitions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(rectRenderContribitions);
|
|
11858
11303
|
}
|
|
11859
|
-
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11860
|
-
|
|
11861
|
-
const
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
} = rect.attribute;
|
|
11304
|
+
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
|
|
11305
|
+
rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
11306
|
+
const {
|
|
11307
|
+
fill = rectAttribute.fill,
|
|
11308
|
+
background: background,
|
|
11309
|
+
stroke = rectAttribute.stroke,
|
|
11310
|
+
cornerRadius = rectAttribute.cornerRadius,
|
|
11311
|
+
cornerType = rectAttribute.cornerType,
|
|
11312
|
+
opacity = rectAttribute.opacity,
|
|
11313
|
+
fillOpacity = rectAttribute.fillOpacity,
|
|
11314
|
+
lineWidth = rectAttribute.lineWidth,
|
|
11315
|
+
strokeOpacity = rectAttribute.strokeOpacity,
|
|
11316
|
+
visible = rectAttribute.visible,
|
|
11317
|
+
x1: x1,
|
|
11318
|
+
y1: y1,
|
|
11319
|
+
x: originX = rectAttribute.x,
|
|
11320
|
+
y: originY = rectAttribute.y,
|
|
11321
|
+
fillStrokeOrder = rectAttribute.fillStrokeOrder
|
|
11322
|
+
} = rect.attribute;
|
|
11879
11323
|
let {
|
|
11880
11324
|
width: width,
|
|
11881
11325
|
height: height
|
|
@@ -11893,18 +11337,17 @@ let DefaultCanvasRectRender = class extends BaseRender {
|
|
|
11893
11337
|
doFill: doFill,
|
|
11894
11338
|
doStroke: doStroke
|
|
11895
11339
|
};
|
|
11896
|
-
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
11340
|
+
context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), fillStrokeOrder ? (this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb), this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb)) : (this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb), this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb)), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
11341
|
+
}
|
|
11342
|
+
_runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb) {
|
|
11343
|
+
doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
|
|
11344
|
+
}
|
|
11345
|
+
_runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb) {
|
|
11346
|
+
doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
|
|
11904
11347
|
}
|
|
11905
11348
|
draw(rect, renderService, drawContext, params) {
|
|
11906
11349
|
const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
|
|
11907
|
-
this.
|
|
11350
|
+
this._draw(rect, rectAttribute, !1, drawContext, params, rectAttribute);
|
|
11908
11351
|
}
|
|
11909
11352
|
};
|
|
11910
11353
|
DefaultCanvasRectRender = __decorate$B([injectable(), __param$s(0, inject(ContributionProvider)), __param$s(0, named(RectRenderContribution)), __metadata$v("design:paramtypes", [Object])], DefaultCanvasRectRender);
|
|
@@ -11928,10 +11371,10 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
|
11928
11371
|
constructor(symbolRenderContribitions) {
|
|
11929
11372
|
super(), this.symbolRenderContribitions = symbolRenderContribitions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(symbolRenderContribitions);
|
|
11930
11373
|
}
|
|
11931
|
-
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
11374
|
+
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
|
|
11932
11375
|
var _a;
|
|
11933
|
-
|
|
11934
|
-
|
|
11376
|
+
symbolAttribute = null != symbolAttribute ? symbolAttribute : getTheme(symbol, null == params ? void 0 : params.theme).symbol;
|
|
11377
|
+
const {
|
|
11935
11378
|
size = symbolAttribute.size,
|
|
11936
11379
|
x: originX = symbolAttribute.x,
|
|
11937
11380
|
y: originY = symbolAttribute.y,
|
|
@@ -11976,14 +11419,13 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
|
|
|
11976
11419
|
a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
11977
11420
|
};
|
|
11978
11421
|
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
|
|
11979
|
-
}) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
|
|
11984
|
-
|
|
11985
|
-
|
|
11986
|
-
fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
11422
|
+
}) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb), this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb)) : (this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb), this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb)), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
|
|
11423
|
+
}
|
|
11424
|
+
_runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb) {
|
|
11425
|
+
doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
|
|
11426
|
+
}
|
|
11427
|
+
_runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb) {
|
|
11428
|
+
doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
|
|
11987
11429
|
}
|
|
11988
11430
|
draw(symbol, renderService, drawContext, params) {
|
|
11989
11431
|
const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
|
|
@@ -12358,16 +11800,19 @@ let DefaultCanvasGroupRender = class {
|
|
|
12358
11800
|
constructor(groupRenderContribitions) {
|
|
12359
11801
|
this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
|
|
12360
11802
|
}
|
|
12361
|
-
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
12362
|
-
const
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
11803
|
+
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb, groupAttribute) {
|
|
11804
|
+
const {
|
|
11805
|
+
clip: clip,
|
|
11806
|
+
fill: fill,
|
|
11807
|
+
stroke: stroke,
|
|
11808
|
+
background: background
|
|
11809
|
+
} = group.attribute;
|
|
11810
|
+
if (!(clip || fill || stroke || background)) return;
|
|
11811
|
+
groupAttribute = null != groupAttribute ? groupAttribute : getTheme(group, null == params ? void 0 : params.theme).group;
|
|
11812
|
+
const {
|
|
12367
11813
|
opacity = groupAttribute.opacity,
|
|
12368
11814
|
width = groupAttribute.width,
|
|
12369
11815
|
height = groupAttribute.height,
|
|
12370
|
-
clip = groupAttribute.clip,
|
|
12371
11816
|
fillOpacity = groupAttribute.fillOpacity,
|
|
12372
11817
|
strokeOpacity = groupAttribute.strokeOpacity,
|
|
12373
11818
|
cornerRadius = groupAttribute.cornerRadius,
|
|
@@ -12415,6 +11860,7 @@ let DefaultCanvasGroupRender = class {
|
|
|
12415
11860
|
});
|
|
12416
11861
|
}
|
|
12417
11862
|
draw(group, renderService, drawContext, params) {
|
|
11863
|
+
var _a;
|
|
12418
11864
|
const {
|
|
12419
11865
|
context: context
|
|
12420
11866
|
} = drawContext;
|
|
@@ -12422,16 +11868,18 @@ let DefaultCanvasGroupRender = class {
|
|
|
12422
11868
|
const {
|
|
12423
11869
|
clip: clip,
|
|
12424
11870
|
baseOpacity = 1,
|
|
12425
|
-
drawMode: drawMode
|
|
12426
|
-
x: x,
|
|
12427
|
-
y: y,
|
|
12428
|
-
width: width,
|
|
12429
|
-
height: height
|
|
11871
|
+
drawMode: drawMode
|
|
12430
11872
|
} = group.attribute,
|
|
12431
11873
|
lastNativeContext = context.nativeContext,
|
|
12432
11874
|
lastNativeCanvas = context.canvas.nativeCanvas;
|
|
12433
11875
|
if (drawMode > 0) {
|
|
12434
|
-
const
|
|
11876
|
+
const {
|
|
11877
|
+
x: x,
|
|
11878
|
+
y: y,
|
|
11879
|
+
width: width,
|
|
11880
|
+
height: height
|
|
11881
|
+
} = group.attribute,
|
|
11882
|
+
canvas = context.canvas,
|
|
12435
11883
|
newCanvas = vglobal.createCanvas({
|
|
12436
11884
|
width: canvas.width,
|
|
12437
11885
|
height: canvas.height,
|
|
@@ -12444,21 +11892,27 @@ let DefaultCanvasGroupRender = class {
|
|
|
12444
11892
|
clip ? context.save() : context.highPerformanceSave();
|
|
12445
11893
|
const baseGlobalAlpha = context.baseGlobalAlpha;
|
|
12446
11894
|
context.baseGlobalAlpha *= baseOpacity;
|
|
12447
|
-
const
|
|
12448
|
-
lastModelMatrix = context.modelMatrix;
|
|
11895
|
+
const lastModelMatrix = context.modelMatrix;
|
|
12449
11896
|
if (context.camera) {
|
|
12450
|
-
const
|
|
11897
|
+
const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
|
|
11898
|
+
nextModelMatrix = mat4Allocate.allocate(),
|
|
12451
11899
|
modelMatrix = mat4Allocate.allocate();
|
|
12452
11900
|
getModelMatrix(modelMatrix, group, groupAttribute), multiplyMat4Mat4(nextModelMatrix, lastModelMatrix || nextModelMatrix, modelMatrix), context.modelMatrix = nextModelMatrix, mat4Allocate.free(modelMatrix), context.setTransform(1, 0, 0, 1, 0, 0, !0);
|
|
12453
11901
|
} else context.transformFromMatrix(group.transMatrix, !0);
|
|
12454
|
-
context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, () => !1, () => !1) : this.drawShape(group, context, 0, 0, drawContext);
|
|
11902
|
+
context.beginPath(), params.skipDraw ? this.drawShape(group, context, 0, 0, drawContext, params, () => !1, () => !1) : this.drawShape(group, context, 0, 0, drawContext, null, null, null);
|
|
12455
11903
|
const {
|
|
12456
|
-
scrollX
|
|
12457
|
-
scrollY
|
|
11904
|
+
scrollX: scrollX,
|
|
11905
|
+
scrollY: scrollY
|
|
12458
11906
|
} = group.attribute;
|
|
12459
11907
|
let p;
|
|
12460
|
-
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.
|
|
12461
|
-
const
|
|
11908
|
+
if ((scrollX || scrollY) && context.translate(scrollX, scrollY), params && params.renderInGroup && (p = params.renderInGroup(params.skipDraw, group, drawContext, null === (_a = params.renderInGroupParams) || void 0 === _a ? void 0 : _a.nextM)), context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix, context.baseGlobalAlpha = baseGlobalAlpha, drawMode > 0) {
|
|
11909
|
+
const {
|
|
11910
|
+
x: x,
|
|
11911
|
+
y: y,
|
|
11912
|
+
width: width,
|
|
11913
|
+
height: height
|
|
11914
|
+
} = group.attribute,
|
|
11915
|
+
newContext = context.nativeContext,
|
|
12462
11916
|
newCanvas = context.canvas.nativeCanvas;
|
|
12463
11917
|
lastNativeContext.save(), lastNativeContext.setTransform(context.dpr, 0, 0, context.dpr, 0, 0, !0), 1 === drawMode && newContext.rect(x, y, width, height), lastNativeContext.drawImage(newCanvas, 0, 0, newCanvas.width, newCanvas.height, 0, 0, context.canvas.displayWidth, context.canvas.displayHeight);
|
|
12464
11918
|
const transform = newContext.getTransform();
|
|
@@ -12671,6 +12125,7 @@ let CommonDrawItemInterceptorContribution = class {
|
|
|
12671
12125
|
this.order = 1, this.interceptors = [new ShadowRootDrawItemInterceptorContribution(), new Canvas3DDrawItemInterceptor(), new InteractiveDrawItemInterceptorContribution(), new DebugDrawItemInterceptorContribution()];
|
|
12672
12126
|
}
|
|
12673
12127
|
afterDrawItem(graphic, renderService, drawContext, drawContribution, params) {
|
|
12128
|
+
if ((!graphic.in3dMode || drawContext.in3dInterceptor) && !graphic.shadowRoot && !(graphic.baseGraphic || graphic.attribute.globalZIndex || graphic.interactiveGraphic)) return !1;
|
|
12674
12129
|
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;
|
|
12675
12130
|
return !1;
|
|
12676
12131
|
}
|
|
@@ -13211,7 +12666,14 @@ var __decorate$q = undefined && undefined.__decorate || function (decorators, ta
|
|
|
13211
12666
|
};
|
|
13212
12667
|
let DefaultDrawContribution = class {
|
|
13213
12668
|
constructor(contributions, drawItemInterceptorContributions) {
|
|
13214
|
-
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.
|
|
12669
|
+
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this._renderInGroup = (skipSort, group, drawContext, nextM) => {
|
|
12670
|
+
var _a;
|
|
12671
|
+
skipSort ? group.forEachChildren(item => {
|
|
12672
|
+
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
12673
|
+
}) : foreach(group, DefaultAttribute.zIndex, item => {
|
|
12674
|
+
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
12675
|
+
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
12676
|
+
}, 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();
|
|
13215
12677
|
}
|
|
13216
12678
|
init() {
|
|
13217
12679
|
this.contributions.forEach(item => {
|
|
@@ -13239,12 +12701,12 @@ let DefaultDrawContribution = class {
|
|
|
13239
12701
|
dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
|
|
13240
12702
|
}
|
|
13241
12703
|
const d = context.dpr % 1;
|
|
13242
|
-
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.
|
|
12704
|
+
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.save(), context.reset(!1), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), renderService.renderTreeRoots.sort((a, b) => {
|
|
13243
12705
|
var _a, _b;
|
|
13244
12706
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
13245
12707
|
}).forEach(group => {
|
|
13246
12708
|
group.isContainer ? this.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : this.renderItem(group, drawContext);
|
|
13247
|
-
}), context.restore(), context.
|
|
12709
|
+
}), context.restore(), context.draw();
|
|
13248
12710
|
}
|
|
13249
12711
|
doRegister() {
|
|
13250
12712
|
throw new Error("暂不支持");
|
|
@@ -13270,15 +12732,12 @@ let DefaultDrawContribution = class {
|
|
|
13270
12732
|
const gm = group.transMatrix;
|
|
13271
12733
|
nextM = matrixAllocate.allocateByObj(parentMatrix).multiply(gm.a, gm.b, gm.c, gm.d, gm.e, gm.f), this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(nextM.getInverse());
|
|
13272
12734
|
}
|
|
13273
|
-
this.renderItem(group, drawContext, {
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
|
|
13279
|
-
drawContext.break || (item.isContainer ? this.renderGroup(item, drawContext, nextM) : this.renderItem(item, drawContext));
|
|
13280
|
-
}, !1, !!(null === (_a = drawContext.context) || void 0 === _a ? void 0 : _a.camera));
|
|
13281
|
-
}
|
|
12735
|
+
drawContext.isGroupScroll = !(!group.attribute.scrollX && !group.attribute.scrollY), this.renderItem(group, drawContext, {
|
|
12736
|
+
renderInGroupParams: {
|
|
12737
|
+
skipSort: skipSort,
|
|
12738
|
+
nextM: nextM
|
|
12739
|
+
},
|
|
12740
|
+
renderInGroup: this._renderInGroup
|
|
13282
12741
|
}), this.useDirtyBounds && (this.dirtyBounds.copy(tempBounds), boundsAllocate.free(tempBounds), matrixAllocate.free(nextM));
|
|
13283
12742
|
}
|
|
13284
12743
|
_increaseRender(group, drawContext) {
|
|
@@ -13335,13 +12794,13 @@ let DefaultDrawContribution = class {
|
|
|
13335
12794
|
const renderer = this.getRenderContribution(graphic);
|
|
13336
12795
|
if (!renderer) return;
|
|
13337
12796
|
let tempBounds,
|
|
13338
|
-
retrans =
|
|
13339
|
-
if (
|
|
12797
|
+
retrans = !1;
|
|
12798
|
+
if (drawContext.isGroupScroll) {
|
|
13340
12799
|
const {
|
|
13341
12800
|
scrollX = 0,
|
|
13342
12801
|
scrollY = 0
|
|
13343
12802
|
} = graphic.parent.attribute;
|
|
13344
|
-
|
|
12803
|
+
retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), this.scrollMatrix.translate(-scrollX, -scrollY);
|
|
13345
12804
|
}
|
|
13346
12805
|
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && "empty" !== graphic.attribute.boundsMode && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
13347
12806
|
if (retrans && graphic.parent) {
|
|
@@ -14909,13 +14368,6 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
|
14909
14368
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14910
14369
|
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14911
14370
|
|
|
14912
|
-
function getEndTriggersOfDrag() {
|
|
14913
|
-
if (vglobal.env === 'browser') {
|
|
14914
|
-
return ['pointerup', 'pointerleave'];
|
|
14915
|
-
}
|
|
14916
|
-
return ['pointerup', 'pointerleave', 'pointerupoutside'];
|
|
14917
|
-
}
|
|
14918
|
-
|
|
14919
14371
|
const delayMap$2 = {
|
|
14920
14372
|
debounce: debounce,
|
|
14921
14373
|
throttle: throttle
|
|
@@ -14949,7 +14401,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
14949
14401
|
}
|
|
14950
14402
|
};
|
|
14951
14403
|
this._onSliderPointerDown = (e) => {
|
|
14952
|
-
this._clearDragEvents();
|
|
14953
14404
|
const { stopSliderDownPropagation = true } = this.attribute;
|
|
14954
14405
|
if (stopSliderDownPropagation) {
|
|
14955
14406
|
e.stopPropagation();
|
|
@@ -14961,12 +14412,15 @@ class ScrollBar extends AbstractComponent {
|
|
|
14961
14412
|
pos: this._prePos,
|
|
14962
14413
|
event: e
|
|
14963
14414
|
});
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14415
|
+
if (vglobal.env === 'browser') {
|
|
14416
|
+
vglobal.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14417
|
+
vglobal.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14418
|
+
}
|
|
14419
|
+
else {
|
|
14420
|
+
this.stage.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14421
|
+
this.stage.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14422
|
+
this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14423
|
+
}
|
|
14970
14424
|
};
|
|
14971
14425
|
this._computeScrollValue = (e) => {
|
|
14972
14426
|
const { direction } = this.attribute;
|
|
@@ -15010,7 +14464,15 @@ class ScrollBar extends AbstractComponent {
|
|
|
15010
14464
|
pre: preRange,
|
|
15011
14465
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
15012
14466
|
});
|
|
15013
|
-
|
|
14467
|
+
if (vglobal.env === 'browser') {
|
|
14468
|
+
vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14469
|
+
vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
14470
|
+
}
|
|
14471
|
+
else {
|
|
14472
|
+
this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14473
|
+
this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
14474
|
+
this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14475
|
+
}
|
|
15014
14476
|
};
|
|
15015
14477
|
}
|
|
15016
14478
|
setScrollRange(range, render = true) {
|
|
@@ -15143,14 +14605,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
15143
14605
|
? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
|
|
15144
14606
|
: clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
15145
14607
|
}
|
|
15146
|
-
_clearDragEvents() {
|
|
15147
|
-
const triggers = getEndTriggersOfDrag();
|
|
15148
|
-
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15149
|
-
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15150
|
-
triggers.forEach((trigger) => {
|
|
15151
|
-
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15152
|
-
});
|
|
15153
|
-
}
|
|
15154
14608
|
_reset() {
|
|
15155
14609
|
this._sliderRenderBounds = null;
|
|
15156
14610
|
this._sliderLimitRange = null;
|
|
@@ -15946,17 +15400,14 @@ class Tag extends AbstractComponent {
|
|
|
15946
15400
|
tagWidth += symbolPlaceWidth;
|
|
15947
15401
|
textX += symbolPlaceWidth;
|
|
15948
15402
|
let textShape;
|
|
15949
|
-
let textWidth;
|
|
15950
|
-
let textHeight;
|
|
15951
15403
|
const isRich = isRichText({ text }) || type === 'rich';
|
|
15952
15404
|
if (isRich) {
|
|
15953
15405
|
const richTextAttrs = Object.assign(Object.assign(Object.assign({}, richTextAttributeTransform(Object.assign({ type, text }, textStyle))), textStyle), { visible: isValid(text) && visible !== false, x: textX, y: 0 });
|
|
15954
|
-
if (isNil(richTextAttrs.lineHeight)) {
|
|
15955
|
-
richTextAttrs.lineHeight = textStyle.fontSize;
|
|
15956
|
-
}
|
|
15957
15406
|
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
15958
|
-
|
|
15959
|
-
|
|
15407
|
+
tagWidth += textShape.AABBBounds.width();
|
|
15408
|
+
tagHeight += textShape.AABBBounds.height();
|
|
15409
|
+
tagX += textShape.AABBBounds.x1;
|
|
15410
|
+
tagY += textShape.AABBBounds.y1;
|
|
15960
15411
|
}
|
|
15961
15412
|
else {
|
|
15962
15413
|
const textAttrs = Object.assign(Object.assign({ text: isObject(text) && 'type' in text && text.type === 'text' ? text.text : text, visible: isValid(text) && visible !== false, lineHeight: textStyle === null || textStyle === void 0 ? void 0 : textStyle.fontSize }, textStyle), { x: textX, y: 0 });
|
|
@@ -15964,134 +15415,126 @@ class Tag extends AbstractComponent {
|
|
|
15964
15415
|
textAttrs.lineHeight = textStyle.fontSize;
|
|
15965
15416
|
}
|
|
15966
15417
|
textShape = group.createOrUpdateChild('tag-text', textAttrs, 'text');
|
|
15418
|
+
if (!isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
15419
|
+
textShape.states = state.text;
|
|
15420
|
+
}
|
|
15967
15421
|
const textBounds = measureTextSize(textAttrs.text, textStyle, (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.getTheme()) === null || _b === void 0 ? void 0 : _b.text);
|
|
15968
|
-
textWidth = textBounds.width;
|
|
15969
|
-
textHeight = textBounds.height;
|
|
15970
|
-
|
|
15971
|
-
|
|
15972
|
-
|
|
15973
|
-
|
|
15974
|
-
|
|
15975
|
-
|
|
15976
|
-
|
|
15977
|
-
|
|
15978
|
-
|
|
15422
|
+
const textWidth = textBounds.width;
|
|
15423
|
+
const textHeight = textBounds.height;
|
|
15424
|
+
tagWidth += textWidth;
|
|
15425
|
+
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
15426
|
+
const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1]));
|
|
15427
|
+
tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);
|
|
15428
|
+
const { textAlign, textBaseline } = textStyle;
|
|
15429
|
+
if (isValid(minWidth) || isValid(maxWidth)) {
|
|
15430
|
+
if (isValid(minWidth) && tagWidth < minWidth) {
|
|
15431
|
+
tagWidth = minWidth;
|
|
15432
|
+
}
|
|
15433
|
+
if (isValid(maxWidth) && tagWidth > maxWidth) {
|
|
15434
|
+
tagWidth = maxWidth;
|
|
15435
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
15436
|
+
}
|
|
15979
15437
|
}
|
|
15980
|
-
|
|
15981
|
-
|
|
15982
|
-
|
|
15438
|
+
tagX = 0;
|
|
15439
|
+
tagY = 0;
|
|
15440
|
+
let flag = 0;
|
|
15441
|
+
if (textAlign === 'left' || textAlign === 'start') {
|
|
15442
|
+
flag = 1;
|
|
15983
15443
|
}
|
|
15984
|
-
|
|
15985
|
-
|
|
15986
|
-
tagY = 0;
|
|
15987
|
-
let flag = 0;
|
|
15988
|
-
if (textAlign === 'left' || textAlign === 'start') {
|
|
15989
|
-
flag = 1;
|
|
15990
|
-
}
|
|
15991
|
-
else if (textAlign === 'right' || textAlign === 'end') {
|
|
15992
|
-
flag = -1;
|
|
15993
|
-
}
|
|
15994
|
-
else if (textAlign === 'center') {
|
|
15995
|
-
flag = 0;
|
|
15996
|
-
}
|
|
15997
|
-
if (!flag) {
|
|
15998
|
-
tagX -= tagWidth / 2;
|
|
15999
|
-
if (symbol) {
|
|
16000
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
15444
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
15445
|
+
flag = -1;
|
|
16001
15446
|
}
|
|
16002
|
-
|
|
16003
|
-
|
|
16004
|
-
else if (flag < 0) {
|
|
16005
|
-
tagX -= tagWidth;
|
|
16006
|
-
if (symbol) {
|
|
16007
|
-
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
15447
|
+
else if (textAlign === 'center') {
|
|
15448
|
+
flag = 0;
|
|
16008
15449
|
}
|
|
16009
|
-
|
|
16010
|
-
|
|
16011
|
-
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16015
|
-
|
|
16016
|
-
|
|
16017
|
-
|
|
16018
|
-
|
|
15450
|
+
if (!flag) {
|
|
15451
|
+
tagX -= tagWidth / 2;
|
|
15452
|
+
if (symbol) {
|
|
15453
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
15454
|
+
}
|
|
15455
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
15456
|
+
}
|
|
15457
|
+
else if (flag < 0) {
|
|
15458
|
+
tagX -= tagWidth;
|
|
15459
|
+
if (symbol) {
|
|
15460
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
15461
|
+
}
|
|
15462
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
15463
|
+
}
|
|
15464
|
+
else if (flag > 0) {
|
|
15465
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
15466
|
+
}
|
|
15467
|
+
const shouldCenter = containerTextAlign ? containerTextAlign === 'center' : textAlwaysCenter;
|
|
15468
|
+
const shouldRight = containerTextAlign === 'right' || containerTextAlign === 'end';
|
|
15469
|
+
const shouldLeft = containerTextAlign === 'left' || containerTextAlign === 'start';
|
|
15470
|
+
if (shouldCenter && flag) {
|
|
15471
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15472
|
+
const tsWidth = textWidth + symbolPlaceWidth;
|
|
15473
|
+
const textX = flag === 1
|
|
15474
|
+
? (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2
|
|
15475
|
+
: parsedPadding[0] + symbolPlaceWidth - (tagWidth / 2 + tsWidth / 2 - symbolPlaceWidth) + textWidth / 2;
|
|
16019
15476
|
textShape.setAttributes({
|
|
16020
15477
|
x: textX,
|
|
16021
|
-
textAlign
|
|
16022
|
-
textConfig: array(textShape.attribute.textConfig).map(t => {
|
|
16023
|
-
return Object.assign(Object.assign({}, t), { textAlign });
|
|
16024
|
-
})
|
|
15478
|
+
textAlign: 'center'
|
|
16025
15479
|
});
|
|
15480
|
+
if (symbol) {
|
|
15481
|
+
const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;
|
|
15482
|
+
symbol.setAttributes({
|
|
15483
|
+
x: symbolX
|
|
15484
|
+
});
|
|
15485
|
+
}
|
|
16026
15486
|
}
|
|
16027
|
-
|
|
15487
|
+
if (shouldLeft && flag !== 1) {
|
|
15488
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15489
|
+
const offset = flag === 0
|
|
15490
|
+
? -containerWidth / 2 + symbolPlaceWidth / 2
|
|
15491
|
+
: -tagWidth + parsedPadding[3] + parsedPadding[1] + symbolPlaceWidth;
|
|
15492
|
+
const textX = offset + symbolPlaceWidth;
|
|
16028
15493
|
textShape.setAttributes({
|
|
16029
15494
|
x: textX,
|
|
16030
|
-
textAlign
|
|
16031
|
-
});
|
|
16032
|
-
}
|
|
16033
|
-
};
|
|
16034
|
-
if (shouldCenter && flag) {
|
|
16035
|
-
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
16036
|
-
const tsWidth = textWidth + symbolPlaceWidth;
|
|
16037
|
-
const textX = flag === 1
|
|
16038
|
-
? (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2
|
|
16039
|
-
: parsedPadding[0] + symbolPlaceWidth - (tagWidth / 2 + tsWidth / 2 - symbolPlaceWidth) + textWidth / 2;
|
|
16040
|
-
updateTextAttrs(textX, 'center');
|
|
16041
|
-
if (symbol) {
|
|
16042
|
-
const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;
|
|
16043
|
-
symbol.setAttributes({
|
|
16044
|
-
x: symbolX
|
|
16045
|
-
});
|
|
16046
|
-
}
|
|
16047
|
-
}
|
|
16048
|
-
if (shouldLeft && flag !== 1) {
|
|
16049
|
-
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
16050
|
-
const offset = flag === 0
|
|
16051
|
-
? -containerWidth / 2 + symbolPlaceWidth / 2
|
|
16052
|
-
: -tagWidth + parsedPadding[3] + parsedPadding[1] + symbolPlaceWidth;
|
|
16053
|
-
const textX = offset + symbolPlaceWidth;
|
|
16054
|
-
updateTextAttrs(textX, 'left');
|
|
16055
|
-
if (symbol) {
|
|
16056
|
-
const symbolX = offset + maxSize / 2;
|
|
16057
|
-
symbol.setAttributes({
|
|
16058
|
-
x: symbolX
|
|
15495
|
+
textAlign: 'left'
|
|
16059
15496
|
});
|
|
15497
|
+
if (symbol) {
|
|
15498
|
+
const symbolX = offset + maxSize / 2;
|
|
15499
|
+
symbol.setAttributes({
|
|
15500
|
+
x: symbolX
|
|
15501
|
+
});
|
|
15502
|
+
}
|
|
16060
15503
|
}
|
|
16061
|
-
|
|
16062
|
-
|
|
16063
|
-
|
|
16064
|
-
|
|
16065
|
-
|
|
16066
|
-
|
|
16067
|
-
const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;
|
|
16068
|
-
symbol.setAttributes({
|
|
16069
|
-
x: symbolX
|
|
15504
|
+
if (shouldRight && flag !== -1) {
|
|
15505
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15506
|
+
const textX = flag === 0 ? containerWidth / 2 + symbolPlaceWidth / 2 : containerWidth;
|
|
15507
|
+
textShape.setAttributes({
|
|
15508
|
+
x: textX,
|
|
15509
|
+
textAlign: 'right'
|
|
16070
15510
|
});
|
|
15511
|
+
if (symbol) {
|
|
15512
|
+
const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;
|
|
15513
|
+
symbol.setAttributes({
|
|
15514
|
+
x: symbolX
|
|
15515
|
+
});
|
|
15516
|
+
}
|
|
16071
15517
|
}
|
|
16072
|
-
|
|
16073
|
-
|
|
16074
|
-
|
|
16075
|
-
|
|
16076
|
-
|
|
15518
|
+
if (textBaseline === 'middle') {
|
|
15519
|
+
tagY -= tagHeight / 2;
|
|
15520
|
+
if (symbol) {
|
|
15521
|
+
symbol.setAttribute('y', 0);
|
|
15522
|
+
}
|
|
16077
15523
|
}
|
|
16078
|
-
|
|
16079
|
-
|
|
16080
|
-
|
|
16081
|
-
|
|
16082
|
-
|
|
15524
|
+
else if (textBaseline === 'bottom') {
|
|
15525
|
+
tagY -= tagHeight;
|
|
15526
|
+
if (symbol) {
|
|
15527
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
15528
|
+
}
|
|
15529
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
16083
15530
|
}
|
|
16084
|
-
|
|
16085
|
-
|
|
16086
|
-
|
|
16087
|
-
|
|
16088
|
-
|
|
16089
|
-
symbol.setAttribute('y', textHeight / 2);
|
|
15531
|
+
else if (textBaseline === 'top') {
|
|
15532
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
15533
|
+
if (symbol) {
|
|
15534
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
15535
|
+
}
|
|
16090
15536
|
}
|
|
16091
15537
|
}
|
|
16092
|
-
if (!isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
16093
|
-
textShape.states = state.text;
|
|
16094
|
-
}
|
|
16095
15538
|
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
16096
15539
|
if (visible && isBoolean(bgVisible)) {
|
|
16097
15540
|
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, width: tagWidth, height: tagHeight, x: tagX, y: tagY }), 'rect');
|
|
@@ -16449,32 +15892,6 @@ class PopTip extends AbstractComponent {
|
|
|
16449
15892
|
};
|
|
16450
15893
|
}
|
|
16451
15894
|
}
|
|
16452
|
-
appearAnimate(animateConfig) {
|
|
16453
|
-
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
16454
|
-
this.setAttributes({ scaleX: 0, scaleY: 0 });
|
|
16455
|
-
this.animate().to({ scaleX: 1, scaleY: 1 }, (duration / 3) * 2, easing);
|
|
16456
|
-
this.titleShape &&
|
|
16457
|
-
this.titleShape
|
|
16458
|
-
.animate()
|
|
16459
|
-
.play(new InputText({ text: '' }, { text: this.titleShape.attribute.text }, duration, easing));
|
|
16460
|
-
this.contentShape &&
|
|
16461
|
-
this.contentShape
|
|
16462
|
-
.animate()
|
|
16463
|
-
.play(new InputText({ text: '' }, { text: this.contentShape.attribute.text }, duration, easing));
|
|
16464
|
-
if (animateConfig.wave) {
|
|
16465
|
-
const dur = duration / 6;
|
|
16466
|
-
this.group
|
|
16467
|
-
.animate()
|
|
16468
|
-
.to({ angle: animateConfig.wave }, dur, easing)
|
|
16469
|
-
.to({ angle: -animateConfig.wave }, dur * 2, easing)
|
|
16470
|
-
.to({ angle: animateConfig.wave }, dur * 2, easing)
|
|
16471
|
-
.to({ angle: 0 }, dur, easing);
|
|
16472
|
-
}
|
|
16473
|
-
}
|
|
16474
|
-
disappearAnimate(animateConfig) {
|
|
16475
|
-
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
16476
|
-
this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing);
|
|
16477
|
-
}
|
|
16478
15895
|
}
|
|
16479
15896
|
PopTip.defaultAttributes = {
|
|
16480
15897
|
position: 'rt',
|
|
@@ -19122,17 +18539,633 @@ class CircleAxis extends AxisBase {
|
|
|
19122
18539
|
textBaseline: this.getTextBaseline(vector)
|
|
19123
18540
|
};
|
|
19124
18541
|
}
|
|
19125
|
-
return {
|
|
19126
|
-
textAlign: 'center',
|
|
19127
|
-
textBaseline: 'middle'
|
|
19128
|
-
};
|
|
19129
|
-
}
|
|
19130
|
-
getLabelPosition(point, vector, text, style) {
|
|
19131
|
-
return point;
|
|
18542
|
+
return {
|
|
18543
|
+
textAlign: 'center',
|
|
18544
|
+
textBaseline: 'middle'
|
|
18545
|
+
};
|
|
18546
|
+
}
|
|
18547
|
+
getLabelPosition(point, vector, text, style) {
|
|
18548
|
+
return point;
|
|
18549
|
+
}
|
|
18550
|
+
}
|
|
18551
|
+
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
18552
|
+
mixin(CircleAxis, CircleAxisMixin);
|
|
18553
|
+
|
|
18554
|
+
var AnimateMode;
|
|
18555
|
+
!function (AnimateMode) {
|
|
18556
|
+
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
18557
|
+
}(AnimateMode || (AnimateMode = {}));
|
|
18558
|
+
|
|
18559
|
+
var AnimateStepType;
|
|
18560
|
+
!function (AnimateStepType) {
|
|
18561
|
+
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
18562
|
+
}(AnimateStepType || (AnimateStepType = {}));
|
|
18563
|
+
var AnimateStatus;
|
|
18564
|
+
!function (AnimateStatus) {
|
|
18565
|
+
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
18566
|
+
}(AnimateStatus || (AnimateStatus = {}));
|
|
18567
|
+
|
|
18568
|
+
class Easing {
|
|
18569
|
+
constructor() {}
|
|
18570
|
+
static linear(t) {
|
|
18571
|
+
return t;
|
|
18572
|
+
}
|
|
18573
|
+
static none() {
|
|
18574
|
+
return this.linear;
|
|
18575
|
+
}
|
|
18576
|
+
static get(amount) {
|
|
18577
|
+
return amount < -1 ? amount = -1 : amount > 1 && (amount = 1), function (t) {
|
|
18578
|
+
return 0 === amount ? t : amount < 0 ? t * (t * -amount + 1 + amount) : t * ((2 - t) * amount + (1 - amount));
|
|
18579
|
+
};
|
|
18580
|
+
}
|
|
18581
|
+
static getPowIn(pow) {
|
|
18582
|
+
return function (t) {
|
|
18583
|
+
return Math.pow(t, pow);
|
|
18584
|
+
};
|
|
18585
|
+
}
|
|
18586
|
+
static getPowOut(pow) {
|
|
18587
|
+
return function (t) {
|
|
18588
|
+
return 1 - Math.pow(1 - t, pow);
|
|
18589
|
+
};
|
|
18590
|
+
}
|
|
18591
|
+
static getPowInOut(pow) {
|
|
18592
|
+
return function (t) {
|
|
18593
|
+
return (t *= 2) < 1 ? .5 * Math.pow(t, pow) : 1 - .5 * Math.abs(Math.pow(2 - t, pow));
|
|
18594
|
+
};
|
|
18595
|
+
}
|
|
18596
|
+
static getBackIn(amount) {
|
|
18597
|
+
return function (t) {
|
|
18598
|
+
return t * t * ((amount + 1) * t - amount);
|
|
18599
|
+
};
|
|
18600
|
+
}
|
|
18601
|
+
static getBackOut(amount) {
|
|
18602
|
+
return function (t) {
|
|
18603
|
+
return --t * t * ((amount + 1) * t + amount) + 1;
|
|
18604
|
+
};
|
|
18605
|
+
}
|
|
18606
|
+
static getBackInOut(amount) {
|
|
18607
|
+
return amount *= 1.525, function (t) {
|
|
18608
|
+
return (t *= 2) < 1 ? t * t * ((amount + 1) * t - amount) * .5 : .5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
|
|
18609
|
+
};
|
|
18610
|
+
}
|
|
18611
|
+
static sineIn(t) {
|
|
18612
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
18613
|
+
}
|
|
18614
|
+
static sineOut(t) {
|
|
18615
|
+
return Math.sin(t * Math.PI / 2);
|
|
18616
|
+
}
|
|
18617
|
+
static sineInOut(t) {
|
|
18618
|
+
return -(Math.cos(Math.PI * t) - 1) / 2;
|
|
18619
|
+
}
|
|
18620
|
+
static expoIn(t) {
|
|
18621
|
+
return 0 === t ? 0 : Math.pow(2, 10 * t - 10);
|
|
18622
|
+
}
|
|
18623
|
+
static expoOut(t) {
|
|
18624
|
+
return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
|
|
18625
|
+
}
|
|
18626
|
+
static expoInOut(t) {
|
|
18627
|
+
return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? Math.pow(2, 20 * t - 10) / 2 : (2 - Math.pow(2, -20 * t + 10)) / 2;
|
|
18628
|
+
}
|
|
18629
|
+
static circIn(t) {
|
|
18630
|
+
return -(Math.sqrt(1 - t * t) - 1);
|
|
18631
|
+
}
|
|
18632
|
+
static circOut(t) {
|
|
18633
|
+
return Math.sqrt(1 - --t * t);
|
|
18634
|
+
}
|
|
18635
|
+
static circInOut(t) {
|
|
18636
|
+
return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
|
|
18637
|
+
}
|
|
18638
|
+
static bounceOut(t) {
|
|
18639
|
+
return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
|
|
18640
|
+
}
|
|
18641
|
+
static bounceIn(t) {
|
|
18642
|
+
return 1 - Easing.bounceOut(1 - t);
|
|
18643
|
+
}
|
|
18644
|
+
static bounceInOut(t) {
|
|
18645
|
+
return t < .5 ? .5 * Easing.bounceIn(2 * t) : .5 * Easing.bounceOut(2 * t - 1) + .5;
|
|
18646
|
+
}
|
|
18647
|
+
static getElasticIn(amplitude, period) {
|
|
18648
|
+
return function (t) {
|
|
18649
|
+
if (0 === t || 1 === t) return t;
|
|
18650
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
18651
|
+
return -amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period);
|
|
18652
|
+
};
|
|
18653
|
+
}
|
|
18654
|
+
static getElasticOut(amplitude, period) {
|
|
18655
|
+
return function (t) {
|
|
18656
|
+
if (0 === t || 1 === t) return t;
|
|
18657
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
18658
|
+
return amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1;
|
|
18659
|
+
};
|
|
18660
|
+
}
|
|
18661
|
+
static getElasticInOut(amplitude, period) {
|
|
18662
|
+
return function (t) {
|
|
18663
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
18664
|
+
return (t *= 2) < 1 ? amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * -.5 : amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * .5 + 1;
|
|
18665
|
+
};
|
|
18666
|
+
}
|
|
18667
|
+
static registerFunc(name, func) {
|
|
18668
|
+
Easing[name] = func;
|
|
18669
|
+
}
|
|
18670
|
+
}
|
|
18671
|
+
function flicker(t, n) {
|
|
18672
|
+
const step = 1 / n;
|
|
18673
|
+
let flag = 1;
|
|
18674
|
+
for (; t > step;) t -= step, flag *= -1;
|
|
18675
|
+
const v = flag * t / step;
|
|
18676
|
+
return v > 0 ? v : 1 + v;
|
|
18677
|
+
}
|
|
18678
|
+
Easing.quadIn = Easing.getPowIn(2), Easing.quadOut = Easing.getPowOut(2), Easing.quadInOut = Easing.getPowInOut(2), Easing.cubicIn = Easing.getPowIn(3), Easing.cubicOut = Easing.getPowOut(3), Easing.cubicInOut = Easing.getPowInOut(3), Easing.quartIn = Easing.getPowIn(4), Easing.quartOut = Easing.getPowOut(4), Easing.quartInOut = Easing.getPowInOut(4), Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easing.quintInOut = Easing.getPowInOut(5), Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7), Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3), Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5), Easing.easeInOutQuad = t => (t /= .5) < 1 ? .5 * Math.pow(t, 2) : -.5 * ((t -= 2) * t - 2), Easing.easeOutElastic = x => {
|
|
18679
|
+
const c4 = 2 * Math.PI / 3;
|
|
18680
|
+
return 0 === x ? 0 : 1 === x ? 1 : Math.pow(2, -10 * x) * Math.sin((10 * x - .75) * c4) + 1;
|
|
18681
|
+
}, Easing.easeInOutElastic = x => {
|
|
18682
|
+
const c5 = 2 * Math.PI / 4.5;
|
|
18683
|
+
return 0 === x ? 0 : 1 === x ? 1 : x < .5 ? -Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1;
|
|
18684
|
+
};
|
|
18685
|
+
for (let i = 0; i < 10; i++) Easing[`flicker${i}`] = t => flicker(t, i);
|
|
18686
|
+
for (let i = 2; i < 10; i++) Easing[`aIn${i}`] = t => i * t * t + (1 - i) * t;
|
|
18687
|
+
|
|
18688
|
+
function interpolateNumber(from, to, ratio) {
|
|
18689
|
+
return from + (to - from) * ratio;
|
|
18690
|
+
}
|
|
18691
|
+
|
|
18692
|
+
class InterpolateUpdateStore {
|
|
18693
|
+
constructor() {
|
|
18694
|
+
this.opacity = (key, from, to, ratio, step, target) => {
|
|
18695
|
+
target.attribute.opacity = interpolateNumber(from, to, ratio);
|
|
18696
|
+
}, this.fillOpacity = (key, from, to, ratio, step, target) => {
|
|
18697
|
+
target.attribute.fillOpacity = interpolateNumber(from, to, ratio);
|
|
18698
|
+
}, this.strokeOpacity = (key, from, to, ratio, step, target) => {
|
|
18699
|
+
target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);
|
|
18700
|
+
}, this.zIndex = (key, from, to, ratio, step, target) => {
|
|
18701
|
+
target.attribute.zIndex = interpolateNumber(from, to, ratio);
|
|
18702
|
+
}, this.backgroundOpacity = (key, from, to, ratio, step, target) => {
|
|
18703
|
+
target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);
|
|
18704
|
+
}, this.shadowOffsetX = (key, from, to, ratio, step, target) => {
|
|
18705
|
+
target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);
|
|
18706
|
+
}, this.shadowOffsetY = (key, from, to, ratio, step, target) => {
|
|
18707
|
+
target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);
|
|
18708
|
+
}, this.shadowBlur = (key, from, to, ratio, step, target) => {
|
|
18709
|
+
target.attribute.shadowBlur = interpolateNumber(from, to, ratio);
|
|
18710
|
+
}, this.fill = (key, from, to, ratio, step, target) => {
|
|
18711
|
+
target.attribute.fill = interpolateColor(from, to, ratio, !1);
|
|
18712
|
+
}, this.fillPure = (key, from, to, ratio, step, target) => {
|
|
18713
|
+
target.attribute.fill = step.fromParsedProps.fill ? interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio) : step.toParsedProps.fill;
|
|
18714
|
+
}, this.stroke = (key, from, to, ratio, step, target) => {
|
|
18715
|
+
target.attribute.stroke = interpolateColor(from, to, ratio, !1);
|
|
18716
|
+
}, this.strokePure = (key, from, to, ratio, step, target) => {
|
|
18717
|
+
target.attribute.stroke = step.fromParsedProps.stroke ? interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio) : step.toParsedProps.stroke;
|
|
18718
|
+
}, this.width = (key, from, to, ratio, step, target) => {
|
|
18719
|
+
target.attribute.width = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18720
|
+
}, this.height = (key, from, to, ratio, step, target) => {
|
|
18721
|
+
target.attribute.height = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18722
|
+
}, this.x = (key, from, to, ratio, step, target) => {
|
|
18723
|
+
target.attribute.x = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18724
|
+
}, this.y = (key, from, to, ratio, step, target) => {
|
|
18725
|
+
target.attribute.y = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18726
|
+
}, this.angle = (key, from, to, ratio, step, target) => {
|
|
18727
|
+
target.attribute.angle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18728
|
+
}, this.scaleX = (key, from, to, ratio, step, target) => {
|
|
18729
|
+
target.attribute.scaleX = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18730
|
+
}, this.scaleY = (key, from, to, ratio, step, target) => {
|
|
18731
|
+
target.attribute.scaleY = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18732
|
+
}, this.lineWidth = (key, from, to, ratio, step, target) => {
|
|
18733
|
+
target.attribute.lineWidth = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18734
|
+
}, this.startAngle = (key, from, to, ratio, step, target) => {
|
|
18735
|
+
target.attribute.startAngle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18736
|
+
}, this.endAngle = (key, from, to, ratio, step, target) => {
|
|
18737
|
+
target.attribute.endAngle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18738
|
+
}, this.radius = (key, from, to, ratio, step, target) => {
|
|
18739
|
+
target.attribute.radius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18740
|
+
}, this.outerRadius = (key, from, to, ratio, step, target) => {
|
|
18741
|
+
target.attribute.outerRadius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18742
|
+
}, this.innerRadius = (key, from, to, ratio, step, target) => {
|
|
18743
|
+
target.attribute.innerRadius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18744
|
+
}, this.size = (key, from, to, ratio, step, target) => {
|
|
18745
|
+
target.attribute.size = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18746
|
+
}, this.points = (key, from, to, ratio, step, target) => {
|
|
18747
|
+
target.attribute.points = pointsInterpolation(from, to, ratio), target.addUpdateBoundTag();
|
|
18748
|
+
};
|
|
18749
|
+
}
|
|
18750
|
+
}
|
|
18751
|
+
const interpolateUpdateStore = new InterpolateUpdateStore();
|
|
18752
|
+
function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
18753
|
+
if (Number.isFinite(to) && Number.isFinite(from)) return target.attribute[key] = from + (to - from) * ratio, !0;
|
|
18754
|
+
if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {
|
|
18755
|
+
const nextList = [];
|
|
18756
|
+
let valid = !0;
|
|
18757
|
+
for (let i = 0; i < to.length; i++) {
|
|
18758
|
+
const v = from[i],
|
|
18759
|
+
val = v + (to[i] - v) * ratio;
|
|
18760
|
+
if (!Number.isFinite(val)) {
|
|
18761
|
+
valid = !1;
|
|
18762
|
+
break;
|
|
18763
|
+
}
|
|
18764
|
+
nextList.push(val);
|
|
18765
|
+
}
|
|
18766
|
+
return valid && (target.attribute[key] = nextList), !0;
|
|
18767
|
+
}
|
|
18768
|
+
return !1;
|
|
18769
|
+
}
|
|
18770
|
+
|
|
18771
|
+
function noop() {}
|
|
18772
|
+
class Step {
|
|
18773
|
+
constructor(type, props, duration, easing) {
|
|
18774
|
+
this._startTime = 0, this._hasFirstRun = !1, 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);
|
|
18775
|
+
}
|
|
18776
|
+
bind(target, animate) {
|
|
18777
|
+
this.target = target, this.animate = animate, this.onBind();
|
|
18778
|
+
}
|
|
18779
|
+
append(step) {
|
|
18780
|
+
this.next = step, step.prev = this, step.setStartTime(this.getStartTime() + this.duration, !1);
|
|
18781
|
+
}
|
|
18782
|
+
updateDownstreamStartTimes() {
|
|
18783
|
+
let currentStep = this.next,
|
|
18784
|
+
currentStartTime = this._startTime + this.duration;
|
|
18785
|
+
for (; currentStep;) currentStep.setStartTime(currentStartTime, !1), currentStartTime += currentStep.duration, currentStep = currentStep.next;
|
|
18786
|
+
this.animate.updateDuration();
|
|
18787
|
+
}
|
|
18788
|
+
getLastProps() {
|
|
18789
|
+
return this.prev ? this.prev.props || {} : this.animate.getStartProps();
|
|
18790
|
+
}
|
|
18791
|
+
setDuration(duration) {
|
|
18792
|
+
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18793
|
+
this.duration = duration, updateDownstream && this.updateDownstreamStartTimes();
|
|
18794
|
+
}
|
|
18795
|
+
getDuration() {
|
|
18796
|
+
return this.duration;
|
|
18797
|
+
}
|
|
18798
|
+
determineInterpolateUpdateFunction() {
|
|
18799
|
+
if (!this.props) return;
|
|
18800
|
+
const funcs = [];
|
|
18801
|
+
this.propKeys.forEach(key => {
|
|
18802
|
+
if ("fill" === key || "stroke" === key) {
|
|
18803
|
+
const from = this.fromProps[key],
|
|
18804
|
+
to = this.props[key];
|
|
18805
|
+
if (isString(from) && isString(to)) {
|
|
18806
|
+
const fromArray = ColorStore.Get(from, ColorType.Color255),
|
|
18807
|
+
toArray = ColorStore.Get(to, ColorType.Color255);
|
|
18808
|
+
this.fromParsedProps || (this.fromParsedProps = {}), this.toParsedProps || (this.toParsedProps = {}), this.fromParsedProps[key] = fromArray, this.toParsedProps[key] = toArray, funcs.push(interpolateUpdateStore["fill" === key ? "fillPure" : "strokePure"]);
|
|
18809
|
+
} else interpolateUpdateStore[key] ? funcs.push(interpolateUpdateStore[key]) : funcs.push(commonInterpolateUpdate);
|
|
18810
|
+
} else interpolateUpdateStore[key] ? funcs.push(interpolateUpdateStore[key]) : funcs.push(commonInterpolateUpdate);
|
|
18811
|
+
}), this.interpolateUpdateFunctions = funcs;
|
|
18812
|
+
}
|
|
18813
|
+
setStartTime(time) {
|
|
18814
|
+
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18815
|
+
this._startTime = time, updateDownstream && this.updateDownstreamStartTimes();
|
|
18816
|
+
}
|
|
18817
|
+
getStartTime() {
|
|
18818
|
+
return this._startTime;
|
|
18819
|
+
}
|
|
18820
|
+
onBind() {}
|
|
18821
|
+
onFirstRun() {}
|
|
18822
|
+
onStart() {
|
|
18823
|
+
if (!this._hasFirstRun) {
|
|
18824
|
+
this._hasFirstRun = !0, this.fromProps = this.getLastProps();
|
|
18825
|
+
const startProps = this.animate.getStartProps();
|
|
18826
|
+
this.propKeys && this.propKeys.forEach(key => {
|
|
18827
|
+
var _a;
|
|
18828
|
+
this.fromProps[key] = null !== (_a = this.fromProps[key]) && void 0 !== _a ? _a : startProps[key];
|
|
18829
|
+
}), this.determineInterpolateUpdateFunction(), this.tryPreventConflict(), this.trySyncStartProps(), this.onFirstRun();
|
|
18830
|
+
}
|
|
18831
|
+
}
|
|
18832
|
+
tryPreventConflict() {
|
|
18833
|
+
const animate = this.animate;
|
|
18834
|
+
this.target.animates.forEach(a => {
|
|
18835
|
+
if (a === animate || a.priority > animate.priority) return;
|
|
18836
|
+
const fromProps = a.getStartProps();
|
|
18837
|
+
this.propKeys.forEach(key => {
|
|
18838
|
+
null != fromProps[key] && a.preventAttr(key);
|
|
18839
|
+
});
|
|
18840
|
+
});
|
|
18841
|
+
}
|
|
18842
|
+
deleteSelfAttr(key) {
|
|
18843
|
+
var _a;
|
|
18844
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
18845
|
+
const index = this.propKeys.indexOf(key);
|
|
18846
|
+
-1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
|
|
18847
|
+
}
|
|
18848
|
+
trySyncStartProps() {
|
|
18849
|
+
this.propKeys.forEach(key => {
|
|
18850
|
+
this.fromProps[key] = this.animate.target.getComputedAttribute(key);
|
|
18851
|
+
});
|
|
18852
|
+
}
|
|
18853
|
+
update(end, ratio, out) {
|
|
18854
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
18855
|
+
const easedRatio = this.easing(ratio);
|
|
18856
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
18857
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
18858
|
+
const key = this.propKeys[index];
|
|
18859
|
+
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
18860
|
+
}), this.onUpdate(end, easedRatio, out);
|
|
18861
|
+
}
|
|
18862
|
+
onUpdate(end, ratio, out) {}
|
|
18863
|
+
onEnd(cb) {
|
|
18864
|
+
this.target.setAttributes(this.props), cb ? this._endCb = cb : this._endCb && this._endCb(this.animate, this);
|
|
18865
|
+
}
|
|
18866
|
+
getEndProps() {
|
|
18867
|
+
return this.props;
|
|
18868
|
+
}
|
|
18869
|
+
getFromProps() {
|
|
18870
|
+
return this.fromProps;
|
|
18871
|
+
}
|
|
18872
|
+
getMergedEndProps() {
|
|
18873
|
+
return this.getEndProps();
|
|
18874
|
+
}
|
|
18875
|
+
stop() {}
|
|
18876
|
+
}
|
|
18877
|
+
class WaitStep extends Step {
|
|
18878
|
+
constructor(type, props, duration, easing) {
|
|
18879
|
+
super(type, props, duration, easing);
|
|
18880
|
+
}
|
|
18881
|
+
update(end, ratio, out) {
|
|
18882
|
+
this.onStart();
|
|
18883
|
+
}
|
|
18884
|
+
determineInterpolateUpdateFunction() {}
|
|
18885
|
+
}
|
|
18886
|
+
|
|
18887
|
+
class DefaultTimeline {
|
|
18888
|
+
get animateCount() {
|
|
18889
|
+
return this.animates.length;
|
|
18890
|
+
}
|
|
18891
|
+
constructor() {
|
|
18892
|
+
this.animates = [], this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this._endAnimatePtr = -1, this.id = Generator.GenAutoIncrementId(), this.animates = [], this.paused = !1;
|
|
18893
|
+
}
|
|
18894
|
+
isRunning() {
|
|
18895
|
+
return !this.paused && this._endAnimatePtr >= 0;
|
|
18896
|
+
}
|
|
18897
|
+
forEachAccessAnimate(cb) {
|
|
18898
|
+
for (let i = 0; i <= this._endAnimatePtr; i++) cb(this.animates[i], i);
|
|
18899
|
+
}
|
|
18900
|
+
addAnimate(animate) {
|
|
18901
|
+
this.animates.push(animate), this._endAnimatePtr++, this.animates[this.animates.length - 1] = this.animates[this._endAnimatePtr], this.animates[this._endAnimatePtr] = animate, this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18902
|
+
}
|
|
18903
|
+
pause() {
|
|
18904
|
+
this.paused = !0;
|
|
18905
|
+
}
|
|
18906
|
+
resume() {
|
|
18907
|
+
this.paused = !1;
|
|
18908
|
+
}
|
|
18909
|
+
tick(delta) {
|
|
18910
|
+
if (this.paused) return;
|
|
18911
|
+
const scaledDelta = delta * this._playSpeed;
|
|
18912
|
+
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18913
|
+
animate.status === AnimateStatus$1.END ? this.removeAnimate(animate, !0, i) : animate.status !== AnimateStatus$1.RUNNING && animate.status !== AnimateStatus$1.INITIAL || animate.advance(scaledDelta);
|
|
18914
|
+
});
|
|
18915
|
+
}
|
|
18916
|
+
clear() {
|
|
18917
|
+
this.forEachAccessAnimate(animate => {
|
|
18918
|
+
animate.release();
|
|
18919
|
+
}), this.animates = [], this._totalDuration = 0;
|
|
18920
|
+
}
|
|
18921
|
+
removeAnimate(animate) {
|
|
18922
|
+
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18923
|
+
let index = arguments.length > 2 ? arguments[2] : undefined;
|
|
18924
|
+
this._endAnimatePtr < 0 || (release && (animate._onRemove && animate._onRemove.forEach(cb => cb()), animate.release()), index = null != index ? index : this.animates.indexOf(animate), this.animates[index] = this.animates[this._endAnimatePtr], this._endAnimatePtr--);
|
|
18925
|
+
}
|
|
18926
|
+
recalculateTotalDuration() {
|
|
18927
|
+
this._totalDuration = 0, this.animates.forEach(animate => {
|
|
18928
|
+
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18929
|
+
});
|
|
18930
|
+
}
|
|
18931
|
+
getTotalDuration() {
|
|
18932
|
+
return this._totalDuration;
|
|
18933
|
+
}
|
|
18934
|
+
getPlaySpeed() {
|
|
18935
|
+
return this._playSpeed;
|
|
18936
|
+
}
|
|
18937
|
+
setPlaySpeed(speed) {
|
|
18938
|
+
this._playSpeed = speed;
|
|
18939
|
+
}
|
|
18940
|
+
getPlayState() {
|
|
18941
|
+
return this.paused ? "paused" : 0 === this.animateCount ? "stopped" : "playing";
|
|
18942
|
+
}
|
|
18943
|
+
setStartTime(time) {
|
|
18944
|
+
this._startTime = time;
|
|
18945
|
+
}
|
|
18946
|
+
getStartTime() {
|
|
18947
|
+
return this._startTime;
|
|
18948
|
+
}
|
|
18949
|
+
getCurrentTime() {
|
|
18950
|
+
return this._currentTime;
|
|
18951
|
+
}
|
|
18952
|
+
setCurrentTime(time) {
|
|
18953
|
+
this._currentTime = time;
|
|
18954
|
+
}
|
|
18955
|
+
}
|
|
18956
|
+
const defaultTimeline = new DefaultTimeline();
|
|
18957
|
+
defaultTimeline.isGlobal = !0;
|
|
18958
|
+
|
|
18959
|
+
class Animate {
|
|
18960
|
+
constructor() {
|
|
18961
|
+
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
18962
|
+
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
18963
|
+
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
18964
|
+
this.id = id, this.status = AnimateStatus.INITIAL, this._timeline = timeline, timeline.addAnimate(this), this.slience = slience, this._startTime = 0, this._duration = 0, this._totalDuration = 0, this._loopCount = 0, this._currentLoop = 0, this._bounce = !1, this._firstStep = null, this._lastStep = null, this._startProps = {}, this._endProps = {}, this._preventAttrs = new Set(), this.currentTime = 0, this.interpolateUpdateFunction = null, this.priority = 0;
|
|
18965
|
+
}
|
|
18966
|
+
getStartProps() {
|
|
18967
|
+
return this._startProps;
|
|
18968
|
+
}
|
|
18969
|
+
getEndProps() {
|
|
18970
|
+
return this._endProps;
|
|
18971
|
+
}
|
|
18972
|
+
setTimeline(timeline) {
|
|
18973
|
+
this._timeline = timeline;
|
|
18974
|
+
}
|
|
18975
|
+
getTimeline() {
|
|
18976
|
+
return this._timeline;
|
|
18977
|
+
}
|
|
18978
|
+
get timeline() {
|
|
18979
|
+
return this._timeline;
|
|
18980
|
+
}
|
|
18981
|
+
bind(target) {
|
|
18982
|
+
return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
18983
|
+
}
|
|
18984
|
+
to(props) {
|
|
18985
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
18986
|
+
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
18987
|
+
const step = new Step(AnimateStepType.to, props, duration, easing);
|
|
18988
|
+
return step.bind(this.target, this), this.updateStepAfterAppend(step), this;
|
|
18989
|
+
}
|
|
18990
|
+
wait(delay) {
|
|
18991
|
+
const step = new WaitStep(AnimateStepType.wait, {}, delay, "linear");
|
|
18992
|
+
return step.bind(this.target, this), this.updateStepAfterAppend(step), this;
|
|
18993
|
+
}
|
|
18994
|
+
updateStepAfterAppend(step) {
|
|
18995
|
+
this._firstStep ? (this._lastStep.append(step), this._lastStep = step) : (this._firstStep = step, this._lastStep = step), this.parseStepProps(step), this.updateDuration();
|
|
18996
|
+
}
|
|
18997
|
+
parseStepProps(step) {
|
|
18998
|
+
this._lastStep && (step.propKeys = step.propKeys || Object.keys(step.props), Object.keys(this._endProps).forEach(key => {
|
|
18999
|
+
var _a;
|
|
19000
|
+
step.props[key] = null !== (_a = step.props[key]) && void 0 !== _a ? _a : this._endProps[key];
|
|
19001
|
+
}), step.propKeys.forEach(key => {
|
|
19002
|
+
this._endProps[key] = step.props[key];
|
|
19003
|
+
}));
|
|
19004
|
+
}
|
|
19005
|
+
reSyncProps() {
|
|
19006
|
+
if (!this._lastStep) return;
|
|
19007
|
+
this._endProps = {};
|
|
19008
|
+
let currentStep = this._firstStep;
|
|
19009
|
+
for (; currentStep;) Object.keys(this._endProps).forEach(key => {
|
|
19010
|
+
var _a;
|
|
19011
|
+
currentStep.props[key] = null !== (_a = currentStep.props[key]) && void 0 !== _a ? _a : this._endProps[key];
|
|
19012
|
+
}), currentStep.propKeys.forEach(key => {
|
|
19013
|
+
this._endProps[key] = currentStep.props[key];
|
|
19014
|
+
}), currentStep = currentStep.next;
|
|
19015
|
+
}
|
|
19016
|
+
from(props) {
|
|
19017
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
19018
|
+
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
19019
|
+
const step = new Step(AnimateStepType.from, props, duration, easing);
|
|
19020
|
+
return this._firstStep ? (this._lastStep.append(step), this._lastStep = step) : (this._firstStep = step, this._lastStep = step), this.updateDuration(), this;
|
|
19021
|
+
}
|
|
19022
|
+
play(customAnimate) {
|
|
19023
|
+
return customAnimate.bind(this.target, this), this.updateStepAfterAppend(customAnimate), this;
|
|
19024
|
+
}
|
|
19025
|
+
pause() {
|
|
19026
|
+
this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.PAUSED);
|
|
19027
|
+
}
|
|
19028
|
+
resume() {
|
|
19029
|
+
this.status === AnimateStatus.PAUSED && (this.status = AnimateStatus.RUNNING);
|
|
19030
|
+
}
|
|
19031
|
+
onStart(cb) {
|
|
19032
|
+
var _a;
|
|
19033
|
+
cb ? (this._onStart || (this._onStart = []), this._onStart.push(cb)) : (null === (_a = this._onStart) || void 0 === _a || _a.forEach(cb => cb()), Object.keys(this._endProps).forEach(key => {
|
|
19034
|
+
this._startProps[key] = this.target.getComputedAttribute(key);
|
|
19035
|
+
}));
|
|
19036
|
+
}
|
|
19037
|
+
onEnd(cb) {
|
|
19038
|
+
var _a;
|
|
19039
|
+
cb ? (this._onEnd || (this._onEnd = []), this._onEnd.push(cb)) : null === (_a = this._onEnd) || void 0 === _a || _a.forEach(cb => cb());
|
|
19040
|
+
}
|
|
19041
|
+
onFrame(cb) {
|
|
19042
|
+
cb && (this._onFrame || (this._onFrame = []), this._onFrame.push(cb));
|
|
19043
|
+
}
|
|
19044
|
+
onRemove(cb) {
|
|
19045
|
+
var _a;
|
|
19046
|
+
cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
|
|
19047
|
+
}
|
|
19048
|
+
preventAttr(key) {
|
|
19049
|
+
this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
|
|
19050
|
+
let step = this._firstStep;
|
|
19051
|
+
for (; step;) step.deleteSelfAttr(key), step = step.next;
|
|
19052
|
+
}
|
|
19053
|
+
preventAttrs(keys) {
|
|
19054
|
+
keys.forEach(key => this._preventAttrs.add(key));
|
|
19055
|
+
}
|
|
19056
|
+
validAttr(key) {
|
|
19057
|
+
return !this._preventAttrs.has(key);
|
|
19058
|
+
}
|
|
19059
|
+
runCb(cb) {
|
|
19060
|
+
var _a;
|
|
19061
|
+
return null === (_a = this._lastStep) || void 0 === _a || _a.onEnd(cb), this;
|
|
19062
|
+
}
|
|
19063
|
+
startAt(t) {
|
|
19064
|
+
return this._startTime = t, this;
|
|
19065
|
+
}
|
|
19066
|
+
customInterpolate(key, ratio, from, to, target, ret) {
|
|
19067
|
+
return !1;
|
|
19068
|
+
}
|
|
19069
|
+
getFromValue() {
|
|
19070
|
+
return this._startProps;
|
|
19071
|
+
}
|
|
19072
|
+
getToValue() {
|
|
19073
|
+
return this._endProps;
|
|
19074
|
+
}
|
|
19075
|
+
stop(type) {
|
|
19076
|
+
let step = this._firstStep;
|
|
19077
|
+
for (; step;) step.stop(), step = step.next;
|
|
19078
|
+
this.status = AnimateStatus.END, this.onEnd(), this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
|
|
19079
|
+
}
|
|
19080
|
+
release() {
|
|
19081
|
+
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
|
|
19082
|
+
}
|
|
19083
|
+
getDuration() {
|
|
19084
|
+
return this._duration;
|
|
19085
|
+
}
|
|
19086
|
+
getStartTime() {
|
|
19087
|
+
return this._startTime;
|
|
19088
|
+
}
|
|
19089
|
+
afterAll(list) {
|
|
19090
|
+
if (!list || 0 === list.length) return this;
|
|
19091
|
+
let maxEndTime = 0;
|
|
19092
|
+
return list.forEach(animate => {
|
|
19093
|
+
const endTime = animate.getStartTime() + animate.getTotalDuration();
|
|
19094
|
+
maxEndTime = Math.max(maxEndTime, endTime);
|
|
19095
|
+
}), this.startAt(maxEndTime);
|
|
19096
|
+
}
|
|
19097
|
+
after(animate) {
|
|
19098
|
+
if (!animate) return this;
|
|
19099
|
+
const endTime = animate.getStartTime() + animate.getTotalDuration();
|
|
19100
|
+
return this.startAt(endTime);
|
|
19101
|
+
}
|
|
19102
|
+
parallel(animate) {
|
|
19103
|
+
return animate ? (this.startAt(animate.getStartTime()), this) : this;
|
|
19104
|
+
}
|
|
19105
|
+
loop(n) {
|
|
19106
|
+
return !0 === n ? n = 1 / 0 : !1 === n && (n = 0), this._loopCount = n, this.updateDuration(), this;
|
|
19107
|
+
}
|
|
19108
|
+
bounce(b) {
|
|
19109
|
+
return this._bounce = b, this;
|
|
19110
|
+
}
|
|
19111
|
+
advance(delta) {
|
|
19112
|
+
var _a;
|
|
19113
|
+
if (this.status === AnimateStatus.END) return void console.warn("aaa 动画已经结束,不能推进");
|
|
19114
|
+
const nextTime = this.currentTime + delta;
|
|
19115
|
+
if (nextTime < this._startTime) return void (this.currentTime = nextTime);
|
|
19116
|
+
if (nextTime >= this._startTime + this._totalDuration) return null === (_a = this._lastStep) || void 0 === _a || _a.onEnd(), this.onEnd(), void (this.status = AnimateStatus.END);
|
|
19117
|
+
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
19118
|
+
let cycleTime = nextTime - this._startTime,
|
|
19119
|
+
newLoop = !1,
|
|
19120
|
+
bounceTime = !1;
|
|
19121
|
+
if (this._loopCount > 0) {
|
|
19122
|
+
cycleTime = (nextTime - this._startTime) % this._duration;
|
|
19123
|
+
const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);
|
|
19124
|
+
newLoop = currentLoop > this._currentLoop, this._currentLoop = currentLoop, bounceTime = this._bounce && currentLoop % 2 == 1, bounceTime && (cycleTime = this._duration - cycleTime);
|
|
19125
|
+
}
|
|
19126
|
+
newLoop && !bounceTime && this.target.setAttributes(this._startProps);
|
|
19127
|
+
let targetStep = null;
|
|
19128
|
+
if (this._lastStep === this._firstStep) targetStep = this._firstStep;else {
|
|
19129
|
+
let currentStep = this._firstStep;
|
|
19130
|
+
for (; currentStep;) {
|
|
19131
|
+
const stepStartTime = currentStep.getStartTime(),
|
|
19132
|
+
stepDuration = currentStep.getDuration();
|
|
19133
|
+
if (cycleTime >= stepStartTime && cycleTime <= stepStartTime + stepDuration) {
|
|
19134
|
+
targetStep = currentStep;
|
|
19135
|
+
break;
|
|
19136
|
+
}
|
|
19137
|
+
currentStep = currentStep.next;
|
|
19138
|
+
}
|
|
19132
19139
|
}
|
|
19140
|
+
if (!targetStep) return;
|
|
19141
|
+
const ratio = (cycleTime - targetStep.getStartTime()) / targetStep.getDuration(),
|
|
19142
|
+
isEnd = ratio >= 1;
|
|
19143
|
+
targetStep.update(isEnd, ratio, {}), isEnd && targetStep.onEnd();
|
|
19144
|
+
}
|
|
19145
|
+
updateDuration() {
|
|
19146
|
+
this._lastStep ? (this._duration = this._lastStep.getStartTime() + this._lastStep.getDuration(), this._totalDuration = this._duration * (this._loopCount + 1)) : this._duration = 0;
|
|
19147
|
+
}
|
|
19148
|
+
getTotalDuration() {
|
|
19149
|
+
return this._totalDuration;
|
|
19150
|
+
}
|
|
19151
|
+
getLoop() {
|
|
19152
|
+
return this._loopCount;
|
|
19153
|
+
}
|
|
19154
|
+
}
|
|
19155
|
+
|
|
19156
|
+
class ACustomAnimate extends Step {
|
|
19157
|
+
constructor(customFrom, customTo, duration, easing, params) {
|
|
19158
|
+
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
|
|
19159
|
+
}
|
|
19160
|
+
update(end, ratio, out) {
|
|
19161
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
19162
|
+
const easedRatio = this.easing(ratio);
|
|
19163
|
+
this.onUpdate(end, easedRatio, out);
|
|
19164
|
+
}
|
|
19165
|
+
setProps(props) {
|
|
19166
|
+
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
19167
|
+
}
|
|
19133
19168
|
}
|
|
19134
|
-
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
19135
|
-
mixin(CircleAxis, CircleAxisMixin);
|
|
19136
19169
|
|
|
19137
19170
|
class GroupTransition extends ACustomAnimate {
|
|
19138
19171
|
constructor() {
|
|
@@ -20028,11 +20061,10 @@ function bitmapTool(width, height, padding = { top: 0, left: 0, right: 0, bottom
|
|
|
20028
20061
|
}
|
|
20029
20062
|
function clampRangeByBitmap($, range) {
|
|
20030
20063
|
const { x1, x2, y1, y2 } = range;
|
|
20031
|
-
const
|
|
20032
|
-
const
|
|
20033
|
-
const
|
|
20034
|
-
const
|
|
20035
|
-
const _y2 = clamp(y2, -top, $.height + bottom);
|
|
20064
|
+
const _x1 = clamp(x1, 0, $.width);
|
|
20065
|
+
const _x2 = clamp(x2, 0, $.width);
|
|
20066
|
+
const _y1 = clamp(y1, 0, $.height);
|
|
20067
|
+
const _y2 = clamp(y2, 0, $.height);
|
|
20036
20068
|
return {
|
|
20037
20069
|
x1: $.x(_x1),
|
|
20038
20070
|
x2: $.x(_x2),
|
|
@@ -20167,91 +20199,6 @@ function clampText(text, width, height, padding = {}) {
|
|
|
20167
20199
|
return { dx, dy };
|
|
20168
20200
|
}
|
|
20169
20201
|
|
|
20170
|
-
const fadeIn = (textAttribute = {}) => {
|
|
20171
|
-
var _a, _b, _c;
|
|
20172
|
-
return {
|
|
20173
|
-
from: {
|
|
20174
|
-
opacity: 0,
|
|
20175
|
-
fillOpacity: 0,
|
|
20176
|
-
strokeOpacity: 0
|
|
20177
|
-
},
|
|
20178
|
-
to: {
|
|
20179
|
-
opacity: (_a = textAttribute.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
20180
|
-
fillOpacity: (_b = textAttribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
20181
|
-
strokeOpacity: (_c = textAttribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
|
|
20182
|
-
}
|
|
20183
|
-
};
|
|
20184
|
-
};
|
|
20185
|
-
const fadeOut = (textAttribute = {}) => {
|
|
20186
|
-
var _a, _b, _c;
|
|
20187
|
-
return {
|
|
20188
|
-
from: {
|
|
20189
|
-
opacity: (_a = textAttribute.opacity) !== null && _a !== void 0 ? _a : 1,
|
|
20190
|
-
fillOpacity: (_b = textAttribute.fillOpacity) !== null && _b !== void 0 ? _b : 1,
|
|
20191
|
-
strokeOpacity: (_c = textAttribute.strokeOpacity) !== null && _c !== void 0 ? _c : 1
|
|
20192
|
-
},
|
|
20193
|
-
to: {
|
|
20194
|
-
opacity: 0,
|
|
20195
|
-
fillOpacity: 0,
|
|
20196
|
-
strokeOpacity: 0
|
|
20197
|
-
}
|
|
20198
|
-
};
|
|
20199
|
-
};
|
|
20200
|
-
const animationEffects = { fadeIn, fadeOut };
|
|
20201
|
-
function getAnimationAttributes(textAttribute, type) {
|
|
20202
|
-
var _a, _b;
|
|
20203
|
-
return (_b = (_a = animationEffects[type]) === null || _a === void 0 ? void 0 : _a.call(animationEffects, textAttribute)) !== null && _b !== void 0 ? _b : { from: {}, to: {} };
|
|
20204
|
-
}
|
|
20205
|
-
function updateAnimation(prev, next, animationConfig) {
|
|
20206
|
-
const changeAttributes = (prev, next) => {
|
|
20207
|
-
const changed = {};
|
|
20208
|
-
for (const key in next.attribute) {
|
|
20209
|
-
if (prev.attribute[key] !== next.attribute[key]) {
|
|
20210
|
-
changed[key] = next.attribute[key];
|
|
20211
|
-
}
|
|
20212
|
-
}
|
|
20213
|
-
return changed;
|
|
20214
|
-
};
|
|
20215
|
-
if (!isArray(animationConfig)) {
|
|
20216
|
-
const { duration, easing, increaseEffect = true } = animationConfig;
|
|
20217
|
-
prev.animate().to(changeAttributes(prev, next), duration, easing);
|
|
20218
|
-
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
20219
|
-
playIncreaseCount(prev, next, duration, easing);
|
|
20220
|
-
}
|
|
20221
|
-
return;
|
|
20222
|
-
}
|
|
20223
|
-
animationConfig.forEach(cfg => {
|
|
20224
|
-
const { duration, easing, increaseEffect = true, channel } = cfg;
|
|
20225
|
-
const { to } = update(prev, next, channel, cfg.options);
|
|
20226
|
-
if (!isEmpty(to)) {
|
|
20227
|
-
prev.animate().to(changeAttributes(prev, next), duration, easing);
|
|
20228
|
-
}
|
|
20229
|
-
if (increaseEffect && prev.type === 'text' && next.type === 'text') {
|
|
20230
|
-
playIncreaseCount(prev, next, duration, easing);
|
|
20231
|
-
}
|
|
20232
|
-
});
|
|
20233
|
-
}
|
|
20234
|
-
const update = (prev, next, channel, options) => {
|
|
20235
|
-
const from = Object.assign({}, prev.attribute);
|
|
20236
|
-
const to = Object.assign({}, next.attribute);
|
|
20237
|
-
array(options === null || options === void 0 ? void 0 : options.excludeChannels).forEach(key => {
|
|
20238
|
-
delete to[key];
|
|
20239
|
-
});
|
|
20240
|
-
Object.keys(to).forEach(key => {
|
|
20241
|
-
if (channel && !channel.includes(key)) {
|
|
20242
|
-
delete to[key];
|
|
20243
|
-
}
|
|
20244
|
-
});
|
|
20245
|
-
return { from, to };
|
|
20246
|
-
};
|
|
20247
|
-
function playIncreaseCount(prev, next, duration, easing) {
|
|
20248
|
-
if (prev.attribute.text !== next.attribute.text &&
|
|
20249
|
-
isValidNumber(Number(prev.attribute.text) * Number(next.attribute.text))) {
|
|
20250
|
-
prev
|
|
20251
|
-
.animate()
|
|
20252
|
-
.play(new IncreaseCount({ text: prev.attribute.text }, { text: next.attribute.text }, duration, easing));
|
|
20253
|
-
}
|
|
20254
|
-
}
|
|
20255
20202
|
const DefaultLabelAnimation = {
|
|
20256
20203
|
mode: 'same-time',
|
|
20257
20204
|
duration: 300,
|
|
@@ -20730,8 +20677,8 @@ class LabelBase extends AbstractComponent {
|
|
|
20730
20677
|
}, attrs, new CustomPath2D());
|
|
20731
20678
|
};
|
|
20732
20679
|
}
|
|
20733
|
-
if (baseMark && baseMark.
|
|
20734
|
-
lineGraphic.setAttribute('stroke', baseMark.
|
|
20680
|
+
if (baseMark && baseMark.getAttributes(true).fill) {
|
|
20681
|
+
lineGraphic.setAttribute('stroke', baseMark.getAttributes(true).fill);
|
|
20735
20682
|
}
|
|
20736
20683
|
if (this.attribute.line && !isEmpty(this.attribute.line.style)) {
|
|
20737
20684
|
lineGraphic.setAttributes(this.attribute.line.style);
|
|
@@ -20921,11 +20868,12 @@ class LabelBase extends AbstractComponent {
|
|
|
20921
20868
|
if (!baseMark) {
|
|
20922
20869
|
continue;
|
|
20923
20870
|
}
|
|
20871
|
+
const graphicAttribute = baseMark.getAttributes(true);
|
|
20924
20872
|
const labelAttribute = Object.assign(Object.assign({ fill: this._isCollectionBase
|
|
20925
|
-
? isArray(
|
|
20926
|
-
?
|
|
20927
|
-
:
|
|
20928
|
-
:
|
|
20873
|
+
? isArray(graphicAttribute.stroke)
|
|
20874
|
+
? graphicAttribute.stroke.find(entry => !!entry && entry !== true)
|
|
20875
|
+
: graphicAttribute.stroke
|
|
20876
|
+
: graphicAttribute.fill }, textStyle), textData);
|
|
20929
20877
|
const text = this._createLabelText(labelAttribute);
|
|
20930
20878
|
labels.push(text);
|
|
20931
20879
|
}
|
|
@@ -20983,9 +20931,7 @@ class LabelBase extends AbstractComponent {
|
|
|
20983
20931
|
return this._overlapByStrategy(labels, option, bmpTool, bitmap);
|
|
20984
20932
|
}
|
|
20985
20933
|
_overlapGlobal(labels, option, bmpTool, bitmap) {
|
|
20986
|
-
let result = labels.filter(label => label.attribute.visible &&
|
|
20987
|
-
label.attribute.opacity !== 0 &&
|
|
20988
|
-
this.isMarkInsideRect(this.getRelatedGraphic(label.attribute), bmpTool));
|
|
20934
|
+
let result = labels.filter(label => label.attribute.visible && label.attribute.opacity !== 0);
|
|
20989
20935
|
const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;
|
|
20990
20936
|
if (clampForce) {
|
|
20991
20937
|
for (let i = 0; i < result.length; i++) {
|
|
@@ -21077,7 +21023,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21077
21023
|
const text = labels[i];
|
|
21078
21024
|
const baseMark = this.getRelatedGraphic(text.attribute);
|
|
21079
21025
|
text.update();
|
|
21080
|
-
if (!
|
|
21026
|
+
if (!isRectIntersect(baseMark.AABBBounds, { x1: 0, x2: bmpTool.width, y1: 0, y2: bmpTool.height }, true)) {
|
|
21081
21027
|
continue;
|
|
21082
21028
|
}
|
|
21083
21029
|
if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {
|
|
@@ -21117,23 +21063,6 @@ class LabelBase extends AbstractComponent {
|
|
|
21117
21063
|
}
|
|
21118
21064
|
return result;
|
|
21119
21065
|
}
|
|
21120
|
-
isMarkInsideRect(baseMark, bmpTool) {
|
|
21121
|
-
const { left, right, top, bottom } = bmpTool.padding;
|
|
21122
|
-
const rect = { x1: -left, x2: bmpTool.width + right, y1: -top, y2: bmpTool.height + bottom };
|
|
21123
|
-
const bounds = baseMark.AABBBounds;
|
|
21124
|
-
if (bounds.width() !== 0 && bounds.height() !== 0) {
|
|
21125
|
-
return isRectIntersect(baseMark.AABBBounds, rect, true);
|
|
21126
|
-
}
|
|
21127
|
-
const { attribute } = baseMark;
|
|
21128
|
-
if (baseMark.type === 'rect') {
|
|
21129
|
-
const { x, x1, y, y1 } = attribute;
|
|
21130
|
-
return pointInRect({ x: x !== null && x !== void 0 ? x : x1, y: y !== null && y !== void 0 ? y : y1 }, rect, true);
|
|
21131
|
-
}
|
|
21132
|
-
else if ('x' in attribute && 'y' in attribute) {
|
|
21133
|
-
return pointInRect({ x: attribute.x, y: attribute.y }, rect, true);
|
|
21134
|
-
}
|
|
21135
|
-
return false;
|
|
21136
|
-
}
|
|
21137
21066
|
getBaseMarkGroup() {
|
|
21138
21067
|
const { baseMarkGroupName } = this.attribute;
|
|
21139
21068
|
if (!baseMarkGroupName) {
|
|
@@ -21197,54 +21126,67 @@ class LabelBase extends AbstractComponent {
|
|
|
21197
21126
|
this._removeLabel(prevTextMap);
|
|
21198
21127
|
this._graphicToText = currentTextMap;
|
|
21199
21128
|
}
|
|
21200
|
-
|
|
21201
|
-
|
|
21129
|
+
runEnterAnimation(text) {
|
|
21130
|
+
if (this._enableAnimation === false || !this._animationConfig.enter) {
|
|
21131
|
+
return;
|
|
21132
|
+
}
|
|
21202
21133
|
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
21203
|
-
this.
|
|
21204
|
-
|
|
21205
|
-
|
|
21206
|
-
|
|
21207
|
-
|
|
21208
|
-
|
|
21209
|
-
|
|
21210
|
-
|
|
21211
|
-
|
|
21212
|
-
|
|
21134
|
+
const { enter } = this._animationConfig;
|
|
21135
|
+
text.applyAnimationState(['enter'], [
|
|
21136
|
+
{
|
|
21137
|
+
name: 'enter',
|
|
21138
|
+
animation: Object.assign(Object.assign({}, enter), { selfOnly: true, customParameters: {
|
|
21139
|
+
relatedGraphic
|
|
21140
|
+
} })
|
|
21141
|
+
}
|
|
21142
|
+
]);
|
|
21143
|
+
}
|
|
21144
|
+
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
21145
|
+
if (this._enableAnimation === false || !this._animationConfig.update) {
|
|
21146
|
+
return;
|
|
21147
|
+
}
|
|
21148
|
+
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
21149
|
+
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
21150
|
+
const { duration, easing } = this._animationConfig.update;
|
|
21151
|
+
prevText.applyAnimationState(['update'], [
|
|
21152
|
+
{
|
|
21153
|
+
name: 'update',
|
|
21154
|
+
animation: {
|
|
21155
|
+
type: 'labelUpdate',
|
|
21156
|
+
duration,
|
|
21157
|
+
easing,
|
|
21158
|
+
customParameters: {
|
|
21159
|
+
prevText,
|
|
21160
|
+
curText,
|
|
21161
|
+
prevLabelLine,
|
|
21162
|
+
curLabelLine
|
|
21163
|
+
}
|
|
21213
21164
|
}
|
|
21214
|
-
this._animationConfig.enter.duration > 0 &&
|
|
21215
|
-
relatedGraphic.once('animate-bind', a => {
|
|
21216
|
-
text.setAttributes(from);
|
|
21217
|
-
labelLine && labelLine.setAttributes(from);
|
|
21218
|
-
const listener = this._afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, this._animationConfig.enter);
|
|
21219
|
-
relatedGraphic.on('afterAttributeUpdate', listener);
|
|
21220
|
-
});
|
|
21221
21165
|
}
|
|
21166
|
+
]);
|
|
21167
|
+
}
|
|
21168
|
+
_addLabel(label, texts, labelLines, index) {
|
|
21169
|
+
const { text, labelLine } = label;
|
|
21170
|
+
if (text) {
|
|
21171
|
+
this.add(text);
|
|
21222
21172
|
}
|
|
21223
|
-
|
|
21224
|
-
|
|
21225
|
-
this.add(text);
|
|
21226
|
-
}
|
|
21227
|
-
if (labelLine) {
|
|
21228
|
-
this.add(labelLine);
|
|
21229
|
-
}
|
|
21173
|
+
if (labelLine) {
|
|
21174
|
+
this.add(labelLine);
|
|
21230
21175
|
}
|
|
21176
|
+
this.runEnterAnimation(text);
|
|
21231
21177
|
}
|
|
21232
21178
|
_updateLabel(prevLabel, currentLabel) {
|
|
21233
21179
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
21234
21180
|
const { text: curText, labelLine: curLabelLine } = currentLabel;
|
|
21235
|
-
if (this._enableAnimation
|
|
21236
|
-
const { duration, easing } = this._animationConfig.update;
|
|
21237
|
-
updateAnimation(prevText, curText, this._animationConfig.update);
|
|
21238
|
-
if (prevLabelLine && curLabelLine) {
|
|
21239
|
-
prevLabel.labelLine.animate().to(curLabelLine.attribute, duration, easing);
|
|
21240
|
-
}
|
|
21241
|
-
}
|
|
21242
|
-
else {
|
|
21181
|
+
if (this._enableAnimation === false || !this._animationConfig.update) {
|
|
21243
21182
|
prevLabel.text.setAttributes(curText.attribute);
|
|
21244
21183
|
if (prevLabelLine && curLabelLine) {
|
|
21245
21184
|
prevLabel.labelLine.setAttributes(curLabelLine.attribute);
|
|
21246
21185
|
}
|
|
21247
21186
|
}
|
|
21187
|
+
else {
|
|
21188
|
+
this._runUpdateAnimation(prevLabel, currentLabel);
|
|
21189
|
+
}
|
|
21248
21190
|
}
|
|
21249
21191
|
_removeLabel(textMap) {
|
|
21250
21192
|
const removeLabelAndLine = (label) => {
|
|
@@ -21254,12 +21196,23 @@ class LabelBase extends AbstractComponent {
|
|
|
21254
21196
|
}
|
|
21255
21197
|
};
|
|
21256
21198
|
if (this._enableAnimation !== false && this._animationConfig.exit !== false) {
|
|
21257
|
-
const { duration, easing } = this._animationConfig.exit;
|
|
21258
21199
|
textMap.forEach(label => {
|
|
21259
21200
|
var _a;
|
|
21260
|
-
|
|
21201
|
+
label.text.applyAnimationState(['exit'], [
|
|
21202
|
+
{
|
|
21203
|
+
name: 'exit',
|
|
21204
|
+
animation: Object.assign({ type: 'fadeOut' }, this._animationConfig.exit)
|
|
21205
|
+
}
|
|
21206
|
+
], () => {
|
|
21261
21207
|
removeLabelAndLine(label);
|
|
21262
21208
|
});
|
|
21209
|
+
(_a = label.labelLine) === null || _a === void 0 ? void 0 : _a.applyAnimationState(['exit'], [
|
|
21210
|
+
{
|
|
21211
|
+
name: 'exit',
|
|
21212
|
+
animation: Object.assign({ type: 'fadeOut' }, this._animationConfig.exit)
|
|
21213
|
+
}
|
|
21214
|
+
], () => {
|
|
21215
|
+
});
|
|
21263
21216
|
});
|
|
21264
21217
|
}
|
|
21265
21218
|
else {
|
|
@@ -21280,75 +21233,6 @@ class LabelBase extends AbstractComponent {
|
|
|
21280
21233
|
}
|
|
21281
21234
|
});
|
|
21282
21235
|
}
|
|
21283
|
-
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
21284
|
-
if (this.attribute.syncState && relatedGraphic) {
|
|
21285
|
-
relatedGraphic.on('afterAttributeUpdate', this._handleRelatedGraphicSetState);
|
|
21286
|
-
}
|
|
21287
|
-
}
|
|
21288
|
-
_afterRelatedGraphicAttributeUpdate(text, texts, labelLine, labelLines, index, relatedGraphic, to, { mode, duration, easing, delay }) {
|
|
21289
|
-
const listener = (event) => {
|
|
21290
|
-
var _a, _b, _c;
|
|
21291
|
-
const { detail } = event;
|
|
21292
|
-
if (!detail) {
|
|
21293
|
-
return {};
|
|
21294
|
-
}
|
|
21295
|
-
const step = (_a = detail.animationState) === null || _a === void 0 ? void 0 : _a.step;
|
|
21296
|
-
const isValidAnimateState = detail.type === AttributeUpdateType.ANIMATE_UPDATE &&
|
|
21297
|
-
step &&
|
|
21298
|
-
!(step.type === 'wait' && ((_b = step.prev) === null || _b === void 0 ? void 0 : _b.type) == null);
|
|
21299
|
-
if (!isValidAnimateState) {
|
|
21300
|
-
return {};
|
|
21301
|
-
}
|
|
21302
|
-
if (detail.type === AttributeUpdateType.ANIMATE_END) {
|
|
21303
|
-
text.setAttributes(to);
|
|
21304
|
-
labelLine && labelLine.setAttributes(to);
|
|
21305
|
-
return;
|
|
21306
|
-
}
|
|
21307
|
-
const onStart = () => {
|
|
21308
|
-
if (relatedGraphic) {
|
|
21309
|
-
relatedGraphic.onAnimateBind = undefined;
|
|
21310
|
-
relatedGraphic.removeEventListener('afterAttributeUpdate', listener);
|
|
21311
|
-
}
|
|
21312
|
-
};
|
|
21313
|
-
switch (mode) {
|
|
21314
|
-
case 'after':
|
|
21315
|
-
if (detail.animationState.end) {
|
|
21316
|
-
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
21317
|
-
labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
|
|
21318
|
-
}
|
|
21319
|
-
break;
|
|
21320
|
-
case 'after-all':
|
|
21321
|
-
if (index === texts.length - 1) {
|
|
21322
|
-
if (detail.animationState.end) {
|
|
21323
|
-
texts.forEach(t => {
|
|
21324
|
-
t.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
21325
|
-
});
|
|
21326
|
-
labelLines.forEach(t => {
|
|
21327
|
-
t.animate().wait(delay).to(to, duration, easing);
|
|
21328
|
-
});
|
|
21329
|
-
}
|
|
21330
|
-
}
|
|
21331
|
-
break;
|
|
21332
|
-
case 'same-time':
|
|
21333
|
-
default:
|
|
21334
|
-
if (this._isCollectionBase) {
|
|
21335
|
-
const point = this._idToPoint.get(text.attribute.id);
|
|
21336
|
-
if (point &&
|
|
21337
|
-
(!text.animates || !text.animates.has('label-animate')) &&
|
|
21338
|
-
relatedGraphic.containsPoint(point.x, point.y, IContainPointMode.LOCAL, (_c = this.stage) === null || _c === void 0 ? void 0 : _c.getPickerService())) {
|
|
21339
|
-
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
21340
|
-
labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
|
|
21341
|
-
}
|
|
21342
|
-
}
|
|
21343
|
-
else if (detail.animationState.isFirstFrameOfStep) {
|
|
21344
|
-
text.animate({ onStart }).wait(delay).to(to, duration, easing);
|
|
21345
|
-
labelLine && labelLine.animate().wait(delay).to(to, duration, easing);
|
|
21346
|
-
}
|
|
21347
|
-
break;
|
|
21348
|
-
}
|
|
21349
|
-
};
|
|
21350
|
-
return listener;
|
|
21351
|
-
}
|
|
21352
21236
|
_smartInvert(labels) {
|
|
21353
21237
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
21354
21238
|
const option = (isObject(this.attribute.smartInvert) ? this.attribute.smartInvert : {});
|
|
@@ -21367,7 +21251,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21367
21251
|
continue;
|
|
21368
21252
|
}
|
|
21369
21253
|
const baseMark = this.getRelatedGraphic(label.attribute);
|
|
21370
|
-
let backgroundColor = baseMark.
|
|
21254
|
+
let backgroundColor = baseMark.getAttributes(true).fill;
|
|
21371
21255
|
let foregroundColor = label.attribute.fill;
|
|
21372
21256
|
if (isObject(backgroundColor) && backgroundColor.gradient) {
|
|
21373
21257
|
const firstStopColor = (_g = (_f = backgroundColor.stops) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.color;
|
|
@@ -21687,7 +21571,7 @@ class ArcLabel extends LabelBase {
|
|
|
21687
21571
|
data.forEach((d, index) => {
|
|
21688
21572
|
var _a, _b;
|
|
21689
21573
|
const currentMark = this._idToGraphic.get(d.id);
|
|
21690
|
-
const graphicAttribute = currentMark.
|
|
21574
|
+
const graphicAttribute = currentMark.getAttributes(true);
|
|
21691
21575
|
const center = { x: (_a = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.x) !== null && _a !== void 0 ? _a : 0, y: (_b = graphicAttribute === null || graphicAttribute === void 0 ? void 0 : graphicAttribute.y) !== null && _b !== void 0 ? _b : 0 };
|
|
21692
21576
|
if (!isNil(data[index]) && !isNil(textBoundsArray[index])) {
|
|
21693
21577
|
const item = data[index] ? data[index] : null;
|
|
@@ -21872,8 +21756,8 @@ class ArcLabel extends LabelBase {
|
|
|
21872
21756
|
};
|
|
21873
21757
|
let maxRadius = 0;
|
|
21874
21758
|
currentMarks.forEach((currentMark) => {
|
|
21875
|
-
if (currentMark.
|
|
21876
|
-
maxRadius = currentMark.
|
|
21759
|
+
if (currentMark.getAttributes(true).outerRadius > maxRadius) {
|
|
21760
|
+
maxRadius = currentMark.getAttributes(true).outerRadius;
|
|
21877
21761
|
}
|
|
21878
21762
|
});
|
|
21879
21763
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -22106,8 +21990,8 @@ class ArcLabel extends LabelBase {
|
|
|
22106
21990
|
const labelConfig = attribute;
|
|
22107
21991
|
let maxRadius = 0;
|
|
22108
21992
|
currentMarks.forEach((currentMark) => {
|
|
22109
|
-
if (currentMark.
|
|
22110
|
-
maxRadius = currentMark.
|
|
21993
|
+
if (currentMark.getAttributes(true).outerRadius > maxRadius) {
|
|
21994
|
+
maxRadius = currentMark.getAttributes(true).outerRadius;
|
|
22111
21995
|
}
|
|
22112
21996
|
});
|
|
22113
21997
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -22149,8 +22033,8 @@ class ArcLabel extends LabelBase {
|
|
|
22149
22033
|
const plotRect = { width: center.x * 2, height: center.y * 2 };
|
|
22150
22034
|
let maxRadius = 0;
|
|
22151
22035
|
currentMarks.forEach((currentMark) => {
|
|
22152
|
-
if (currentMark.
|
|
22153
|
-
maxRadius = currentMark.
|
|
22036
|
+
if (currentMark.getAttributes(true).outerRadius > maxRadius) {
|
|
22037
|
+
maxRadius = currentMark.getAttributes(true).outerRadius;
|
|
22154
22038
|
}
|
|
22155
22039
|
});
|
|
22156
22040
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -22221,8 +22105,8 @@ class ArcLabel extends LabelBase {
|
|
|
22221
22105
|
const line1MinLength = labelConfig.line.line1MinLength;
|
|
22222
22106
|
let maxRadius = 0;
|
|
22223
22107
|
currentMarks.forEach((currentMark) => {
|
|
22224
|
-
if (currentMark.
|
|
22225
|
-
maxRadius = currentMark.
|
|
22108
|
+
if (currentMark.getAttributes(true).outerRadius > maxRadius) {
|
|
22109
|
+
maxRadius = currentMark.getAttributes(true).outerRadius;
|
|
22226
22110
|
}
|
|
22227
22111
|
});
|
|
22228
22112
|
const radiusRatio = this.computeLayoutOuterRadius(maxRadius, attribute.width, attribute.height);
|
|
@@ -22310,7 +22194,7 @@ class ArcLabel extends LabelBase {
|
|
|
22310
22194
|
});
|
|
22311
22195
|
}
|
|
22312
22196
|
if (baseMark.type === 'arc3d' && baseMark) {
|
|
22313
|
-
const { beta, x, y } = baseMark.
|
|
22197
|
+
const { beta, x, y } = baseMark.getAttributes(true);
|
|
22314
22198
|
lineGraphic.setAttributes({
|
|
22315
22199
|
beta,
|
|
22316
22200
|
anchor3d: [x, y]
|
|
@@ -27222,17 +27106,23 @@ class Slider extends AbstractComponent {
|
|
|
27222
27106
|
};
|
|
27223
27107
|
this._onHandlerPointerdown = (e) => {
|
|
27224
27108
|
e.stopPropagation();
|
|
27225
|
-
this._clearAllDragEvents();
|
|
27226
27109
|
this._isChanging = true;
|
|
27227
27110
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27228
27111
|
this._currentHandler = e.target;
|
|
27229
27112
|
this._prePos = this._isHorizontal ? x : y;
|
|
27230
|
-
|
|
27231
|
-
|
|
27232
|
-
|
|
27233
|
-
|
|
27234
|
-
|
|
27235
|
-
}
|
|
27113
|
+
if (vglobal.env === 'browser') {
|
|
27114
|
+
vglobal.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27115
|
+
capture: true
|
|
27116
|
+
});
|
|
27117
|
+
vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27118
|
+
}
|
|
27119
|
+
else {
|
|
27120
|
+
this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27121
|
+
capture: true
|
|
27122
|
+
});
|
|
27123
|
+
this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27124
|
+
this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27125
|
+
}
|
|
27236
27126
|
};
|
|
27237
27127
|
this._onHandlerPointerMove = (e) => {
|
|
27238
27128
|
var _a, _b;
|
|
@@ -27275,20 +27165,38 @@ class Slider extends AbstractComponent {
|
|
|
27275
27165
|
e.preventDefault();
|
|
27276
27166
|
this._isChanging = false;
|
|
27277
27167
|
this._currentHandler = null;
|
|
27278
|
-
|
|
27168
|
+
if (vglobal.env === 'browser') {
|
|
27169
|
+
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27170
|
+
capture: true
|
|
27171
|
+
});
|
|
27172
|
+
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27173
|
+
}
|
|
27174
|
+
else {
|
|
27175
|
+
this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27176
|
+
capture: true
|
|
27177
|
+
});
|
|
27178
|
+
this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27179
|
+
this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27180
|
+
}
|
|
27279
27181
|
};
|
|
27280
27182
|
this._onTrackPointerdown = (e) => {
|
|
27281
27183
|
e.stopPropagation();
|
|
27282
|
-
this._clearAllDragEvents();
|
|
27283
27184
|
this._isChanging = true;
|
|
27284
27185
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27285
27186
|
this._prePos = this._isHorizontal ? x : y;
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
}
|
|
27187
|
+
if (vglobal.env === 'browser') {
|
|
27188
|
+
vglobal.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27189
|
+
capture: true
|
|
27190
|
+
});
|
|
27191
|
+
vglobal.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27192
|
+
}
|
|
27193
|
+
else {
|
|
27194
|
+
this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27195
|
+
capture: true
|
|
27196
|
+
});
|
|
27197
|
+
this.stage.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27198
|
+
this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27199
|
+
}
|
|
27292
27200
|
};
|
|
27293
27201
|
this._onTrackPointerMove = (e) => {
|
|
27294
27202
|
e.stopPropagation();
|
|
@@ -27345,11 +27253,22 @@ class Slider extends AbstractComponent {
|
|
|
27345
27253
|
this._onTrackPointerUp = (e) => {
|
|
27346
27254
|
e.preventDefault();
|
|
27347
27255
|
this._isChanging = false;
|
|
27348
|
-
|
|
27256
|
+
if (vglobal.env === 'browser') {
|
|
27257
|
+
vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27258
|
+
capture: true
|
|
27259
|
+
});
|
|
27260
|
+
vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27261
|
+
}
|
|
27262
|
+
else {
|
|
27263
|
+
this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27264
|
+
capture: true
|
|
27265
|
+
});
|
|
27266
|
+
this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27267
|
+
this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27268
|
+
}
|
|
27349
27269
|
};
|
|
27350
27270
|
this._onRailPointerDown = (e) => {
|
|
27351
27271
|
e.stopPropagation();
|
|
27352
|
-
this._clearAllDragEvents();
|
|
27353
27272
|
this._isChanging = true;
|
|
27354
27273
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27355
27274
|
if (max === min) {
|
|
@@ -27737,18 +27656,6 @@ class Slider extends AbstractComponent {
|
|
|
27737
27656
|
this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
|
|
27738
27657
|
this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
|
|
27739
27658
|
}
|
|
27740
|
-
_clearAllDragEvents() {
|
|
27741
|
-
const triggers = getEndTriggersOfDrag();
|
|
27742
|
-
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
27743
|
-
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
27744
|
-
triggers.forEach((trigger) => {
|
|
27745
|
-
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
27746
|
-
});
|
|
27747
|
-
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
27748
|
-
triggers.forEach((trigger) => {
|
|
27749
|
-
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
27750
|
-
});
|
|
27751
|
-
}
|
|
27752
27659
|
_updateTrack() {
|
|
27753
27660
|
const { inverse, railWidth, railHeight } = this.attribute;
|
|
27754
27661
|
const startHandler = this._startHandler;
|
|
@@ -31346,97 +31253,6 @@ class StoryLabelItem extends AbstractComponent {
|
|
|
31346
31253
|
this._titleBottom = titleBottom;
|
|
31347
31254
|
this._line = line;
|
|
31348
31255
|
}
|
|
31349
|
-
appearAnimate(animateConfig) {
|
|
31350
|
-
const { duration = 1000, easing = 'quadOut', symbolStartOuterType = 'scale', titleType = 'typewriter', titlePanelType = 'scale' } = animateConfig;
|
|
31351
|
-
const symbolTime = duration / 10;
|
|
31352
|
-
this._symbolStart.setAttributes({ scaleX: 0, scaleY: 0 });
|
|
31353
|
-
this._symbolStart.animate().to({ scaleX: 1, scaleY: 1 }, symbolTime * 5, easing);
|
|
31354
|
-
let symbolStartOuterFrom;
|
|
31355
|
-
let symbolStartOuterTo;
|
|
31356
|
-
if (symbolStartOuterType === 'scale') {
|
|
31357
|
-
symbolStartOuterFrom = { scaleX: 0, scaleY: 0 };
|
|
31358
|
-
symbolStartOuterTo = { scaleX: 1, scaleY: 1 };
|
|
31359
|
-
}
|
|
31360
|
-
else {
|
|
31361
|
-
symbolStartOuterFrom = { clipRange: 0 };
|
|
31362
|
-
symbolStartOuterTo = { clipRange: 1 };
|
|
31363
|
-
}
|
|
31364
|
-
this._symbolStartOuter.setAttributes(symbolStartOuterFrom);
|
|
31365
|
-
this._symbolStartOuter.animate().to(symbolStartOuterTo, symbolTime * 5, easing);
|
|
31366
|
-
this._symbolEnd.setAttributes({ scaleX: 0, scaleY: 0 });
|
|
31367
|
-
this._symbolEnd
|
|
31368
|
-
.animate()
|
|
31369
|
-
.wait(symbolTime * 8)
|
|
31370
|
-
.to({ scaleX: 1, scaleY: 1 }, symbolTime * 2, easing);
|
|
31371
|
-
this._line.setAttributes({ clipRange: 0 });
|
|
31372
|
-
this._line.animate().to({ clipRange: 1 }, symbolTime * 9, easing);
|
|
31373
|
-
if (titleType === 'typewriter') {
|
|
31374
|
-
const titleTopText = this._titleTop.attribute.text;
|
|
31375
|
-
this._titleTop.setAttributes({ text: '' });
|
|
31376
|
-
this._titleTop
|
|
31377
|
-
.animate()
|
|
31378
|
-
.wait(symbolTime * 5)
|
|
31379
|
-
.play(new InputText({ text: '' }, { text: titleTopText }, symbolTime * 4, 'linear'));
|
|
31380
|
-
const titleBottomText = this._titleBottom.attribute.text;
|
|
31381
|
-
this._titleBottom.setAttributes({ text: '' });
|
|
31382
|
-
this._titleBottom
|
|
31383
|
-
.animate()
|
|
31384
|
-
.wait(symbolTime * 5)
|
|
31385
|
-
.play(new InputText({ text: '' }, { text: titleBottomText }, symbolTime * 4, 'linear'));
|
|
31386
|
-
}
|
|
31387
|
-
else {
|
|
31388
|
-
this._titleTop.setAttributes({ dy: this._titleTop.AABBBounds.height() + 10 });
|
|
31389
|
-
this._titleTop
|
|
31390
|
-
.animate()
|
|
31391
|
-
.wait(symbolTime * 5)
|
|
31392
|
-
.to({ dy: 0 }, symbolTime * 4, 'linear');
|
|
31393
|
-
this._titleBottom.setAttributes({ dy: -(10 + this._titleBottom.AABBBounds.height()) });
|
|
31394
|
-
this._titleBottom
|
|
31395
|
-
.animate()
|
|
31396
|
-
.wait(symbolTime * 5)
|
|
31397
|
-
.to({ dy: 0 }, symbolTime * 4, 'linear');
|
|
31398
|
-
}
|
|
31399
|
-
if (titlePanelType === 'scale') {
|
|
31400
|
-
[this._titleTopPanel, this._titleBottomPanel].forEach(panel => {
|
|
31401
|
-
const scaleX = panel.attribute.scaleX;
|
|
31402
|
-
panel.setAttributes({ scaleX: 0 });
|
|
31403
|
-
panel.animate().to({ scaleX }, duration, 'circInOut');
|
|
31404
|
-
});
|
|
31405
|
-
}
|
|
31406
|
-
else if (titlePanelType === 'stroke') {
|
|
31407
|
-
[this._titleTopPanel, this._titleBottomPanel].forEach(panel => {
|
|
31408
|
-
const b = panel.AABBBounds;
|
|
31409
|
-
const totalLen = (b.width() + b.height()) * 2;
|
|
31410
|
-
panel.setAttributes({ lineDash: [0, totalLen * 10] });
|
|
31411
|
-
panel.animate().to({ lineDash: [totalLen, totalLen * 10] }, duration, 'quadOut');
|
|
31412
|
-
});
|
|
31413
|
-
}
|
|
31414
|
-
}
|
|
31415
|
-
disappearAnimate(animateConfig) {
|
|
31416
|
-
if (animateConfig.mode === 'scale') {
|
|
31417
|
-
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
31418
|
-
this.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing);
|
|
31419
|
-
}
|
|
31420
|
-
else {
|
|
31421
|
-
const { duration = 1000, easing = 'quadOut' } = animateConfig;
|
|
31422
|
-
this._line.animate().to({ clipRange: 0 }, duration, easing);
|
|
31423
|
-
this._symbolStart
|
|
31424
|
-
.animate()
|
|
31425
|
-
.wait(duration / 2)
|
|
31426
|
-
.to({ scaleX: 0, scaleY: 0 }, duration / 2, easing);
|
|
31427
|
-
this._symbolEnd.animate().to({ scaleX: 0, scaleY: 0 }, duration, easing);
|
|
31428
|
-
this._titleTop.animate().to({ dy: this._titleTop.AABBBounds.height() + 10 }, duration / 2, easing);
|
|
31429
|
-
this._titleBottom
|
|
31430
|
-
.animate()
|
|
31431
|
-
.to({ dy: -(10 + this._titleBottom.AABBBounds.height()) }, duration / 2, easing);
|
|
31432
|
-
this._symbolStartOuter
|
|
31433
|
-
.animate()
|
|
31434
|
-
.wait(duration / 2)
|
|
31435
|
-
.to({ clipRange: 0 }, duration / 2, easing);
|
|
31436
|
-
this._titleTopPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');
|
|
31437
|
-
this._titleBottomPanel.animate().to({ scaleX: 0 }, duration, 'circInOut');
|
|
31438
|
-
}
|
|
31439
|
-
}
|
|
31440
31256
|
}
|
|
31441
31257
|
StoryLabelItem.defaultAttributes = {
|
|
31442
31258
|
contentOffsetX: 100,
|
|
@@ -31482,6 +31298,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31482
31298
|
theme: 'default'
|
|
31483
31299
|
};
|
|
31484
31300
|
|
|
31485
|
-
const version = "0.
|
|
31301
|
+
const version = "0.23.0-alpha.3";
|
|
31486
31302
|
|
|
31487
31303
|
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 };
|