@visactor/vrender-components 0.23.0-alpha.3 → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/animation/animate-component.d.ts +22 -0
- package/cjs/animation/animate-component.js +29 -0
- package/cjs/animation/animate-component.js.map +1 -0
- package/cjs/animation/axis-animate.d.ts +10 -0
- package/cjs/animation/axis-animate.js +71 -0
- package/cjs/animation/axis-animate.js.map +1 -0
- package/cjs/animation/label-animate.d.ts +10 -0
- package/cjs/animation/label-animate.js +80 -0
- package/cjs/animation/label-animate.js.map +1 -0
- package/cjs/axis/animate/config.d.ts +6 -0
- package/cjs/axis/animate/config.js +10 -0
- package/cjs/axis/animate/config.js.map +1 -0
- package/cjs/axis/animate/group-transition.d.ts +2 -1
- package/cjs/axis/animate/group-transition.js +2 -2
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +7 -2
- package/cjs/axis/base.js +70 -5
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/register.js +2 -2
- package/cjs/axis/register.js.map +1 -1
- package/cjs/axis/type.d.ts +4 -0
- package/cjs/axis/type.js.map +1 -1
- package/cjs/brush/config.js +1 -2
- package/cjs/brush/type.js +2 -1
- package/cjs/crosshair/rect.js +1 -2
- package/cjs/crosshair/type.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/register.js +1 -2
- package/cjs/jsx/index.js +2 -1
- package/cjs/label/animate/animate.d.ts +1 -12
- package/cjs/label/animate/animate.js +1 -78
- package/cjs/label/animate/animate.js.map +1 -1
- package/cjs/label/base.d.ts +4 -3
- package/cjs/label/base.js +40 -32
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/dataLabel.js +1 -1
- package/cjs/label/overlap/scaler.js +3 -3
- package/cjs/label/overlap/scaler.js.map +1 -1
- package/cjs/label/register.d.ts +1 -0
- package/cjs/label/register.js +8 -4
- package/cjs/label/register.js.map +1 -1
- package/cjs/label-item/index.js +1 -1
- package/cjs/label-item/label-item.js +1 -1
- 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/contribution.js +4 -2
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +5 -0
- package/cjs/poptip/poptip.js +87 -18
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/poptip/type.d.ts +4 -1
- package/cjs/poptip/type.js.map +1 -1
- package/cjs/tag/tag.js +60 -56
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/weather/weather-box.d.ts +1 -2
- package/cjs/weather/weather-box.js.map +1 -1
- package/dist/index.es.js +2398 -1787
- package/es/animation/animate-component.d.ts +22 -0
- package/es/animation/animate-component.js +21 -0
- package/es/animation/animate-component.js.map +1 -0
- package/es/animation/axis-animate.d.ts +10 -0
- package/es/animation/axis-animate.js +60 -0
- package/es/animation/axis-animate.js.map +1 -0
- package/es/animation/label-animate.d.ts +10 -0
- package/es/animation/label-animate.js +69 -0
- package/es/animation/label-animate.js.map +1 -0
- package/es/axis/animate/config.d.ts +6 -0
- package/es/axis/animate/config.js +6 -0
- package/es/axis/animate/config.js.map +1 -0
- package/es/axis/animate/group-transition.d.ts +2 -1
- package/es/axis/animate/group-transition.js +3 -1
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +7 -2
- package/es/axis/base.js +75 -9
- package/es/axis/base.js.map +1 -1
- package/es/axis/line.js.map +1 -1
- package/es/axis/register.js +3 -1
- package/es/axis/register.js.map +1 -1
- package/es/axis/type.d.ts +4 -0
- package/es/axis/type.js.map +1 -1
- package/es/brush/config.js +1 -2
- package/es/brush/type.js +2 -1
- package/es/crosshair/rect.js +1 -2
- package/es/crosshair/type.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/register.js +1 -2
- package/es/jsx/index.js +2 -1
- package/es/label/animate/animate.d.ts +1 -12
- package/es/label/animate/animate.js +0 -76
- package/es/label/animate/animate.js.map +1 -1
- package/es/label/base.d.ts +4 -3
- package/es/label/base.js +42 -32
- package/es/label/base.js.map +1 -1
- package/es/label/dataLabel.js +1 -1
- package/es/label/overlap/scaler.js +1 -1
- package/es/label/overlap/scaler.js.map +1 -1
- package/es/label/register.d.ts +1 -0
- package/es/label/register.js +7 -1
- package/es/label/register.js.map +1 -1
- package/es/label-item/index.js +1 -1
- package/es/label-item/label-item.js +1 -1
- 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/contribution.js +4 -2
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/poptip.d.ts +5 -0
- package/es/poptip/poptip.js +85 -19
- package/es/poptip/poptip.js.map +1 -1
- package/es/poptip/type.d.ts +4 -1
- package/es/poptip/type.js.map +1 -1
- package/es/tag/tag.js +59 -56
- package/es/tag/tag.js.map +1 -1
- package/es/weather/weather-box.d.ts +1 -2
- package/es/weather/weather-box.js.map +1 -1
- package/package.json +7 -7
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,
|
|
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, isNumber, sqrt, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, Color, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Generator {
|
|
@@ -825,6 +825,20 @@ var MeasureModeEnum;
|
|
|
825
825
|
MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
|
|
826
826
|
}(MeasureModeEnum || (MeasureModeEnum = {}));
|
|
827
827
|
|
|
828
|
+
var AnimateMode;
|
|
829
|
+
!function (AnimateMode) {
|
|
830
|
+
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
831
|
+
}(AnimateMode || (AnimateMode = {}));
|
|
832
|
+
|
|
833
|
+
var AnimateStepType;
|
|
834
|
+
!function (AnimateStepType) {
|
|
835
|
+
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
836
|
+
}(AnimateStepType || (AnimateStepType = {}));
|
|
837
|
+
var AnimateStatus;
|
|
838
|
+
!function (AnimateStatus) {
|
|
839
|
+
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
840
|
+
}(AnimateStatus || (AnimateStatus = {}));
|
|
841
|
+
|
|
828
842
|
const circleThreshold = tau - 1e-8;
|
|
829
843
|
class BoundsContext {
|
|
830
844
|
constructor(bounds) {
|
|
@@ -967,18 +981,6 @@ var AttributeUpdateType;
|
|
|
967
981
|
!function (AttributeUpdateType) {
|
|
968
982
|
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";
|
|
969
983
|
}(AttributeUpdateType || (AttributeUpdateType = {}));
|
|
970
|
-
var AnimateStatus$1;
|
|
971
|
-
!function (AnimateStatus) {
|
|
972
|
-
AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
|
|
973
|
-
}(AnimateStatus$1 || (AnimateStatus$1 = {}));
|
|
974
|
-
var AnimateMode$1;
|
|
975
|
-
!function (AnimateMode) {
|
|
976
|
-
AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
|
|
977
|
-
}(AnimateMode$1 || (AnimateMode$1 = {}));
|
|
978
|
-
var AnimateStepType$1;
|
|
979
|
-
!function (AnimateStepType) {
|
|
980
|
-
AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
|
|
981
|
-
}(AnimateStepType$1 || (AnimateStepType$1 = {}));
|
|
982
984
|
var Direction;
|
|
983
985
|
!function (Direction) {
|
|
984
986
|
Direction[Direction.ROW = 1] = "ROW", Direction[Direction.COLUMN = 2] = "COLUMN";
|
|
@@ -2864,6 +2866,7 @@ function applyStrokeStyle(ctx, character) {
|
|
|
2864
2866
|
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
2865
2867
|
}
|
|
2866
2868
|
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
2869
|
+
if (desc.length <= 1) return 0;
|
|
2867
2870
|
if (!width || width <= 0) return 0;
|
|
2868
2871
|
const textMeasure = application.graphicUtil.textMeasure;
|
|
2869
2872
|
let index = guessIndex,
|
|
@@ -2897,6 +2900,13 @@ function testLetter2(string, index) {
|
|
|
2897
2900
|
}
|
|
2898
2901
|
function measureTextCanvas(text, character) {
|
|
2899
2902
|
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
|
|
2903
|
+
var _a;
|
|
2904
|
+
if ("" === text) return {
|
|
2905
|
+
ascent: 0,
|
|
2906
|
+
height: 0,
|
|
2907
|
+
descent: 0,
|
|
2908
|
+
width: 0
|
|
2909
|
+
};
|
|
2900
2910
|
const measurement = application.graphicUtil.textMeasure.measureText(text, character),
|
|
2901
2911
|
result = {
|
|
2902
2912
|
ascent: 0,
|
|
@@ -2906,7 +2916,9 @@ function measureTextCanvas(text, character) {
|
|
|
2906
2916
|
},
|
|
2907
2917
|
ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
|
|
2908
2918
|
descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
|
|
2909
|
-
|
|
2919
|
+
"number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent);
|
|
2920
|
+
const space = null !== (_a = character.space) && void 0 !== _a ? _a : 0;
|
|
2921
|
+
return result.width += space, result;
|
|
2910
2922
|
}
|
|
2911
2923
|
|
|
2912
2924
|
var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -4191,7 +4203,7 @@ class FederatedEvent {
|
|
|
4191
4203
|
}
|
|
4192
4204
|
_composedDetailPath(params) {
|
|
4193
4205
|
if (params && params.graphic) {
|
|
4194
|
-
const g =
|
|
4206
|
+
const g = params.graphic;
|
|
4195
4207
|
if (g.stage) {
|
|
4196
4208
|
const path = g.stage.eventSystem.manager.propagationPath(g);
|
|
4197
4209
|
this.detailPath.push(path), this._composedDetailPath(params.params);
|
|
@@ -4241,142 +4253,6 @@ const EventTarget = {
|
|
|
4241
4253
|
}
|
|
4242
4254
|
};
|
|
4243
4255
|
|
|
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;
|
|
4266
|
-
}
|
|
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
|
-
}
|
|
4275
|
-
}
|
|
4276
|
-
}
|
|
4277
|
-
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
4278
|
-
|
|
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;
|
|
4282
|
-
}
|
|
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));
|
|
4286
|
-
}
|
|
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
|
-
}))
|
|
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);
|
|
4315
|
-
}
|
|
4316
|
-
return !1;
|
|
4317
|
-
}
|
|
4318
|
-
cb && cb(fromArray, toArray);
|
|
4319
|
-
return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
|
|
4320
|
-
}
|
|
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
|
-
};
|
|
4335
|
-
}
|
|
4336
|
-
function interpolateGradientRadialColor(fc, tc, ratio) {
|
|
4337
|
-
const fStops = fc.stops,
|
|
4338
|
-
tStops = tc.stops;
|
|
4339
|
-
return {
|
|
4340
|
-
gradient: "radial",
|
|
4341
|
-
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
4342
|
-
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
4343
|
-
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
4344
|
-
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
4345
|
-
r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
|
|
4346
|
-
r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
|
|
4347
|
-
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
4348
|
-
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
4349
|
-
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
4350
|
-
}))
|
|
4351
|
-
};
|
|
4352
|
-
}
|
|
4353
|
-
function interpolateGradientConicalColor(fc, tc, ratio) {
|
|
4354
|
-
const fStops = fc.stops,
|
|
4355
|
-
tStops = tc.stops;
|
|
4356
|
-
return {
|
|
4357
|
-
gradient: "conical",
|
|
4358
|
-
startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
|
|
4359
|
-
endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
|
|
4360
|
-
x: fc.x + (tc.x - fc.x) * ratio,
|
|
4361
|
-
y: fc.y + (tc.y - fc.y) * ratio,
|
|
4362
|
-
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
4363
|
-
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
4364
|
-
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
4365
|
-
}))
|
|
4366
|
-
};
|
|
4367
|
-
}
|
|
4368
|
-
function interpolatePureColorArray(from, to, ratio) {
|
|
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];
|
|
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
|
-
}
|
|
4374
|
-
const _fromColorRGB = [0, 0, 0, 0],
|
|
4375
|
-
_toColorRGB = [0, 0, 0, 0];
|
|
4376
|
-
function colorStringInterpolationToStr(fromColor, toColor, ratio) {
|
|
4377
|
-
return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB), `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
|
|
4378
|
-
}
|
|
4379
|
-
|
|
4380
4256
|
class ResourceLoader {
|
|
4381
4257
|
static GetImage(url, mark) {
|
|
4382
4258
|
var _a;
|
|
@@ -5623,6 +5499,15 @@ class Graphic extends Node {
|
|
|
5623
5499
|
y: y
|
|
5624
5500
|
});
|
|
5625
5501
|
}
|
|
5502
|
+
setAttributesAndPreventAnimate(params) {
|
|
5503
|
+
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
5504
|
+
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
5505
|
+
this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
|
|
5506
|
+
Object.keys(params).forEach(key => {
|
|
5507
|
+
animate.preventAttr(key);
|
|
5508
|
+
});
|
|
5509
|
+
});
|
|
5510
|
+
}
|
|
5626
5511
|
setAttributes(params) {
|
|
5627
5512
|
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
5628
5513
|
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -5790,10 +5675,10 @@ class Graphic extends Node {
|
|
|
5790
5675
|
duration: stateAnimateConfig.duration,
|
|
5791
5676
|
easing: stateAnimateConfig.easing
|
|
5792
5677
|
}
|
|
5793
|
-
}]), noAnimateAttrs && this.
|
|
5678
|
+
}]), noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, !1, {
|
|
5794
5679
|
type: AttributeUpdateType.STATE
|
|
5795
5680
|
});
|
|
5796
|
-
} else this.stopStateAnimates(), this.
|
|
5681
|
+
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
5797
5682
|
type: AttributeUpdateType.STATE
|
|
5798
5683
|
});
|
|
5799
5684
|
}
|
|
@@ -5814,13 +5699,9 @@ class Graphic extends Node {
|
|
|
5814
5699
|
});
|
|
5815
5700
|
}
|
|
5816
5701
|
getNormalAttribute(key) {
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
const endProps = animate.getEndProps();
|
|
5821
|
-
has(endProps, key) && (value = endProps[key]);
|
|
5822
|
-
}
|
|
5823
|
-
}), value;
|
|
5702
|
+
var _a, _b;
|
|
5703
|
+
const value = this.attribute[key];
|
|
5704
|
+
return this.animates ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
|
|
5824
5705
|
}
|
|
5825
5706
|
clearStates(hasAnimation) {
|
|
5826
5707
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
|
|
@@ -5981,80 +5862,6 @@ class Graphic extends Node {
|
|
|
5981
5862
|
type: AttributeUpdateType.ANIMATE_END
|
|
5982
5863
|
});
|
|
5983
5864
|
}
|
|
5984
|
-
onStep(subAnimate, animate, step, ratio, end) {
|
|
5985
|
-
const nextAttributes = {};
|
|
5986
|
-
if (step.customAnimate) step.customAnimate.update(end, ratio, nextAttributes);else {
|
|
5987
|
-
const nextProps = step.props,
|
|
5988
|
-
nextParsedProps = step.parsedProps,
|
|
5989
|
-
propKeys = step.propKeys;
|
|
5990
|
-
this.stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, void 0, nextParsedProps, propKeys);
|
|
5991
|
-
}
|
|
5992
|
-
this.setAttributes(nextAttributes, !1, {
|
|
5993
|
-
type: AttributeUpdateType.ANIMATE_UPDATE,
|
|
5994
|
-
animationState: {
|
|
5995
|
-
ratio: ratio,
|
|
5996
|
-
end: end,
|
|
5997
|
-
step: step,
|
|
5998
|
-
isFirstFrameOfStep: subAnimate.getLastStep() !== step
|
|
5999
|
-
}
|
|
6000
|
-
}), this.stage && this.stage.renderNextFrame();
|
|
6001
|
-
}
|
|
6002
|
-
stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, lastProps, nextParsedProps, propKeys) {
|
|
6003
|
-
propKeys || (propKeys = Object.keys(nextProps), step.propKeys = propKeys), end ? step.propKeys.forEach(key => {
|
|
6004
|
-
animate.validAttr(key) && (nextAttributes[key] = nextProps[key]);
|
|
6005
|
-
}) : propKeys.forEach(key => {
|
|
6006
|
-
var _a;
|
|
6007
|
-
if (!animate.validAttr(key)) return;
|
|
6008
|
-
const nextStepVal = nextProps[key],
|
|
6009
|
-
lastStepVal = null !== (_a = lastProps && lastProps[key]) && void 0 !== _a ? _a : subAnimate.getLastPropByName(key, step);
|
|
6010
|
-
if (null == nextStepVal || null == lastStepVal || nextStepVal === lastStepVal) return void (nextAttributes[key] = nextStepVal);
|
|
6011
|
-
let match;
|
|
6012
|
-
match = animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes), match || (match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes), match || this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) || this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes));
|
|
6013
|
-
}), step.parsedProps = nextParsedProps;
|
|
6014
|
-
}
|
|
6015
|
-
defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) {
|
|
6016
|
-
if (Number.isFinite(nextStepVal) && Number.isFinite(lastStepVal)) return nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio, !0;
|
|
6017
|
-
if ("fill" === key) {
|
|
6018
|
-
nextParsedProps || (nextParsedProps = {});
|
|
6019
|
-
const fillColorArray = nextParsedProps.fillColorArray,
|
|
6020
|
-
color = interpolateColor(lastStepVal, null != fillColorArray ? fillColorArray : nextStepVal, ratio, !1, (fArray, tArray) => {
|
|
6021
|
-
nextParsedProps.fillColorArray = tArray;
|
|
6022
|
-
});
|
|
6023
|
-
return color && (nextAttributes[key] = color), !0;
|
|
6024
|
-
}
|
|
6025
|
-
if ("stroke" === key) {
|
|
6026
|
-
nextParsedProps || (nextParsedProps = {});
|
|
6027
|
-
const strokeColorArray = nextParsedProps.strokeColorArray,
|
|
6028
|
-
color = interpolateColor(lastStepVal, null != strokeColorArray ? strokeColorArray : nextStepVal, ratio, !1, (fArray, tArray) => {
|
|
6029
|
-
nextParsedProps.strokeColorArray = tArray;
|
|
6030
|
-
});
|
|
6031
|
-
return color && (nextAttributes[key] = color), !0;
|
|
6032
|
-
}
|
|
6033
|
-
if ("shadowColor" === key) {
|
|
6034
|
-
nextParsedProps || (nextParsedProps = {});
|
|
6035
|
-
const shadowColorArray = nextParsedProps.shadowColorArray,
|
|
6036
|
-
color = interpolateColor(lastStepVal, null != shadowColorArray ? shadowColorArray : nextStepVal, ratio, !0, (fArray, tArray) => {
|
|
6037
|
-
nextParsedProps.shadowColorArray = tArray;
|
|
6038
|
-
});
|
|
6039
|
-
return color && (nextAttributes[key] = color), !0;
|
|
6040
|
-
}
|
|
6041
|
-
if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {
|
|
6042
|
-
const nextList = [];
|
|
6043
|
-
let valid = !0;
|
|
6044
|
-
for (let i = 0; i < nextStepVal.length; i++) {
|
|
6045
|
-
const v = lastStepVal[i],
|
|
6046
|
-
val = v + (nextStepVal[i] - v) * ratio;
|
|
6047
|
-
if (!Number.isFinite(val)) {
|
|
6048
|
-
valid = !1;
|
|
6049
|
-
break;
|
|
6050
|
-
}
|
|
6051
|
-
nextList.push(val);
|
|
6052
|
-
}
|
|
6053
|
-
valid && (nextAttributes[key] = nextList);
|
|
6054
|
-
}
|
|
6055
|
-
return !1;
|
|
6056
|
-
}
|
|
6057
|
-
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {}
|
|
6058
5865
|
getDefaultAttribute(name) {
|
|
6059
5866
|
return this.getGraphicTheme()[name];
|
|
6060
5867
|
}
|
|
@@ -6708,48 +6515,184 @@ function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke)
|
|
|
6708
6515
|
return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
|
|
6709
6516
|
}
|
|
6710
6517
|
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6726
|
-
|
|
6518
|
+
var ColorType;
|
|
6519
|
+
!function (ColorType) {
|
|
6520
|
+
ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
|
|
6521
|
+
}(ColorType || (ColorType = {}));
|
|
6522
|
+
class ColorStore {
|
|
6523
|
+
static Get(str) {
|
|
6524
|
+
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
|
|
6525
|
+
let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
|
|
6526
|
+
if (size === ColorType.Color1) {
|
|
6527
|
+
const color = ColorStore.store1[str];
|
|
6528
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
6529
|
+
const c = Color.parseColorString(str);
|
|
6530
|
+
if (c) {
|
|
6531
|
+
const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
|
|
6532
|
+
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];
|
|
6533
|
+
}
|
|
6534
|
+
return arr;
|
|
6535
|
+
}
|
|
6536
|
+
const color = ColorStore.store255[str];
|
|
6537
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
6538
|
+
const c = Color.parseColorString(str);
|
|
6539
|
+
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;
|
|
6540
|
+
}
|
|
6541
|
+
static Set(str, size, arr) {
|
|
6542
|
+
if (size === ColorType.Color1) {
|
|
6543
|
+
if (ColorStore.store1[str]) return;
|
|
6544
|
+
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])];
|
|
6545
|
+
} else {
|
|
6546
|
+
if (ColorStore.store255[str]) return;
|
|
6547
|
+
ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
|
|
6548
|
+
}
|
|
6727
6549
|
}
|
|
6728
|
-
return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
|
|
6729
6550
|
}
|
|
6551
|
+
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
6730
6552
|
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
const GroupRenderContribution = Symbol.for("GroupRenderContribution");
|
|
6735
|
-
const ImageRenderContribution = Symbol.for("ImageRenderContribution");
|
|
6736
|
-
const PathRenderContribution = Symbol.for("PathRenderContribution");
|
|
6737
|
-
const PolygonRenderContribution = Symbol.for("PolygonRenderContribution");
|
|
6738
|
-
const RectRenderContribution = Symbol.for("RectRenderContribution");
|
|
6739
|
-
const SymbolRenderContribution = Symbol.for("SymbolRenderContribution");
|
|
6740
|
-
const TextRenderContribution = Symbol.for("TextRenderContribution");
|
|
6741
|
-
const InteractiveSubRenderContribution = Symbol.for("InteractiveSubRenderContribution");
|
|
6742
|
-
|
|
6743
|
-
function textDrawOffsetX(textAlign, width) {
|
|
6744
|
-
return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
|
|
6553
|
+
function colorArrayToString(color) {
|
|
6554
|
+
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6555
|
+
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;
|
|
6745
6556
|
}
|
|
6746
|
-
function
|
|
6747
|
-
|
|
6748
|
-
|
|
6557
|
+
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
6558
|
+
if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
|
|
6559
|
+
return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray(from) ? from[index] : from, isArray(to) ? to[index] : to, ratio, alphaChannel));
|
|
6560
|
+
}
|
|
6561
|
+
return _interpolateColor(from, to, ratio, alphaChannel, cb);
|
|
6749
6562
|
}
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6563
|
+
function _interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
6564
|
+
if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
|
|
6565
|
+
let fromArray,
|
|
6566
|
+
toArray,
|
|
6567
|
+
fromGradient = !1,
|
|
6568
|
+
toGradient = !1;
|
|
6569
|
+
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) {
|
|
6570
|
+
const gradient = fromGradient ? from : to,
|
|
6571
|
+
pure = fromGradient ? to : from,
|
|
6572
|
+
gradientFromPure = Object.assign(Object.assign({}, gradient), {
|
|
6573
|
+
stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
|
|
6574
|
+
color: colorArrayToString(pure)
|
|
6575
|
+
}))
|
|
6576
|
+
});
|
|
6577
|
+
return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
|
|
6578
|
+
}
|
|
6579
|
+
if (fromGradient) {
|
|
6580
|
+
if (from.gradient === to.gradient) {
|
|
6581
|
+
const fc = from,
|
|
6582
|
+
tc = to,
|
|
6583
|
+
fromStops = fc.stops,
|
|
6584
|
+
toStops = tc.stops;
|
|
6585
|
+
if (fromStops.length !== toStops.length) return !1;
|
|
6586
|
+
if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
|
|
6587
|
+
if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
|
|
6588
|
+
if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
|
|
6589
|
+
}
|
|
6590
|
+
return !1;
|
|
6591
|
+
}
|
|
6592
|
+
cb && cb(fromArray, toArray);
|
|
6593
|
+
return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
|
|
6594
|
+
}
|
|
6595
|
+
function interpolateGradientLinearColor(fc, tc, ratio) {
|
|
6596
|
+
const fStops = fc.stops,
|
|
6597
|
+
tStops = tc.stops;
|
|
6598
|
+
return {
|
|
6599
|
+
gradient: "linear",
|
|
6600
|
+
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
6601
|
+
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
6602
|
+
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
6603
|
+
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
6604
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6605
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6606
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6607
|
+
}))
|
|
6608
|
+
};
|
|
6609
|
+
}
|
|
6610
|
+
function interpolateGradientRadialColor(fc, tc, ratio) {
|
|
6611
|
+
const fStops = fc.stops,
|
|
6612
|
+
tStops = tc.stops;
|
|
6613
|
+
return {
|
|
6614
|
+
gradient: "radial",
|
|
6615
|
+
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
6616
|
+
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
6617
|
+
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
6618
|
+
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
6619
|
+
r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
|
|
6620
|
+
r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
|
|
6621
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6622
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6623
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6624
|
+
}))
|
|
6625
|
+
};
|
|
6626
|
+
}
|
|
6627
|
+
function interpolateGradientConicalColor(fc, tc, ratio) {
|
|
6628
|
+
const fStops = fc.stops,
|
|
6629
|
+
tStops = tc.stops;
|
|
6630
|
+
return {
|
|
6631
|
+
gradient: "conical",
|
|
6632
|
+
startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
|
|
6633
|
+
endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
|
|
6634
|
+
x: fc.x + (tc.x - fc.x) * ratio,
|
|
6635
|
+
y: fc.y + (tc.y - fc.y) * ratio,
|
|
6636
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6637
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6638
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6639
|
+
}))
|
|
6640
|
+
};
|
|
6641
|
+
}
|
|
6642
|
+
function interpolatePureColorArray(from, to, ratio) {
|
|
6643
|
+
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];
|
|
6644
|
+
}
|
|
6645
|
+
function interpolatePureColorArrayToStr(from, to, ratio) {
|
|
6646
|
+
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})`;
|
|
6647
|
+
}
|
|
6648
|
+
const _fromColorRGB = [0, 0, 0, 0],
|
|
6649
|
+
_toColorRGB = [0, 0, 0, 0];
|
|
6650
|
+
function colorStringInterpolationToStr(fromColor, toColor, ratio) {
|
|
6651
|
+
return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB), `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
|
|
6652
|
+
}
|
|
6653
|
+
|
|
6654
|
+
function getConicGradientAt(x, y, angle, color) {
|
|
6655
|
+
const {
|
|
6656
|
+
stops: stops,
|
|
6657
|
+
startAngle: startAngle,
|
|
6658
|
+
endAngle: endAngle
|
|
6659
|
+
} = color;
|
|
6660
|
+
for (; angle < 0;) angle += pi2;
|
|
6661
|
+
for (; angle > pi2;) angle -= pi2;
|
|
6662
|
+
if (angle < startAngle) return stops[0].color;
|
|
6663
|
+
if (angle > endAngle) return stops[0].color;
|
|
6664
|
+
let startStop,
|
|
6665
|
+
endStop,
|
|
6666
|
+
percent = (angle - startAngle) / (endAngle - startAngle);
|
|
6667
|
+
for (let i = 0; i < stops.length; i++) if (stops[i].offset >= percent) {
|
|
6668
|
+
startStop = stops[i - 1], endStop = stops[i];
|
|
6669
|
+
break;
|
|
6670
|
+
}
|
|
6671
|
+
return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
|
|
6672
|
+
}
|
|
6673
|
+
|
|
6674
|
+
const ArcRenderContribution = Symbol.for("ArcRenderContribution");
|
|
6675
|
+
const AreaRenderContribution = Symbol.for("AreaRenderContribution");
|
|
6676
|
+
const CircleRenderContribution = Symbol.for("CircleRenderContribution");
|
|
6677
|
+
const GroupRenderContribution = Symbol.for("GroupRenderContribution");
|
|
6678
|
+
const ImageRenderContribution = Symbol.for("ImageRenderContribution");
|
|
6679
|
+
const PathRenderContribution = Symbol.for("PathRenderContribution");
|
|
6680
|
+
const PolygonRenderContribution = Symbol.for("PolygonRenderContribution");
|
|
6681
|
+
const RectRenderContribution = Symbol.for("RectRenderContribution");
|
|
6682
|
+
const SymbolRenderContribution = Symbol.for("SymbolRenderContribution");
|
|
6683
|
+
const TextRenderContribution = Symbol.for("TextRenderContribution");
|
|
6684
|
+
const InteractiveSubRenderContribution = Symbol.for("InteractiveSubRenderContribution");
|
|
6685
|
+
|
|
6686
|
+
function textDrawOffsetX(textAlign, width) {
|
|
6687
|
+
return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
|
|
6688
|
+
}
|
|
6689
|
+
function textLayoutOffsetY(baseline, lineHeight, fontSize) {
|
|
6690
|
+
let buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
6691
|
+
return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
|
|
6692
|
+
}
|
|
6693
|
+
|
|
6694
|
+
function identityMat4(out) {
|
|
6695
|
+
return out[0] = 1, out[1] = 0, out[2] = 0, out[3] = 0, out[4] = 0, out[5] = 1, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = 0, out[13] = 0, out[14] = 0, out[15] = 1, out;
|
|
6753
6696
|
}
|
|
6754
6697
|
function rotateX(out, a, rad) {
|
|
6755
6698
|
const s = Math.sin(rad),
|
|
@@ -8279,6 +8222,7 @@ function getFixedLRTB(left, right, top, bottom) {
|
|
|
8279
8222
|
}
|
|
8280
8223
|
class Paragraph {
|
|
8281
8224
|
constructor(text, newLine, character, ascentDescentMode) {
|
|
8225
|
+
var _a, _b;
|
|
8282
8226
|
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
|
|
8283
8227
|
const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
8284
8228
|
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
@@ -8291,7 +8235,7 @@ class Paragraph {
|
|
|
8291
8235
|
let halfDetaHeight = 0,
|
|
8292
8236
|
deltaAscent = 0,
|
|
8293
8237
|
deltaDescent = 0;
|
|
8294
|
-
this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
|
|
8238
|
+
this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, this.space = character.space, this.dx = null !== (_a = character.dx) && void 0 !== _a ? _a : 0, this.dy = null !== (_b = character.dy) && void 0 !== _b ? _b : 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
|
|
8295
8239
|
}
|
|
8296
8240
|
updateWidth() {
|
|
8297
8241
|
const {
|
|
@@ -8310,11 +8254,11 @@ class Paragraph {
|
|
|
8310
8254
|
if ("hide" === this.ellipsis) return;
|
|
8311
8255
|
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
8312
8256
|
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
8313
|
-
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8257
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
|
|
8314
8258
|
const {
|
|
8315
8259
|
width: width
|
|
8316
8260
|
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8317
|
-
|
|
8261
|
+
left -= this.ellipsisWidth - width;
|
|
8318
8262
|
}
|
|
8319
8263
|
}
|
|
8320
8264
|
}
|
|
@@ -8325,20 +8269,21 @@ class Paragraph {
|
|
|
8325
8269
|
});
|
|
8326
8270
|
}
|
|
8327
8271
|
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
8272
|
+
var _a;
|
|
8328
8273
|
let baseline = top + ascent,
|
|
8329
8274
|
text = this.text,
|
|
8330
|
-
left = this.left + deltaLeft;
|
|
8275
|
+
left = this.left + deltaLeft + (null !== (_a = this.space) && void 0 !== _a ? _a : 0) / 2;
|
|
8331
8276
|
baseline += this.top;
|
|
8332
8277
|
let direction = this.direction;
|
|
8333
8278
|
if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
8334
8279
|
if ("hide" === this.ellipsis) return;
|
|
8335
8280
|
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
8336
8281
|
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
8337
|
-
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8282
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
|
|
8338
8283
|
const {
|
|
8339
8284
|
width: width
|
|
8340
8285
|
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8341
|
-
|
|
8286
|
+
left -= this.ellipsisWidth - width;
|
|
8342
8287
|
}
|
|
8343
8288
|
}
|
|
8344
8289
|
}
|
|
@@ -8353,7 +8298,7 @@ class Paragraph {
|
|
|
8353
8298
|
const {
|
|
8354
8299
|
lineWidth = 1
|
|
8355
8300
|
} = this.character;
|
|
8356
|
-
if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill) if (this.character.lineThrough || this.character.underline) {
|
|
8301
|
+
if (this.character.stroke && lineWidth && ctx.strokeText(text, left + this.dx, baseline + this.dy), this.character.fill && ctx.fillText(text, left + this.dx, baseline + this.dy), this.character.fill) if (this.character.lineThrough || this.character.underline) {
|
|
8357
8302
|
if (this.character.underline) {
|
|
8358
8303
|
const top = 1 + baseline,
|
|
8359
8304
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
@@ -13158,6 +13103,16 @@ function flatten_simplify(points, tolerance, highestQuality) {
|
|
|
13158
13103
|
return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
|
|
13159
13104
|
}
|
|
13160
13105
|
|
|
13106
|
+
function diff(oldAttrs, newAttrs, getAttr) {
|
|
13107
|
+
const diffObj = {};
|
|
13108
|
+
for (const key in newAttrs) key in oldAttrs && isEqual(oldAttrs[key], newAttrs[key]) || (diffObj[key] = newAttrs[key]);
|
|
13109
|
+
if (getAttr) for (const key in oldAttrs) if (!(key in newAttrs)) {
|
|
13110
|
+
const value = getAttr(key);
|
|
13111
|
+
void 0 !== value && (diffObj[key] = value);
|
|
13112
|
+
}
|
|
13113
|
+
return diffObj;
|
|
13114
|
+
}
|
|
13115
|
+
|
|
13161
13116
|
let loadArcModule = !1;
|
|
13162
13117
|
const arcModule = new ContainerModule(bind => {
|
|
13163
13118
|
loadArcModule || (loadArcModule = !0, bind(DefaultCanvasArcRender).toSelf().inSingletonScope(), bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope(), bind(GraphicRender).toService(ArcRender), bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution), bindContributionProvider(bind, ArcRenderContribution));
|
|
@@ -15400,14 +15355,17 @@ class Tag extends AbstractComponent {
|
|
|
15400
15355
|
tagWidth += symbolPlaceWidth;
|
|
15401
15356
|
textX += symbolPlaceWidth;
|
|
15402
15357
|
let textShape;
|
|
15358
|
+
let textWidth;
|
|
15359
|
+
let textHeight;
|
|
15403
15360
|
const isRich = isRichText({ text }) || type === 'rich';
|
|
15404
15361
|
if (isRich) {
|
|
15405
15362
|
const richTextAttrs = Object.assign(Object.assign(Object.assign({}, richTextAttributeTransform(Object.assign({ type, text }, textStyle))), textStyle), { visible: isValid(text) && visible !== false, x: textX, y: 0 });
|
|
15363
|
+
if (isNil(richTextAttrs.lineHeight)) {
|
|
15364
|
+
richTextAttrs.lineHeight = textStyle.fontSize;
|
|
15365
|
+
}
|
|
15406
15366
|
textShape = group.createOrUpdateChild('tag-text', richTextAttrs, 'richtext');
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
tagX += textShape.AABBBounds.x1;
|
|
15410
|
-
tagY += textShape.AABBBounds.y1;
|
|
15367
|
+
textWidth = textShape.AABBBounds.width();
|
|
15368
|
+
textHeight = textShape.AABBBounds.height();
|
|
15411
15369
|
}
|
|
15412
15370
|
else {
|
|
15413
15371
|
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 });
|
|
@@ -15415,126 +15373,134 @@ class Tag extends AbstractComponent {
|
|
|
15415
15373
|
textAttrs.lineHeight = textStyle.fontSize;
|
|
15416
15374
|
}
|
|
15417
15375
|
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
|
-
}
|
|
15421
15376
|
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);
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
if (isValid(maxWidth) && tagWidth > maxWidth) {
|
|
15434
|
-
tagWidth = maxWidth;
|
|
15435
|
-
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
15436
|
-
}
|
|
15437
|
-
}
|
|
15438
|
-
tagX = 0;
|
|
15439
|
-
tagY = 0;
|
|
15440
|
-
let flag = 0;
|
|
15441
|
-
if (textAlign === 'left' || textAlign === 'start') {
|
|
15442
|
-
flag = 1;
|
|
15377
|
+
textWidth = textBounds.width;
|
|
15378
|
+
textHeight = textBounds.height;
|
|
15379
|
+
}
|
|
15380
|
+
tagWidth += textWidth;
|
|
15381
|
+
const size = (_c = shape.size) !== null && _c !== void 0 ? _c : 10;
|
|
15382
|
+
const maxSize = (isNumber(size) ? size : Math.max(size[0], size[1]));
|
|
15383
|
+
tagHeight += Math.max(textHeight, shape.visible ? maxSize : 0);
|
|
15384
|
+
const { textAlign, textBaseline } = textStyle;
|
|
15385
|
+
if (isValid(minWidth) || isValid(maxWidth)) {
|
|
15386
|
+
if (isValid(minWidth) && tagWidth < minWidth) {
|
|
15387
|
+
tagWidth = minWidth;
|
|
15443
15388
|
}
|
|
15444
|
-
|
|
15445
|
-
|
|
15389
|
+
if (isValid(maxWidth) && tagWidth > maxWidth) {
|
|
15390
|
+
tagWidth = maxWidth;
|
|
15391
|
+
textShape.setAttribute('maxLineWidth', maxWidth - parsedPadding[1] - parsedPadding[2]);
|
|
15446
15392
|
}
|
|
15447
|
-
|
|
15448
|
-
|
|
15393
|
+
}
|
|
15394
|
+
tagX = 0;
|
|
15395
|
+
tagY = 0;
|
|
15396
|
+
let flag = 0;
|
|
15397
|
+
if (textAlign === 'left' || textAlign === 'start') {
|
|
15398
|
+
flag = 1;
|
|
15399
|
+
}
|
|
15400
|
+
else if (textAlign === 'right' || textAlign === 'end') {
|
|
15401
|
+
flag = -1;
|
|
15402
|
+
}
|
|
15403
|
+
else if (textAlign === 'center') {
|
|
15404
|
+
flag = 0;
|
|
15405
|
+
}
|
|
15406
|
+
if (!flag) {
|
|
15407
|
+
tagX -= tagWidth / 2;
|
|
15408
|
+
if (symbol) {
|
|
15409
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth / 2);
|
|
15449
15410
|
}
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15411
|
+
group.setAttribute('x', -symbolPlaceWidth / 2);
|
|
15412
|
+
}
|
|
15413
|
+
else if (flag < 0) {
|
|
15414
|
+
tagX -= tagWidth;
|
|
15415
|
+
if (symbol) {
|
|
15416
|
+
symbol.setAttribute('x', (symbol.attribute.x || 0) - textWidth);
|
|
15456
15417
|
}
|
|
15457
|
-
|
|
15458
|
-
|
|
15459
|
-
|
|
15460
|
-
|
|
15461
|
-
|
|
15462
|
-
|
|
15463
|
-
|
|
15464
|
-
|
|
15465
|
-
|
|
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;
|
|
15418
|
+
group.setAttribute('x', -parsedPadding[1] - symbolPlaceWidth);
|
|
15419
|
+
}
|
|
15420
|
+
else if (flag > 0) {
|
|
15421
|
+
group.setAttribute('x', parsedPadding[3]);
|
|
15422
|
+
}
|
|
15423
|
+
const shouldCenter = containerTextAlign ? containerTextAlign === 'center' : textAlwaysCenter;
|
|
15424
|
+
const shouldRight = containerTextAlign === 'right' || containerTextAlign === 'end';
|
|
15425
|
+
const shouldLeft = containerTextAlign === 'left' || containerTextAlign === 'start';
|
|
15426
|
+
const updateTextAttrs = (textX, textAlign) => {
|
|
15427
|
+
if (textShape.type === 'richtext') {
|
|
15476
15428
|
textShape.setAttributes({
|
|
15477
15429
|
x: textX,
|
|
15478
|
-
textAlign
|
|
15430
|
+
textAlign,
|
|
15431
|
+
textConfig: array(textShape.attribute.textConfig).map(t => {
|
|
15432
|
+
return Object.assign(Object.assign({}, t), { textAlign });
|
|
15433
|
+
})
|
|
15479
15434
|
});
|
|
15480
|
-
if (symbol) {
|
|
15481
|
-
const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;
|
|
15482
|
-
symbol.setAttributes({
|
|
15483
|
-
x: symbolX
|
|
15484
|
-
});
|
|
15485
|
-
}
|
|
15486
15435
|
}
|
|
15487
|
-
|
|
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;
|
|
15436
|
+
else {
|
|
15493
15437
|
textShape.setAttributes({
|
|
15494
15438
|
x: textX,
|
|
15495
|
-
textAlign
|
|
15439
|
+
textAlign
|
|
15496
15440
|
});
|
|
15497
|
-
if (symbol) {
|
|
15498
|
-
const symbolX = offset + maxSize / 2;
|
|
15499
|
-
symbol.setAttributes({
|
|
15500
|
-
x: symbolX
|
|
15501
|
-
});
|
|
15502
|
-
}
|
|
15503
15441
|
}
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15442
|
+
};
|
|
15443
|
+
if (shouldCenter && flag) {
|
|
15444
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15445
|
+
const tsWidth = textWidth + symbolPlaceWidth;
|
|
15446
|
+
const textX = flag === 1
|
|
15447
|
+
? (containerWidth - tsWidth) / 2 + symbolPlaceWidth + textWidth / 2
|
|
15448
|
+
: parsedPadding[0] + symbolPlaceWidth - (tagWidth / 2 + tsWidth / 2 - symbolPlaceWidth) + textWidth / 2;
|
|
15449
|
+
updateTextAttrs(textX, 'center');
|
|
15450
|
+
if (symbol) {
|
|
15451
|
+
const symbolX = textX - textWidth / 2 - symbolPlaceWidth + maxSize / 2;
|
|
15452
|
+
symbol.setAttributes({
|
|
15453
|
+
x: symbolX
|
|
15510
15454
|
});
|
|
15511
|
-
if (symbol) {
|
|
15512
|
-
const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;
|
|
15513
|
-
symbol.setAttributes({
|
|
15514
|
-
x: symbolX
|
|
15515
|
-
});
|
|
15516
|
-
}
|
|
15517
15455
|
}
|
|
15518
|
-
|
|
15519
|
-
|
|
15520
|
-
|
|
15521
|
-
|
|
15522
|
-
|
|
15456
|
+
}
|
|
15457
|
+
if (shouldLeft && flag !== 1) {
|
|
15458
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15459
|
+
const offset = flag === 0
|
|
15460
|
+
? -containerWidth / 2 + symbolPlaceWidth / 2
|
|
15461
|
+
: -tagWidth + parsedPadding[3] + parsedPadding[1] + symbolPlaceWidth;
|
|
15462
|
+
const textX = offset + symbolPlaceWidth;
|
|
15463
|
+
updateTextAttrs(textX, 'left');
|
|
15464
|
+
if (symbol) {
|
|
15465
|
+
const symbolX = offset + maxSize / 2;
|
|
15466
|
+
symbol.setAttributes({
|
|
15467
|
+
x: symbolX
|
|
15468
|
+
});
|
|
15523
15469
|
}
|
|
15524
|
-
|
|
15525
|
-
|
|
15526
|
-
|
|
15527
|
-
|
|
15528
|
-
|
|
15529
|
-
|
|
15470
|
+
}
|
|
15471
|
+
if (shouldRight && flag !== -1) {
|
|
15472
|
+
const containerWidth = tagWidth - parsedPadding[1] - parsedPadding[3];
|
|
15473
|
+
const textX = flag === 0 ? containerWidth / 2 + symbolPlaceWidth / 2 : containerWidth;
|
|
15474
|
+
updateTextAttrs(textX, 'right');
|
|
15475
|
+
if (symbol) {
|
|
15476
|
+
const symbolX = textX - textWidth - symbolPlaceWidth + maxSize / 2;
|
|
15477
|
+
symbol.setAttributes({
|
|
15478
|
+
x: symbolX
|
|
15479
|
+
});
|
|
15530
15480
|
}
|
|
15531
|
-
|
|
15532
|
-
|
|
15533
|
-
|
|
15534
|
-
|
|
15535
|
-
|
|
15481
|
+
}
|
|
15482
|
+
if (textBaseline === 'middle') {
|
|
15483
|
+
tagY -= tagHeight / 2;
|
|
15484
|
+
if (symbol) {
|
|
15485
|
+
symbol.setAttribute('y', 0);
|
|
15486
|
+
}
|
|
15487
|
+
}
|
|
15488
|
+
else if (textBaseline === 'bottom') {
|
|
15489
|
+
tagY -= tagHeight;
|
|
15490
|
+
if (symbol) {
|
|
15491
|
+
symbol.setAttribute('y', -textHeight / 2);
|
|
15492
|
+
}
|
|
15493
|
+
group.setAttribute('y', -parsedPadding[2]);
|
|
15494
|
+
}
|
|
15495
|
+
else if (textBaseline === 'top') {
|
|
15496
|
+
group.setAttribute('y', parsedPadding[0]);
|
|
15497
|
+
if (symbol) {
|
|
15498
|
+
symbol.setAttribute('y', textHeight / 2);
|
|
15536
15499
|
}
|
|
15537
15500
|
}
|
|
15501
|
+
if (!isEmpty(state === null || state === void 0 ? void 0 : state.text)) {
|
|
15502
|
+
textShape.states = state.text;
|
|
15503
|
+
}
|
|
15538
15504
|
const { visible: bgVisible } = panel, backgroundStyle = __rest(panel, ["visible"]);
|
|
15539
15505
|
if (visible && isBoolean(bgVisible)) {
|
|
15540
15506
|
const bgRect = this.createOrUpdateChild('tag-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && !!text, width: tagWidth, height: tagHeight, x: tagX, y: tagY }), 'rect');
|
|
@@ -15675,7 +15641,7 @@ class PopTip extends AbstractComponent {
|
|
|
15675
15641
|
}
|
|
15676
15642
|
render() {
|
|
15677
15643
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
15678
|
-
const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0 } = this.attribute;
|
|
15644
|
+
const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = 'position', logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute;
|
|
15679
15645
|
let { title = '', content = '' } = this.attribute;
|
|
15680
15646
|
title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;
|
|
15681
15647
|
content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
|
|
@@ -15757,11 +15723,12 @@ class PopTip extends AbstractComponent {
|
|
|
15757
15723
|
poptipHeight += contentShape.AABBBounds.height();
|
|
15758
15724
|
}
|
|
15759
15725
|
}
|
|
15760
|
-
const layout = position === 'auto';
|
|
15726
|
+
const layout = position === 'auto' || isArray(position);
|
|
15727
|
+
const positionList = isArray(position) ? position : this.positionList;
|
|
15761
15728
|
let maxBBoxI;
|
|
15762
15729
|
let maxBBoxSize = -Infinity;
|
|
15763
|
-
for (let i = 0; i <
|
|
15764
|
-
const p = layout ?
|
|
15730
|
+
for (let i = 0; i < positionList.length + 1; i++) {
|
|
15731
|
+
const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
|
|
15765
15732
|
let symbolType = 'arrow2Left';
|
|
15766
15733
|
let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;
|
|
15767
15734
|
let offsetY = 0;
|
|
@@ -15770,16 +15737,21 @@ class PopTip extends AbstractComponent {
|
|
|
15770
15737
|
}
|
|
15771
15738
|
else if (triangleMode === 'concise') {
|
|
15772
15739
|
symbolType = conciseSymbolMap[p];
|
|
15773
|
-
offsetX = ['tl', 'bl', 'rt', 'rb'].includes(
|
|
15740
|
+
offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)
|
|
15774
15741
|
? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2
|
|
15775
15742
|
: -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;
|
|
15776
|
-
offsetY = ['tl', 'tr', 'lb', 'rb'].includes(
|
|
15743
|
+
offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)
|
|
15777
15744
|
? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2
|
|
15778
15745
|
: (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
|
|
15779
15746
|
}
|
|
15780
15747
|
const { angle, offset } = this.getAngleAndOffset(p, popTipWidth, poptipHeight, isArray(spaceSize) ? spaceSize : [spaceSize, spaceSize - lineWidth], symbolType);
|
|
15748
|
+
let anchorPoint = { x: 0, y: 0 };
|
|
15749
|
+
if (poptipAnchor === 'bounds' && positionBounds) {
|
|
15750
|
+
anchorPoint = this.calculateAnchorPoint(p, positionBounds);
|
|
15751
|
+
}
|
|
15752
|
+
let bgSymbol;
|
|
15781
15753
|
if (isBoolean(bgVisible)) {
|
|
15782
|
-
|
|
15754
|
+
bgSymbol = group.createOrUpdateChild('poptip-symbol-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && (contentVisible || titleVisible), x: offsetX, y: offsetY, strokeBoundsBuffer: -1, boundsPadding: -2, anchor: [0, 0], symbolType, angle: angle, dx: offset[0], dy: offset[1] - ((_j = backgroundStyle.space) !== null && _j !== void 0 ? _j : 0), size: symbolSize, zIndex: 9 }), 'symbol');
|
|
15783
15755
|
if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
15784
15756
|
bgSymbol.states = state.panel;
|
|
15785
15757
|
}
|
|
@@ -15795,8 +15767,8 @@ class PopTip extends AbstractComponent {
|
|
|
15795
15767
|
}
|
|
15796
15768
|
}
|
|
15797
15769
|
group.setAttributes({
|
|
15798
|
-
x: -offset[0] + dx,
|
|
15799
|
-
y: -offset[1] + dy,
|
|
15770
|
+
x: -offset[0] + dx + anchorPoint.x,
|
|
15771
|
+
y: -offset[1] + dy + anchorPoint.y,
|
|
15800
15772
|
anchor: [offsetX, offsetY]
|
|
15801
15773
|
});
|
|
15802
15774
|
if (logoSymbol) {
|
|
@@ -15818,27 +15790,97 @@ class PopTip extends AbstractComponent {
|
|
|
15818
15790
|
group.createOrUpdateChild('poptip-logo-text', Object.assign(Object.assign({}, logoTextStyle), { x: 0, y: poptipHeight / 2, visible: bgVisible && (contentVisible || titleVisible), text: logoText, textAlign: 'center', textBaseline: 'middle', zIndex: 10 }), 'text');
|
|
15819
15791
|
}
|
|
15820
15792
|
}
|
|
15821
|
-
if (
|
|
15793
|
+
if (range) {
|
|
15822
15794
|
_tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
|
|
15823
15795
|
const b = _tBounds;
|
|
15824
15796
|
const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);
|
|
15825
|
-
if (
|
|
15826
|
-
|
|
15797
|
+
if (layout) {
|
|
15798
|
+
if (rectInsideAnotherRect(b, stageBounds, false)) {
|
|
15799
|
+
break;
|
|
15800
|
+
}
|
|
15801
|
+
else {
|
|
15802
|
+
const bbox = getRectIntersect(b, stageBounds, false);
|
|
15803
|
+
const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
|
|
15804
|
+
if (size > maxBBoxSize) {
|
|
15805
|
+
maxBBoxSize = size;
|
|
15806
|
+
maxBBoxI = i;
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15827
15809
|
}
|
|
15828
|
-
|
|
15829
|
-
const
|
|
15830
|
-
const
|
|
15831
|
-
|
|
15832
|
-
|
|
15833
|
-
|
|
15810
|
+
if (['top', 'bottom', 'left', 'right'].includes(p)) {
|
|
15811
|
+
const isVerticalPosition = p === 'top' || p === 'bottom';
|
|
15812
|
+
const isHorizontalPosition = p === 'left' || p === 'right';
|
|
15813
|
+
let mainDirectionOverlap = false;
|
|
15814
|
+
if (isVerticalPosition) {
|
|
15815
|
+
mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);
|
|
15816
|
+
}
|
|
15817
|
+
else if (isHorizontalPosition) {
|
|
15818
|
+
mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);
|
|
15819
|
+
}
|
|
15820
|
+
if (!mainDirectionOverlap) {
|
|
15821
|
+
let secondaryOffset = 0;
|
|
15822
|
+
const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
|
|
15823
|
+
if (isVerticalPosition) {
|
|
15824
|
+
if (b.x1 < 0) {
|
|
15825
|
+
secondaryOffset = -b.x1;
|
|
15826
|
+
}
|
|
15827
|
+
else if (b.x2 > stageBounds.x2) {
|
|
15828
|
+
secondaryOffset = stageBounds.x2 - b.x2;
|
|
15829
|
+
}
|
|
15830
|
+
group.setAttribute('x', group.attribute.x + secondaryOffset);
|
|
15831
|
+
bgSymbol.setAttribute('dx', min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber));
|
|
15832
|
+
}
|
|
15833
|
+
else if (isHorizontalPosition) {
|
|
15834
|
+
if (b.y1 < 0) {
|
|
15835
|
+
secondaryOffset = -b.y1;
|
|
15836
|
+
}
|
|
15837
|
+
else if (b.y2 > stageBounds.y2) {
|
|
15838
|
+
secondaryOffset = stageBounds.y2 - b.y2;
|
|
15839
|
+
}
|
|
15840
|
+
group.setAttribute('y', group.attribute.y + secondaryOffset);
|
|
15841
|
+
bgSymbol.setAttribute('dy', min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber));
|
|
15842
|
+
}
|
|
15843
|
+
break;
|
|
15834
15844
|
}
|
|
15835
15845
|
}
|
|
15846
|
+
if (!layout) {
|
|
15847
|
+
break;
|
|
15848
|
+
}
|
|
15836
15849
|
}
|
|
15837
15850
|
else {
|
|
15838
15851
|
break;
|
|
15839
15852
|
}
|
|
15840
15853
|
}
|
|
15841
15854
|
}
|
|
15855
|
+
calculateAnchorPoint(position, positionBounds) {
|
|
15856
|
+
if (!positionBounds) {
|
|
15857
|
+
return { x: 0, y: 0 };
|
|
15858
|
+
}
|
|
15859
|
+
const { x, y } = this.attribute;
|
|
15860
|
+
const { x1, y1, x2, y2 } = positionBounds;
|
|
15861
|
+
const width = x2 - x1;
|
|
15862
|
+
const height = y2 - y1;
|
|
15863
|
+
switch (position) {
|
|
15864
|
+
case 'top':
|
|
15865
|
+
case 'tl':
|
|
15866
|
+
case 'tr':
|
|
15867
|
+
return { x: x1 + width / 2 - x, y: y1 - y };
|
|
15868
|
+
case 'bottom':
|
|
15869
|
+
case 'bl':
|
|
15870
|
+
case 'br':
|
|
15871
|
+
return { x: x1 + width / 2 - x, y: y2 - y };
|
|
15872
|
+
case 'left':
|
|
15873
|
+
case 'lt':
|
|
15874
|
+
case 'lb':
|
|
15875
|
+
return { x: x1 - x, y: y1 + height / 2 - y };
|
|
15876
|
+
case 'right':
|
|
15877
|
+
case 'rt':
|
|
15878
|
+
case 'rb':
|
|
15879
|
+
return { x: x2 - x, y: y1 + height / 2 - y };
|
|
15880
|
+
default:
|
|
15881
|
+
return { x: 0, y: 0 };
|
|
15882
|
+
}
|
|
15883
|
+
}
|
|
15842
15884
|
getAngleAndOffset(position, width, height, size, symbolType) {
|
|
15843
15885
|
const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];
|
|
15844
15886
|
switch (position) {
|
|
@@ -15944,7 +15986,7 @@ let PopTipRenderContribution = class PopTipRenderContribution {
|
|
|
15944
15986
|
poptip.content = (_a = poptip.content) !== null && _a !== void 0 ? _a : graphic.attribute.text;
|
|
15945
15987
|
}
|
|
15946
15988
|
const matrix = graphic.globalTransMatrix;
|
|
15947
|
-
this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false }, poptip), { x: matrix.e, y: matrix.f }));
|
|
15989
|
+
this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false, poptipAnchor: 'bounds' }, poptip), { x: matrix.e, y: matrix.f, positionBounds: graphic.globalAABBBounds }));
|
|
15948
15990
|
drawContext.stage.tryInitInteractiveLayer();
|
|
15949
15991
|
const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
|
|
15950
15992
|
if (interactiveLayer) {
|
|
@@ -16896,7 +16938,38 @@ const dispatchClickState = (e, container, lastSelect) => {
|
|
|
16896
16938
|
return lastSelect;
|
|
16897
16939
|
};
|
|
16898
16940
|
|
|
16899
|
-
class
|
|
16941
|
+
class AnimateComponent extends AbstractComponent {
|
|
16942
|
+
_prepareAnimate(defaultAnimation) {
|
|
16943
|
+
if (this.attribute.animation !== false) {
|
|
16944
|
+
const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;
|
|
16945
|
+
const animationCfg = isObject(animation) ? animation : {};
|
|
16946
|
+
this._animationConfig = {
|
|
16947
|
+
enter: animationEnter !== false ? merge({}, defaultAnimation, animationCfg, animationEnter !== null && animationEnter !== void 0 ? animationEnter : {}) : false,
|
|
16948
|
+
exit: animationExit !== false ? merge({}, defaultAnimation, animationCfg, animationExit !== null && animationExit !== void 0 ? animationExit : {}) : false,
|
|
16949
|
+
update: animationUpdate !== false
|
|
16950
|
+
? isArray(animationUpdate)
|
|
16951
|
+
? animationUpdate
|
|
16952
|
+
: merge({}, defaultAnimation, animationCfg, animationUpdate !== null && animationUpdate !== void 0 ? animationUpdate : {})
|
|
16953
|
+
: false
|
|
16954
|
+
};
|
|
16955
|
+
}
|
|
16956
|
+
else {
|
|
16957
|
+
this._animationConfig = {
|
|
16958
|
+
enter: false,
|
|
16959
|
+
exit: false,
|
|
16960
|
+
update: false
|
|
16961
|
+
};
|
|
16962
|
+
}
|
|
16963
|
+
}
|
|
16964
|
+
}
|
|
16965
|
+
|
|
16966
|
+
const DefaultAxisAnimation = {
|
|
16967
|
+
type: 'default',
|
|
16968
|
+
duration: 300,
|
|
16969
|
+
easing: 'linear'
|
|
16970
|
+
};
|
|
16971
|
+
|
|
16972
|
+
class AxisBase extends AnimateComponent {
|
|
16900
16973
|
constructor() {
|
|
16901
16974
|
super(...arguments);
|
|
16902
16975
|
this.name = 'axis';
|
|
@@ -16923,6 +16996,7 @@ class AxisBase extends AbstractComponent {
|
|
|
16923
16996
|
}
|
|
16924
16997
|
getBoundsWithoutRender(attributes) {
|
|
16925
16998
|
const currentAttribute = cloneDeep(this.attribute);
|
|
16999
|
+
currentAttribute.scale = this.attribute.scale;
|
|
16926
17000
|
merge(this.attribute, attributes);
|
|
16927
17001
|
const offscreenGroup = graphicCreator.group({
|
|
16928
17002
|
x: this.attribute.x,
|
|
@@ -16935,12 +17009,17 @@ class AxisBase extends AbstractComponent {
|
|
|
16935
17009
|
return offscreenGroup.AABBBounds;
|
|
16936
17010
|
}
|
|
16937
17011
|
render() {
|
|
17012
|
+
this._prepare();
|
|
16938
17013
|
this._prevInnerView = this._innerView && getElMap(this._innerView);
|
|
16939
17014
|
this.removeAllChild(true);
|
|
16940
17015
|
this._innerView = graphicCreator.group({ x: 0, y: 0, pickable: false });
|
|
16941
17016
|
this.add(this._innerView);
|
|
16942
17017
|
this._renderInner(this._innerView);
|
|
16943
17018
|
this._bindEvent();
|
|
17019
|
+
this.runAnimation();
|
|
17020
|
+
}
|
|
17021
|
+
_prepare() {
|
|
17022
|
+
this._prepareAnimate(DefaultAxisAnimation);
|
|
16944
17023
|
}
|
|
16945
17024
|
_bindEvent() {
|
|
16946
17025
|
if (this.attribute.disableTriggerEvent) {
|
|
@@ -17262,18 +17341,89 @@ class AxisBase extends AbstractComponent {
|
|
|
17262
17341
|
});
|
|
17263
17342
|
return data;
|
|
17264
17343
|
}
|
|
17265
|
-
|
|
17266
|
-
|
|
17267
|
-
this.
|
|
17268
|
-
|
|
17269
|
-
|
|
17270
|
-
|
|
17271
|
-
|
|
17272
|
-
|
|
17273
|
-
|
|
17274
|
-
|
|
17275
|
-
|
|
17276
|
-
|
|
17344
|
+
runAnimation() {
|
|
17345
|
+
const lastScale = this.lastScale;
|
|
17346
|
+
if (this.attribute.scale) {
|
|
17347
|
+
const scale = this.attribute.scale;
|
|
17348
|
+
this.lastScale = scale.clone();
|
|
17349
|
+
this.lastScale.range([0, 1]);
|
|
17350
|
+
}
|
|
17351
|
+
if (this.attribute.animation && this.applyAnimationState) {
|
|
17352
|
+
const currentInnerView = this.getInnerView();
|
|
17353
|
+
const prevInnerView = this.getPrevInnerView();
|
|
17354
|
+
if (!prevInnerView) {
|
|
17355
|
+
return;
|
|
17356
|
+
}
|
|
17357
|
+
const animationConfig = this._animationConfig;
|
|
17358
|
+
this._newElementAttrMap = {};
|
|
17359
|
+
traverseGroup(currentInnerView, (el) => {
|
|
17360
|
+
var _a;
|
|
17361
|
+
if (el.type !== 'group' && el.id) {
|
|
17362
|
+
const oldEl = prevInnerView[el.id];
|
|
17363
|
+
el.setFinalAttribute(el.attribute);
|
|
17364
|
+
if (oldEl) {
|
|
17365
|
+
oldEl.release();
|
|
17366
|
+
const oldAttrs = oldEl.attribute;
|
|
17367
|
+
const finalAttrs = el.getFinalAttribute();
|
|
17368
|
+
const diffAttrs = diff(oldAttrs, finalAttrs);
|
|
17369
|
+
let hasDiff = Object.keys(diffAttrs).length > 0;
|
|
17370
|
+
if ('opacity' in oldAttrs && finalAttrs.opacity !== oldAttrs.opacity) {
|
|
17371
|
+
diffAttrs.opacity = (_a = finalAttrs.opacity) !== null && _a !== void 0 ? _a : 1;
|
|
17372
|
+
hasDiff = true;
|
|
17373
|
+
}
|
|
17374
|
+
if (animationConfig.update && hasDiff) {
|
|
17375
|
+
this._newElementAttrMap[el.id] = {
|
|
17376
|
+
state: 'update',
|
|
17377
|
+
node: el,
|
|
17378
|
+
attrs: el.attribute
|
|
17379
|
+
};
|
|
17380
|
+
const oldAttrs = oldEl.attribute;
|
|
17381
|
+
el.setAttributes(oldAttrs);
|
|
17382
|
+
el.applyAnimationState(['update'], [
|
|
17383
|
+
{
|
|
17384
|
+
name: 'update',
|
|
17385
|
+
animation: Object.assign(Object.assign({ selfOnly: true }, animationConfig.update), { type: 'axisUpdate', customParameters: {
|
|
17386
|
+
config: animationConfig.update,
|
|
17387
|
+
diffAttrs,
|
|
17388
|
+
lastScale
|
|
17389
|
+
} })
|
|
17390
|
+
}
|
|
17391
|
+
]);
|
|
17392
|
+
}
|
|
17393
|
+
}
|
|
17394
|
+
else if (animationConfig.enter) {
|
|
17395
|
+
this._newElementAttrMap[el.id] = {
|
|
17396
|
+
state: 'enter',
|
|
17397
|
+
node: el,
|
|
17398
|
+
attrs: el.attribute
|
|
17399
|
+
};
|
|
17400
|
+
el.applyAnimationState(['enter'], [
|
|
17401
|
+
{
|
|
17402
|
+
name: 'enter',
|
|
17403
|
+
animation: Object.assign(Object.assign({}, animationConfig.enter), { type: 'axisEnter', selfOnly: true, customParameters: {
|
|
17404
|
+
config: animationConfig.enter,
|
|
17405
|
+
lastScale,
|
|
17406
|
+
getTickCoord: this.getTickCoord.bind(this)
|
|
17407
|
+
} })
|
|
17408
|
+
}
|
|
17409
|
+
]);
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17412
|
+
});
|
|
17413
|
+
}
|
|
17414
|
+
}
|
|
17415
|
+
release() {
|
|
17416
|
+
super.release();
|
|
17417
|
+
this._prevInnerView = null;
|
|
17418
|
+
this._innerView = null;
|
|
17419
|
+
}
|
|
17420
|
+
}
|
|
17421
|
+
|
|
17422
|
+
const methods$1 = {
|
|
17423
|
+
parity: function (items) {
|
|
17424
|
+
return items.filter((item, i) => (i % 2 ? item.setAttribute('opacity', 0) : 1));
|
|
17425
|
+
},
|
|
17426
|
+
greedy: function (items, sep) {
|
|
17277
17427
|
let a;
|
|
17278
17428
|
return items.filter((b, i) => {
|
|
17279
17429
|
if (!i || !textIntersect(a, b, sep)) {
|
|
@@ -17733,666 +17883,1179 @@ class LineAxisMixin {
|
|
|
17733
17883
|
}
|
|
17734
17884
|
}
|
|
17735
17885
|
|
|
17736
|
-
|
|
17737
|
-
|
|
17738
|
-
|
|
17739
|
-
|
|
17740
|
-
|
|
17886
|
+
class Easing {
|
|
17887
|
+
constructor() {}
|
|
17888
|
+
static linear(t) {
|
|
17889
|
+
return t;
|
|
17890
|
+
}
|
|
17891
|
+
static none() {
|
|
17892
|
+
return this.linear;
|
|
17893
|
+
}
|
|
17894
|
+
static get(amount) {
|
|
17895
|
+
return amount < -1 ? amount = -1 : amount > 1 && (amount = 1), function (t) {
|
|
17896
|
+
return 0 === amount ? t : amount < 0 ? t * (t * -amount + 1 + amount) : t * ((2 - t) * amount + (1 - amount));
|
|
17897
|
+
};
|
|
17898
|
+
}
|
|
17899
|
+
static getPowIn(pow) {
|
|
17900
|
+
return function (t) {
|
|
17901
|
+
return Math.pow(t, pow);
|
|
17902
|
+
};
|
|
17903
|
+
}
|
|
17904
|
+
static getPowOut(pow) {
|
|
17905
|
+
return function (t) {
|
|
17906
|
+
return 1 - Math.pow(1 - t, pow);
|
|
17907
|
+
};
|
|
17908
|
+
}
|
|
17909
|
+
static getPowInOut(pow) {
|
|
17910
|
+
return function (t) {
|
|
17911
|
+
return (t *= 2) < 1 ? .5 * Math.pow(t, pow) : 1 - .5 * Math.abs(Math.pow(2 - t, pow));
|
|
17912
|
+
};
|
|
17913
|
+
}
|
|
17914
|
+
static getBackIn(amount) {
|
|
17915
|
+
return function (t) {
|
|
17916
|
+
return t * t * ((amount + 1) * t - amount);
|
|
17917
|
+
};
|
|
17918
|
+
}
|
|
17919
|
+
static getBackOut(amount) {
|
|
17920
|
+
return function (t) {
|
|
17921
|
+
return --t * t * ((amount + 1) * t + amount) + 1;
|
|
17922
|
+
};
|
|
17923
|
+
}
|
|
17924
|
+
static getBackInOut(amount) {
|
|
17925
|
+
return amount *= 1.525, function (t) {
|
|
17926
|
+
return (t *= 2) < 1 ? t * t * ((amount + 1) * t - amount) * .5 : .5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
|
|
17927
|
+
};
|
|
17928
|
+
}
|
|
17929
|
+
static sineIn(t) {
|
|
17930
|
+
return 1 - Math.cos(t * Math.PI / 2);
|
|
17931
|
+
}
|
|
17932
|
+
static sineOut(t) {
|
|
17933
|
+
return Math.sin(t * Math.PI / 2);
|
|
17934
|
+
}
|
|
17935
|
+
static sineInOut(t) {
|
|
17936
|
+
return -(Math.cos(Math.PI * t) - 1) / 2;
|
|
17937
|
+
}
|
|
17938
|
+
static expoIn(t) {
|
|
17939
|
+
return 0 === t ? 0 : Math.pow(2, 10 * t - 10);
|
|
17940
|
+
}
|
|
17941
|
+
static expoOut(t) {
|
|
17942
|
+
return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
|
|
17943
|
+
}
|
|
17944
|
+
static expoInOut(t) {
|
|
17945
|
+
return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? Math.pow(2, 20 * t - 10) / 2 : (2 - Math.pow(2, -20 * t + 10)) / 2;
|
|
17946
|
+
}
|
|
17947
|
+
static circIn(t) {
|
|
17948
|
+
return -(Math.sqrt(1 - t * t) - 1);
|
|
17949
|
+
}
|
|
17950
|
+
static circOut(t) {
|
|
17951
|
+
return Math.sqrt(1 - --t * t);
|
|
17952
|
+
}
|
|
17953
|
+
static circInOut(t) {
|
|
17954
|
+
return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
|
|
17955
|
+
}
|
|
17956
|
+
static bounceOut(t) {
|
|
17957
|
+
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;
|
|
17958
|
+
}
|
|
17959
|
+
static bounceIn(t) {
|
|
17960
|
+
return 1 - Easing.bounceOut(1 - t);
|
|
17961
|
+
}
|
|
17962
|
+
static bounceInOut(t) {
|
|
17963
|
+
return t < .5 ? .5 * Easing.bounceIn(2 * t) : .5 * Easing.bounceOut(2 * t - 1) + .5;
|
|
17964
|
+
}
|
|
17965
|
+
static getElasticIn(amplitude, period) {
|
|
17966
|
+
return function (t) {
|
|
17967
|
+
if (0 === t || 1 === t) return t;
|
|
17968
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
17969
|
+
return -amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period);
|
|
17970
|
+
};
|
|
17971
|
+
}
|
|
17972
|
+
static getElasticOut(amplitude, period) {
|
|
17973
|
+
return function (t) {
|
|
17974
|
+
if (0 === t || 1 === t) return t;
|
|
17975
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
17976
|
+
return amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1;
|
|
17977
|
+
};
|
|
17978
|
+
}
|
|
17979
|
+
static getElasticInOut(amplitude, period) {
|
|
17980
|
+
return function (t) {
|
|
17981
|
+
const s = period / pi2 * Math.asin(1 / amplitude);
|
|
17982
|
+
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;
|
|
17983
|
+
};
|
|
17984
|
+
}
|
|
17985
|
+
static registerFunc(name, func) {
|
|
17986
|
+
Easing[name] = func;
|
|
17987
|
+
}
|
|
17741
17988
|
}
|
|
17742
|
-
function
|
|
17743
|
-
|
|
17744
|
-
|
|
17989
|
+
function flicker(t, n) {
|
|
17990
|
+
const step = 1 / n;
|
|
17991
|
+
let flag = 1;
|
|
17992
|
+
for (; t > step;) t -= step, flag *= -1;
|
|
17993
|
+
const v = flag * t / step;
|
|
17994
|
+
return v > 0 ? v : 1 + v;
|
|
17745
17995
|
}
|
|
17746
|
-
|
|
17747
|
-
|
|
17748
|
-
|
|
17996
|
+
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 => {
|
|
17997
|
+
const c4 = 2 * Math.PI / 3;
|
|
17998
|
+
return 0 === x ? 0 : 1 === x ? 1 : Math.pow(2, -10 * x) * Math.sin((10 * x - .75) * c4) + 1;
|
|
17999
|
+
}, Easing.easeInOutElastic = x => {
|
|
18000
|
+
const c5 = 2 * Math.PI / 4.5;
|
|
18001
|
+
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;
|
|
18002
|
+
};
|
|
18003
|
+
for (let i = 0; i < 10; i++) Easing[`flicker${i}`] = t => flicker(t, i);
|
|
18004
|
+
for (let i = 2; i < 10; i++) Easing[`aIn${i}`] = t => i * t * t + (1 - i) * t;
|
|
18005
|
+
|
|
18006
|
+
function interpolateNumber(from, to, ratio) {
|
|
18007
|
+
return from + (to - from) * ratio;
|
|
17749
18008
|
}
|
|
17750
|
-
|
|
17751
|
-
|
|
17752
|
-
|
|
18009
|
+
|
|
18010
|
+
class InterpolateUpdateStore {
|
|
18011
|
+
constructor() {
|
|
18012
|
+
this.opacity = (key, from, to, ratio, step, target) => {
|
|
18013
|
+
target.attribute.opacity = interpolateNumber(from, to, ratio);
|
|
18014
|
+
}, this.baseOpacity = (key, from, to, ratio, step, target) => {
|
|
18015
|
+
target.attribute.baseOpacity = interpolateNumber(from, to, ratio);
|
|
18016
|
+
}, this.fillOpacity = (key, from, to, ratio, step, target) => {
|
|
18017
|
+
target.attribute.fillOpacity = interpolateNumber(from, to, ratio);
|
|
18018
|
+
}, this.strokeOpacity = (key, from, to, ratio, step, target) => {
|
|
18019
|
+
target.attribute.strokeOpacity = interpolateNumber(from, to, ratio);
|
|
18020
|
+
}, this.zIndex = (key, from, to, ratio, step, target) => {
|
|
18021
|
+
target.attribute.zIndex = interpolateNumber(from, to, ratio);
|
|
18022
|
+
}, this.backgroundOpacity = (key, from, to, ratio, step, target) => {
|
|
18023
|
+
target.attribute.backgroundOpacity = interpolateNumber(from, to, ratio);
|
|
18024
|
+
}, this.shadowOffsetX = (key, from, to, ratio, step, target) => {
|
|
18025
|
+
target.attribute.shadowOffsetX = interpolateNumber(from, to, ratio);
|
|
18026
|
+
}, this.shadowOffsetY = (key, from, to, ratio, step, target) => {
|
|
18027
|
+
target.attribute.shadowOffsetY = interpolateNumber(from, to, ratio);
|
|
18028
|
+
}, this.shadowBlur = (key, from, to, ratio, step, target) => {
|
|
18029
|
+
target.attribute.shadowBlur = interpolateNumber(from, to, ratio);
|
|
18030
|
+
}, this.fill = (key, from, to, ratio, step, target) => {
|
|
18031
|
+
target.attribute.fill = interpolateColor(from, to, ratio, !1);
|
|
18032
|
+
}, this.fillPure = (key, from, to, ratio, step, target) => {
|
|
18033
|
+
target.attribute.fill = step.fromParsedProps.fill ? interpolatePureColorArrayToStr(step.fromParsedProps.fill, step.toParsedProps.fill, ratio) : step.toParsedProps.fill;
|
|
18034
|
+
}, this.stroke = (key, from, to, ratio, step, target) => {
|
|
18035
|
+
target.attribute.stroke = interpolateColor(from, to, ratio, !1);
|
|
18036
|
+
}, this.strokePure = (key, from, to, ratio, step, target) => {
|
|
18037
|
+
target.attribute.stroke = step.fromParsedProps.stroke ? interpolatePureColorArrayToStr(step.fromParsedProps.stroke, step.toParsedProps.stroke, ratio) : step.toParsedProps.stroke;
|
|
18038
|
+
}, this.width = (key, from, to, ratio, step, target) => {
|
|
18039
|
+
target.attribute.width = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18040
|
+
}, this.height = (key, from, to, ratio, step, target) => {
|
|
18041
|
+
target.attribute.height = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18042
|
+
}, this.x = (key, from, to, ratio, step, target) => {
|
|
18043
|
+
target.attribute.x = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18044
|
+
}, this.y = (key, from, to, ratio, step, target) => {
|
|
18045
|
+
target.attribute.y = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18046
|
+
}, this.angle = (key, from, to, ratio, step, target) => {
|
|
18047
|
+
target.attribute.angle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18048
|
+
}, this.scaleX = (key, from, to, ratio, step, target) => {
|
|
18049
|
+
target.attribute.scaleX = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18050
|
+
}, this.scaleY = (key, from, to, ratio, step, target) => {
|
|
18051
|
+
target.attribute.scaleY = interpolateNumber(from, to, ratio), target.addUpdateBoundTag(), target.addUpdatePositionTag();
|
|
18052
|
+
}, this.lineWidth = (key, from, to, ratio, step, target) => {
|
|
18053
|
+
target.attribute.lineWidth = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18054
|
+
}, this.startAngle = (key, from, to, ratio, step, target) => {
|
|
18055
|
+
target.attribute.startAngle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18056
|
+
}, this.endAngle = (key, from, to, ratio, step, target) => {
|
|
18057
|
+
target.attribute.endAngle = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18058
|
+
}, this.radius = (key, from, to, ratio, step, target) => {
|
|
18059
|
+
target.attribute.radius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18060
|
+
}, this.outerRadius = (key, from, to, ratio, step, target) => {
|
|
18061
|
+
target.attribute.outerRadius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18062
|
+
}, this.innerRadius = (key, from, to, ratio, step, target) => {
|
|
18063
|
+
target.attribute.innerRadius = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18064
|
+
}, this.size = (key, from, to, ratio, step, target) => {
|
|
18065
|
+
target.attribute.size = interpolateNumber(from, to, ratio), target.addUpdateBoundTag();
|
|
18066
|
+
}, this.points = (key, from, to, ratio, step, target) => {
|
|
18067
|
+
target.attribute.points = pointsInterpolation(from, to, ratio), target.addUpdateBoundTag();
|
|
18068
|
+
};
|
|
18069
|
+
}
|
|
17753
18070
|
}
|
|
17754
|
-
|
|
17755
|
-
|
|
17756
|
-
|
|
18071
|
+
const interpolateUpdateStore = new InterpolateUpdateStore();
|
|
18072
|
+
function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
18073
|
+
if (Number.isFinite(to) && Number.isFinite(from)) return target.attribute[key] = from + (to - from) * ratio, !0;
|
|
18074
|
+
if (Array.isArray(to) && Array.isArray(from) && to.length === from.length) {
|
|
18075
|
+
const nextList = [];
|
|
18076
|
+
let valid = !0;
|
|
18077
|
+
for (let i = 0; i < to.length; i++) {
|
|
18078
|
+
const v = from[i],
|
|
18079
|
+
val = v + (to[i] - v) * ratio;
|
|
18080
|
+
if (!Number.isFinite(val)) {
|
|
18081
|
+
valid = !1;
|
|
18082
|
+
break;
|
|
18083
|
+
}
|
|
18084
|
+
nextList.push(val);
|
|
18085
|
+
}
|
|
18086
|
+
return valid && (target.attribute[key] = nextList), !0;
|
|
18087
|
+
}
|
|
18088
|
+
return !1;
|
|
17757
18089
|
}
|
|
17758
18090
|
|
|
17759
|
-
|
|
17760
|
-
class
|
|
17761
|
-
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
17766
|
-
|
|
17767
|
-
|
|
17768
|
-
|
|
17769
|
-
|
|
17770
|
-
|
|
17771
|
-
|
|
17772
|
-
|
|
17773
|
-
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
let lastStartPoint = start;
|
|
17823
|
-
this._breaks.forEach(b => {
|
|
17824
|
-
const { startPoint, endPoint } = b;
|
|
17825
|
-
linePoints.push([lastStartPoint, startPoint]);
|
|
17826
|
-
lastStartPoint = endPoint;
|
|
17827
|
-
});
|
|
17828
|
-
linePoints.push([lastStartPoint, end]);
|
|
17829
|
-
lineAttrs.points = linePoints;
|
|
17830
|
-
lineAttrs.multiSegment = true;
|
|
17831
|
-
}
|
|
17832
|
-
else {
|
|
17833
|
-
lineAttrs.points = [start, end];
|
|
17834
|
-
}
|
|
17835
|
-
if (!isEmpty(state)) {
|
|
17836
|
-
lineAttrs.state = {
|
|
17837
|
-
line: merge({}, DEFAULT_STATES$1, state),
|
|
17838
|
-
symbol: merge({}, DEFAULT_STATES$1, state)
|
|
17839
|
-
};
|
|
17840
|
-
}
|
|
17841
|
-
const axisLineGroup = new Segment(lineAttrs);
|
|
17842
|
-
axisLineGroup.name = AXIS_ELEMENT_NAME.line;
|
|
17843
|
-
axisLineGroup.id = this._getNodeId('line');
|
|
17844
|
-
container.add(axisLineGroup);
|
|
17845
|
-
}
|
|
17846
|
-
getTextAlign(vector) {
|
|
17847
|
-
let align = 'center';
|
|
17848
|
-
if (isNumberClose(vector[0], 0)) {
|
|
17849
|
-
if (isNumberClose(vector[1], 0)) {
|
|
17850
|
-
if (Object.is(vector[1], -0)) {
|
|
17851
|
-
align = 'start';
|
|
17852
|
-
}
|
|
17853
|
-
else if (Object.is(vector[0], -0)) {
|
|
17854
|
-
align = 'end';
|
|
17855
|
-
}
|
|
17856
|
-
}
|
|
17857
|
-
else {
|
|
17858
|
-
align = 'center';
|
|
17859
|
-
}
|
|
17860
|
-
}
|
|
17861
|
-
else if (vector[0] > 0) {
|
|
17862
|
-
align = 'start';
|
|
17863
|
-
}
|
|
17864
|
-
else if (vector[0] < 0) {
|
|
17865
|
-
align = 'end';
|
|
17866
|
-
}
|
|
17867
|
-
return align;
|
|
18091
|
+
function noop() {}
|
|
18092
|
+
class Step {
|
|
18093
|
+
constructor(type, props, duration, easing) {
|
|
18094
|
+
this._startTime = 0, this._hasFirstRun = !1, this._syncAttributeUpdate = () => {
|
|
18095
|
+
this.target.setAttributes(this.target.attribute);
|
|
18096
|
+
}, this.type = type, this.props = props, this.duration = duration, this.easing = easing ? "function" == typeof easing ? easing : Easing[easing] : Easing.linear, "wait" === type && (this.onUpdate = noop), this.id = Generator.GenAutoIncrementId(), this.syncAttributeUpdate = noop;
|
|
18097
|
+
}
|
|
18098
|
+
bind(target, animate) {
|
|
18099
|
+
this.target = target, this.animate = animate, this.onBind(), this.syncAttributeUpdate();
|
|
18100
|
+
}
|
|
18101
|
+
append(step) {
|
|
18102
|
+
this.next = step, step.prev = this, step.setStartTime(this.getStartTime() + this.duration, !1);
|
|
18103
|
+
}
|
|
18104
|
+
updateDownstreamStartTimes() {
|
|
18105
|
+
let currentStep = this.next,
|
|
18106
|
+
currentStartTime = this._startTime + this.duration;
|
|
18107
|
+
for (; currentStep;) currentStep.setStartTime(currentStartTime, !1), currentStartTime += currentStep.duration, currentStep = currentStep.next;
|
|
18108
|
+
this.animate.updateDuration();
|
|
18109
|
+
}
|
|
18110
|
+
getLastProps() {
|
|
18111
|
+
return this.prev ? this.prev.props || {} : this.animate.getStartProps();
|
|
18112
|
+
}
|
|
18113
|
+
setDuration(duration) {
|
|
18114
|
+
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18115
|
+
this.duration = duration, updateDownstream && this.updateDownstreamStartTimes();
|
|
18116
|
+
}
|
|
18117
|
+
getDuration() {
|
|
18118
|
+
return this.duration;
|
|
18119
|
+
}
|
|
18120
|
+
determineInterpolateUpdateFunction() {
|
|
18121
|
+
if (!this.props) return;
|
|
18122
|
+
const funcs = [];
|
|
18123
|
+
this.propKeys.forEach(key => {
|
|
18124
|
+
if ("fill" === key || "stroke" === key) {
|
|
18125
|
+
const from = this.fromProps[key],
|
|
18126
|
+
to = this.props[key];
|
|
18127
|
+
if (isString(from) && isString(to)) {
|
|
18128
|
+
const fromArray = ColorStore.Get(from, ColorType.Color255),
|
|
18129
|
+
toArray = ColorStore.Get(to, ColorType.Color255);
|
|
18130
|
+
this.fromParsedProps || (this.fromParsedProps = {}), this.toParsedProps || (this.toParsedProps = {}), this.fromParsedProps[key] = fromArray, this.toParsedProps[key] = toArray, funcs.push(interpolateUpdateStore["fill" === key ? "fillPure" : "strokePure"]);
|
|
18131
|
+
} else interpolateUpdateStore[key] ? funcs.push(interpolateUpdateStore[key]) : funcs.push(commonInterpolateUpdate);
|
|
18132
|
+
} else interpolateUpdateStore[key] ? funcs.push(interpolateUpdateStore[key]) : funcs.push(commonInterpolateUpdate);
|
|
18133
|
+
}), this.interpolateUpdateFunctions = funcs;
|
|
18134
|
+
}
|
|
18135
|
+
setStartTime(time) {
|
|
18136
|
+
let updateDownstream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18137
|
+
this._startTime = time, updateDownstream && this.updateDownstreamStartTimes();
|
|
18138
|
+
}
|
|
18139
|
+
getStartTime() {
|
|
18140
|
+
return this._startTime;
|
|
18141
|
+
}
|
|
18142
|
+
onBind() {
|
|
18143
|
+
"glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
|
|
18144
|
+
}
|
|
18145
|
+
onFirstRun() {}
|
|
18146
|
+
onStart() {
|
|
18147
|
+
if (!this._hasFirstRun) {
|
|
18148
|
+
this._hasFirstRun = !0, this.fromProps = this.getLastProps();
|
|
18149
|
+
const startProps = this.animate.getStartProps();
|
|
18150
|
+
this.propKeys && this.propKeys.forEach(key => {
|
|
18151
|
+
var _a;
|
|
18152
|
+
this.fromProps[key] = null !== (_a = this.fromProps[key]) && void 0 !== _a ? _a : startProps[key];
|
|
18153
|
+
}), this.determineInterpolateUpdateFunction(), this.tryPreventConflict(), this.trySyncStartProps(), this.onFirstRun();
|
|
17868
18154
|
}
|
|
17869
|
-
|
|
17870
|
-
|
|
17871
|
-
|
|
17872
|
-
|
|
17873
|
-
|
|
17874
|
-
|
|
17875
|
-
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
17879
|
-
|
|
17880
|
-
|
|
17881
|
-
|
|
17882
|
-
|
|
17883
|
-
|
|
17884
|
-
|
|
17885
|
-
|
|
17886
|
-
|
|
17887
|
-
|
|
17888
|
-
|
|
17889
|
-
|
|
17890
|
-
|
|
17891
|
-
|
|
17892
|
-
|
|
17893
|
-
|
|
17894
|
-
|
|
17895
|
-
|
|
17896
|
-
|
|
17897
|
-
|
|
17898
|
-
|
|
17899
|
-
|
|
17900
|
-
|
|
17901
|
-
|
|
17902
|
-
|
|
17903
|
-
|
|
17904
|
-
|
|
17905
|
-
|
|
17906
|
-
|
|
17907
|
-
|
|
17908
|
-
|
|
17909
|
-
|
|
17910
|
-
|
|
17911
|
-
|
|
17912
|
-
|
|
17913
|
-
|
|
17914
|
-
|
|
17915
|
-
|
|
17916
|
-
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
|
|
17924
|
-
|
|
17925
|
-
|
|
17926
|
-
|
|
17927
|
-
|
|
17928
|
-
|
|
17929
|
-
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
|
|
17934
|
-
|
|
17935
|
-
|
|
17936
|
-
|
|
17937
|
-
|
|
17938
|
-
|
|
17939
|
-
|
|
17940
|
-
|
|
17941
|
-
|
|
17942
|
-
|
|
17943
|
-
|
|
17944
|
-
|
|
17945
|
-
|
|
17946
|
-
|
|
17947
|
-
|
|
17948
|
-
|
|
17949
|
-
|
|
17950
|
-
|
|
17951
|
-
|
|
17952
|
-
|
|
17953
|
-
|
|
17954
|
-
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
|
|
17961
|
-
|
|
17962
|
-
|
|
17963
|
-
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
|
|
17967
|
-
|
|
17968
|
-
|
|
17969
|
-
|
|
17970
|
-
|
|
17971
|
-
|
|
17972
|
-
|
|
17973
|
-
|
|
17974
|
-
|
|
17975
|
-
|
|
17976
|
-
|
|
17977
|
-
|
|
17978
|
-
|
|
17979
|
-
|
|
17980
|
-
|
|
17981
|
-
|
|
17982
|
-
|
|
17983
|
-
|
|
17984
|
-
|
|
17985
|
-
|
|
17986
|
-
|
|
17987
|
-
|
|
17988
|
-
|
|
17989
|
-
|
|
17990
|
-
|
|
17991
|
-
|
|
17992
|
-
|
|
17993
|
-
|
|
17994
|
-
|
|
17995
|
-
|
|
17996
|
-
|
|
17997
|
-
|
|
17998
|
-
|
|
17999
|
-
|
|
18000
|
-
|
|
18001
|
-
|
|
18002
|
-
|
|
18003
|
-
|
|
18004
|
-
|
|
18005
|
-
|
|
18006
|
-
|
|
18007
|
-
|
|
18008
|
-
|
|
18009
|
-
|
|
18010
|
-
|
|
18011
|
-
|
|
18012
|
-
|
|
18013
|
-
|
|
18014
|
-
|
|
18015
|
-
|
|
18016
|
-
|
|
18017
|
-
|
|
18018
|
-
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18022
|
-
|
|
18023
|
-
|
|
18024
|
-
|
|
18025
|
-
|
|
18026
|
-
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18032
|
-
|
|
18033
|
-
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18048
|
-
|
|
18049
|
-
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18062
|
-
|
|
18063
|
-
|
|
18064
|
-
|
|
18065
|
-
|
|
18066
|
-
|
|
18067
|
-
|
|
18068
|
-
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
|
|
18087
|
-
|
|
18088
|
-
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
|
|
18094
|
-
|
|
18095
|
-
|
|
18096
|
-
|
|
18097
|
-
|
|
18098
|
-
|
|
18099
|
-
|
|
18100
|
-
|
|
18101
|
-
|
|
18102
|
-
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18106
|
-
|
|
18107
|
-
|
|
18108
|
-
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
|
|
18119
|
-
|
|
18120
|
-
|
|
18121
|
-
|
|
18122
|
-
|
|
18123
|
-
|
|
18124
|
-
|
|
18125
|
-
|
|
18126
|
-
|
|
18127
|
-
|
|
18128
|
-
|
|
18129
|
-
|
|
18130
|
-
|
|
18131
|
-
|
|
18132
|
-
|
|
18133
|
-
|
|
18134
|
-
|
|
18135
|
-
|
|
18136
|
-
|
|
18137
|
-
|
|
18138
|
-
|
|
18139
|
-
|
|
18140
|
-
|
|
18141
|
-
|
|
18142
|
-
|
|
18143
|
-
|
|
18144
|
-
|
|
18145
|
-
|
|
18146
|
-
|
|
18147
|
-
|
|
18148
|
-
|
|
18149
|
-
|
|
18150
|
-
|
|
18151
|
-
|
|
18152
|
-
|
|
18153
|
-
|
|
18154
|
-
|
|
18155
|
-
|
|
18156
|
-
|
|
18157
|
-
|
|
18158
|
-
|
|
18159
|
-
|
|
18160
|
-
|
|
18161
|
-
|
|
18162
|
-
|
|
18163
|
-
axisLength,
|
|
18164
|
-
overflowLimitLength
|
|
18165
|
-
});
|
|
18166
|
-
}
|
|
18167
|
-
if (autoHide$1) {
|
|
18168
|
-
autoHide(labelShapes, {
|
|
18169
|
-
orient,
|
|
18170
|
-
method: autoHideMethod,
|
|
18171
|
-
separation: autoHideSeparation,
|
|
18172
|
-
lastVisible,
|
|
18173
|
-
firstVisible
|
|
18174
|
-
});
|
|
18175
|
-
}
|
|
18176
|
-
}
|
|
18177
|
-
}
|
|
18178
|
-
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
18179
|
-
const { verticalLimitSize, orient } = this.attribute;
|
|
18180
|
-
const isHorizontal = orient === 'bottom' || orient === 'top';
|
|
18181
|
-
const axisLabelContainerBounds = labelContainer.AABBBounds;
|
|
18182
|
-
let axisLabelContainerSize = isHorizontal ? axisLabelContainerBounds.height() : axisLabelContainerBounds.width();
|
|
18183
|
-
const { verticalMinSize } = this.attribute;
|
|
18184
|
-
if (isValidNumber(verticalMinSize) && (!isValidNumber(verticalLimitSize) || verticalMinSize <= verticalLimitSize)) {
|
|
18185
|
-
const minSize = this._getAxisLabelLimitLength(verticalMinSize, layerCount);
|
|
18186
|
-
axisLabelContainerSize = Math.max(axisLabelContainerSize, minSize);
|
|
18187
|
-
let x;
|
|
18188
|
-
let y;
|
|
18189
|
-
if (orient === 'left') {
|
|
18190
|
-
x = axisLabelContainerBounds.x2 - axisLabelContainerSize;
|
|
18191
|
-
y = axisLabelContainerBounds.y1;
|
|
18192
|
-
}
|
|
18193
|
-
else if (orient === 'right') {
|
|
18194
|
-
x = axisLabelContainerBounds.x1;
|
|
18195
|
-
y = axisLabelContainerBounds.y1;
|
|
18196
|
-
}
|
|
18197
|
-
else if (orient === 'top') {
|
|
18198
|
-
x = axisLabelContainerBounds.x1;
|
|
18199
|
-
y = axisLabelContainerBounds.y2 - axisLabelContainerSize;
|
|
18200
|
-
}
|
|
18201
|
-
else if (orient === 'bottom') {
|
|
18202
|
-
x = axisLabelContainerBounds.x1;
|
|
18203
|
-
y = axisLabelContainerBounds.y1;
|
|
18204
|
-
}
|
|
18205
|
-
const bgRect = graphicCreator.rect({
|
|
18206
|
-
x,
|
|
18207
|
-
y,
|
|
18208
|
-
width: isHorizontal ? axisLabelContainerBounds.width() : axisLabelContainerSize,
|
|
18209
|
-
height: isHorizontal ? axisLabelContainerSize : axisLabelContainerBounds.height(),
|
|
18210
|
-
pickable: false
|
|
18211
|
-
});
|
|
18212
|
-
bgRect.name = AXIS_ELEMENT_NAME.axisLabelBackground;
|
|
18213
|
-
bgRect.id = this._getNodeId('axis-label-background');
|
|
18214
|
-
labelContainer.insertBefore(bgRect, labelContainer.firstChild);
|
|
18215
|
-
}
|
|
18216
|
-
if (isValid(this.attribute.label.containerAlign)) {
|
|
18217
|
-
let start;
|
|
18218
|
-
if (orient === 'left') {
|
|
18219
|
-
start = axisLabelContainerBounds.x2 - axisLabelContainerSize;
|
|
18220
|
-
}
|
|
18221
|
-
else if (orient === 'right') {
|
|
18222
|
-
start = axisLabelContainerBounds.x1;
|
|
18223
|
-
}
|
|
18224
|
-
else if (orient === 'top') {
|
|
18225
|
-
start = axisLabelContainerBounds.y2 - axisLabelContainerSize;
|
|
18226
|
-
}
|
|
18227
|
-
else if (orient === 'bottom') {
|
|
18228
|
-
start = axisLabelContainerBounds.y1;
|
|
18229
|
-
}
|
|
18230
|
-
alignAxisLabels(labelShapes, start, axisLabelContainerSize, orient, this.attribute.label.containerAlign);
|
|
18231
|
-
}
|
|
18155
|
+
}
|
|
18156
|
+
tryPreventConflict() {
|
|
18157
|
+
const animate = this.animate;
|
|
18158
|
+
this.target.animates.forEach(a => {
|
|
18159
|
+
if (a === animate || a.priority > animate.priority) return;
|
|
18160
|
+
const fromProps = a.getStartProps();
|
|
18161
|
+
this.propKeys.forEach(key => {
|
|
18162
|
+
null != fromProps[key] && a.preventAttr(key);
|
|
18163
|
+
});
|
|
18164
|
+
});
|
|
18165
|
+
}
|
|
18166
|
+
deleteSelfAttr(key) {
|
|
18167
|
+
var _a;
|
|
18168
|
+
delete this.props[key], this.fromProps && delete this.fromProps[key];
|
|
18169
|
+
const index = this.propKeys.indexOf(key);
|
|
18170
|
+
-1 !== index && (this.propKeys.splice(index, 1), null === (_a = this.interpolateUpdateFunctions) || void 0 === _a || _a.splice(index, 1));
|
|
18171
|
+
}
|
|
18172
|
+
trySyncStartProps() {
|
|
18173
|
+
this.propKeys.forEach(key => {
|
|
18174
|
+
this.fromProps[key] = this.animate.target.getComputedAttribute(key);
|
|
18175
|
+
});
|
|
18176
|
+
}
|
|
18177
|
+
update(end, ratio, out) {
|
|
18178
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
18179
|
+
const easedRatio = this.easing(ratio);
|
|
18180
|
+
this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach((func, index) => {
|
|
18181
|
+
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
18182
|
+
const key = this.propKeys[index];
|
|
18183
|
+
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
18184
|
+
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
18185
|
+
}
|
|
18186
|
+
onUpdate(end, ratio, out) {}
|
|
18187
|
+
onEnd(cb) {
|
|
18188
|
+
this.target.setAttributes(this.props), cb ? this._endCb = cb : this._endCb && this._endCb(this.animate, this);
|
|
18189
|
+
}
|
|
18190
|
+
getEndProps() {
|
|
18191
|
+
return this.props;
|
|
18192
|
+
}
|
|
18193
|
+
getFromProps() {
|
|
18194
|
+
return this.fromProps;
|
|
18195
|
+
}
|
|
18196
|
+
getMergedEndProps() {
|
|
18197
|
+
return this.getEndProps();
|
|
18198
|
+
}
|
|
18199
|
+
stop() {}
|
|
18200
|
+
}
|
|
18201
|
+
class WaitStep extends Step {
|
|
18202
|
+
constructor(type, props, duration, easing) {
|
|
18203
|
+
super(type, props, duration, easing);
|
|
18204
|
+
}
|
|
18205
|
+
update(end, ratio, out) {
|
|
18206
|
+
this.onStart();
|
|
18207
|
+
}
|
|
18208
|
+
determineInterpolateUpdateFunction() {}
|
|
18209
|
+
}
|
|
18210
|
+
|
|
18211
|
+
class DefaultTimeline {
|
|
18212
|
+
get animateCount() {
|
|
18213
|
+
return this.animates.length;
|
|
18214
|
+
}
|
|
18215
|
+
constructor() {
|
|
18216
|
+
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;
|
|
18217
|
+
}
|
|
18218
|
+
isRunning() {
|
|
18219
|
+
return !this.paused && this._endAnimatePtr >= 0;
|
|
18220
|
+
}
|
|
18221
|
+
forEachAccessAnimate(cb) {
|
|
18222
|
+
for (let i = 0; i <= this._endAnimatePtr; i++) cb(this.animates[i], i);
|
|
18223
|
+
}
|
|
18224
|
+
addAnimate(animate) {
|
|
18225
|
+
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());
|
|
18226
|
+
}
|
|
18227
|
+
pause() {
|
|
18228
|
+
this.paused = !0;
|
|
18229
|
+
}
|
|
18230
|
+
resume() {
|
|
18231
|
+
this.paused = !1;
|
|
18232
|
+
}
|
|
18233
|
+
tick(delta) {
|
|
18234
|
+
if (this.paused) return;
|
|
18235
|
+
const scaledDelta = delta * this._playSpeed;
|
|
18236
|
+
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18237
|
+
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0, i) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
18238
|
+
});
|
|
18239
|
+
}
|
|
18240
|
+
clear() {
|
|
18241
|
+
this.forEachAccessAnimate(animate => {
|
|
18242
|
+
animate.release();
|
|
18243
|
+
}), this.animates = [], this._totalDuration = 0;
|
|
18244
|
+
}
|
|
18245
|
+
removeAnimate(animate) {
|
|
18246
|
+
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18247
|
+
let index = arguments.length > 2 ? arguments[2] : undefined;
|
|
18248
|
+
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--);
|
|
18249
|
+
}
|
|
18250
|
+
recalculateTotalDuration() {
|
|
18251
|
+
this._totalDuration = 0, this.animates.forEach(animate => {
|
|
18252
|
+
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18253
|
+
});
|
|
18254
|
+
}
|
|
18255
|
+
getTotalDuration() {
|
|
18256
|
+
return this._totalDuration;
|
|
18257
|
+
}
|
|
18258
|
+
getPlaySpeed() {
|
|
18259
|
+
return this._playSpeed;
|
|
18260
|
+
}
|
|
18261
|
+
setPlaySpeed(speed) {
|
|
18262
|
+
this._playSpeed = speed;
|
|
18263
|
+
}
|
|
18264
|
+
getPlayState() {
|
|
18265
|
+
return this.paused ? "paused" : 0 === this.animateCount ? "stopped" : "playing";
|
|
18266
|
+
}
|
|
18267
|
+
setStartTime(time) {
|
|
18268
|
+
this._startTime = time;
|
|
18269
|
+
}
|
|
18270
|
+
getStartTime() {
|
|
18271
|
+
return this._startTime;
|
|
18272
|
+
}
|
|
18273
|
+
getCurrentTime() {
|
|
18274
|
+
return this._currentTime;
|
|
18275
|
+
}
|
|
18276
|
+
setCurrentTime(time) {
|
|
18277
|
+
this._currentTime = time;
|
|
18278
|
+
}
|
|
18279
|
+
}
|
|
18280
|
+
const defaultTimeline = new DefaultTimeline();
|
|
18281
|
+
defaultTimeline.isGlobal = !0;
|
|
18282
|
+
|
|
18283
|
+
class Animate {
|
|
18284
|
+
constructor() {
|
|
18285
|
+
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
18286
|
+
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
18287
|
+
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
18288
|
+
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;
|
|
18289
|
+
}
|
|
18290
|
+
getStartProps() {
|
|
18291
|
+
return this._startProps;
|
|
18292
|
+
}
|
|
18293
|
+
getEndProps() {
|
|
18294
|
+
return this._endProps;
|
|
18295
|
+
}
|
|
18296
|
+
setTimeline(timeline) {
|
|
18297
|
+
this._timeline = timeline;
|
|
18298
|
+
}
|
|
18299
|
+
getTimeline() {
|
|
18300
|
+
return this._timeline;
|
|
18301
|
+
}
|
|
18302
|
+
get timeline() {
|
|
18303
|
+
return this._timeline;
|
|
18304
|
+
}
|
|
18305
|
+
bind(target) {
|
|
18306
|
+
return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.target.animationAttribute || (this.target.animationAttribute = {}), this;
|
|
18307
|
+
}
|
|
18308
|
+
to(props) {
|
|
18309
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
18310
|
+
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
18311
|
+
const step = new Step(AnimateStepType.to, props, duration, easing);
|
|
18312
|
+
return step.bind(this.target, this), this.updateStepAfterAppend(step), this;
|
|
18313
|
+
}
|
|
18314
|
+
wait(delay) {
|
|
18315
|
+
const step = new WaitStep(AnimateStepType.wait, {}, delay, "linear");
|
|
18316
|
+
return step.bind(this.target, this), this.updateStepAfterAppend(step), this;
|
|
18317
|
+
}
|
|
18318
|
+
updateStepAfterAppend(step) {
|
|
18319
|
+
this._firstStep ? (this._lastStep.append(step), this._lastStep = step) : (this._firstStep = step, this._lastStep = step), this.parseStepProps(step), this.updateDuration();
|
|
18320
|
+
}
|
|
18321
|
+
parseStepProps(step) {
|
|
18322
|
+
this._lastStep && (step.propKeys = step.propKeys || Object.keys(step.props), Object.keys(this._endProps).forEach(key => {
|
|
18323
|
+
var _a;
|
|
18324
|
+
step.props[key] = null !== (_a = step.props[key]) && void 0 !== _a ? _a : this._endProps[key];
|
|
18325
|
+
}), step.propKeys.forEach(key => {
|
|
18326
|
+
this._endProps[key] = step.props[key];
|
|
18327
|
+
}));
|
|
18328
|
+
}
|
|
18329
|
+
reSyncProps() {
|
|
18330
|
+
if (!this._lastStep) return;
|
|
18331
|
+
this._endProps = {};
|
|
18332
|
+
let currentStep = this._firstStep;
|
|
18333
|
+
for (; currentStep;) Object.keys(this._endProps).forEach(key => {
|
|
18334
|
+
var _a;
|
|
18335
|
+
currentStep.props[key] = null !== (_a = currentStep.props[key]) && void 0 !== _a ? _a : this._endProps[key];
|
|
18336
|
+
}), currentStep.propKeys.forEach(key => {
|
|
18337
|
+
this._endProps[key] = currentStep.props[key];
|
|
18338
|
+
}), currentStep = currentStep.next;
|
|
18339
|
+
}
|
|
18340
|
+
from(props) {
|
|
18341
|
+
let duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
18342
|
+
let easing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "linear";
|
|
18343
|
+
const step = new Step(AnimateStepType.from, props, duration, easing);
|
|
18344
|
+
return this._firstStep ? (this._lastStep.append(step), this._lastStep = step) : (this._firstStep = step, this._lastStep = step), this.updateDuration(), this;
|
|
18345
|
+
}
|
|
18346
|
+
play(customAnimate) {
|
|
18347
|
+
return customAnimate.bind(this.target, this), this.updateStepAfterAppend(customAnimate), this;
|
|
18348
|
+
}
|
|
18349
|
+
pause() {
|
|
18350
|
+
this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.PAUSED);
|
|
18351
|
+
}
|
|
18352
|
+
resume() {
|
|
18353
|
+
this.status === AnimateStatus.PAUSED && (this.status = AnimateStatus.RUNNING);
|
|
18354
|
+
}
|
|
18355
|
+
onStart(cb) {
|
|
18356
|
+
var _a;
|
|
18357
|
+
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 => {
|
|
18358
|
+
this._startProps[key] = this.target.getComputedAttribute(key);
|
|
18359
|
+
}));
|
|
18360
|
+
}
|
|
18361
|
+
onEnd(cb) {
|
|
18362
|
+
var _a;
|
|
18363
|
+
cb ? (this._onEnd || (this._onEnd = []), this._onEnd.push(cb)) : null === (_a = this._onEnd) || void 0 === _a || _a.forEach(cb => cb());
|
|
18364
|
+
}
|
|
18365
|
+
onFrame(cb) {
|
|
18366
|
+
cb && (this._onFrame || (this._onFrame = []), this._onFrame.push(cb));
|
|
18367
|
+
}
|
|
18368
|
+
onRemove(cb) {
|
|
18369
|
+
var _a;
|
|
18370
|
+
cb ? (this._onRemove || (this._onRemove = []), this._onRemove.push(cb)) : null === (_a = this._onRemove) || void 0 === _a || _a.forEach(cb => cb());
|
|
18371
|
+
}
|
|
18372
|
+
preventAttr(key) {
|
|
18373
|
+
this._preventAttrs.add(key), delete this._startProps[key], delete this._endProps[key];
|
|
18374
|
+
let step = this._firstStep;
|
|
18375
|
+
for (; step;) step.deleteSelfAttr(key), step = step.next;
|
|
18376
|
+
}
|
|
18377
|
+
preventAttrs(keys) {
|
|
18378
|
+
keys.forEach(key => this._preventAttrs.add(key));
|
|
18379
|
+
}
|
|
18380
|
+
validAttr(key) {
|
|
18381
|
+
return !this._preventAttrs.has(key);
|
|
18382
|
+
}
|
|
18383
|
+
runCb(cb) {
|
|
18384
|
+
var _a;
|
|
18385
|
+
return null === (_a = this._lastStep) || void 0 === _a || _a.onEnd(cb), this;
|
|
18386
|
+
}
|
|
18387
|
+
startAt(t) {
|
|
18388
|
+
return this._startTime = t, this;
|
|
18389
|
+
}
|
|
18390
|
+
customInterpolate(key, ratio, from, to, target, ret) {
|
|
18391
|
+
return !1;
|
|
18392
|
+
}
|
|
18393
|
+
getFromValue() {
|
|
18394
|
+
return this._startProps;
|
|
18395
|
+
}
|
|
18396
|
+
getToValue() {
|
|
18397
|
+
return this._endProps;
|
|
18398
|
+
}
|
|
18399
|
+
stop(type) {
|
|
18400
|
+
let step = this._firstStep;
|
|
18401
|
+
for (; step;) step.stop(), step = step.next;
|
|
18402
|
+
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));
|
|
18403
|
+
}
|
|
18404
|
+
release() {
|
|
18405
|
+
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
|
|
18406
|
+
}
|
|
18407
|
+
getDuration() {
|
|
18408
|
+
return this._duration;
|
|
18409
|
+
}
|
|
18410
|
+
getStartTime() {
|
|
18411
|
+
return this._startTime;
|
|
18412
|
+
}
|
|
18413
|
+
afterAll(list) {
|
|
18414
|
+
if (!list || 0 === list.length) return this;
|
|
18415
|
+
let maxEndTime = 0;
|
|
18416
|
+
return list.forEach(animate => {
|
|
18417
|
+
const endTime = animate.getStartTime() + animate.getTotalDuration();
|
|
18418
|
+
maxEndTime = Math.max(maxEndTime, endTime);
|
|
18419
|
+
}), this.startAt(maxEndTime);
|
|
18420
|
+
}
|
|
18421
|
+
after(animate) {
|
|
18422
|
+
if (!animate) return this;
|
|
18423
|
+
const endTime = animate.getStartTime() + animate.getTotalDuration();
|
|
18424
|
+
return this.startAt(endTime);
|
|
18425
|
+
}
|
|
18426
|
+
parallel(animate) {
|
|
18427
|
+
return animate ? (this.startAt(animate.getStartTime()), this) : this;
|
|
18428
|
+
}
|
|
18429
|
+
loop(n) {
|
|
18430
|
+
return !0 === n ? n = 1 / 0 : !1 === n && (n = 0), this._loopCount = n, this.updateDuration(), this;
|
|
18431
|
+
}
|
|
18432
|
+
bounce(b) {
|
|
18433
|
+
return this._bounce = b, this;
|
|
18434
|
+
}
|
|
18435
|
+
advance(delta) {
|
|
18436
|
+
var _a;
|
|
18437
|
+
if (this.status === AnimateStatus.END) return void console.warn("aaa 动画已经结束,不能推进");
|
|
18438
|
+
const nextTime = this.currentTime + delta;
|
|
18439
|
+
if (nextTime < this._startTime) return void (this.currentTime = nextTime);
|
|
18440
|
+
if (nextTime >= this._startTime + this._totalDuration) return null === (_a = this._lastStep) || void 0 === _a || _a.onEnd(), this.onEnd(), void (this.status = AnimateStatus.END);
|
|
18441
|
+
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
18442
|
+
let cycleTime = nextTime - this._startTime,
|
|
18443
|
+
newLoop = !1,
|
|
18444
|
+
bounceTime = !1;
|
|
18445
|
+
if (this._loopCount > 0) {
|
|
18446
|
+
cycleTime = (nextTime - this._startTime) % this._duration;
|
|
18447
|
+
const currentLoop = Math.floor((nextTime - this._startTime) / this._duration);
|
|
18448
|
+
newLoop = currentLoop > this._currentLoop, this._currentLoop = currentLoop, bounceTime = this._bounce && currentLoop % 2 == 1, bounceTime && (cycleTime = this._duration - cycleTime);
|
|
18232
18449
|
}
|
|
18233
|
-
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
|
|
18242
|
-
|
|
18243
|
-
titleHeight = measureTextSize(title.text, title.textStyle, (_e = (_d = this.stage) === null || _d === void 0 ? void 0 : _d.getTheme()) === null || _e === void 0 ? void 0 : _e.text).height;
|
|
18244
|
-
const padding = normalizePadding(title.padding);
|
|
18245
|
-
titleSpacing = title.space + padding[0] + padding[2];
|
|
18246
|
-
}
|
|
18247
|
-
if (limitLength) {
|
|
18248
|
-
limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount;
|
|
18450
|
+
newLoop && !bounceTime && this.target.setAttributes(this._startProps);
|
|
18451
|
+
let targetStep = null;
|
|
18452
|
+
if (this._lastStep === this._firstStep) targetStep = this._firstStep;else {
|
|
18453
|
+
let currentStep = this._firstStep;
|
|
18454
|
+
for (; currentStep;) {
|
|
18455
|
+
const stepStartTime = currentStep.getStartTime(),
|
|
18456
|
+
stepDuration = currentStep.getDuration();
|
|
18457
|
+
if (cycleTime >= stepStartTime && cycleTime <= stepStartTime + stepDuration) {
|
|
18458
|
+
targetStep = currentStep;
|
|
18459
|
+
break;
|
|
18249
18460
|
}
|
|
18250
|
-
|
|
18251
|
-
|
|
18252
|
-
release() {
|
|
18253
|
-
super.release();
|
|
18254
|
-
this._breaks = null;
|
|
18461
|
+
currentStep = currentStep.next;
|
|
18462
|
+
}
|
|
18255
18463
|
}
|
|
18464
|
+
if (!targetStep) return;
|
|
18465
|
+
const ratio = (cycleTime - targetStep.getStartTime()) / targetStep.getDuration(),
|
|
18466
|
+
isEnd = ratio >= 1;
|
|
18467
|
+
targetStep.update(isEnd, ratio, {}), isEnd && targetStep.onEnd();
|
|
18468
|
+
}
|
|
18469
|
+
updateDuration() {
|
|
18470
|
+
this._lastStep ? (this._duration = this._lastStep.getStartTime() + this._lastStep.getDuration(), this._totalDuration = this._duration * (this._loopCount + 1)) : this._duration = 0;
|
|
18471
|
+
}
|
|
18472
|
+
getTotalDuration() {
|
|
18473
|
+
return this._totalDuration;
|
|
18474
|
+
}
|
|
18475
|
+
getLoop() {
|
|
18476
|
+
return this._loopCount;
|
|
18477
|
+
}
|
|
18256
18478
|
}
|
|
18257
|
-
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
18258
|
-
mixin(LineAxis, LineAxisMixin);
|
|
18259
18479
|
|
|
18260
|
-
class
|
|
18261
|
-
|
|
18262
|
-
|
|
18263
|
-
|
|
18264
|
-
|
|
18265
|
-
|
|
18266
|
-
|
|
18267
|
-
|
|
18268
|
-
|
|
18269
|
-
|
|
18270
|
-
|
|
18271
|
-
|
|
18272
|
-
|
|
18273
|
-
|
|
18274
|
-
|
|
18480
|
+
class AnimateExecutor {
|
|
18481
|
+
static registerBuiltInAnimate(name, animate) {
|
|
18482
|
+
AnimateExecutor.builtInAnimateMap[name] = animate;
|
|
18483
|
+
}
|
|
18484
|
+
constructor(target) {
|
|
18485
|
+
this._animates = [], this._startCallbacks = [], this._endCallbacks = [], this._started = !1, this._activeCount = 0, this._target = target;
|
|
18486
|
+
}
|
|
18487
|
+
onStart(cb) {
|
|
18488
|
+
cb ? (this._startCallbacks.push(cb), this._started && this._activeCount > 0 && cb()) : this._startCallbacks.forEach(cb => {
|
|
18489
|
+
cb();
|
|
18490
|
+
});
|
|
18491
|
+
}
|
|
18492
|
+
onEnd(cb) {
|
|
18493
|
+
cb ? this._endCallbacks.push(cb) : this._endCallbacks.forEach(cb => {
|
|
18494
|
+
cb();
|
|
18495
|
+
});
|
|
18496
|
+
}
|
|
18497
|
+
_trackAnimation(animate) {
|
|
18498
|
+
this._animates.push(animate), this._activeCount++, 1 !== this._activeCount || this._started || (this._started = !0, this.onStart()), animate.onEnd(() => {
|
|
18499
|
+
this._activeCount--;
|
|
18500
|
+
const index = this._animates.indexOf(animate);
|
|
18501
|
+
index >= 0 && this._animates.splice(index, 1), 0 === this._activeCount && this._started && (this._started = !1, this.onEnd());
|
|
18502
|
+
});
|
|
18503
|
+
}
|
|
18504
|
+
parseParams(params, isTimeline) {
|
|
18505
|
+
var _a, _b;
|
|
18506
|
+
const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
|
|
18507
|
+
startTime = this.resolveValue(params.startTime, void 0, 0),
|
|
18508
|
+
parsedParams = Object.assign({}, params);
|
|
18509
|
+
parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
|
|
18510
|
+
const oneByOne = this.resolveValue(params.oneByOne, void 0, !1);
|
|
18511
|
+
if (isTimeline) {
|
|
18512
|
+
const timeSlices = parsedParams.timeSlices;
|
|
18513
|
+
isArray(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
|
|
18514
|
+
let sliceTime = 0;
|
|
18515
|
+
parsedParams.timeSlices.forEach(slice => {
|
|
18516
|
+
slice.delay = this.resolveValue(slice.delay, void 0, 0), slice.delayAfter = this.resolveValue(slice.delayAfter, void 0, 0), slice.duration = this.resolveValue(slice.duration, void 0, 300), sliceTime += slice.delay + slice.duration + slice.delayAfter;
|
|
18517
|
+
});
|
|
18518
|
+
let oneByOneDelay = 0,
|
|
18519
|
+
oneByOneTime = 0;
|
|
18520
|
+
if (oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay, totalTime) {
|
|
18521
|
+
const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2),
|
|
18522
|
+
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18523
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
18524
|
+
let effects = slice.effects;
|
|
18525
|
+
return Array.isArray(effects) || (effects = [effects]), Object.assign(Object.assign({}, slice), {
|
|
18526
|
+
delay: slice.delay * scale,
|
|
18527
|
+
delayAfter: slice.delayAfter * scale,
|
|
18528
|
+
duration: slice.duration * scale,
|
|
18529
|
+
effects: effects.map(effect => {
|
|
18530
|
+
var _a, _b;
|
|
18531
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
|
|
18532
|
+
customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
18533
|
+
return Object.assign(Object.assign({}, effect), {
|
|
18534
|
+
custom: custom,
|
|
18535
|
+
customType: customType
|
|
18536
|
+
});
|
|
18537
|
+
})
|
|
18538
|
+
});
|
|
18539
|
+
}), parsedParams.oneByOne = oneByOneTime * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
|
|
18540
|
+
}
|
|
18541
|
+
} else {
|
|
18542
|
+
const delay = this.resolveValue(params.delay, void 0, 0),
|
|
18543
|
+
delayAfter = this.resolveValue(params.delayAfter, void 0, 0),
|
|
18544
|
+
duration = this.resolveValue(params.duration, void 0, 300);
|
|
18545
|
+
let oneByOneDelay = 0,
|
|
18546
|
+
oneByOneTime = 0;
|
|
18547
|
+
oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = duration + oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
|
|
18548
|
+
const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
|
|
18549
|
+
if (parsedParams.customType = customType, totalTime) {
|
|
18550
|
+
const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
|
|
18551
|
+
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18552
|
+
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOne = oneByOneTime * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
|
|
18553
|
+
}
|
|
18275
18554
|
}
|
|
18276
|
-
|
|
18277
|
-
|
|
18278
|
-
|
|
18555
|
+
return parsedParams;
|
|
18556
|
+
}
|
|
18557
|
+
execute(params) {
|
|
18558
|
+
Array.isArray(params) ? params.forEach(param => this._execute(param)) : this._execute(params);
|
|
18559
|
+
}
|
|
18560
|
+
_execute(params) {
|
|
18561
|
+
if (params.selfOnly) return this._executeItem(params, this._target, 0, 1);
|
|
18562
|
+
const isTimeline = ("timeSlices" in params);
|
|
18563
|
+
let filteredChildren;
|
|
18564
|
+
isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter(child => {
|
|
18565
|
+
var _a;
|
|
18566
|
+
return params.partitioner(null === (_a = child.context) || void 0 === _a ? void 0 : _a.data, child, {});
|
|
18567
|
+
})), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
|
|
18568
|
+
var _a, _b;
|
|
18569
|
+
return params.sort(null === (_a = a.context) || void 0 === _a ? void 0 : _a.data, null === (_b = b.context) || void 0 === _b ? void 0 : _b.data, a, b, {});
|
|
18570
|
+
}));
|
|
18571
|
+
const parsedParams = this.parseParams(params, isTimeline),
|
|
18572
|
+
cb = isTimeline ? (child, index, count) => {
|
|
18573
|
+
const animate = this.executeTimelineItem(parsedParams, child, index, count);
|
|
18574
|
+
animate && this._trackAnimation(animate);
|
|
18575
|
+
} : (child, index, count) => {
|
|
18576
|
+
const animate = this.executeTypeConfigItem(parsedParams, child, index, count);
|
|
18577
|
+
animate && this._trackAnimation(animate);
|
|
18578
|
+
};
|
|
18579
|
+
filteredChildren ? filteredChildren.forEach((child, index) => cb(child, index, filteredChildren.length)) : this._target.count <= 1 ? cb(this._target, 0, 1) : this._target.forEachChildren((child, index) => cb(child, index, this._target.count - 1));
|
|
18580
|
+
}
|
|
18581
|
+
executeTypeConfigItem(params, graphic, index, count) {
|
|
18582
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18583
|
+
const {
|
|
18584
|
+
type = "fromTo",
|
|
18585
|
+
channel: channel,
|
|
18586
|
+
customParameters: customParameters,
|
|
18587
|
+
easing = "linear",
|
|
18588
|
+
delay = 0,
|
|
18589
|
+
delayAfter = 0,
|
|
18590
|
+
duration = 300,
|
|
18591
|
+
startTime = 0,
|
|
18592
|
+
oneByOneDelay = 0,
|
|
18593
|
+
loop: loop,
|
|
18594
|
+
bounce: bounce,
|
|
18595
|
+
priority = 0,
|
|
18596
|
+
options: options,
|
|
18597
|
+
custom: custom,
|
|
18598
|
+
customType: customType,
|
|
18599
|
+
controlOptions: controlOptions
|
|
18600
|
+
} = params,
|
|
18601
|
+
animate = graphic.animate();
|
|
18602
|
+
animate.priority = priority;
|
|
18603
|
+
const delayValue = isFunction(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
|
|
18604
|
+
datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
|
|
18605
|
+
indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
|
|
18606
|
+
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime + delayValue);
|
|
18607
|
+
const wait = index * oneByOneDelay;
|
|
18608
|
+
wait > 0 && animate.wait(wait);
|
|
18609
|
+
let parsedFromProps = null,
|
|
18610
|
+
props = params.to,
|
|
18611
|
+
from = params.from;
|
|
18612
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from), this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1));
|
|
18613
|
+
const delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_h = null === (_g = graphic.context) || void 0 === _g ? void 0 : _g.data) || void 0 === _h ? void 0 : _h[0], graphic, {}) : delayAfter;
|
|
18614
|
+
return delayAfterValue > 0 && animate.wait(delayAfterValue), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
18615
|
+
}
|
|
18616
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
|
|
18617
|
+
var _a, _b, _c, _d;
|
|
18618
|
+
if (custom && customType) {
|
|
18619
|
+
const customParams = this.resolveValue(customParameters, graphic, {}),
|
|
18620
|
+
objOptions = isFunction(options) ? options.call(null, null !== (_b = customParameters && (null === (_a = customParameters.data) || void 0 === _a ? void 0 : _a[0])) && void 0 !== _b ? _b : null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, customParameters) : options;
|
|
18621
|
+
customParams.options = objOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
18622
|
+
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
18623
|
+
}
|
|
18624
|
+
executeTimelineItem(params, graphic, index, count) {
|
|
18625
|
+
var _a, _b, _c, _d;
|
|
18626
|
+
const {
|
|
18627
|
+
timeSlices: timeSlices,
|
|
18628
|
+
startTime = 0,
|
|
18629
|
+
loop: loop,
|
|
18630
|
+
bounce: bounce,
|
|
18631
|
+
oneByOneDelay: oneByOneDelay,
|
|
18632
|
+
priority: priority,
|
|
18633
|
+
controlOptions: controlOptions
|
|
18634
|
+
} = params,
|
|
18635
|
+
datum = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0],
|
|
18636
|
+
indexKey = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.indexKey;
|
|
18637
|
+
datum && indexKey && (index = null !== (_d = datum[indexKey]) && void 0 !== _d ? _d : index);
|
|
18638
|
+
const animate = graphic.animate();
|
|
18639
|
+
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
18640
|
+
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
18641
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic);
|
|
18642
|
+
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
18643
|
+
}
|
|
18644
|
+
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
18645
|
+
var _a, _b, _c, _d;
|
|
18646
|
+
const {
|
|
18647
|
+
effects: effects,
|
|
18648
|
+
duration = 300,
|
|
18649
|
+
delay = 0,
|
|
18650
|
+
delayAfter = 0
|
|
18651
|
+
} = slice,
|
|
18652
|
+
delayValue = isFunction(delay) ? delay(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : delay,
|
|
18653
|
+
delayAfterValue = isFunction(delayAfter) ? delayAfter(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : delayAfter;
|
|
18654
|
+
delayValue > 0 && animate.wait(delayValue);
|
|
18655
|
+
(Array.isArray(effects) ? effects : [effects]).forEach(effect => {
|
|
18656
|
+
var _a, _b;
|
|
18657
|
+
const {
|
|
18658
|
+
type = "fromTo",
|
|
18659
|
+
channel: channel,
|
|
18660
|
+
customParameters: customParameters,
|
|
18661
|
+
easing = "linear",
|
|
18662
|
+
options: options
|
|
18663
|
+
} = effect;
|
|
18664
|
+
let parsedFromProps = null,
|
|
18665
|
+
props = effect.to,
|
|
18666
|
+
from = effect.from;
|
|
18667
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
18668
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
18669
|
+
customType = null !== (_b = effect.customType) && void 0 !== _b ? _b : custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
18670
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic);
|
|
18671
|
+
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
18672
|
+
}
|
|
18673
|
+
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
18674
|
+
const to = props;
|
|
18675
|
+
Object.keys(to).forEach(key => {
|
|
18676
|
+
animate.target.getComputedAttribute(key);
|
|
18677
|
+
}), animate.interpolateUpdateFunction = (from, to, ratio, step, target) => {
|
|
18678
|
+
interpolator(ratio, from, to, step, target, animate.target, customParams);
|
|
18679
|
+
}, animate.to(props, duration, easing);
|
|
18680
|
+
}
|
|
18681
|
+
createCustomAnimation(animate, CustomAnimateConstructor, from, props, duration, easing, customParams) {
|
|
18682
|
+
const customAnimate = new CustomAnimateConstructor(from, props, duration, easing, customParams);
|
|
18683
|
+
animate.play(customAnimate);
|
|
18684
|
+
}
|
|
18685
|
+
createPropsFromChannel(channel, graphic) {
|
|
18686
|
+
const props = {};
|
|
18687
|
+
let from = null;
|
|
18688
|
+
return channel ? (Array.isArray(channel) ? channel.forEach(key => {
|
|
18689
|
+
var _a, _b;
|
|
18690
|
+
const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
|
|
18691
|
+
void 0 !== value && (props[key] = value);
|
|
18692
|
+
}) : Object.entries(channel).forEach(_ref => {
|
|
18693
|
+
let [key, config] = _ref;
|
|
18694
|
+
var _a, _b;
|
|
18695
|
+
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data, graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_b = graphic.context) || void 0 === _b ? void 0 : _b.data, graphic, {}) : from[key] = config.from);
|
|
18696
|
+
}), {
|
|
18697
|
+
from: from,
|
|
18698
|
+
props: props
|
|
18699
|
+
}) : {
|
|
18700
|
+
from: from,
|
|
18701
|
+
props: props
|
|
18702
|
+
};
|
|
18703
|
+
}
|
|
18704
|
+
resolveValue(value, graphic, defaultValue) {
|
|
18705
|
+
var _a;
|
|
18706
|
+
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data, graphic, {}) : value;
|
|
18707
|
+
}
|
|
18708
|
+
executeItem(params, graphic) {
|
|
18709
|
+
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
18710
|
+
let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
18711
|
+
return Array.isArray(params) ? params.map(param => this._executeItem(param, graphic, index, count)).filter(Boolean) : [this._executeItem(params, graphic, index, count)].filter(Boolean);
|
|
18712
|
+
}
|
|
18713
|
+
_executeItem(params, graphic) {
|
|
18714
|
+
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
18715
|
+
let count = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
18716
|
+
if (!graphic) return null;
|
|
18717
|
+
const isTimeline = ("timeSlices" in params);
|
|
18718
|
+
let animate = null;
|
|
18719
|
+
const parsedParams = this.parseParams(params, isTimeline);
|
|
18720
|
+
return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
|
|
18721
|
+
}
|
|
18722
|
+
stop(type) {
|
|
18723
|
+
for (; this._animates.length > 0;) {
|
|
18724
|
+
const animate = this._animates.pop();
|
|
18725
|
+
null == animate || animate.stop(type);
|
|
18279
18726
|
}
|
|
18727
|
+
this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
|
|
18728
|
+
}
|
|
18280
18729
|
}
|
|
18730
|
+
AnimateExecutor.builtInAnimateMap = {};
|
|
18281
18731
|
|
|
18282
|
-
|
|
18283
|
-
|
|
18284
|
-
|
|
18285
|
-
|
|
18286
|
-
|
|
18732
|
+
class ACustomAnimate extends Step {
|
|
18733
|
+
constructor(customFrom, customTo, duration, easing, params) {
|
|
18734
|
+
super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params;
|
|
18735
|
+
}
|
|
18736
|
+
update(end, ratio, out) {
|
|
18737
|
+
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
18738
|
+
const easedRatio = this.easing(ratio);
|
|
18739
|
+
this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
18740
|
+
}
|
|
18741
|
+
setProps(props) {
|
|
18742
|
+
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
18743
|
+
}
|
|
18287
18744
|
}
|
|
18288
|
-
|
|
18289
|
-
|
|
18290
|
-
|
|
18291
|
-
|
|
18292
|
-
|
|
18293
|
-
|
|
18745
|
+
class AComponentAnimate extends ACustomAnimate {
|
|
18746
|
+
completeBind(animator) {
|
|
18747
|
+
this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration());
|
|
18748
|
+
}
|
|
18749
|
+
stop() {
|
|
18750
|
+
this._animator && this._animator.stop();
|
|
18751
|
+
}
|
|
18294
18752
|
}
|
|
18295
|
-
|
|
18296
|
-
|
|
18297
|
-
|
|
18298
|
-
|
|
18299
|
-
|
|
18300
|
-
|
|
18301
|
-
|
|
18302
|
-
|
|
18303
|
-
|
|
18304
|
-
|
|
18305
|
-
|
|
18306
|
-
|
|
18307
|
-
|
|
18753
|
+
|
|
18754
|
+
class ComponentAnimator {
|
|
18755
|
+
constructor(component) {
|
|
18756
|
+
this.tasks = [], this.started = !1, this.completed = 0, this.totalDuration = 0, this.onStartCallbacks = [], this.onEndCallbacks = [], this.onUpdateCallbacks = [], this.component = component;
|
|
18757
|
+
}
|
|
18758
|
+
animate(graphic, config) {
|
|
18759
|
+
return this.started ? (console.warn("Cannot add animations after animation has started"), this) : (this.tasks.push({
|
|
18760
|
+
graphic: graphic,
|
|
18761
|
+
config: config
|
|
18762
|
+
}), this);
|
|
18763
|
+
}
|
|
18764
|
+
onStart(callback) {
|
|
18765
|
+
return this.onStartCallbacks.push(callback), this;
|
|
18766
|
+
}
|
|
18767
|
+
onEnd(callback) {
|
|
18768
|
+
return this.onEndCallbacks.push(callback), this;
|
|
18769
|
+
}
|
|
18770
|
+
onUpdate(callback) {
|
|
18771
|
+
return this.onUpdateCallbacks.push(callback), this;
|
|
18772
|
+
}
|
|
18773
|
+
start() {
|
|
18774
|
+
return this.started ? (console.warn("Animation has already started"), this) : (this.started = !0, this.completed = 0, this.onStartCallbacks.forEach(callback => callback()), 0 === this.tasks.length ? (setTimeout(() => {
|
|
18775
|
+
this.onEndCallbacks.forEach(callback => callback());
|
|
18776
|
+
}, 0), this) : (this.tasks.forEach(task => {
|
|
18777
|
+
const executor = new AnimateExecutor(task.graphic);
|
|
18778
|
+
executor.onEnd(() => {
|
|
18779
|
+
this.completed++, this.completed === this.tasks.length && this.onEndCallbacks.forEach(callback => callback());
|
|
18780
|
+
});
|
|
18781
|
+
const animate = executor.executeItem(task.config, task.graphic);
|
|
18782
|
+
task.animate = animate, animate.forEach(animate => {
|
|
18783
|
+
this.totalDuration = Math.max(this.totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18784
|
+
});
|
|
18785
|
+
}), this));
|
|
18786
|
+
}
|
|
18787
|
+
deleteSelfAttr(key) {
|
|
18788
|
+
this.tasks.forEach(task => {
|
|
18789
|
+
task.animate && task.animate.forEach(animate => animate.preventAttr(key));
|
|
18308
18790
|
});
|
|
18309
|
-
|
|
18310
|
-
|
|
18311
|
-
|
|
18791
|
+
}
|
|
18792
|
+
stop(type) {
|
|
18793
|
+
return this.tasks.forEach(task => {
|
|
18794
|
+
task.animate && task.animate.forEach(animate => animate.stop(type));
|
|
18795
|
+
}), this.started && this.completed !== this.tasks.length && (this.onEndCallbacks.forEach(callback => callback()), this.completed = this.tasks.length), this;
|
|
18796
|
+
}
|
|
18797
|
+
getDuration() {
|
|
18798
|
+
return this.totalDuration;
|
|
18799
|
+
}
|
|
18312
18800
|
}
|
|
18313
|
-
function
|
|
18314
|
-
|
|
18315
|
-
|
|
18316
|
-
|
|
18317
|
-
|
|
18318
|
-
|
|
18319
|
-
|
|
18320
|
-
|
|
18321
|
-
|
|
18322
|
-
|
|
18323
|
-
|
|
18324
|
-
|
|
18325
|
-
|
|
18326
|
-
|
|
18327
|
-
|
|
18328
|
-
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
|
|
18332
|
-
|
|
18333
|
-
|
|
18334
|
-
|
|
18335
|
-
|
|
18336
|
-
|
|
18337
|
-
|
|
18338
|
-
|
|
18339
|
-
|
|
18340
|
-
|
|
18341
|
-
|
|
18342
|
-
|
|
18343
|
-
|
|
18344
|
-
|
|
18345
|
-
|
|
18346
|
-
|
|
18347
|
-
|
|
18348
|
-
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18801
|
+
function createComponentAnimator(component) {
|
|
18802
|
+
return new ComponentAnimator(component);
|
|
18803
|
+
}
|
|
18804
|
+
|
|
18805
|
+
class AxisEnter extends AComponentAnimate {
|
|
18806
|
+
onBind() {
|
|
18807
|
+
var _a;
|
|
18808
|
+
const animator = createComponentAnimator(this.target);
|
|
18809
|
+
this._animator = animator;
|
|
18810
|
+
const duration = this.duration;
|
|
18811
|
+
const easing = this.easing;
|
|
18812
|
+
const { config, lastScale, getTickCoord } = this.params;
|
|
18813
|
+
let ratio = 1;
|
|
18814
|
+
if (lastScale && getTickCoord) {
|
|
18815
|
+
ratio = 0.7;
|
|
18816
|
+
const currData = this.target.data;
|
|
18817
|
+
const oldValue = lastScale.scale(currData.rawValue);
|
|
18818
|
+
const point = getTickCoord(oldValue);
|
|
18819
|
+
const newX = this.target.attribute.x;
|
|
18820
|
+
const newY = this.target.attribute.y;
|
|
18821
|
+
this.target.setAttributes({ x: point.x, y: point.y });
|
|
18822
|
+
animator.animate(this.target, {
|
|
18823
|
+
type: 'to',
|
|
18824
|
+
to: { x: newX, y: newY },
|
|
18825
|
+
duration,
|
|
18826
|
+
easing
|
|
18827
|
+
});
|
|
18828
|
+
}
|
|
18829
|
+
animator.animate(this.target, {
|
|
18830
|
+
type: (_a = config.type) !== null && _a !== void 0 ? _a : 'fadeIn',
|
|
18831
|
+
to: config.to,
|
|
18832
|
+
duration: duration * ratio,
|
|
18833
|
+
easing
|
|
18834
|
+
});
|
|
18835
|
+
this.completeBind(animator);
|
|
18836
|
+
}
|
|
18837
|
+
}
|
|
18838
|
+
class AxisUpdate extends AComponentAnimate {
|
|
18839
|
+
onBind() {
|
|
18840
|
+
var _a;
|
|
18841
|
+
const animator = createComponentAnimator(this.target);
|
|
18842
|
+
this._animator = animator;
|
|
18843
|
+
const duration = this.duration;
|
|
18844
|
+
const easing = this.easing;
|
|
18845
|
+
const { config, diffAttrs } = this.params;
|
|
18846
|
+
animator.animate(this.target, {
|
|
18847
|
+
type: (_a = config.type) !== null && _a !== void 0 ? _a : 'to',
|
|
18848
|
+
to: Object.assign({}, diffAttrs),
|
|
18849
|
+
duration,
|
|
18850
|
+
easing,
|
|
18851
|
+
customParameters: {
|
|
18852
|
+
diffAttrs: Object.assign({}, diffAttrs)
|
|
18353
18853
|
}
|
|
18354
18854
|
});
|
|
18855
|
+
this.completeBind(animator);
|
|
18856
|
+
}
|
|
18857
|
+
deleteSelfAttr(key) {
|
|
18858
|
+
super.deleteSelfAttr(key);
|
|
18859
|
+
this._animator.deleteSelfAttr(key);
|
|
18860
|
+
}
|
|
18861
|
+
tryPreventConflict() {
|
|
18862
|
+
return;
|
|
18355
18863
|
}
|
|
18356
18864
|
}
|
|
18865
|
+
function registerAxisAnimate() {
|
|
18866
|
+
AnimateExecutor.registerBuiltInAnimate('axisEnter', AxisEnter);
|
|
18867
|
+
AnimateExecutor.registerBuiltInAnimate('axisUpdate', AxisUpdate);
|
|
18868
|
+
}
|
|
18357
18869
|
|
|
18358
|
-
|
|
18359
|
-
|
|
18870
|
+
function loadBasicAxis() {
|
|
18871
|
+
registerGroup();
|
|
18872
|
+
registerLine();
|
|
18873
|
+
registerRichtext();
|
|
18874
|
+
registerText();
|
|
18875
|
+
registerAxisAnimate();
|
|
18876
|
+
}
|
|
18877
|
+
function loadLineAxisComponent() {
|
|
18878
|
+
loadBasicAxis();
|
|
18879
|
+
registerRect();
|
|
18880
|
+
}
|
|
18881
|
+
function loadCircleAxisComponent() {
|
|
18882
|
+
loadBasicAxis();
|
|
18883
|
+
registerCircle();
|
|
18884
|
+
}
|
|
18885
|
+
function loadLineAxisGridComponent() {
|
|
18886
|
+
registerGroup();
|
|
18887
|
+
registerPath();
|
|
18888
|
+
}
|
|
18889
|
+
function loadCircleAxisGridComponent() {
|
|
18890
|
+
registerGroup();
|
|
18891
|
+
registerPath();
|
|
18892
|
+
}
|
|
18893
|
+
|
|
18894
|
+
loadLineAxisComponent();
|
|
18895
|
+
class LineAxis extends AxisBase {
|
|
18360
18896
|
constructor(attributes, options) {
|
|
18361
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({},
|
|
18897
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, LineAxis.defaultAttributes, attributes), options);
|
|
18362
18898
|
}
|
|
18363
|
-
|
|
18364
|
-
|
|
18365
|
-
|
|
18366
|
-
|
|
18367
|
-
|
|
18368
|
-
|
|
18369
|
-
|
|
18899
|
+
_renderInner(container) {
|
|
18900
|
+
var _a;
|
|
18901
|
+
this._breaks = null;
|
|
18902
|
+
if (this.attribute.breaks && this.attribute.breaks.length) {
|
|
18903
|
+
const transformedBreaks = [];
|
|
18904
|
+
for (let index = 0; index < this.attribute.breaks.length; index++) {
|
|
18905
|
+
const aBreak = this.attribute.breaks[index];
|
|
18906
|
+
const { range, breakSymbol, rawRange } = aBreak;
|
|
18907
|
+
transformedBreaks.push({
|
|
18908
|
+
startPoint: this.getTickCoord(range[0]),
|
|
18909
|
+
endPoint: this.getTickCoord(range[1]),
|
|
18910
|
+
range,
|
|
18911
|
+
breakSymbol,
|
|
18912
|
+
rawRange
|
|
18913
|
+
});
|
|
18914
|
+
}
|
|
18915
|
+
this._breaks = transformedBreaks;
|
|
18370
18916
|
}
|
|
18371
|
-
|
|
18372
|
-
if (
|
|
18373
|
-
|
|
18374
|
-
|
|
18917
|
+
super._renderInner(container);
|
|
18918
|
+
if (this._breaks && this._breaks.length) {
|
|
18919
|
+
this._breaks.forEach((b, index) => {
|
|
18920
|
+
const { startPoint, endPoint, breakSymbol, rawRange } = b;
|
|
18921
|
+
if ((breakSymbol === null || breakSymbol === void 0 ? void 0 : breakSymbol.visible) !== false) {
|
|
18922
|
+
const axisBreakGroup = graphicCreator.group({
|
|
18923
|
+
zIndex: TopZIndex
|
|
18924
|
+
});
|
|
18925
|
+
axisBreakGroup.name = AXIS_ELEMENT_NAME.axisBreak;
|
|
18926
|
+
axisBreakGroup.id = this._getNodeId(`${AXIS_ELEMENT_NAME.axisBreak}-${index}`);
|
|
18927
|
+
axisBreakGroup.data = rawRange;
|
|
18928
|
+
const symbolStyle = getAxisBreakSymbolAttrs(breakSymbol);
|
|
18929
|
+
const shape1 = graphicCreator.symbol(Object.assign({ x: startPoint.x, y: startPoint.y }, symbolStyle));
|
|
18930
|
+
shape1.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
18931
|
+
const shape2 = graphicCreator.symbol(Object.assign({ x: endPoint.x, y: endPoint.y }, symbolStyle));
|
|
18932
|
+
shape2.name = AXIS_ELEMENT_NAME.axisBreakSymbol;
|
|
18933
|
+
axisBreakGroup.add(shape1);
|
|
18934
|
+
axisBreakGroup.add(shape2);
|
|
18935
|
+
container.add(axisBreakGroup);
|
|
18936
|
+
}
|
|
18937
|
+
});
|
|
18938
|
+
}
|
|
18939
|
+
const { panel } = this.attribute;
|
|
18940
|
+
if (panel && panel.visible) {
|
|
18941
|
+
const axisContainer = this.axisContainer;
|
|
18942
|
+
const axisContainerBounds = axisContainer.AABBBounds;
|
|
18943
|
+
const bgRect = graphicCreator.rect(Object.assign({ x: axisContainerBounds.x1, y: axisContainerBounds.y1, width: axisContainerBounds.width(), height: axisContainerBounds.height() }, panel.style));
|
|
18944
|
+
bgRect.name = AXIS_ELEMENT_NAME.background;
|
|
18945
|
+
bgRect.id = this._getNodeId('background');
|
|
18946
|
+
bgRect.states = merge({}, DEFAULT_STATES$1, (_a = panel.state) !== null && _a !== void 0 ? _a : {});
|
|
18947
|
+
axisContainer.insertBefore(bgRect, axisContainer.firstChild);
|
|
18948
|
+
}
|
|
18949
|
+
}
|
|
18950
|
+
renderLine(container) {
|
|
18951
|
+
const { start, end, line } = this.attribute;
|
|
18952
|
+
const _a = line, { startSymbol, endSymbol, style, state } = _a, restLineAttrs = __rest(_a, ["startSymbol", "endSymbol", "style", "state"]);
|
|
18953
|
+
const lineAttrs = Object.assign({ startSymbol,
|
|
18954
|
+
endSymbol, lineStyle: style }, restLineAttrs);
|
|
18955
|
+
if (this._breaks && this._breaks.length) {
|
|
18956
|
+
const linePoints = [];
|
|
18957
|
+
let lastStartPoint = start;
|
|
18958
|
+
this._breaks.forEach(b => {
|
|
18959
|
+
const { startPoint, endPoint } = b;
|
|
18960
|
+
linePoints.push([lastStartPoint, startPoint]);
|
|
18961
|
+
lastStartPoint = endPoint;
|
|
18962
|
+
});
|
|
18963
|
+
linePoints.push([lastStartPoint, end]);
|
|
18964
|
+
lineAttrs.points = linePoints;
|
|
18965
|
+
lineAttrs.multiSegment = true;
|
|
18375
18966
|
}
|
|
18376
18967
|
else {
|
|
18377
|
-
|
|
18378
|
-
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line.style);
|
|
18379
|
-
lineGraphic = graphicCreator.circle(arcAttrs);
|
|
18968
|
+
lineAttrs.points = [start, end];
|
|
18380
18969
|
}
|
|
18381
|
-
|
|
18382
|
-
|
|
18383
|
-
|
|
18384
|
-
|
|
18970
|
+
if (!isEmpty(state)) {
|
|
18971
|
+
lineAttrs.state = {
|
|
18972
|
+
line: merge({}, DEFAULT_STATES$1, state),
|
|
18973
|
+
symbol: merge({}, DEFAULT_STATES$1, state)
|
|
18974
|
+
};
|
|
18385
18975
|
}
|
|
18386
|
-
|
|
18976
|
+
const axisLineGroup = new Segment(lineAttrs);
|
|
18977
|
+
axisLineGroup.name = AXIS_ELEMENT_NAME.line;
|
|
18978
|
+
axisLineGroup.id = this._getNodeId('line');
|
|
18979
|
+
container.add(axisLineGroup);
|
|
18980
|
+
}
|
|
18981
|
+
getTextAlign(vector) {
|
|
18982
|
+
let align = 'center';
|
|
18983
|
+
if (isNumberClose(vector[0], 0)) {
|
|
18984
|
+
if (isNumberClose(vector[1], 0)) {
|
|
18985
|
+
if (Object.is(vector[1], -0)) {
|
|
18986
|
+
align = 'start';
|
|
18987
|
+
}
|
|
18988
|
+
else if (Object.is(vector[0], -0)) {
|
|
18989
|
+
align = 'end';
|
|
18990
|
+
}
|
|
18991
|
+
}
|
|
18992
|
+
else {
|
|
18993
|
+
align = 'center';
|
|
18994
|
+
}
|
|
18995
|
+
}
|
|
18996
|
+
else if (vector[0] > 0) {
|
|
18997
|
+
align = 'start';
|
|
18998
|
+
}
|
|
18999
|
+
else if (vector[0] < 0) {
|
|
19000
|
+
align = 'end';
|
|
19001
|
+
}
|
|
19002
|
+
return align;
|
|
18387
19003
|
}
|
|
18388
19004
|
getTitleAttribute() {
|
|
18389
19005
|
var _a, _b, _c;
|
|
18390
|
-
const {
|
|
18391
|
-
|
|
18392
|
-
|
|
18393
|
-
|
|
19006
|
+
const _d = this.attribute.title, { position = 'middle', space = 4, textStyle = {}, autoRotate = true, shape, background, state = {}, maxWidth } = _d, restAttrs = __rest(_d, ["position", "space", "textStyle", "autoRotate", "shape", "background", "state", "maxWidth"]);
|
|
19007
|
+
let percent = 0.5;
|
|
19008
|
+
if (position === 'start') {
|
|
19009
|
+
percent = 0;
|
|
19010
|
+
}
|
|
19011
|
+
else if (position === 'end') {
|
|
19012
|
+
percent = 1;
|
|
19013
|
+
}
|
|
19014
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
19015
|
+
const factor = -1 * verticalFactor;
|
|
19016
|
+
const point = this.getTickCoord(percent);
|
|
19017
|
+
const axisVector = this.getRelativeVector();
|
|
19018
|
+
let labelLength = 0;
|
|
18394
19019
|
if (((_a = this.attribute.label) === null || _a === void 0 ? void 0 : _a.visible) && this.attribute.label.inside === false) {
|
|
18395
|
-
|
|
19020
|
+
const space = +get(this.attribute, 'label.space', 4);
|
|
19021
|
+
labelLength += space;
|
|
19022
|
+
const layerCount = Object.keys(this.axisLabelLayerSize).length;
|
|
19023
|
+
if (axisVector[1] === 0) {
|
|
19024
|
+
const labelBoundsHeight = this.axisLabelsContainer ? this.axisLabelsContainer.AABBBounds.height() : 0;
|
|
19025
|
+
if (isFinite(labelBoundsHeight)) {
|
|
19026
|
+
labelLength += labelBoundsHeight + (layerCount - 1) * space;
|
|
19027
|
+
}
|
|
19028
|
+
else {
|
|
19029
|
+
labelLength = 0;
|
|
19030
|
+
}
|
|
19031
|
+
}
|
|
19032
|
+
else {
|
|
19033
|
+
if (axisVector[0] === 0) {
|
|
19034
|
+
if (this.axisLabelsContainer &&
|
|
19035
|
+
this.axisLabelsContainer.AABBBounds &&
|
|
19036
|
+
!this.axisLabelsContainer.AABBBounds.empty()) {
|
|
19037
|
+
const baseX = this.axisLabelLayerSize[0].labelPos;
|
|
19038
|
+
const bounds = this.axisLabelsContainer.AABBBounds;
|
|
19039
|
+
labelLength +=
|
|
19040
|
+
(factor === 1
|
|
19041
|
+
? bounds.x2 > baseX
|
|
19042
|
+
? Math.min(bounds.x2 - baseX, bounds.width())
|
|
19043
|
+
: 0
|
|
19044
|
+
: bounds.x1 < baseX
|
|
19045
|
+
? Math.min(baseX - bounds.x1, bounds.width())
|
|
19046
|
+
: 0) +
|
|
19047
|
+
(layerCount - 1) * space;
|
|
19048
|
+
}
|
|
19049
|
+
else {
|
|
19050
|
+
labelLength = 0;
|
|
19051
|
+
}
|
|
19052
|
+
}
|
|
19053
|
+
else {
|
|
19054
|
+
Object.keys(this.axisLabelLayerSize).forEach((layer, index) => {
|
|
19055
|
+
labelLength += this.axisLabelLayerSize[layer].width + (index > 0 ? space : 0);
|
|
19056
|
+
});
|
|
19057
|
+
}
|
|
19058
|
+
}
|
|
18396
19059
|
}
|
|
18397
19060
|
let tickLength = 0;
|
|
18398
19061
|
if (((_b = this.attribute.tick) === null || _b === void 0 ? void 0 : _b.visible) && this.attribute.tick.inside === false) {
|
|
@@ -18401,32 +19064,70 @@ class CircleAxis extends AxisBase {
|
|
|
18401
19064
|
if (((_c = this.attribute.subTick) === null || _c === void 0 ? void 0 : _c.visible) && this.attribute.subTick.inside === false) {
|
|
18402
19065
|
tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);
|
|
18403
19066
|
}
|
|
18404
|
-
const offset =
|
|
18405
|
-
|
|
18406
|
-
|
|
18407
|
-
|
|
18408
|
-
|
|
18409
|
-
}
|
|
19067
|
+
const offset = tickLength + labelLength + space;
|
|
19068
|
+
const titlePoint = this.getVerticalCoord(point, offset, false);
|
|
19069
|
+
const vector = this.getVerticalVector(offset, false, { x: 0, y: 0 });
|
|
19070
|
+
let { angle } = restAttrs;
|
|
19071
|
+
let textAlign;
|
|
18410
19072
|
if (position === 'start') {
|
|
18411
|
-
|
|
18412
|
-
titlePoint = {
|
|
18413
|
-
x: center.x,
|
|
18414
|
-
y: center.y - offset
|
|
18415
|
-
};
|
|
19073
|
+
textAlign = 'start';
|
|
18416
19074
|
}
|
|
18417
19075
|
else if (position === 'end') {
|
|
18418
|
-
|
|
18419
|
-
|
|
18420
|
-
|
|
18421
|
-
|
|
18422
|
-
|
|
19076
|
+
textAlign = 'end';
|
|
19077
|
+
}
|
|
19078
|
+
else {
|
|
19079
|
+
textAlign = 'center';
|
|
19080
|
+
}
|
|
19081
|
+
let textBaseline;
|
|
19082
|
+
if (isNil(angle) && autoRotate) {
|
|
19083
|
+
const v1 = [1, 0];
|
|
19084
|
+
const radian = angleTo(axisVector, v1, true);
|
|
19085
|
+
angle = radian;
|
|
19086
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
19087
|
+
const factor = -1 * verticalFactor;
|
|
19088
|
+
if (factor === 1) {
|
|
19089
|
+
textBaseline = 'bottom';
|
|
19090
|
+
}
|
|
19091
|
+
else {
|
|
19092
|
+
textBaseline = 'top';
|
|
19093
|
+
}
|
|
19094
|
+
}
|
|
19095
|
+
else {
|
|
19096
|
+
textAlign = this.getTextAlign(vector);
|
|
19097
|
+
textBaseline = this.getTextBaseline(vector, false);
|
|
18423
19098
|
}
|
|
18424
|
-
|
|
19099
|
+
let maxTagWidth = maxWidth;
|
|
19100
|
+
if (isNil(maxTagWidth)) {
|
|
19101
|
+
const { verticalLimitSize, verticalMinSize, orient } = this.attribute;
|
|
19102
|
+
const limitSize = Math.min(verticalLimitSize || Infinity, verticalMinSize || Infinity);
|
|
19103
|
+
if (isValidNumber(limitSize)) {
|
|
19104
|
+
const isX = orient === 'bottom' || orient === 'top';
|
|
19105
|
+
if (isX) {
|
|
19106
|
+
if (angle !== Math.PI / 2) {
|
|
19107
|
+
const cosValue = Math.abs(Math.cos(angle !== null && angle !== void 0 ? angle : 0));
|
|
19108
|
+
maxTagWidth = cosValue < 1e-6 ? Infinity : this.attribute.end.x / cosValue;
|
|
19109
|
+
}
|
|
19110
|
+
else {
|
|
19111
|
+
maxTagWidth = limitSize - offset;
|
|
19112
|
+
}
|
|
19113
|
+
}
|
|
19114
|
+
else {
|
|
19115
|
+
if (angle && angle !== 0) {
|
|
19116
|
+
const sinValue = Math.abs(Math.sin(angle));
|
|
19117
|
+
maxTagWidth = sinValue < 1e-6 ? Infinity : this.attribute.end.y / sinValue;
|
|
19118
|
+
}
|
|
19119
|
+
else {
|
|
19120
|
+
maxTagWidth = limitSize - offset;
|
|
19121
|
+
}
|
|
19122
|
+
}
|
|
19123
|
+
}
|
|
19124
|
+
}
|
|
19125
|
+
const attrs = Object.assign(Object.assign(Object.assign({}, titlePoint), restAttrs), { maxWidth: maxTagWidth, textStyle: Object.assign({ textAlign,
|
|
19126
|
+
textBaseline }, textStyle), state: {
|
|
18425
19127
|
text: merge({}, DEFAULT_STATES$1, state.text),
|
|
18426
19128
|
shape: merge({}, DEFAULT_STATES$1, state.shape),
|
|
18427
19129
|
panel: merge({}, DEFAULT_STATES$1, state.background)
|
|
18428
19130
|
} });
|
|
18429
|
-
const { angle } = restAttrs;
|
|
18430
19131
|
attrs.angle = angle;
|
|
18431
19132
|
if (shape && shape.visible) {
|
|
18432
19133
|
attrs.shape = Object.assign({ visible: true }, shape.style);
|
|
@@ -18439,733 +19140,551 @@ class CircleAxis extends AxisBase {
|
|
|
18439
19140
|
}
|
|
18440
19141
|
return attrs;
|
|
18441
19142
|
}
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
const {
|
|
18445
|
-
const
|
|
18446
|
-
|
|
18447
|
-
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
for (let i = 0; i < tickLineCount; i++) {
|
|
18453
|
-
const pre = tickLineItems[i];
|
|
18454
|
-
const next = tickLineItems[i + 1];
|
|
18455
|
-
for (let j = 0; j < subCount; j++) {
|
|
18456
|
-
const percent = (j + 1) / (subCount + 1);
|
|
18457
|
-
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
18458
|
-
const point = this.getTickCoord(value);
|
|
18459
|
-
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
18460
|
-
subTickLineItems.push({
|
|
18461
|
-
start: point,
|
|
18462
|
-
end: endPoint,
|
|
18463
|
-
value
|
|
18464
|
-
});
|
|
18465
|
-
}
|
|
19143
|
+
getTextBaseline(vector, inside) {
|
|
19144
|
+
let base = 'middle';
|
|
19145
|
+
const { verticalFactor = 1 } = this.attribute;
|
|
19146
|
+
const factor = (inside ? 1 : -1) * verticalFactor;
|
|
19147
|
+
if (isNumberClose(vector[1], 0)) {
|
|
19148
|
+
if (isNumberClose(vector[0], 0) && !Object.is(vector[0], -0) && !Object.is(vector[1], -0)) {
|
|
19149
|
+
base = factor === 1 ? 'bottom' : 'top';
|
|
19150
|
+
}
|
|
19151
|
+
else {
|
|
19152
|
+
base = 'middle';
|
|
18466
19153
|
}
|
|
18467
19154
|
}
|
|
18468
|
-
|
|
19155
|
+
else if (vector[1] > 0) {
|
|
19156
|
+
base = 'top';
|
|
19157
|
+
}
|
|
19158
|
+
else if (vector[1] < 0) {
|
|
19159
|
+
base = 'bottom';
|
|
19160
|
+
}
|
|
19161
|
+
return base;
|
|
19162
|
+
}
|
|
19163
|
+
getLabelAlign(vector, inside, angle) {
|
|
19164
|
+
const orient = this.attribute.orient;
|
|
19165
|
+
const isCartesian = ['top', 'bottom', 'right', 'left'].includes(orient);
|
|
19166
|
+
if (isCartesian || (vector[0] === 0 && vector[1] === 0)) {
|
|
19167
|
+
if (orient === 'top' || orient === 'bottom') {
|
|
19168
|
+
return getXAxisLabelAlign(inside ? (orient === 'bottom' ? 'top' : 'bottom') : orient, angle);
|
|
19169
|
+
}
|
|
19170
|
+
if (orient === 'left' || orient === 'right') {
|
|
19171
|
+
return getYAxisLabelAlign(inside ? (orient === 'left' ? 'right' : 'left') : orient, angle);
|
|
19172
|
+
}
|
|
19173
|
+
}
|
|
19174
|
+
return {
|
|
19175
|
+
textAlign: this.getTextAlign(vector),
|
|
19176
|
+
textBaseline: this.getTextBaseline(vector, inside)
|
|
19177
|
+
};
|
|
18469
19178
|
}
|
|
18470
19179
|
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
19180
|
+
var _a, _b, _c, _d;
|
|
19181
|
+
const { flush = false } = this.attribute.label || {};
|
|
19182
|
+
if (flush && labelShapes.length) {
|
|
19183
|
+
const { orient, start: axisStart, end: axisEnd } = this.attribute;
|
|
19184
|
+
const isX = orient === 'bottom' || orient === 'top';
|
|
19185
|
+
const first = labelShapes[0];
|
|
19186
|
+
const last$1 = last(labelShapes);
|
|
19187
|
+
const isInverse = isX ? first.attribute.x > last$1.attribute.x : first.attribute.y < last$1.attribute.y;
|
|
19188
|
+
if (isX) {
|
|
19189
|
+
const leftMostLabel = isInverse ? last$1 : first;
|
|
19190
|
+
const rightMostLabel = isInverse ? first : last$1;
|
|
19191
|
+
const left = axisStart.x;
|
|
19192
|
+
const right = axisEnd.x;
|
|
19193
|
+
const leftBound = leftMostLabel.AABBBounds.x1;
|
|
19194
|
+
const rightBound = rightMostLabel.AABBBounds.x2;
|
|
19195
|
+
if (leftBound < left) {
|
|
19196
|
+
const angle = leftMostLabel.attribute.angle;
|
|
19197
|
+
if (angle) {
|
|
19198
|
+
leftMostLabel.setAttributes({ dx: ((_a = leftMostLabel.attribute.dx) !== null && _a !== void 0 ? _a : 0) + left - leftBound });
|
|
19199
|
+
}
|
|
19200
|
+
else {
|
|
19201
|
+
leftMostLabel.setAttributes({
|
|
19202
|
+
x: left,
|
|
19203
|
+
textAlign: 'left'
|
|
19204
|
+
});
|
|
19205
|
+
}
|
|
19206
|
+
}
|
|
19207
|
+
if (rightBound > right) {
|
|
19208
|
+
const angle = rightMostLabel.attribute.angle;
|
|
19209
|
+
if (angle) {
|
|
19210
|
+
rightMostLabel.setAttributes({ dx: ((_b = rightMostLabel.attribute.dx) !== null && _b !== void 0 ? _b : 0) + right - rightBound });
|
|
19211
|
+
}
|
|
19212
|
+
else {
|
|
19213
|
+
rightMostLabel.setAttributes({
|
|
19214
|
+
x: right,
|
|
19215
|
+
textAlign: 'right'
|
|
19216
|
+
});
|
|
19217
|
+
}
|
|
19218
|
+
}
|
|
19219
|
+
}
|
|
19220
|
+
else {
|
|
19221
|
+
const bottomMostLabel = isInverse ? last$1 : first;
|
|
19222
|
+
const topMostLabel = isInverse ? first : last$1;
|
|
19223
|
+
const bottomBound = bottomMostLabel.AABBBounds.y2;
|
|
19224
|
+
const topBound = topMostLabel.AABBBounds.y1;
|
|
19225
|
+
const top = axisStart.y;
|
|
19226
|
+
const bottom = axisEnd.y;
|
|
19227
|
+
if (topBound < top) {
|
|
19228
|
+
const angle = topMostLabel.attribute.angle;
|
|
19229
|
+
if (angle) {
|
|
19230
|
+
topMostLabel.setAttributes({
|
|
19231
|
+
dy: ((_c = topMostLabel.attribute.dy) !== null && _c !== void 0 ? _c : 0) + top - topBound
|
|
19232
|
+
});
|
|
19233
|
+
}
|
|
19234
|
+
else {
|
|
19235
|
+
topMostLabel.setAttributes({
|
|
19236
|
+
y: top,
|
|
19237
|
+
textBaseline: 'top'
|
|
19238
|
+
});
|
|
19239
|
+
}
|
|
19240
|
+
}
|
|
19241
|
+
if (bottomBound > bottom) {
|
|
19242
|
+
const angle = bottomMostLabel.attribute.angle;
|
|
19243
|
+
if (angle) {
|
|
19244
|
+
bottomMostLabel.setAttributes({
|
|
19245
|
+
dy: ((_d = bottomMostLabel.attribute.dy) !== null && _d !== void 0 ? _d : 0) + bottom - bottomBound
|
|
19246
|
+
});
|
|
19247
|
+
}
|
|
19248
|
+
else {
|
|
19249
|
+
bottomMostLabel.setAttributes({
|
|
19250
|
+
y: bottom,
|
|
19251
|
+
textBaseline: 'bottom'
|
|
19252
|
+
});
|
|
19253
|
+
}
|
|
19254
|
+
}
|
|
19255
|
+
}
|
|
19256
|
+
}
|
|
18471
19257
|
return;
|
|
18472
19258
|
}
|
|
18473
19259
|
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
18474
19260
|
if (isEmpty(labelShapes)) {
|
|
18475
19261
|
return;
|
|
18476
19262
|
}
|
|
18477
|
-
const {
|
|
18478
|
-
const
|
|
18479
|
-
|
|
18480
|
-
x1: 0,
|
|
18481
|
-
y1: 0,
|
|
18482
|
-
x2: size.width,
|
|
18483
|
-
y2: size.height
|
|
18484
|
-
}
|
|
18485
|
-
: {
|
|
18486
|
-
x1: center.x - radius,
|
|
18487
|
-
y1: center.y - radius,
|
|
18488
|
-
x2: center.x + radius,
|
|
18489
|
-
y2: center.y + radius
|
|
18490
|
-
};
|
|
18491
|
-
const { layoutFunc, autoLimit, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, autoWrap } = label;
|
|
19263
|
+
const { verticalLimitSize, label, orient } = this.attribute;
|
|
19264
|
+
const limitLength = this._getAxisLabelLimitLength(verticalLimitSize, layerCount);
|
|
19265
|
+
const { layoutFunc, autoRotate: autoRotate$1, autoRotateAngle, autoLimit: autoLimit$1, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, lastVisible, firstVisible, autoWrap: autoWrap$1, overflowLimitLength } = label;
|
|
18492
19266
|
if (isFunction(layoutFunc)) {
|
|
18493
19267
|
layoutFunc(labelShapes, labelData, layer, this);
|
|
18494
19268
|
}
|
|
18495
19269
|
else {
|
|
18496
|
-
if (
|
|
18497
|
-
|
|
19270
|
+
if (autoRotate$1) {
|
|
19271
|
+
autoRotate(labelShapes, {
|
|
19272
|
+
labelRotateAngle: autoRotateAngle,
|
|
19273
|
+
orient
|
|
19274
|
+
});
|
|
19275
|
+
}
|
|
19276
|
+
else if (autoWrap$1) {
|
|
19277
|
+
const isVertical = orient === 'left' || orient === 'right';
|
|
19278
|
+
const axisLength = isVertical
|
|
19279
|
+
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
19280
|
+
: Math.abs(this.attribute.start.x - this.attribute.end.x);
|
|
19281
|
+
autoWrap(labelShapes, { orient, limitLength, axisLength, ellipsis: limitEllipsis });
|
|
19282
|
+
}
|
|
19283
|
+
if (!autoWrap$1 && autoLimit$1 && isValidNumber(limitLength) && limitLength > 0) {
|
|
19284
|
+
const isVertical = orient === 'left' || orient === 'right';
|
|
19285
|
+
const axisLength = isVertical
|
|
19286
|
+
? Math.abs(this.attribute.start.y - this.attribute.end.y)
|
|
19287
|
+
: Math.abs(this.attribute.start.x - this.attribute.end.x);
|
|
19288
|
+
const verticalLimitLength = isVertical
|
|
19289
|
+
? axisLength / labelShapes.length
|
|
19290
|
+
: !autoHide$1 && !autoRotate$1
|
|
19291
|
+
? axisLength / labelShapes.length
|
|
19292
|
+
: Infinity;
|
|
19293
|
+
autoLimit(labelShapes, {
|
|
19294
|
+
limitLength,
|
|
19295
|
+
verticalLimitLength,
|
|
19296
|
+
ellipsis: limitEllipsis,
|
|
19297
|
+
orient,
|
|
19298
|
+
axisLength,
|
|
19299
|
+
overflowLimitLength
|
|
19300
|
+
});
|
|
18498
19301
|
}
|
|
18499
19302
|
if (autoHide$1) {
|
|
18500
19303
|
autoHide(labelShapes, {
|
|
18501
19304
|
orient,
|
|
18502
19305
|
method: autoHideMethod,
|
|
18503
|
-
separation: autoHideSeparation
|
|
18504
|
-
|
|
18505
|
-
|
|
18506
|
-
|
|
18507
|
-
|
|
18508
|
-
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
18509
|
-
return;
|
|
18510
|
-
}
|
|
18511
|
-
getTextBaseline(vector) {
|
|
18512
|
-
if (Math.abs(vector[1] / vector[0]) < 0.3) {
|
|
18513
|
-
return 'middle';
|
|
18514
|
-
}
|
|
18515
|
-
else if (vector[1] < 0) {
|
|
18516
|
-
return 'bottom';
|
|
18517
|
-
}
|
|
18518
|
-
else if (vector[1] > 0) {
|
|
18519
|
-
return 'top';
|
|
18520
|
-
}
|
|
18521
|
-
return 'middle';
|
|
18522
|
-
}
|
|
18523
|
-
getLabelAlign(vector, inside, angle) {
|
|
18524
|
-
if (isNumberClose(vector[0], 0)) {
|
|
18525
|
-
return {
|
|
18526
|
-
textAlign: 'center',
|
|
18527
|
-
textBaseline: vector[1] > 0 ? 'top' : 'bottom'
|
|
18528
|
-
};
|
|
18529
|
-
}
|
|
18530
|
-
else if (vector[0] < 0) {
|
|
18531
|
-
return {
|
|
18532
|
-
textAlign: 'right',
|
|
18533
|
-
textBaseline: this.getTextBaseline(vector)
|
|
18534
|
-
};
|
|
18535
|
-
}
|
|
18536
|
-
else if (vector[0] > 0) {
|
|
18537
|
-
return {
|
|
18538
|
-
textAlign: 'left',
|
|
18539
|
-
textBaseline: this.getTextBaseline(vector)
|
|
18540
|
-
};
|
|
19306
|
+
separation: autoHideSeparation,
|
|
19307
|
+
lastVisible,
|
|
19308
|
+
firstVisible
|
|
19309
|
+
});
|
|
19310
|
+
}
|
|
18541
19311
|
}
|
|
18542
|
-
return {
|
|
18543
|
-
textAlign: 'center',
|
|
18544
|
-
textBaseline: 'middle'
|
|
18545
|
-
};
|
|
18546
|
-
}
|
|
18547
|
-
getLabelPosition(point, vector, text, style) {
|
|
18548
|
-
return point;
|
|
18549
19312
|
}
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18554
|
-
|
|
18555
|
-
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
|
|
18574
|
-
|
|
18575
|
-
|
|
18576
|
-
|
|
18577
|
-
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
|
|
18599
|
-
|
|
18600
|
-
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
|
|
18604
|
-
}
|
|
18605
|
-
|
|
18606
|
-
|
|
18607
|
-
|
|
18608
|
-
|
|
18609
|
-
|
|
18610
|
-
|
|
18611
|
-
|
|
18612
|
-
|
|
18613
|
-
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18620
|
-
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18625
|
-
|
|
18626
|
-
|
|
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);
|
|
19313
|
+
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
19314
|
+
const { verticalLimitSize, orient } = this.attribute;
|
|
19315
|
+
const isHorizontal = orient === 'bottom' || orient === 'top';
|
|
19316
|
+
const axisLabelContainerBounds = labelContainer.AABBBounds;
|
|
19317
|
+
let axisLabelContainerSize = isHorizontal ? axisLabelContainerBounds.height() : axisLabelContainerBounds.width();
|
|
19318
|
+
const { verticalMinSize } = this.attribute;
|
|
19319
|
+
if (isValidNumber(verticalMinSize) && (!isValidNumber(verticalLimitSize) || verticalMinSize <= verticalLimitSize)) {
|
|
19320
|
+
const minSize = this._getAxisLabelLimitLength(verticalMinSize, layerCount);
|
|
19321
|
+
axisLabelContainerSize = Math.max(axisLabelContainerSize, minSize);
|
|
19322
|
+
let x;
|
|
19323
|
+
let y;
|
|
19324
|
+
if (orient === 'left') {
|
|
19325
|
+
x = axisLabelContainerBounds.x2 - axisLabelContainerSize;
|
|
19326
|
+
y = axisLabelContainerBounds.y1;
|
|
19327
|
+
}
|
|
19328
|
+
else if (orient === 'right') {
|
|
19329
|
+
x = axisLabelContainerBounds.x1;
|
|
19330
|
+
y = axisLabelContainerBounds.y1;
|
|
19331
|
+
}
|
|
19332
|
+
else if (orient === 'top') {
|
|
19333
|
+
x = axisLabelContainerBounds.x1;
|
|
19334
|
+
y = axisLabelContainerBounds.y2 - axisLabelContainerSize;
|
|
19335
|
+
}
|
|
19336
|
+
else if (orient === 'bottom') {
|
|
19337
|
+
x = axisLabelContainerBounds.x1;
|
|
19338
|
+
y = axisLabelContainerBounds.y1;
|
|
19339
|
+
}
|
|
19340
|
+
const bgRect = graphicCreator.rect({
|
|
19341
|
+
x,
|
|
19342
|
+
y,
|
|
19343
|
+
width: isHorizontal ? axisLabelContainerBounds.width() : axisLabelContainerSize,
|
|
19344
|
+
height: isHorizontal ? axisLabelContainerSize : axisLabelContainerBounds.height(),
|
|
19345
|
+
pickable: false
|
|
19346
|
+
});
|
|
19347
|
+
bgRect.name = AXIS_ELEMENT_NAME.axisLabelBackground;
|
|
19348
|
+
bgRect.id = this._getNodeId('axis-label-background');
|
|
19349
|
+
labelContainer.insertBefore(bgRect, labelContainer.firstChild);
|
|
19350
|
+
}
|
|
19351
|
+
if (isValid(this.attribute.label.containerAlign)) {
|
|
19352
|
+
let start;
|
|
19353
|
+
if (orient === 'left') {
|
|
19354
|
+
start = axisLabelContainerBounds.x2 - axisLabelContainerSize;
|
|
19355
|
+
}
|
|
19356
|
+
else if (orient === 'right') {
|
|
19357
|
+
start = axisLabelContainerBounds.x1;
|
|
19358
|
+
}
|
|
19359
|
+
else if (orient === 'top') {
|
|
19360
|
+
start = axisLabelContainerBounds.y2 - axisLabelContainerSize;
|
|
19361
|
+
}
|
|
19362
|
+
else if (orient === 'bottom') {
|
|
19363
|
+
start = axisLabelContainerBounds.y1;
|
|
19364
|
+
}
|
|
19365
|
+
alignAxisLabels(labelShapes, start, axisLabelContainerSize, orient, this.attribute.label.containerAlign);
|
|
19366
|
+
}
|
|
19367
|
+
}
|
|
19368
|
+
_getAxisLabelLimitLength(limitSize, layerCount) {
|
|
19369
|
+
var _a, _b, _c, _d, _e;
|
|
19370
|
+
const { label, title, line, tick } = this.attribute;
|
|
19371
|
+
const labelSpace = (_a = label.space) !== null && _a !== void 0 ? _a : 4;
|
|
19372
|
+
let limitLength = limitSize;
|
|
19373
|
+
let titleHeight = 0;
|
|
19374
|
+
let titleSpacing = 0;
|
|
19375
|
+
const axisLineWidth = line && line.visible ? (_b = line.style.lineWidth) !== null && _b !== void 0 ? _b : 1 : 0;
|
|
19376
|
+
const tickLength = tick && tick.visible ? (_c = tick.length) !== null && _c !== void 0 ? _c : 4 : 0;
|
|
19377
|
+
if (title && title.visible && typeof title.text === 'string') {
|
|
19378
|
+
titleHeight = measureTextSize(title.text, title.textStyle, (_e = (_d = this.stage) === null || _d === void 0 ? void 0 : _d.getTheme()) === null || _e === void 0 ? void 0 : _e.text).height;
|
|
19379
|
+
const padding = normalizePadding(title.padding);
|
|
19380
|
+
titleSpacing = title.space + padding[0] + padding[2];
|
|
19381
|
+
}
|
|
19382
|
+
if (limitLength) {
|
|
19383
|
+
limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount;
|
|
19384
|
+
}
|
|
19385
|
+
return limitLength;
|
|
19386
|
+
}
|
|
19387
|
+
release() {
|
|
19388
|
+
super.release();
|
|
19389
|
+
this._breaks = null;
|
|
18765
19390
|
}
|
|
18766
|
-
return valid && (target.attribute[key] = nextList), !0;
|
|
18767
|
-
}
|
|
18768
|
-
return !1;
|
|
18769
19391
|
}
|
|
19392
|
+
LineAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
19393
|
+
mixin(LineAxis, LineAxisMixin);
|
|
18770
19394
|
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18785
|
-
|
|
18786
|
-
|
|
18787
|
-
|
|
18788
|
-
|
|
18789
|
-
|
|
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();
|
|
19395
|
+
class CircleAxisMixin {
|
|
19396
|
+
isInValidValue(value) {
|
|
19397
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE } = this.attribute;
|
|
19398
|
+
if (Math.abs(endAngle - startAngle) % (Math.PI * 2) === 0) {
|
|
19399
|
+
return value > 1;
|
|
19400
|
+
}
|
|
19401
|
+
return value < 0 || value > 1;
|
|
19402
|
+
}
|
|
19403
|
+
getTickCoord(tickValue) {
|
|
19404
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, center, radius, inside = false, innerRadius = 0 } = this.attribute;
|
|
19405
|
+
const angle = startAngle + (endAngle - startAngle) * tickValue;
|
|
19406
|
+
return polarToCartesian(center, inside && innerRadius > 0 ? innerRadius : radius, angle);
|
|
19407
|
+
}
|
|
19408
|
+
getVerticalVector(offset, inside = false, point) {
|
|
19409
|
+
return getCircleVerticalVector(offset, point, this.attribute.center, inside, this.attribute.inside);
|
|
19410
|
+
}
|
|
19411
|
+
getRelativeVector(point) {
|
|
19412
|
+
const { center } = this.attribute;
|
|
19413
|
+
return [point.y - center.y, -1 * (point.x - center.x)];
|
|
18830
19414
|
}
|
|
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
19415
|
}
|
|
18886
19416
|
|
|
18887
|
-
|
|
18888
|
-
|
|
18889
|
-
|
|
18890
|
-
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
|
|
18899
|
-
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18936
|
-
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
|
|
18940
|
-
|
|
18941
|
-
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
19417
|
+
function findSiblingLabels(labels, selfIndex) {
|
|
19418
|
+
const len = labels.length;
|
|
19419
|
+
const prevLabel = selfIndex >= 1 ? labels[selfIndex - 1] : labels[len - 1];
|
|
19420
|
+
const nextLabel = selfIndex < len - 1 ? labels[selfIndex + 1] : labels[0];
|
|
19421
|
+
return { prevLabel, nextLabel };
|
|
19422
|
+
}
|
|
19423
|
+
function adjustMaxLineWidth(label, maxLineWidth, ellipsis) {
|
|
19424
|
+
var _a;
|
|
19425
|
+
label.setAttributes({
|
|
19426
|
+
maxLineWidth,
|
|
19427
|
+
ellipsis: (_a = label.attribute.ellipsis) !== null && _a !== void 0 ? _a : ellipsis
|
|
19428
|
+
});
|
|
19429
|
+
}
|
|
19430
|
+
function adjustMaxHeight(labels, selfIndex, bounds) {
|
|
19431
|
+
const siblings = [];
|
|
19432
|
+
if (labels.length >= 3) {
|
|
19433
|
+
const { prevLabel, nextLabel } = findSiblingLabels(labels, selfIndex);
|
|
19434
|
+
siblings.push(prevLabel, nextLabel);
|
|
19435
|
+
}
|
|
19436
|
+
else if (labels.length === 2) {
|
|
19437
|
+
siblings.push(labels[selfIndex === 0 ? 1 : 0]);
|
|
19438
|
+
}
|
|
19439
|
+
const label = labels[selfIndex];
|
|
19440
|
+
let heightLimit = Math.min(Math.abs(label.attribute.y - bounds.y1), Math.abs(label.attribute.y - bounds.y2));
|
|
19441
|
+
siblings.forEach(sibling => {
|
|
19442
|
+
heightLimit = Math.min(heightLimit, Math.abs(sibling.attribute.y - label.attribute.y));
|
|
19443
|
+
});
|
|
19444
|
+
if (heightLimit > 0) {
|
|
19445
|
+
label.setAttributes({ whiteSpace: 'normal', heightLimit });
|
|
19446
|
+
}
|
|
19447
|
+
}
|
|
19448
|
+
function circleAutoLimit(labels, config) {
|
|
19449
|
+
const { ellipsis, inside, bounds, autoWrap, center } = config;
|
|
19450
|
+
if (!inside) {
|
|
19451
|
+
labels.forEach((label, index) => {
|
|
19452
|
+
const { x, y } = label.attribute;
|
|
19453
|
+
const b = label.AABBBounds;
|
|
19454
|
+
if (isNumberClose(x, center.x)) {
|
|
19455
|
+
if (y > bounds.y2 || y < bounds.y1) {
|
|
19456
|
+
adjustMaxLineWidth(label, 0, ellipsis);
|
|
19457
|
+
return;
|
|
19458
|
+
}
|
|
19459
|
+
const boxWidth = bounds.x2 - bounds.x1;
|
|
19460
|
+
if (labels.length >= 3) {
|
|
19461
|
+
const { prevLabel, nextLabel } = findSiblingLabels(labels, index);
|
|
19462
|
+
let leftX = prevLabel.attribute.x;
|
|
19463
|
+
let rightX = nextLabel.attribute.x;
|
|
19464
|
+
if (leftX > rightX) {
|
|
19465
|
+
leftX = nextLabel.attribute.x;
|
|
19466
|
+
rightX = prevLabel.attribute.x;
|
|
19467
|
+
}
|
|
19468
|
+
const maxWidth = leftX === rightX
|
|
19469
|
+
? boxWidth
|
|
19470
|
+
: x >= leftX && x <= rightX
|
|
19471
|
+
? rightX - leftX
|
|
19472
|
+
: Math.min(Math.abs(leftX - x), Math.abs(rightX - x));
|
|
19473
|
+
if (label.AABBBounds.width() > maxWidth) {
|
|
19474
|
+
adjustMaxLineWidth(label, maxWidth, ellipsis);
|
|
19475
|
+
}
|
|
19476
|
+
}
|
|
19477
|
+
else if (label.AABBBounds.width() > boxWidth) {
|
|
19478
|
+
adjustMaxLineWidth(label, boxWidth, ellipsis);
|
|
19479
|
+
}
|
|
19480
|
+
}
|
|
19481
|
+
else if (x > center.x && b.x2 > bounds.x2) {
|
|
19482
|
+
adjustMaxLineWidth(label, bounds.x2 - x, ellipsis);
|
|
19483
|
+
autoWrap && adjustMaxHeight(labels, index, bounds);
|
|
19484
|
+
}
|
|
19485
|
+
else if (x < center.x && b.x1 < bounds.x1) {
|
|
19486
|
+
adjustMaxLineWidth(label, x - bounds.x1, ellipsis);
|
|
19487
|
+
autoWrap && adjustMaxHeight(labels, index, bounds);
|
|
19488
|
+
}
|
|
19489
|
+
});
|
|
19490
|
+
}
|
|
18955
19491
|
}
|
|
18956
|
-
const defaultTimeline = new DefaultTimeline();
|
|
18957
|
-
defaultTimeline.isGlobal = !0;
|
|
18958
19492
|
|
|
18959
|
-
|
|
18960
|
-
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
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);
|
|
19493
|
+
loadCircleAxisComponent();
|
|
19494
|
+
class CircleAxis extends AxisBase {
|
|
19495
|
+
constructor(attributes, options) {
|
|
19496
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, CircleAxis.defaultAttributes, attributes));
|
|
19497
|
+
}
|
|
19498
|
+
renderLine(container) {
|
|
19499
|
+
const { startAngle = POLAR_START_ANGLE, endAngle = POLAR_END_ANGLE, radius, center, innerRadius = 0, line = {}, inside = false, sides } = this.attribute;
|
|
19500
|
+
let arcRadius = radius;
|
|
19501
|
+
let arcInnerRadius = innerRadius;
|
|
19502
|
+
if (inside && innerRadius > 0) {
|
|
19503
|
+
arcRadius = innerRadius;
|
|
19504
|
+
arcInnerRadius = 0;
|
|
19505
|
+
}
|
|
19506
|
+
let lineGraphic;
|
|
19507
|
+
if (isValidNumber(sides) && sides >= 3) {
|
|
19508
|
+
const gridPoints = getCirclePoints(center, sides, arcRadius, startAngle, endAngle);
|
|
19509
|
+
lineGraphic = graphicCreator.path(Object.assign(Object.assign({}, line.style), { path: getPolygonPath(gridPoints, true) }));
|
|
19510
|
+
}
|
|
19511
|
+
else {
|
|
19512
|
+
const arcAttrs = Object.assign(Object.assign(Object.assign({}, center), { startAngle,
|
|
19513
|
+
endAngle, radius: arcRadius, innerRadius: arcInnerRadius }), line.style);
|
|
19514
|
+
lineGraphic = graphicCreator.circle(arcAttrs);
|
|
19515
|
+
}
|
|
19516
|
+
lineGraphic.name = AXIS_ELEMENT_NAME.line;
|
|
19517
|
+
lineGraphic.id = this._getNodeId('line');
|
|
19518
|
+
if (!isEmpty(line.state)) {
|
|
19519
|
+
lineGraphic.states = merge({}, DEFAULT_STATES$1, line.state);
|
|
19520
|
+
}
|
|
19521
|
+
container.add(lineGraphic);
|
|
19125
19522
|
}
|
|
19126
|
-
|
|
19127
|
-
|
|
19128
|
-
|
|
19129
|
-
|
|
19130
|
-
|
|
19131
|
-
|
|
19132
|
-
|
|
19133
|
-
|
|
19134
|
-
targetStep = currentStep;
|
|
19135
|
-
break;
|
|
19523
|
+
getTitleAttribute() {
|
|
19524
|
+
var _a, _b, _c;
|
|
19525
|
+
const { center, radius, innerRadius = 0 } = this.attribute;
|
|
19526
|
+
const _d = this.attribute.title, { space = 4, textStyle = {}, shape, background, state = {} } = _d, restAttrs = __rest(_d, ["space", "textStyle", "shape", "background", "state"]);
|
|
19527
|
+
let titlePoint = center;
|
|
19528
|
+
let labelHeight = 0;
|
|
19529
|
+
if (((_a = this.attribute.label) === null || _a === void 0 ? void 0 : _a.visible) && this.attribute.label.inside === false) {
|
|
19530
|
+
labelHeight = get(this.attribute.label, 'style.fontSize', 12) + get(this.attribute.label, 'space', 4);
|
|
19136
19531
|
}
|
|
19137
|
-
|
|
19138
|
-
|
|
19532
|
+
let tickLength = 0;
|
|
19533
|
+
if (((_b = this.attribute.tick) === null || _b === void 0 ? void 0 : _b.visible) && this.attribute.tick.inside === false) {
|
|
19534
|
+
tickLength = this.attribute.tick.length || 4;
|
|
19535
|
+
}
|
|
19536
|
+
if (((_c = this.attribute.subTick) === null || _c === void 0 ? void 0 : _c.visible) && this.attribute.subTick.inside === false) {
|
|
19537
|
+
tickLength = Math.max(tickLength, this.attribute.subTick.length || 2);
|
|
19538
|
+
}
|
|
19539
|
+
const offset = radius + tickLength + labelHeight + space;
|
|
19540
|
+
let textBaseline = 'middle';
|
|
19541
|
+
let { position } = this.attribute.title;
|
|
19542
|
+
if (isNil(position)) {
|
|
19543
|
+
position = innerRadius === 0 ? 'end' : 'middle';
|
|
19544
|
+
}
|
|
19545
|
+
if (position === 'start') {
|
|
19546
|
+
textBaseline = 'bottom';
|
|
19547
|
+
titlePoint = {
|
|
19548
|
+
x: center.x,
|
|
19549
|
+
y: center.y - offset
|
|
19550
|
+
};
|
|
19551
|
+
}
|
|
19552
|
+
else if (position === 'end') {
|
|
19553
|
+
textBaseline = 'top';
|
|
19554
|
+
titlePoint = {
|
|
19555
|
+
x: center.x,
|
|
19556
|
+
y: center.y + offset
|
|
19557
|
+
};
|
|
19558
|
+
}
|
|
19559
|
+
const attrs = Object.assign(Object.assign(Object.assign({}, titlePoint), restAttrs), { textStyle: Object.assign({ textBaseline, textAlign: 'center' }, textStyle), state: {
|
|
19560
|
+
text: merge({}, DEFAULT_STATES$1, state.text),
|
|
19561
|
+
shape: merge({}, DEFAULT_STATES$1, state.shape),
|
|
19562
|
+
panel: merge({}, DEFAULT_STATES$1, state.background)
|
|
19563
|
+
} });
|
|
19564
|
+
const { angle } = restAttrs;
|
|
19565
|
+
attrs.angle = angle;
|
|
19566
|
+
if (shape && shape.visible) {
|
|
19567
|
+
attrs.shape = Object.assign({ visible: true }, shape.style);
|
|
19568
|
+
if (shape.space) {
|
|
19569
|
+
attrs.space = shape.space;
|
|
19570
|
+
}
|
|
19571
|
+
}
|
|
19572
|
+
if (background && background.visible) {
|
|
19573
|
+
attrs.panel = Object.assign({ visible: true }, background.style);
|
|
19574
|
+
}
|
|
19575
|
+
return attrs;
|
|
19576
|
+
}
|
|
19577
|
+
getSubTickLineItems() {
|
|
19578
|
+
var _a, _b;
|
|
19579
|
+
const { subTick } = this.attribute;
|
|
19580
|
+
const subTickLineItems = [];
|
|
19581
|
+
const { count: subCount = 4, inside = false, length = 2 } = subTick;
|
|
19582
|
+
const tickLineItems = this.tickLineItems;
|
|
19583
|
+
const tickLineCount = tickLineItems.length;
|
|
19584
|
+
if (tickLineCount >= 2) {
|
|
19585
|
+
const tickSegment = this.data[1].value - this.data[0].value;
|
|
19586
|
+
const isAlignWithLable = (_b = (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.tick) === null || _b === void 0 ? void 0 : _b.alignWithLabel;
|
|
19587
|
+
for (let i = 0; i < tickLineCount; i++) {
|
|
19588
|
+
const pre = tickLineItems[i];
|
|
19589
|
+
const next = tickLineItems[i + 1];
|
|
19590
|
+
for (let j = 0; j < subCount; j++) {
|
|
19591
|
+
const percent = (j + 1) / (subCount + 1);
|
|
19592
|
+
const value = (1 - percent) * pre.value + percent * (next ? next.value : isAlignWithLable ? 1 : pre.value + tickSegment);
|
|
19593
|
+
const point = this.getTickCoord(value);
|
|
19594
|
+
const endPoint = this.getVerticalCoord(point, length, inside);
|
|
19595
|
+
subTickLineItems.push({
|
|
19596
|
+
start: point,
|
|
19597
|
+
end: endPoint,
|
|
19598
|
+
value
|
|
19599
|
+
});
|
|
19600
|
+
}
|
|
19601
|
+
}
|
|
19602
|
+
}
|
|
19603
|
+
return subTickLineItems;
|
|
19604
|
+
}
|
|
19605
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
19606
|
+
return;
|
|
19607
|
+
}
|
|
19608
|
+
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
19609
|
+
if (isEmpty(labelShapes)) {
|
|
19610
|
+
return;
|
|
19611
|
+
}
|
|
19612
|
+
const { inside, radius, center, size, label, orient } = this.attribute;
|
|
19613
|
+
const bounds = size
|
|
19614
|
+
? {
|
|
19615
|
+
x1: 0,
|
|
19616
|
+
y1: 0,
|
|
19617
|
+
x2: size.width,
|
|
19618
|
+
y2: size.height
|
|
19619
|
+
}
|
|
19620
|
+
: {
|
|
19621
|
+
x1: center.x - radius,
|
|
19622
|
+
y1: center.y - radius,
|
|
19623
|
+
x2: center.x + radius,
|
|
19624
|
+
y2: center.y + radius
|
|
19625
|
+
};
|
|
19626
|
+
const { layoutFunc, autoLimit, limitEllipsis, autoHide: autoHide$1, autoHideMethod, autoHideSeparation, autoWrap } = label;
|
|
19627
|
+
if (isFunction(layoutFunc)) {
|
|
19628
|
+
layoutFunc(labelShapes, labelData, layer, this);
|
|
19629
|
+
}
|
|
19630
|
+
else {
|
|
19631
|
+
if (autoLimit || autoWrap) {
|
|
19632
|
+
circleAutoLimit(labelShapes, { inside, autoWrap, bounds, ellipsis: limitEllipsis, center });
|
|
19633
|
+
}
|
|
19634
|
+
if (autoHide$1) {
|
|
19635
|
+
autoHide(labelShapes, {
|
|
19636
|
+
orient,
|
|
19637
|
+
method: autoHideMethod,
|
|
19638
|
+
separation: autoHideSeparation
|
|
19639
|
+
});
|
|
19640
|
+
}
|
|
19641
|
+
}
|
|
19642
|
+
}
|
|
19643
|
+
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
19644
|
+
return;
|
|
19645
|
+
}
|
|
19646
|
+
getTextBaseline(vector) {
|
|
19647
|
+
if (Math.abs(vector[1] / vector[0]) < 0.3) {
|
|
19648
|
+
return 'middle';
|
|
19649
|
+
}
|
|
19650
|
+
else if (vector[1] < 0) {
|
|
19651
|
+
return 'bottom';
|
|
19652
|
+
}
|
|
19653
|
+
else if (vector[1] > 0) {
|
|
19654
|
+
return 'top';
|
|
19655
|
+
}
|
|
19656
|
+
return 'middle';
|
|
19657
|
+
}
|
|
19658
|
+
getLabelAlign(vector, inside, angle) {
|
|
19659
|
+
if (isNumberClose(vector[0], 0)) {
|
|
19660
|
+
return {
|
|
19661
|
+
textAlign: 'center',
|
|
19662
|
+
textBaseline: vector[1] > 0 ? 'top' : 'bottom'
|
|
19663
|
+
};
|
|
19664
|
+
}
|
|
19665
|
+
else if (vector[0] < 0) {
|
|
19666
|
+
return {
|
|
19667
|
+
textAlign: 'right',
|
|
19668
|
+
textBaseline: this.getTextBaseline(vector)
|
|
19669
|
+
};
|
|
19670
|
+
}
|
|
19671
|
+
else if (vector[0] > 0) {
|
|
19672
|
+
return {
|
|
19673
|
+
textAlign: 'left',
|
|
19674
|
+
textBaseline: this.getTextBaseline(vector)
|
|
19675
|
+
};
|
|
19676
|
+
}
|
|
19677
|
+
return {
|
|
19678
|
+
textAlign: 'center',
|
|
19679
|
+
textBaseline: 'middle'
|
|
19680
|
+
};
|
|
19681
|
+
}
|
|
19682
|
+
getLabelPosition(point, vector, text, style) {
|
|
19683
|
+
return point;
|
|
19139
19684
|
}
|
|
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
|
-
}
|
|
19168
19685
|
}
|
|
19686
|
+
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
19687
|
+
mixin(CircleAxis, CircleAxisMixin);
|
|
19169
19688
|
|
|
19170
19689
|
class GroupTransition extends ACustomAnimate {
|
|
19171
19690
|
constructor() {
|
|
@@ -20061,10 +20580,11 @@ function bitmapTool(width, height, padding = { top: 0, left: 0, right: 0, bottom
|
|
|
20061
20580
|
}
|
|
20062
20581
|
function clampRangeByBitmap($, range) {
|
|
20063
20582
|
const { x1, x2, y1, y2 } = range;
|
|
20064
|
-
const
|
|
20065
|
-
const
|
|
20066
|
-
const
|
|
20067
|
-
const
|
|
20583
|
+
const { top = 0, left = 0, right = 0, bottom = 0 } = $.padding;
|
|
20584
|
+
const _x1 = clamp(x1, -left, $.width + right);
|
|
20585
|
+
const _x2 = clamp(x2, -left, $.width + right);
|
|
20586
|
+
const _y1 = clamp(y1, -top, $.height + bottom);
|
|
20587
|
+
const _y2 = clamp(y2, -top, $.height + bottom);
|
|
20068
20588
|
return {
|
|
20069
20589
|
x1: $.x(_x1),
|
|
20070
20590
|
x2: $.x(_x2),
|
|
@@ -20410,11 +20930,100 @@ function getAlignOffset(align) {
|
|
|
20410
20930
|
return 0.5;
|
|
20411
20931
|
}
|
|
20412
20932
|
|
|
20933
|
+
class LabelUpdate extends AComponentAnimate {
|
|
20934
|
+
onBind() {
|
|
20935
|
+
const animator = createComponentAnimator(this.target);
|
|
20936
|
+
this._animator = animator;
|
|
20937
|
+
const duration = this.duration;
|
|
20938
|
+
const easing = this.easing;
|
|
20939
|
+
const { prevText, curText, prevLabelLine, curLabelLine } = this.params;
|
|
20940
|
+
const diff = {};
|
|
20941
|
+
for (const key in curText.attribute) {
|
|
20942
|
+
if (prevText.attribute[key] !== curText.attribute[key]) {
|
|
20943
|
+
diff[key] = curText.attribute[key];
|
|
20944
|
+
}
|
|
20945
|
+
}
|
|
20946
|
+
const rest = __rest(diff, ["text"]);
|
|
20947
|
+
animator.animate(prevText, {
|
|
20948
|
+
type: 'to',
|
|
20949
|
+
to: rest,
|
|
20950
|
+
duration,
|
|
20951
|
+
easing
|
|
20952
|
+
});
|
|
20953
|
+
animator.animate(prevText, {
|
|
20954
|
+
type: 'increaseCount',
|
|
20955
|
+
to: {
|
|
20956
|
+
text: curText.attribute.text
|
|
20957
|
+
},
|
|
20958
|
+
duration,
|
|
20959
|
+
easing
|
|
20960
|
+
});
|
|
20961
|
+
if (prevLabelLine) {
|
|
20962
|
+
animator.animate(prevLabelLine, {
|
|
20963
|
+
type: 'to',
|
|
20964
|
+
to: curLabelLine.attribute,
|
|
20965
|
+
duration,
|
|
20966
|
+
easing
|
|
20967
|
+
});
|
|
20968
|
+
}
|
|
20969
|
+
this.completeBind(animator);
|
|
20970
|
+
}
|
|
20971
|
+
tryPreventConflict() {
|
|
20972
|
+
return;
|
|
20973
|
+
}
|
|
20974
|
+
}
|
|
20975
|
+
class LabelEnter extends AComponentAnimate {
|
|
20976
|
+
onBind() {
|
|
20977
|
+
const animator = createComponentAnimator(this.target);
|
|
20978
|
+
this._animator = animator;
|
|
20979
|
+
const duration = this.duration;
|
|
20980
|
+
const easing = this.easing;
|
|
20981
|
+
const { relatedGraphic, relatedGraphics, config } = this.params;
|
|
20982
|
+
const { mode, type = 'fadeIn' } = config;
|
|
20983
|
+
const target = this.target;
|
|
20984
|
+
let startTime = 0;
|
|
20985
|
+
if (mode === 'after') {
|
|
20986
|
+
relatedGraphic.animates &&
|
|
20987
|
+
relatedGraphic.animates.forEach((animate) => {
|
|
20988
|
+
startTime = Math.max(startTime, animate.getStartTime() + animate.getTotalDuration());
|
|
20989
|
+
});
|
|
20990
|
+
}
|
|
20991
|
+
else if (mode === 'after-all') {
|
|
20992
|
+
relatedGraphics &&
|
|
20993
|
+
relatedGraphics.forEach((graphic) => {
|
|
20994
|
+
graphic.animates &&
|
|
20995
|
+
graphic.animates.forEach((animate) => {
|
|
20996
|
+
startTime = Math.max(startTime, animate.getStartTime() + animate.getTotalDuration());
|
|
20997
|
+
});
|
|
20998
|
+
});
|
|
20999
|
+
}
|
|
21000
|
+
else {
|
|
21001
|
+
relatedGraphic.animates &&
|
|
21002
|
+
relatedGraphic.animates.forEach((animate) => {
|
|
21003
|
+
startTime = Math.max(startTime, animate.getStartTime());
|
|
21004
|
+
});
|
|
21005
|
+
}
|
|
21006
|
+
animator.animate(target, Object.assign(Object.assign({}, config), { duration,
|
|
21007
|
+
easing,
|
|
21008
|
+
startTime,
|
|
21009
|
+
type }));
|
|
21010
|
+
this.completeBind(animator);
|
|
21011
|
+
}
|
|
21012
|
+
tryPreventConflict() {
|
|
21013
|
+
return;
|
|
21014
|
+
}
|
|
21015
|
+
}
|
|
21016
|
+
function registerLabelAnimate() {
|
|
21017
|
+
AnimateExecutor.registerBuiltInAnimate('labelUpdate', LabelUpdate);
|
|
21018
|
+
AnimateExecutor.registerBuiltInAnimate('labelEnter', LabelEnter);
|
|
21019
|
+
}
|
|
21020
|
+
|
|
20413
21021
|
function loadLabelComponent() {
|
|
20414
21022
|
registerGroup();
|
|
20415
21023
|
registerText();
|
|
20416
21024
|
registerRichtext();
|
|
20417
21025
|
registerLine();
|
|
21026
|
+
registerLabelAnimate();
|
|
20418
21027
|
}
|
|
20419
21028
|
|
|
20420
21029
|
const isIntersect = (top, bottom) => {
|
|
@@ -20589,7 +21198,7 @@ function shiftY(texts, option) {
|
|
|
20589
21198
|
}
|
|
20590
21199
|
|
|
20591
21200
|
loadLabelComponent();
|
|
20592
|
-
class LabelBase extends
|
|
21201
|
+
class LabelBase extends AnimateComponent {
|
|
20593
21202
|
setBitmap(bitmap) {
|
|
20594
21203
|
this._bitmap = bitmap;
|
|
20595
21204
|
}
|
|
@@ -20835,26 +21444,7 @@ class LabelBase extends AbstractComponent {
|
|
|
20835
21444
|
}
|
|
20836
21445
|
}
|
|
20837
21446
|
}
|
|
20838
|
-
|
|
20839
|
-
const { animation, animationEnter, animationExit, animationUpdate } = this.attribute;
|
|
20840
|
-
const animationCfg = isObject(animation) ? animation : {};
|
|
20841
|
-
this._animationConfig = {
|
|
20842
|
-
enter: animationEnter !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationEnter !== null && animationEnter !== void 0 ? animationEnter : {}) : false,
|
|
20843
|
-
exit: animationExit !== false ? merge({}, DefaultLabelAnimation, animationCfg, animationExit !== null && animationExit !== void 0 ? animationExit : {}) : false,
|
|
20844
|
-
update: animationUpdate !== false
|
|
20845
|
-
? isArray(animationUpdate)
|
|
20846
|
-
? animationUpdate
|
|
20847
|
-
: merge({}, DefaultLabelAnimation, animationCfg, animationUpdate !== null && animationUpdate !== void 0 ? animationUpdate : {})
|
|
20848
|
-
: false
|
|
20849
|
-
};
|
|
20850
|
-
}
|
|
20851
|
-
else {
|
|
20852
|
-
this._animationConfig = {
|
|
20853
|
-
enter: false,
|
|
20854
|
-
exit: false,
|
|
20855
|
-
update: false
|
|
20856
|
-
};
|
|
20857
|
-
}
|
|
21447
|
+
this._prepareAnimate(DefaultLabelAnimation);
|
|
20858
21448
|
}
|
|
20859
21449
|
getRelatedGraphic(item) {
|
|
20860
21450
|
return this._idToGraphic.get(item.id);
|
|
@@ -20931,7 +21521,9 @@ class LabelBase extends AbstractComponent {
|
|
|
20931
21521
|
return this._overlapByStrategy(labels, option, bmpTool, bitmap);
|
|
20932
21522
|
}
|
|
20933
21523
|
_overlapGlobal(labels, option, bmpTool, bitmap) {
|
|
20934
|
-
let result = labels.filter(label => label.attribute.visible &&
|
|
21524
|
+
let result = labels.filter(label => label.attribute.visible &&
|
|
21525
|
+
label.attribute.opacity !== 0 &&
|
|
21526
|
+
this.isMarkInsideRect(this.getRelatedGraphic(label.attribute), bmpTool));
|
|
20935
21527
|
const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;
|
|
20936
21528
|
if (clampForce) {
|
|
20937
21529
|
for (let i = 0; i < result.length; i++) {
|
|
@@ -21023,7 +21615,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21023
21615
|
const text = labels[i];
|
|
21024
21616
|
const baseMark = this.getRelatedGraphic(text.attribute);
|
|
21025
21617
|
text.update();
|
|
21026
|
-
if (!
|
|
21618
|
+
if (!this.isMarkInsideRect(baseMark, bmpTool)) {
|
|
21027
21619
|
continue;
|
|
21028
21620
|
}
|
|
21029
21621
|
if (canPlace(bmpTool, bitmap, text.AABBBounds, clampForce, overlapPadding)) {
|
|
@@ -21063,6 +21655,23 @@ class LabelBase extends AbstractComponent {
|
|
|
21063
21655
|
}
|
|
21064
21656
|
return result;
|
|
21065
21657
|
}
|
|
21658
|
+
isMarkInsideRect(baseMark, bmpTool) {
|
|
21659
|
+
const { left, right, top, bottom } = bmpTool.padding;
|
|
21660
|
+
const rect = { x1: -left, x2: bmpTool.width + right, y1: -top, y2: bmpTool.height + bottom };
|
|
21661
|
+
const bounds = baseMark.AABBBounds;
|
|
21662
|
+
if (bounds.width() !== 0 && bounds.height() !== 0) {
|
|
21663
|
+
return isRectIntersect(baseMark.AABBBounds, rect, true);
|
|
21664
|
+
}
|
|
21665
|
+
const { attribute } = baseMark;
|
|
21666
|
+
if (baseMark.type === 'rect') {
|
|
21667
|
+
const { x, x1, y, y1 } = attribute;
|
|
21668
|
+
return pointInRect({ x: x !== null && x !== void 0 ? x : x1, y: y !== null && y !== void 0 ? y : y1 }, rect, true);
|
|
21669
|
+
}
|
|
21670
|
+
else if ('x' in attribute && 'y' in attribute) {
|
|
21671
|
+
return pointInRect({ x: attribute.x, y: attribute.y }, rect, true);
|
|
21672
|
+
}
|
|
21673
|
+
return false;
|
|
21674
|
+
}
|
|
21066
21675
|
getBaseMarkGroup() {
|
|
21067
21676
|
const { baseMarkGroupName } = this.attribute;
|
|
21068
21677
|
if (!baseMarkGroupName) {
|
|
@@ -21126,20 +21735,22 @@ class LabelBase extends AbstractComponent {
|
|
|
21126
21735
|
this._removeLabel(prevTextMap);
|
|
21127
21736
|
this._graphicToText = currentTextMap;
|
|
21128
21737
|
}
|
|
21129
|
-
runEnterAnimation(text) {
|
|
21738
|
+
runEnterAnimation(text, labelLine) {
|
|
21130
21739
|
if (this._enableAnimation === false || !this._animationConfig.enter) {
|
|
21131
21740
|
return;
|
|
21132
21741
|
}
|
|
21133
21742
|
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
21134
21743
|
const { enter } = this._animationConfig;
|
|
21135
|
-
text.applyAnimationState(['enter'], [
|
|
21744
|
+
[text, labelLine].filter(Boolean).forEach(item => item.applyAnimationState(['enter'], [
|
|
21136
21745
|
{
|
|
21137
21746
|
name: 'enter',
|
|
21138
|
-
animation: Object.assign(Object.assign({}, enter), { selfOnly: true, customParameters: {
|
|
21139
|
-
relatedGraphic
|
|
21747
|
+
animation: Object.assign(Object.assign({}, enter), { type: 'labelEnter', selfOnly: true, customParameters: {
|
|
21748
|
+
relatedGraphic,
|
|
21749
|
+
relatedGraphics: this._idToGraphic,
|
|
21750
|
+
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'clipIn' })
|
|
21140
21751
|
} })
|
|
21141
21752
|
}
|
|
21142
|
-
]);
|
|
21753
|
+
]));
|
|
21143
21754
|
}
|
|
21144
21755
|
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
21145
21756
|
if (this._enableAnimation === false || !this._animationConfig.update) {
|
|
@@ -21173,7 +21784,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21173
21784
|
if (labelLine) {
|
|
21174
21785
|
this.add(labelLine);
|
|
21175
21786
|
}
|
|
21176
|
-
this.runEnterAnimation(text);
|
|
21787
|
+
this.runEnterAnimation(text, labelLine);
|
|
21177
21788
|
}
|
|
21178
21789
|
_updateLabel(prevLabel, currentLabel) {
|
|
21179
21790
|
const { text: prevText, labelLine: prevLabelLine } = prevLabel;
|
|
@@ -21201,7 +21812,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21201
21812
|
label.text.applyAnimationState(['exit'], [
|
|
21202
21813
|
{
|
|
21203
21814
|
name: 'exit',
|
|
21204
|
-
animation: Object.assign({ type: 'fadeOut' }
|
|
21815
|
+
animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: 'fadeOut' })
|
|
21205
21816
|
}
|
|
21206
21817
|
], () => {
|
|
21207
21818
|
removeLabelAndLine(label);
|
|
@@ -21209,7 +21820,7 @@ class LabelBase extends AbstractComponent {
|
|
|
21209
21820
|
(_a = label.labelLine) === null || _a === void 0 ? void 0 : _a.applyAnimationState(['exit'], [
|
|
21210
21821
|
{
|
|
21211
21822
|
name: 'exit',
|
|
21212
|
-
animation: Object.assign({ type: 'fadeOut' }
|
|
21823
|
+
animation: Object.assign(Object.assign({}, this._animationConfig.exit), { type: 'fadeOut' })
|
|
21213
21824
|
}
|
|
21214
21825
|
], () => {
|
|
21215
21826
|
});
|
|
@@ -31298,6 +31909,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31298
31909
|
theme: 'default'
|
|
31299
31910
|
};
|
|
31300
31911
|
|
|
31301
|
-
const version = "0.
|
|
31912
|
+
const version = "1.0.0-alpha.2";
|
|
31302
31913
|
|
|
31303
31914
|
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 };
|