@visactor/vrender-components 1.0.0-alpha.1 → 1.0.0-alpha.10
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/axis-animate.js +4 -4
- package/cjs/animation/axis-animate.js.map +1 -1
- package/cjs/axis/base.d.ts +2 -2
- package/cjs/axis/base.js +1 -1
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/util.js +5 -5
- package/cjs/axis/util.js.map +1 -1
- package/cjs/brush/brush.d.ts +16 -10
- package/cjs/brush/brush.js +81 -93
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/brush/config.d.ts +5 -5
- package/cjs/brush/config.js +5 -5
- package/cjs/brush/config.js.map +1 -1
- package/cjs/brush/type.d.ts +1 -0
- package/cjs/brush/type.js +1 -1
- package/cjs/brush/type.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +3 -0
- package/cjs/data-zoom/data-zoom.js +36 -19
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.d.ts +1 -0
- package/cjs/label/base.js +23 -5
- package/cjs/label/base.js.map +1 -1
- package/cjs/marker/animate/animate.d.ts +3 -3
- package/cjs/marker/animate/animate.js.map +1 -1
- package/cjs/marker/animate/clip-in.d.ts +1 -1
- package/cjs/marker/animate/clip-in.js +6 -3
- package/cjs/marker/animate/clip-in.js.map +1 -1
- package/cjs/marker/animate/fade-in.d.ts +3 -3
- package/cjs/marker/animate/fade-in.js +10 -4
- package/cjs/marker/animate/fade-in.js.map +1 -1
- package/cjs/marker/animate/fade-out.d.ts +3 -3
- package/cjs/marker/animate/fade-out.js +10 -4
- package/cjs/marker/animate/fade-out.js.map +1 -1
- package/cjs/marker/arc-area.d.ts +8 -5
- package/cjs/marker/arc-area.js +18 -39
- package/cjs/marker/arc-area.js.map +1 -1
- package/cjs/marker/arc-line.d.ts +6 -4
- package/cjs/marker/arc-line.js +12 -9
- package/cjs/marker/arc-line.js.map +1 -1
- package/cjs/marker/area.d.ts +6 -4
- package/cjs/marker/area.js +14 -32
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +2 -3
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/common-line.d.ts +11 -7
- package/cjs/marker/common-line.js +11 -31
- package/cjs/marker/common-line.js.map +1 -1
- package/cjs/marker/config.d.ts +2 -0
- package/cjs/marker/config.js +2 -0
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/line.d.ts +6 -4
- package/cjs/marker/line.js +10 -4
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/mixin/label.d.ts +16 -0
- package/cjs/marker/mixin/label.js +57 -0
- package/cjs/marker/mixin/label.js.map +1 -0
- package/cjs/marker/type.d.ts +19 -16
- package/cjs/marker/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +1 -0
- package/cjs/scrollbar/scrollbar.js +21 -12
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/slider/slider.d.ts +3 -0
- package/cjs/slider/slider.js +48 -27
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/switch/switch.js +2 -2
- package/cjs/switch/switch.js.map +1 -1
- package/cjs/util/event.d.ts +1 -0
- package/cjs/util/event.js +14 -0
- package/cjs/util/event.js.map +1 -0
- package/dist/index.es.js +1692 -978
- package/es/animation/axis-animate.js +4 -4
- package/es/animation/axis-animate.js.map +1 -1
- package/es/axis/base.d.ts +2 -2
- package/es/axis/base.js +1 -1
- package/es/axis/base.js.map +1 -1
- package/es/axis/util.js +5 -6
- package/es/axis/util.js.map +1 -1
- package/es/brush/brush.d.ts +16 -10
- package/es/brush/brush.js +83 -95
- package/es/brush/brush.js.map +1 -1
- package/es/brush/config.d.ts +5 -5
- package/es/brush/config.js +5 -5
- package/es/brush/config.js.map +1 -1
- package/es/brush/type.d.ts +1 -0
- package/es/brush/type.js +1 -1
- package/es/brush/type.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +3 -0
- package/es/data-zoom/data-zoom.js +35 -16
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.d.ts +1 -0
- package/es/label/base.js +23 -5
- package/es/label/base.js.map +1 -1
- package/es/marker/animate/animate.d.ts +3 -3
- package/es/marker/animate/animate.js.map +1 -1
- package/es/marker/animate/clip-in.d.ts +1 -1
- package/es/marker/animate/clip-in.js +6 -2
- package/es/marker/animate/clip-in.js.map +1 -1
- package/es/marker/animate/fade-in.d.ts +3 -3
- package/es/marker/animate/fade-in.js +11 -3
- package/es/marker/animate/fade-in.js.map +1 -1
- package/es/marker/animate/fade-out.d.ts +3 -3
- package/es/marker/animate/fade-out.js +11 -3
- package/es/marker/animate/fade-out.js.map +1 -1
- package/es/marker/arc-area.d.ts +8 -5
- package/es/marker/arc-area.js +19 -41
- package/es/marker/arc-area.js.map +1 -1
- package/es/marker/arc-line.d.ts +6 -4
- package/es/marker/arc-line.js +12 -9
- package/es/marker/arc-line.js.map +1 -1
- package/es/marker/area.d.ts +6 -4
- package/es/marker/area.js +15 -34
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +2 -3
- package/es/marker/base.js.map +1 -1
- package/es/marker/common-line.d.ts +11 -7
- package/es/marker/common-line.js +14 -34
- package/es/marker/common-line.js.map +1 -1
- package/es/marker/config.d.ts +2 -0
- package/es/marker/config.js +2 -0
- package/es/marker/config.js.map +1 -1
- package/es/marker/line.d.ts +6 -4
- package/es/marker/line.js +10 -4
- package/es/marker/line.js.map +1 -1
- package/es/marker/mixin/label.d.ts +16 -0
- package/es/marker/mixin/label.js +45 -0
- package/es/marker/mixin/label.js.map +1 -0
- package/es/marker/type.d.ts +19 -16
- package/es/marker/type.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +1 -0
- package/es/scrollbar/scrollbar.js +22 -11
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/slider/slider.d.ts +3 -0
- package/es/slider/slider.js +49 -26
- package/es/slider/slider.js.map +1 -1
- package/es/switch/switch.js +2 -2
- package/es/switch/switch.js.map +1 -1
- package/es/util/event.d.ts +1 -0
- package/es/util/event.js +6 -0
- package/es/util/event.js.map +1 -0
- 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, cos, sin, isString, pointAt, isNumber, sqrt, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isPointInLine, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, sqrt, Color, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
|
|
2
2
|
import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
|
|
3
3
|
|
|
4
4
|
class Generator {
|
|
@@ -596,14 +596,14 @@ class PerformanceRAF {
|
|
|
596
596
|
}
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
-
var __decorate$
|
|
599
|
+
var __decorate$Q = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
600
600
|
var d,
|
|
601
601
|
c = arguments.length,
|
|
602
602
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
603
603
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
604
604
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
605
605
|
},
|
|
606
|
-
__metadata$
|
|
606
|
+
__metadata$G = undefined && undefined.__metadata || function (k, v) {
|
|
607
607
|
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
608
608
|
},
|
|
609
609
|
__param$A = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
@@ -818,7 +818,7 @@ let DefaultGlobal = class {
|
|
|
818
818
|
return this._env || this.setEnv("browser"), this.envContribution.copyToClipBoard(text);
|
|
819
819
|
}
|
|
820
820
|
};
|
|
821
|
-
DefaultGlobal = __decorate$
|
|
821
|
+
DefaultGlobal = __decorate$Q([injectable(), __param$A(0, inject(ContributionProvider)), __param$A(0, named(EnvContribution)), __metadata$G("design:paramtypes", [Object])], DefaultGlobal);
|
|
822
822
|
|
|
823
823
|
var MeasureModeEnum;
|
|
824
824
|
!function (MeasureModeEnum) {
|
|
@@ -1063,15 +1063,19 @@ function drawArc(context, x, y, coords) {
|
|
|
1063
1063
|
context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry)
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1066
|
+
const addArcToBezierPath = function (bezierPath, startAngle, endAngle, cx, cy, rx, ry) {
|
|
1067
|
+
let counterclockwise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : !1;
|
|
1068
|
+
const PI2 = 2 * Math.PI,
|
|
1069
|
+
sAngle = (startAngle % PI2 + PI2) % PI2;
|
|
1070
|
+
let deltaAngle,
|
|
1071
|
+
eAngle = (endAngle % PI2 + PI2) % PI2;
|
|
1072
|
+
counterclockwise ? (eAngle >= sAngle && (eAngle -= PI2), deltaAngle = eAngle - sAngle) : (eAngle <= sAngle && (eAngle += PI2), deltaAngle = eAngle - sAngle);
|
|
1073
|
+
const count = Math.ceil(Math.abs(deltaAngle) / (.5 * Math.PI)),
|
|
1074
|
+
stepAngle = deltaAngle / count;
|
|
1070
1075
|
for (let i = 0; i < count; i++) {
|
|
1071
|
-
const sa =
|
|
1072
|
-
ea =
|
|
1073
|
-
len = 4 * Math.tan(Math.abs(stepAngle) / 4)
|
|
1074
|
-
dir = ea < sa ? -1 : 1,
|
|
1076
|
+
const sa = sAngle + stepAngle * i,
|
|
1077
|
+
ea = sAngle + stepAngle * (i + 1),
|
|
1078
|
+
len = 4 / 3 * Math.tan(Math.abs(stepAngle) / 4),
|
|
1075
1079
|
c1 = Math.cos(sa),
|
|
1076
1080
|
s1 = Math.sin(sa),
|
|
1077
1081
|
c2 = Math.cos(ea),
|
|
@@ -1080,8 +1084,9 @@ const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) =>
|
|
|
1080
1084
|
y1 = s1 * ry + cy,
|
|
1081
1085
|
x4 = c2 * rx + cx,
|
|
1082
1086
|
y4 = s2 * ry + cy,
|
|
1083
|
-
|
|
1084
|
-
|
|
1087
|
+
sign = counterclockwise ? -1 : 1,
|
|
1088
|
+
hx = rx * len * sign,
|
|
1089
|
+
hy = ry * len * sign;
|
|
1085
1090
|
bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
|
|
1086
1091
|
}
|
|
1087
1092
|
};
|
|
@@ -1642,6 +1647,11 @@ let Step$1 = class Step {
|
|
|
1642
1647
|
return this.context.tryUpdateLength();
|
|
1643
1648
|
}
|
|
1644
1649
|
};
|
|
1650
|
+
class StepClosed extends Step$1 {
|
|
1651
|
+
lineEnd() {
|
|
1652
|
+
this.context.closePath();
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1645
1655
|
function genStepSegments(points, t) {
|
|
1646
1656
|
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1647
1657
|
const {
|
|
@@ -1655,6 +1665,16 @@ function genStepSegments(points, t) {
|
|
|
1655
1665
|
function genStepTypeSegments(path, points) {
|
|
1656
1666
|
return genCurveSegments(path, points);
|
|
1657
1667
|
}
|
|
1668
|
+
function genStepClosedSegments(points, t) {
|
|
1669
|
+
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1670
|
+
const {
|
|
1671
|
+
direction: direction,
|
|
1672
|
+
startPoint: startPoint
|
|
1673
|
+
} = params;
|
|
1674
|
+
if (points.length < 2 - Number(!!startPoint)) return null;
|
|
1675
|
+
const segContext = new SegContext("step", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction.ROW : Direction.COLUMN);
|
|
1676
|
+
return genStepTypeSegments(new StepClosed(segContext, t, startPoint), points), segContext;
|
|
1677
|
+
}
|
|
1658
1678
|
|
|
1659
1679
|
class LinearClosed extends Linear {
|
|
1660
1680
|
lineEnd() {
|
|
@@ -1884,6 +1904,8 @@ function calcLineCache(points, curveType, params) {
|
|
|
1884
1904
|
return genMonotoneYSegments(points, params);
|
|
1885
1905
|
case "step":
|
|
1886
1906
|
return genStepSegments(points, .5, params);
|
|
1907
|
+
case "stepClosed":
|
|
1908
|
+
return genStepClosedSegments(points, .5, params);
|
|
1887
1909
|
case "stepBefore":
|
|
1888
1910
|
return genStepSegments(points, 0, params);
|
|
1889
1911
|
case "stepAfter":
|
|
@@ -1954,8 +1976,14 @@ class CustomPath2D extends CurvePath {
|
|
|
1954
1976
|
if (!this.toStringCbList) {
|
|
1955
1977
|
const list = [];
|
|
1956
1978
|
list[enumCommandMap.M] = cmd => `M${cmd[1]} ${cmd[2]}`, list[enumCommandMap.L] = cmd => `L${cmd[1]} ${cmd[2]}`, list[enumCommandMap.Q] = cmd => `Q${cmd[1]} ${cmd[2]} ${cmd[3]} ${cmd[4]}`, list[enumCommandMap.C] = cmd => `C${cmd[1]} ${cmd[2]} ${cmd[3]} ${cmd[4]} ${cmd[5]} ${cmd[6]}`, list[enumCommandMap.A] = cmd => {
|
|
1957
|
-
const bezierPathList = []
|
|
1958
|
-
|
|
1979
|
+
const bezierPathList = [],
|
|
1980
|
+
x = cmd[1],
|
|
1981
|
+
y = cmd[2],
|
|
1982
|
+
radius = cmd[3],
|
|
1983
|
+
startAngle = cmd[4],
|
|
1984
|
+
endAngle = cmd[5],
|
|
1985
|
+
counterclockwise = cmd[6];
|
|
1986
|
+
addArcToBezierPath(bezierPathList, startAngle, endAngle, x, y, radius, radius, counterclockwise);
|
|
1959
1987
|
let path = "";
|
|
1960
1988
|
for (let i = 0; i < bezierPathList.length; i += 6) path += `C${bezierPathList[i]} ${bezierPathList[i + 1]} ${bezierPathList[i + 2]} ${bezierPathList[i + 3]} ${bezierPathList[i + 4]} ${bezierPathList[i + 5]}`;
|
|
1961
1989
|
return path;
|
|
@@ -2318,7 +2346,8 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
|
2318
2346
|
filter: "",
|
|
2319
2347
|
cursor: null,
|
|
2320
2348
|
html: null,
|
|
2321
|
-
react: null
|
|
2349
|
+
react: null,
|
|
2350
|
+
vue: null
|
|
2322
2351
|
}, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
|
|
2323
2352
|
const DefaultConnectAttribute = {
|
|
2324
2353
|
connectedType: "none",
|
|
@@ -2353,7 +2382,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
|
|
|
2353
2382
|
overflow: "hidden",
|
|
2354
2383
|
shadowPickMode: "graphic",
|
|
2355
2384
|
keepStrokeScale: !1,
|
|
2356
|
-
clipConfig: null
|
|
2385
|
+
clipConfig: null,
|
|
2386
|
+
roughStyle: null
|
|
2357
2387
|
}, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
2358
2388
|
const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
2359
2389
|
startAngle: 0,
|
|
@@ -2426,6 +2456,12 @@ const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute
|
|
|
2426
2456
|
cornerRadius: 0,
|
|
2427
2457
|
closePath: !0
|
|
2428
2458
|
});
|
|
2459
|
+
const DefaultStarAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
2460
|
+
width: 100,
|
|
2461
|
+
height: 100,
|
|
2462
|
+
spikes: 5,
|
|
2463
|
+
thickness: .5
|
|
2464
|
+
});
|
|
2429
2465
|
const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
2430
2466
|
width: 0,
|
|
2431
2467
|
height: 0,
|
|
@@ -2751,6 +2787,7 @@ function getScaledStroke(context, width, dpr) {
|
|
|
2751
2787
|
function createColor(context, c, params) {
|
|
2752
2788
|
let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
2753
2789
|
let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
2790
|
+
var _a, _b, _c, _d;
|
|
2754
2791
|
if (!c || !0 === c) return "black";
|
|
2755
2792
|
let result, color;
|
|
2756
2793
|
if (isArray(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
|
|
@@ -2764,9 +2801,10 @@ function createColor(context, c, params) {
|
|
|
2764
2801
|
if (params.attribute) {
|
|
2765
2802
|
const {
|
|
2766
2803
|
scaleX = 1,
|
|
2767
|
-
scaleY = 1
|
|
2804
|
+
scaleY = 1,
|
|
2805
|
+
angle = 0
|
|
2768
2806
|
} = params.attribute;
|
|
2769
|
-
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
|
|
2807
|
+
w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY, (angle || 1 !== scaleX || 1 !== scaleY) && (x = null !== (_a = params.x1WithoutTransform) && void 0 !== _a ? _a : 0, y = null !== (_b = params.y1WithoutTransform) && void 0 !== _b ? _b : 0, w = null !== (_c = params.widthWithoutTransform) && void 0 !== _c ? _c : w, h = null !== (_d = params.heightWithoutTransform) && void 0 !== _d ? _d : h);
|
|
2770
2808
|
}
|
|
2771
2809
|
"linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
|
|
2772
2810
|
}
|
|
@@ -2791,7 +2829,7 @@ function createConicGradient(context, color, x, y, w, h) {
|
|
|
2791
2829
|
const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
|
|
2792
2830
|
return color.stops.forEach(stop => {
|
|
2793
2831
|
canvasGradient.addColorStop(stop.offset, stop.color);
|
|
2794
|
-
}), canvasGradient.GetPattern(w + x, h + y, undefined);
|
|
2832
|
+
}), canvasGradient.GetPattern ? canvasGradient.GetPattern(w + x, h + y, undefined) : canvasGradient;
|
|
2795
2833
|
}
|
|
2796
2834
|
|
|
2797
2835
|
const DIRECTION_KEY = {
|
|
@@ -2921,7 +2959,7 @@ function measureTextCanvas(text, character) {
|
|
|
2921
2959
|
return result.width += space, result;
|
|
2922
2960
|
}
|
|
2923
2961
|
|
|
2924
|
-
var __decorate$
|
|
2962
|
+
var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
2925
2963
|
var d,
|
|
2926
2964
|
c = arguments.length,
|
|
2927
2965
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -3313,9 +3351,9 @@ let ATextMeasure = class {
|
|
|
3313
3351
|
return data.str = data.result, data.width += suffixWidth, data;
|
|
3314
3352
|
}
|
|
3315
3353
|
};
|
|
3316
|
-
ATextMeasure = __decorate$
|
|
3354
|
+
ATextMeasure = __decorate$P([injectable()], ATextMeasure);
|
|
3317
3355
|
|
|
3318
|
-
var __decorate$
|
|
3356
|
+
var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
3319
3357
|
var d,
|
|
3320
3358
|
c = arguments.length,
|
|
3321
3359
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -3324,7 +3362,7 @@ var __decorate$N = undefined && undefined.__decorate || function (decorators, ta
|
|
|
3324
3362
|
};
|
|
3325
3363
|
const TextMeasureContribution = Symbol.for("TextMeasureContribution");
|
|
3326
3364
|
let DefaultTextMeasureContribution = class extends ATextMeasure {};
|
|
3327
|
-
DefaultTextMeasureContribution = __decorate$
|
|
3365
|
+
DefaultTextMeasureContribution = __decorate$O([injectable()], DefaultTextMeasureContribution);
|
|
3328
3366
|
|
|
3329
3367
|
const container = new Container();
|
|
3330
3368
|
|
|
@@ -3333,6 +3371,355 @@ const CanvasFactory = Symbol.for("CanvasFactory");
|
|
|
3333
3371
|
function wrapCanvas(params) {
|
|
3334
3372
|
return container.getNamed(CanvasFactory, application.global.env)(params);
|
|
3335
3373
|
}
|
|
3374
|
+
const EPSILON_NUMERIC = 1e-4,
|
|
3375
|
+
THREE_SQRT = Math.sqrt(3),
|
|
3376
|
+
ONE_THIRD = 1 / 3;
|
|
3377
|
+
function isAroundZero(val) {
|
|
3378
|
+
return val > -EPSILON && val < EPSILON;
|
|
3379
|
+
}
|
|
3380
|
+
function isNotAroundZero(val) {
|
|
3381
|
+
return val > EPSILON || val < -EPSILON;
|
|
3382
|
+
}
|
|
3383
|
+
const _v0 = [0, 0],
|
|
3384
|
+
_v1 = [0, 0],
|
|
3385
|
+
_v2 = [0, 0];
|
|
3386
|
+
function distanceSquare(v1, v2) {
|
|
3387
|
+
return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]);
|
|
3388
|
+
}
|
|
3389
|
+
function quadraticAt(p0, p1, p2, t) {
|
|
3390
|
+
const onet = 1 - t;
|
|
3391
|
+
return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
|
|
3392
|
+
}
|
|
3393
|
+
function cubicAt(p0, p1, p2, p3, t) {
|
|
3394
|
+
const onet = 1 - t;
|
|
3395
|
+
return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
|
|
3396
|
+
}
|
|
3397
|
+
function quadraticRootAt(p0, p1, p2, val, roots) {
|
|
3398
|
+
const a = p0 - 2 * p1 + p2,
|
|
3399
|
+
b = 2 * (p1 - p0),
|
|
3400
|
+
c = p0 - val;
|
|
3401
|
+
let n = 0;
|
|
3402
|
+
if (isAroundZero(a)) {
|
|
3403
|
+
if (isNotAroundZero(b)) {
|
|
3404
|
+
const t1 = -c / b;
|
|
3405
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
|
|
3406
|
+
}
|
|
3407
|
+
} else {
|
|
3408
|
+
const disc = b * b - 4 * a * c;
|
|
3409
|
+
if (isAroundZero(disc)) {
|
|
3410
|
+
const t1 = -b / (2 * a);
|
|
3411
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
|
|
3412
|
+
} else if (disc > 0) {
|
|
3413
|
+
const discSqrt = Math.sqrt(disc),
|
|
3414
|
+
t1 = (-b + discSqrt) / (2 * a),
|
|
3415
|
+
t2 = (-b - discSqrt) / (2 * a);
|
|
3416
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
|
|
3417
|
+
}
|
|
3418
|
+
}
|
|
3419
|
+
return n;
|
|
3420
|
+
}
|
|
3421
|
+
function quadraticExtremum(p0, p1, p2) {
|
|
3422
|
+
const divider = p0 + p2 - 2 * p1;
|
|
3423
|
+
return 0 === divider ? .5 : (p0 - p1) / divider;
|
|
3424
|
+
}
|
|
3425
|
+
function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
|
|
3426
|
+
let t = 0,
|
|
3427
|
+
interval = .005,
|
|
3428
|
+
d = 1 / 0;
|
|
3429
|
+
_v0[0] = x, _v0[1] = y;
|
|
3430
|
+
for (let _t = 0; _t < 1; _t += .05) {
|
|
3431
|
+
_v1[0] = quadraticAt(x0, x1, x2, _t), _v1[1] = quadraticAt(y0, y1, y2, _t);
|
|
3432
|
+
const d1 = distanceSquare(_v0, _v1);
|
|
3433
|
+
d1 < d && (t = _t, d = d1);
|
|
3434
|
+
}
|
|
3435
|
+
d = 1 / 0;
|
|
3436
|
+
for (let i = 0; i < 32 && !(interval < EPSILON_NUMERIC); i++) {
|
|
3437
|
+
const prev = t - interval,
|
|
3438
|
+
next = t + interval;
|
|
3439
|
+
_v1[0] = quadraticAt(x0, x1, x2, prev), _v1[1] = quadraticAt(y0, y1, y2, prev);
|
|
3440
|
+
const d1 = distanceSquare(_v1, _v0);
|
|
3441
|
+
if (prev >= 0 && d1 < d) t = prev, d = d1;else {
|
|
3442
|
+
_v2[0] = quadraticAt(x0, x1, x2, next), _v2[1] = quadraticAt(y0, y1, y2, next);
|
|
3443
|
+
const d2 = distanceSquare(_v2, _v0);
|
|
3444
|
+
next <= 1 && d2 < d ? (t = next, d = d2) : interval *= .5;
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
return out && (out[0] = quadraticAt(x0, x1, x2, t), out[1] = quadraticAt(y0, y1, y2, t)), Math.sqrt(d);
|
|
3448
|
+
}
|
|
3449
|
+
function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
|
|
3450
|
+
let prev,
|
|
3451
|
+
next,
|
|
3452
|
+
d1,
|
|
3453
|
+
d2,
|
|
3454
|
+
t = 0,
|
|
3455
|
+
interval = .005,
|
|
3456
|
+
d = 1 / 0;
|
|
3457
|
+
_v0[0] = x, _v0[1] = y;
|
|
3458
|
+
for (let _t = 0; _t < 1; _t += .05) _v1[0] = cubicAt(x0, x1, x2, x3, _t), _v1[1] = cubicAt(y0, y1, y2, y3, _t), d1 = distanceSquare(_v0, _v1), d1 < d && (t = _t, d = d1);
|
|
3459
|
+
d = 1 / 0;
|
|
3460
|
+
for (let i = 0; i < 32 && !(interval < EPSILON_NUMERIC); i++) prev = t - interval, next = t + interval, _v1[0] = cubicAt(x0, x1, x2, x3, prev), _v1[1] = cubicAt(y0, y1, y2, y3, prev), d1 = distanceSquare(_v1, _v0), prev >= 0 && d1 < d ? (t = prev, d = d1) : (_v2[0] = cubicAt(x0, x1, x2, x3, next), _v2[1] = cubicAt(y0, y1, y2, y3, next), d2 = distanceSquare(_v2, _v0), next <= 1 && d2 < d ? (t = next, d = d2) : interval *= .5);
|
|
3461
|
+
return out && (out[0] = cubicAt(x0, x1, x2, x3, t), out[1] = cubicAt(y0, y1, y2, y3, t)), Math.sqrt(d);
|
|
3462
|
+
}
|
|
3463
|
+
function normalizeRadian(angle) {
|
|
3464
|
+
return (angle %= pi2) < 0 && (angle += pi2), angle;
|
|
3465
|
+
}
|
|
3466
|
+
function containQuadStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
|
|
3467
|
+
if (0 === lineWidth) return !1;
|
|
3468
|
+
const _l = lineWidth;
|
|
3469
|
+
if (y > y0 + _l && y > y1 + _l && y > y2 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l) return !1;
|
|
3470
|
+
return quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null) <= _l / 2;
|
|
3471
|
+
}
|
|
3472
|
+
function containCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
|
|
3473
|
+
if (0 === lineWidth) return !1;
|
|
3474
|
+
const _l = lineWidth;
|
|
3475
|
+
if (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l) return !1;
|
|
3476
|
+
return cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null) <= _l / 2;
|
|
3477
|
+
}
|
|
3478
|
+
function containArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
|
|
3479
|
+
if (0 === lineWidth) return !1;
|
|
3480
|
+
const _l = lineWidth;
|
|
3481
|
+
x -= cx, y -= cy;
|
|
3482
|
+
const d = Math.sqrt(x * x + y * y);
|
|
3483
|
+
if (d - _l > r || d + _l < r) return !1;
|
|
3484
|
+
if (Math.abs(startAngle - endAngle) % pi2 < 1e-4) return !0;
|
|
3485
|
+
if (anticlockwise) {
|
|
3486
|
+
const tmp = startAngle;
|
|
3487
|
+
startAngle = normalizeRadian(endAngle), endAngle = normalizeRadian(tmp);
|
|
3488
|
+
} else startAngle = normalizeRadian(startAngle), endAngle = normalizeRadian(endAngle);
|
|
3489
|
+
startAngle > endAngle && (endAngle += pi2);
|
|
3490
|
+
let angle = Math.atan2(y, x);
|
|
3491
|
+
return angle < 0 && (angle += pi2), angle >= startAngle && angle <= endAngle || angle + pi2 >= startAngle && angle + pi2 <= endAngle;
|
|
3492
|
+
}
|
|
3493
|
+
function containLineStroke(x0, y0, x1, y1, lineWidth, x, y) {
|
|
3494
|
+
if (0 === lineWidth) return !1;
|
|
3495
|
+
const _l = lineWidth,
|
|
3496
|
+
_halfL = lineWidth / 2;
|
|
3497
|
+
let _a = 0,
|
|
3498
|
+
_b = x0;
|
|
3499
|
+
if (y > y0 + _halfL && y > y1 + _halfL || y < y0 - _halfL && y < y1 - _halfL || x > x0 + _halfL && x > x1 + _halfL || x < x0 - _halfL && x < x1 - _halfL) return !1;
|
|
3500
|
+
if (x0 === x1) return Math.abs(x - x0) <= _l / 2;
|
|
3501
|
+
_a = (y0 - y1) / (x0 - x1), _b = (x0 * y1 - x1 * y0) / (x0 - x1);
|
|
3502
|
+
const tmp = _a * x - y + _b;
|
|
3503
|
+
return tmp * tmp / (_a * _a + 1) <= _l / 2 * _l / 2;
|
|
3504
|
+
}
|
|
3505
|
+
const EPSILON = 1e-4;
|
|
3506
|
+
function cubicRootAt(p0, p1, p2, p3, val, roots) {
|
|
3507
|
+
const a = p3 + 3 * (p1 - p2) - p0,
|
|
3508
|
+
b = 3 * (p2 - 2 * p1 + p0),
|
|
3509
|
+
c = 3 * (p1 - p0),
|
|
3510
|
+
d = p0 - val,
|
|
3511
|
+
A = b * b - 3 * a * c,
|
|
3512
|
+
B = b * c - 9 * a * d,
|
|
3513
|
+
C = c * c - 3 * b * d;
|
|
3514
|
+
let n = 0;
|
|
3515
|
+
if (isAroundZero(A) && isAroundZero(B)) {
|
|
3516
|
+
if (isAroundZero(b)) roots[0] = 0;else {
|
|
3517
|
+
const t1 = -c / b;
|
|
3518
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
|
|
3519
|
+
}
|
|
3520
|
+
} else {
|
|
3521
|
+
const disc = B * B - 4 * A * C;
|
|
3522
|
+
if (isAroundZero(disc)) {
|
|
3523
|
+
const K = B / A,
|
|
3524
|
+
t1 = -b / a + K,
|
|
3525
|
+
t2 = -K / 2;
|
|
3526
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
|
|
3527
|
+
} else if (disc > 0) {
|
|
3528
|
+
const discSqrt = Math.sqrt(disc);
|
|
3529
|
+
let Y1 = A * b + 1.5 * a * (-B + discSqrt),
|
|
3530
|
+
Y2 = A * b + 1.5 * a * (-B - discSqrt);
|
|
3531
|
+
Y1 = Y1 < 0 ? -Math.pow(-Y1, ONE_THIRD) : Math.pow(Y1, ONE_THIRD), Y2 = Y2 < 0 ? -Math.pow(-Y2, ONE_THIRD) : Math.pow(Y2, ONE_THIRD);
|
|
3532
|
+
const t1 = (-b - (Y1 + Y2)) / (3 * a);
|
|
3533
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
|
|
3534
|
+
} else {
|
|
3535
|
+
const T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A)),
|
|
3536
|
+
theta = Math.acos(T) / 3,
|
|
3537
|
+
ASqrt = Math.sqrt(A),
|
|
3538
|
+
tmp = Math.cos(theta),
|
|
3539
|
+
t1 = (-b - 2 * ASqrt * tmp) / (3 * a),
|
|
3540
|
+
t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a),
|
|
3541
|
+
t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
|
|
3542
|
+
t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2), t3 >= 0 && t3 <= 1 && (roots[n++] = t3);
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
return n;
|
|
3546
|
+
}
|
|
3547
|
+
function cubicExtrema(p0, p1, p2, p3, extrema) {
|
|
3548
|
+
const b = 6 * p2 - 12 * p1 + 6 * p0,
|
|
3549
|
+
a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2,
|
|
3550
|
+
c = 3 * p1 - 3 * p0;
|
|
3551
|
+
let n = 0;
|
|
3552
|
+
if (isAroundZero(a)) {
|
|
3553
|
+
if (isNotAroundZero(b)) {
|
|
3554
|
+
const t1 = -c / b;
|
|
3555
|
+
t1 >= 0 && t1 <= 1 && (extrema[n++] = t1);
|
|
3556
|
+
}
|
|
3557
|
+
} else {
|
|
3558
|
+
const disc = b * b - 4 * a * c;
|
|
3559
|
+
if (isAroundZero(disc)) extrema[0] = -b / (2 * a);else if (disc > 0) {
|
|
3560
|
+
const discSqrt = Math.sqrt(disc),
|
|
3561
|
+
t1 = (-b + discSqrt) / (2 * a),
|
|
3562
|
+
t2 = (-b - discSqrt) / (2 * a);
|
|
3563
|
+
t1 >= 0 && t1 <= 1 && (extrema[n++] = t1), t2 >= 0 && t2 <= 1 && (extrema[n++] = t2);
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
return n;
|
|
3567
|
+
}
|
|
3568
|
+
function isAroundEqual(a, b) {
|
|
3569
|
+
return Math.abs(a - b) < EPSILON;
|
|
3570
|
+
}
|
|
3571
|
+
const roots = [-1, -1, -1],
|
|
3572
|
+
extrema = [-1, -1];
|
|
3573
|
+
function swapExtrema() {
|
|
3574
|
+
const tmp = extrema[0];
|
|
3575
|
+
extrema[0] = extrema[1], extrema[1] = tmp;
|
|
3576
|
+
}
|
|
3577
|
+
function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
|
|
3578
|
+
if (y > y0 && y > y1 && y > y2 && y > y3 || y < y0 && y < y1 && y < y2 && y < y3) return 0;
|
|
3579
|
+
const nRoots = cubicRootAt(y0, y1, y2, y3, y, roots);
|
|
3580
|
+
if (0 === nRoots) return 0;
|
|
3581
|
+
let w = 0,
|
|
3582
|
+
nExtrema = -1,
|
|
3583
|
+
y0_ = 0,
|
|
3584
|
+
y1_ = 0;
|
|
3585
|
+
for (let i = 0; i < nRoots; i++) {
|
|
3586
|
+
const t = roots[i],
|
|
3587
|
+
unit = 0 === t || 1 === t ? .5 : 1;
|
|
3588
|
+
cubicAt(x0, x1, x2, x3, t) < x || (nExtrema < 0 && (nExtrema = cubicExtrema(y0, y1, y2, y3, extrema), extrema[1] < extrema[0] && nExtrema > 1 && swapExtrema(), y0_ = cubicAt(y0, y1, y2, y3, extrema[0]), nExtrema > 1 && (y1_ = cubicAt(y0, y1, y2, y3, extrema[1]))), 2 === nExtrema ? t < extrema[0] ? w += y0_ < y0 ? unit : -unit : t < extrema[1] ? w += y1_ < y0_ ? unit : -unit : w += y3 < y1_ ? unit : -unit : t < extrema[0] ? w += y0_ < y0 ? unit : -unit : w += y3 < y0_ ? unit : -unit);
|
|
3589
|
+
}
|
|
3590
|
+
return w;
|
|
3591
|
+
}
|
|
3592
|
+
function windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
|
|
3593
|
+
if (y > y0 && y > y1 && y > y2 || y < y0 && y < y1 && y < y2) return 0;
|
|
3594
|
+
const nRoots = quadraticRootAt(y0, y1, y2, y, roots);
|
|
3595
|
+
if (0 === nRoots) return 0;
|
|
3596
|
+
const t = quadraticExtremum(y0, y1, y2);
|
|
3597
|
+
if (t >= 0 && t <= 1) {
|
|
3598
|
+
let w = 0;
|
|
3599
|
+
const y_ = quadraticAt(y0, y1, y2, t);
|
|
3600
|
+
for (let i = 0; i < nRoots; i++) {
|
|
3601
|
+
const unit = 0 === roots[i] || 1 === roots[i] ? .5 : 1;
|
|
3602
|
+
quadraticAt(x0, x1, x2, roots[i]) < x || (roots[i] < t ? w += y_ < y0 ? unit : -unit : w += y2 < y_ ? unit : -unit);
|
|
3603
|
+
}
|
|
3604
|
+
return w;
|
|
3605
|
+
}
|
|
3606
|
+
const unit = 0 === roots[0] || 1 === roots[0] ? .5 : 1;
|
|
3607
|
+
return quadraticAt(x0, x1, x2, roots[0]) < x ? 0 : y2 < y0 ? unit : -unit;
|
|
3608
|
+
}
|
|
3609
|
+
function windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
|
|
3610
|
+
if ((y -= cy) > r || y < -r) return 0;
|
|
3611
|
+
const tmp = Math.sqrt(r * r - y * y);
|
|
3612
|
+
roots[0] = -tmp, roots[1] = tmp;
|
|
3613
|
+
const dTheta = Math.abs(startAngle - endAngle);
|
|
3614
|
+
if (dTheta < 1e-4) return 0;
|
|
3615
|
+
if (dTheta >= pi2 - 1e-4) {
|
|
3616
|
+
startAngle = 0, endAngle = pi2;
|
|
3617
|
+
const dir = anticlockwise ? 1 : -1;
|
|
3618
|
+
return x >= roots[0] + cx && x <= roots[1] + cx ? dir : 0;
|
|
3619
|
+
}
|
|
3620
|
+
if (startAngle > endAngle) {
|
|
3621
|
+
const tmp = startAngle;
|
|
3622
|
+
startAngle = endAngle, endAngle = tmp;
|
|
3623
|
+
}
|
|
3624
|
+
startAngle < 0 && (startAngle += pi2, endAngle += pi2);
|
|
3625
|
+
let w = 0;
|
|
3626
|
+
for (let i = 0; i < 2; i++) {
|
|
3627
|
+
const x_ = roots[i];
|
|
3628
|
+
if (x_ + cx > x) {
|
|
3629
|
+
let angle = Math.atan2(y, x_),
|
|
3630
|
+
dir = anticlockwise ? 1 : -1;
|
|
3631
|
+
angle < 0 && (angle = pi2 + angle), (angle >= startAngle && angle <= endAngle || angle + pi2 >= startAngle && angle + pi2 <= endAngle) && (angle > pi / 2 && angle < 1.5 * pi && (dir = -dir), w += dir);
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
return w;
|
|
3635
|
+
}
|
|
3636
|
+
function modpi2(radian) {
|
|
3637
|
+
return Math.round(radian / pi * 1e8) / 1e8 % 2 * pi;
|
|
3638
|
+
}
|
|
3639
|
+
function normalizeArcAngles(angles, anticlockwise) {
|
|
3640
|
+
let newStartAngle = modpi2(angles[0]);
|
|
3641
|
+
newStartAngle < 0 && (newStartAngle += pi2);
|
|
3642
|
+
const delta = newStartAngle - angles[0];
|
|
3643
|
+
let newEndAngle = angles[1];
|
|
3644
|
+
newEndAngle += delta, !anticlockwise && newEndAngle - newStartAngle >= pi2 ? newEndAngle = newStartAngle + pi2 : anticlockwise && newStartAngle - newEndAngle >= pi2 ? newEndAngle = newStartAngle - pi2 : !anticlockwise && newStartAngle > newEndAngle ? newEndAngle = newStartAngle + (pi2 - modpi2(newStartAngle - newEndAngle)) : anticlockwise && newStartAngle < newEndAngle && (newEndAngle = newStartAngle - (pi2 - modpi2(newEndAngle - newStartAngle))), angles[0] = newStartAngle, angles[1] = newEndAngle;
|
|
3645
|
+
}
|
|
3646
|
+
const tmpAngles = [0, 0];
|
|
3647
|
+
function containPath(commands, lineWidth, isStroke, x, y) {
|
|
3648
|
+
const data = commands,
|
|
3649
|
+
len = commands.length;
|
|
3650
|
+
let x1,
|
|
3651
|
+
y1,
|
|
3652
|
+
w = 0,
|
|
3653
|
+
xi = 0,
|
|
3654
|
+
yi = 0,
|
|
3655
|
+
x0 = 0,
|
|
3656
|
+
y0 = 0;
|
|
3657
|
+
for (let i = 0; i < len; i++) {
|
|
3658
|
+
const command = data[i],
|
|
3659
|
+
isFirst = 0 === i;
|
|
3660
|
+
command[0] === enumCommandMap.M && i > 1 && (isStroke || (w += isPointInLine(xi, yi, x0, y0, x, y))), isFirst && (xi = command[1], yi = command[2], x0 = xi, y0 = yi);
|
|
3661
|
+
const c0 = command[0],
|
|
3662
|
+
c1 = command[1],
|
|
3663
|
+
c2 = command[2],
|
|
3664
|
+
c3 = command[3],
|
|
3665
|
+
c4 = command[4],
|
|
3666
|
+
c5 = command[5],
|
|
3667
|
+
c6 = command[6];
|
|
3668
|
+
let startAngle = c4,
|
|
3669
|
+
endAngle = c5;
|
|
3670
|
+
tmpAngles[0] = startAngle, tmpAngles[1] = endAngle, normalizeArcAngles(tmpAngles, Boolean(command[6])), startAngle = tmpAngles[0], endAngle = tmpAngles[1];
|
|
3671
|
+
const theta = startAngle,
|
|
3672
|
+
dTheta = endAngle - startAngle,
|
|
3673
|
+
anticlockwise = !!(1 - (command[6] ? 0 : 1)),
|
|
3674
|
+
_x = (x - c1) * c3 / c3 + c1;
|
|
3675
|
+
switch (c0) {
|
|
3676
|
+
case enumCommandMap.M:
|
|
3677
|
+
x0 = c1, y0 = c2, xi = x0, yi = y0;
|
|
3678
|
+
break;
|
|
3679
|
+
case enumCommandMap.L:
|
|
3680
|
+
if (isStroke) {
|
|
3681
|
+
if (containLineStroke(xi, yi, c1, c2, lineWidth, x, y)) return !0;
|
|
3682
|
+
} else w += isPointInLine(xi, yi, c1, c2, x, y) || 0;
|
|
3683
|
+
xi = c1, yi = c2;
|
|
3684
|
+
break;
|
|
3685
|
+
case enumCommandMap.C:
|
|
3686
|
+
if (isStroke) {
|
|
3687
|
+
if (containCubicStroke(xi, yi, c1, c2, c3, c4, c5, c6, lineWidth, x, y)) return !0;
|
|
3688
|
+
} else w += windingCubic(xi, yi, c1, c2, c3, c4, c5, c6, x, y) || 0;
|
|
3689
|
+
xi = c5, yi = c6;
|
|
3690
|
+
break;
|
|
3691
|
+
case enumCommandMap.Q:
|
|
3692
|
+
if (isStroke) {
|
|
3693
|
+
if (containQuadStroke(xi, yi, c1, c2, c3, c4, lineWidth, x, y)) return !0;
|
|
3694
|
+
} else w += windingQuadratic(xi, yi, c1, c2, c3, c4, x, y) || 0;
|
|
3695
|
+
xi = c3, yi = c4;
|
|
3696
|
+
break;
|
|
3697
|
+
case enumCommandMap.A:
|
|
3698
|
+
if (x1 = Math.cos(theta) * c3 + c1, y1 = Math.sin(theta) * c3 + c2, isFirst ? (x0 = x1, y0 = y1) : w += isPointInLine(xi, yi, x1, y1, x, y), isStroke) {
|
|
3699
|
+
if (containArcStroke(c1, c2, c3, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) return !0;
|
|
3700
|
+
} else w += windingArc(c1, c2, c3, theta, theta + dTheta, anticlockwise, _x, y);
|
|
3701
|
+
xi = Math.cos(theta + dTheta) * c3 + c1, yi = Math.sin(theta + dTheta) * c3 + c2;
|
|
3702
|
+
break;
|
|
3703
|
+
case enumCommandMap.R:
|
|
3704
|
+
if (x0 = xi = c1, y0 = yi = c2, x1 = x0 + c3, y1 = y0 + c4, isStroke) {
|
|
3705
|
+
if (containLineStroke(x0, y0, x1, y0, lineWidth, x, y) || containLineStroke(x1, y0, x1, y1, lineWidth, x, y) || containLineStroke(x1, y1, x0, y1, lineWidth, x, y) || containLineStroke(x0, y1, x0, y0, lineWidth, x, y)) return !0;
|
|
3706
|
+
} else w += isPointInLine(x1, y0, x1, y1, x, y), w += isPointInLine(x0, y1, x0, y0, x, y);
|
|
3707
|
+
break;
|
|
3708
|
+
case enumCommandMap.Z:
|
|
3709
|
+
if (isStroke) {
|
|
3710
|
+
if (containLineStroke(xi, yi, x0, y0, lineWidth, x, y)) return !0;
|
|
3711
|
+
} else w += isPointInLine(xi, yi, x0, y0, x, y);
|
|
3712
|
+
xi = x0, yi = y0;
|
|
3713
|
+
}
|
|
3714
|
+
}
|
|
3715
|
+
return isStroke || isAroundEqual(yi, y0) || (w += isPointInLine(xi, yi, x0, y0, x, y) || 0), 0 !== w;
|
|
3716
|
+
}
|
|
3717
|
+
function contain(commands, x, y) {
|
|
3718
|
+
return containPath(commands, 0, !1, x, y);
|
|
3719
|
+
}
|
|
3720
|
+
function containStroke(commands, lineWidth, x, y) {
|
|
3721
|
+
return containPath(commands, lineWidth, !0, x, y);
|
|
3722
|
+
}
|
|
3336
3723
|
|
|
3337
3724
|
class DefaultCanvasAllocate {
|
|
3338
3725
|
constructor() {
|
|
@@ -3385,14 +3772,14 @@ class DefaultCanvasAllocate {
|
|
|
3385
3772
|
}
|
|
3386
3773
|
const canvasAllocate = new DefaultCanvasAllocate();
|
|
3387
3774
|
|
|
3388
|
-
var __decorate$
|
|
3775
|
+
var __decorate$N = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
3389
3776
|
var d,
|
|
3390
3777
|
c = arguments.length,
|
|
3391
3778
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
3392
3779
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
3393
3780
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3394
3781
|
},
|
|
3395
|
-
__metadata$
|
|
3782
|
+
__metadata$F = undefined && undefined.__metadata || function (k, v) {
|
|
3396
3783
|
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
3397
3784
|
};
|
|
3398
3785
|
const VWindow = Symbol.for("VWindow");
|
|
@@ -3529,16 +3916,16 @@ let DefaultWindow = class {
|
|
|
3529
3916
|
return this._handler.getTopLeft(baseWindow);
|
|
3530
3917
|
}
|
|
3531
3918
|
};
|
|
3532
|
-
DefaultWindow = __decorate$
|
|
3919
|
+
DefaultWindow = __decorate$N([injectable(), __metadata$F("design:paramtypes", [])], DefaultWindow);
|
|
3533
3920
|
|
|
3534
|
-
var __decorate$
|
|
3921
|
+
var __decorate$M = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
3535
3922
|
var d,
|
|
3536
3923
|
c = arguments.length,
|
|
3537
3924
|
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
3538
3925
|
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
3539
3926
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3540
3927
|
},
|
|
3541
|
-
__metadata$
|
|
3928
|
+
__metadata$E = undefined && undefined.__metadata || function (k, v) {
|
|
3542
3929
|
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
3543
3930
|
},
|
|
3544
3931
|
__param$z = undefined && undefined.__param || function (paramIndex, decorator) {
|
|
@@ -3636,7 +4023,7 @@ let DefaultGraphicUtil = class {
|
|
|
3636
4023
|
return c.nativeCanvas ? c.nativeCanvas : null;
|
|
3637
4024
|
}
|
|
3638
4025
|
};
|
|
3639
|
-
DefaultGraphicUtil = __decorate$
|
|
4026
|
+
DefaultGraphicUtil = __decorate$M([injectable(), __param$z(0, inject(ContributionProvider)), __param$z(0, named(TextMeasureContribution)), __metadata$E("design:paramtypes", [Object])], DefaultGraphicUtil);
|
|
3640
4027
|
var TransformMode;
|
|
3641
4028
|
!function (TransformMode) {
|
|
3642
4029
|
TransformMode[TransformMode.transform = 0] = "transform", TransformMode[TransformMode.matrix = 1] = "matrix";
|
|
@@ -3694,7 +4081,7 @@ let DefaultTransformUtil = class {
|
|
|
3694
4081
|
return this;
|
|
3695
4082
|
}
|
|
3696
4083
|
};
|
|
3697
|
-
DefaultTransformUtil = __decorate$
|
|
4084
|
+
DefaultTransformUtil = __decorate$M([injectable(), __metadata$E("design:paramtypes", [])], DefaultTransformUtil);
|
|
3698
4085
|
|
|
3699
4086
|
const defaultThemeObj = {
|
|
3700
4087
|
arc: DefaultArcAttribute,
|
|
@@ -3706,6 +4093,7 @@ const defaultThemeObj = {
|
|
|
3706
4093
|
text: DefaultTextAttribute,
|
|
3707
4094
|
rect: DefaultRectAttribute,
|
|
3708
4095
|
polygon: DefaultPolygonAttribute,
|
|
4096
|
+
star: DefaultStarAttribute,
|
|
3709
4097
|
richtext: DefaultRichTextAttribute,
|
|
3710
4098
|
richtextIcon: DefaultRichTextIconAttribute,
|
|
3711
4099
|
image: DefaultImageAttribute,
|
|
@@ -3724,6 +4112,7 @@ function newThemeObj() {
|
|
|
3724
4112
|
text: Object.assign({}, defaultThemeObj.text),
|
|
3725
4113
|
rect: Object.assign({}, defaultThemeObj.rect),
|
|
3726
4114
|
polygon: Object.assign({}, defaultThemeObj.polygon),
|
|
4115
|
+
star: Object.assign({}, defaultThemeObj.star),
|
|
3727
4116
|
richtext: Object.assign({}, defaultThemeObj.richtext),
|
|
3728
4117
|
richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
|
|
3729
4118
|
image: Object.assign({}, defaultThemeObj.image),
|
|
@@ -4913,7 +5302,7 @@ class RectSymbol extends BaseSymbol {
|
|
|
4913
5302
|
}
|
|
4914
5303
|
var rect = new RectSymbol();
|
|
4915
5304
|
|
|
4916
|
-
const tempBounds
|
|
5305
|
+
const tempBounds = new AABBBounds();
|
|
4917
5306
|
class CustomSymbolClass {
|
|
4918
5307
|
constructor(type, path) {
|
|
4919
5308
|
let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
@@ -4942,7 +5331,7 @@ class CustomSymbolClass {
|
|
|
4942
5331
|
let {
|
|
4943
5332
|
path: path
|
|
4944
5333
|
} = _ref;
|
|
4945
|
-
tempBounds
|
|
5334
|
+
tempBounds.x1 = path.bounds.x1 * size, tempBounds.y1 = path.bounds.y1 * size, tempBounds.x2 = path.bounds.x2 * size, tempBounds.y2 = path.bounds.y2 * size, bounds.union(tempBounds);
|
|
4946
5335
|
});
|
|
4947
5336
|
}
|
|
4948
5337
|
this.path.bounds && (bounds.x1 = this.path.bounds.x1 * size, bounds.y1 = this.path.bounds.y1 * size, bounds.x2 = this.path.bounds.x2 * size, bounds.y2 = this.path.bounds.y2 * size);
|
|
@@ -5237,6 +5626,7 @@ genNumberType();
|
|
|
5237
5626
|
const RECT_NUMBER_TYPE = genNumberType();
|
|
5238
5627
|
genNumberType();
|
|
5239
5628
|
const RICHTEXT_NUMBER_TYPE = genNumberType();
|
|
5629
|
+
genNumberType();
|
|
5240
5630
|
const SYMBOL_NUMBER_TYPE = genNumberType();
|
|
5241
5631
|
const TEXT_NUMBER_TYPE = genNumberType();
|
|
5242
5632
|
const GraphicService = Symbol.for("GraphicService");
|
|
@@ -5259,111 +5649,633 @@ const DefaultStateAnimateConfig = {
|
|
|
5259
5649
|
easing: "cubicOut"
|
|
5260
5650
|
};
|
|
5261
5651
|
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
const
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5652
|
+
function identityMat4(out) {
|
|
5653
|
+
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;
|
|
5654
|
+
}
|
|
5655
|
+
function rotateX(out, a, rad) {
|
|
5656
|
+
const s = Math.sin(rad),
|
|
5657
|
+
c = Math.cos(rad),
|
|
5658
|
+
a10 = a[4],
|
|
5659
|
+
a11 = a[5],
|
|
5660
|
+
a12 = a[6],
|
|
5661
|
+
a13 = a[7],
|
|
5662
|
+
a20 = a[8],
|
|
5663
|
+
a21 = a[9],
|
|
5664
|
+
a22 = a[10],
|
|
5665
|
+
a23 = a[11];
|
|
5666
|
+
return a !== out && (out[0] = a[0], out[1] = a[1], out[2] = a[2], out[3] = a[3], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[4] = a10 * c + a20 * s, out[5] = a11 * c + a21 * s, out[6] = a12 * c + a22 * s, out[7] = a13 * c + a23 * s, out[8] = a20 * c - a10 * s, out[9] = a21 * c - a11 * s, out[10] = a22 * c - a12 * s, out[11] = a23 * c - a13 * s, out;
|
|
5667
|
+
}
|
|
5668
|
+
function rotateY(out, a, rad) {
|
|
5669
|
+
const s = Math.sin(rad),
|
|
5670
|
+
c = Math.cos(rad),
|
|
5671
|
+
a00 = a[0],
|
|
5672
|
+
a01 = a[1],
|
|
5673
|
+
a02 = a[2],
|
|
5674
|
+
a03 = a[3],
|
|
5675
|
+
a20 = a[8],
|
|
5676
|
+
a21 = a[9],
|
|
5677
|
+
a22 = a[10],
|
|
5678
|
+
a23 = a[11];
|
|
5679
|
+
return a !== out && (out[4] = a[4], out[5] = a[5], out[6] = a[6], out[7] = a[7], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c - a20 * s, out[1] = a01 * c - a21 * s, out[2] = a02 * c - a22 * s, out[3] = a03 * c - a23 * s, out[8] = a00 * s + a20 * c, out[9] = a01 * s + a21 * c, out[10] = a02 * s + a22 * c, out[11] = a03 * s + a23 * c, out;
|
|
5680
|
+
}
|
|
5681
|
+
function rotateZ(out, a, rad) {
|
|
5682
|
+
const s = Math.sin(rad),
|
|
5683
|
+
c = Math.cos(rad),
|
|
5684
|
+
a00 = a[0],
|
|
5685
|
+
a01 = a[1],
|
|
5686
|
+
a02 = a[2],
|
|
5687
|
+
a03 = a[3],
|
|
5688
|
+
a10 = a[4],
|
|
5689
|
+
a11 = a[5],
|
|
5690
|
+
a12 = a[6],
|
|
5691
|
+
a13 = a[7];
|
|
5692
|
+
return a !== out && (out[8] = a[8], out[9] = a[9], out[10] = a[10], out[11] = a[11], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c + a10 * s, out[1] = a01 * c + a11 * s, out[2] = a02 * c + a12 * s, out[3] = a03 * c + a13 * s, out[4] = a10 * c - a00 * s, out[5] = a11 * c - a01 * s, out[6] = a12 * c - a02 * s, out[7] = a13 * c - a03 * s, out;
|
|
5693
|
+
}
|
|
5694
|
+
function translate(out, a, v) {
|
|
5695
|
+
const x = v[0],
|
|
5696
|
+
y = v[1],
|
|
5697
|
+
z = v[2];
|
|
5698
|
+
let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
|
|
5699
|
+
return a === out ? (out[12] = a[0] * x + a[4] * y + a[8] * z + a[12], out[13] = a[1] * x + a[5] * y + a[9] * z + a[13], out[14] = a[2] * x + a[6] * y + a[10] * z + a[14], out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]) : (a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], out[0] = a00, out[1] = a01, out[2] = a02, out[3] = a03, out[4] = a10, out[5] = a11, out[6] = a12, out[7] = a13, out[8] = a20, out[9] = a21, out[10] = a22, out[11] = a23, out[12] = a00 * x + a10 * y + a20 * z + a[12], out[13] = a01 * x + a11 * y + a21 * z + a[13], out[14] = a02 * x + a12 * y + a22 * z + a[14], out[15] = a03 * x + a13 * y + a23 * z + a[15]), out;
|
|
5700
|
+
}
|
|
5701
|
+
function mat3Tomat4(out, b) {
|
|
5702
|
+
out[0] = b.a, out[1] = b.b, out[2] = 0, out[3] = 0, out[4] = b.c, out[5] = b.d, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = b.e, out[13] = b.f, out[14] = 0, out[15] = 1;
|
|
5703
|
+
}
|
|
5704
|
+
function scaleMat4(out, a, v) {
|
|
5705
|
+
const x = v[0],
|
|
5706
|
+
y = v[1],
|
|
5707
|
+
z = v[2];
|
|
5708
|
+
return out[0] = a[0] * x, out[1] = a[1] * x, out[2] = a[2] * x, out[3] = a[3] * x, out[4] = a[4] * y, out[5] = a[5] * y, out[6] = a[6] * y, out[7] = a[7] * y, out[8] = a[8] * z, out[9] = a[9] * z, out[10] = a[10] * z, out[11] = a[11] * z, out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15], out;
|
|
5709
|
+
}
|
|
5710
|
+
function multiplyMat4Mat4(out, a, b) {
|
|
5711
|
+
const a00 = a[0],
|
|
5712
|
+
a01 = a[1],
|
|
5713
|
+
a02 = a[2],
|
|
5714
|
+
a03 = a[3],
|
|
5715
|
+
a10 = a[4],
|
|
5716
|
+
a11 = a[5],
|
|
5717
|
+
a12 = a[6],
|
|
5718
|
+
a13 = a[7],
|
|
5719
|
+
a20 = a[8],
|
|
5720
|
+
a21 = a[9],
|
|
5721
|
+
a22 = a[10],
|
|
5722
|
+
a23 = a[11],
|
|
5723
|
+
a30 = a[12],
|
|
5724
|
+
a31 = a[13],
|
|
5725
|
+
a32 = a[14],
|
|
5726
|
+
a33 = a[15];
|
|
5727
|
+
let b0 = b[0],
|
|
5728
|
+
b1 = b[1],
|
|
5729
|
+
b2 = b[2],
|
|
5730
|
+
b3 = b[3];
|
|
5731
|
+
return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10], b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
|
|
5732
|
+
}
|
|
5733
|
+
|
|
5734
|
+
function createMat4() {
|
|
5735
|
+
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
5736
|
+
}
|
|
5737
|
+
class DefaultMatrixAllocate {
|
|
5738
|
+
constructor() {
|
|
5739
|
+
this.pools = [];
|
|
5307
5740
|
}
|
|
5308
|
-
|
|
5309
|
-
|
|
5741
|
+
allocate(a, b, c, d, e, f) {
|
|
5742
|
+
if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
|
|
5743
|
+
const m = this.pools.pop();
|
|
5744
|
+
return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
|
|
5310
5745
|
}
|
|
5311
|
-
|
|
5312
|
-
|
|
5746
|
+
allocateByObj(matrix) {
|
|
5747
|
+
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
5748
|
+
const m = this.pools.pop();
|
|
5749
|
+
return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
|
|
5313
5750
|
}
|
|
5314
|
-
|
|
5315
|
-
|
|
5751
|
+
free(d) {
|
|
5752
|
+
this.pools.push(d);
|
|
5316
5753
|
}
|
|
5317
|
-
get
|
|
5318
|
-
return this.
|
|
5754
|
+
get length() {
|
|
5755
|
+
return this.pools.length;
|
|
5319
5756
|
}
|
|
5320
|
-
|
|
5321
|
-
|
|
5757
|
+
release() {
|
|
5758
|
+
this.pools = [];
|
|
5322
5759
|
}
|
|
5760
|
+
}
|
|
5761
|
+
class DefaultMat4Allocate {
|
|
5323
5762
|
constructor() {
|
|
5324
|
-
|
|
5325
|
-
var _a;
|
|
5326
|
-
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
5327
|
-
}
|
|
5328
|
-
getAttributes() {
|
|
5329
|
-
return this.attribute;
|
|
5763
|
+
this.pools = [];
|
|
5330
5764
|
}
|
|
5331
|
-
|
|
5332
|
-
|
|
5765
|
+
static identity(out) {
|
|
5766
|
+
return identityMat4(out);
|
|
5333
5767
|
}
|
|
5334
|
-
|
|
5335
|
-
this.
|
|
5768
|
+
allocate() {
|
|
5769
|
+
if (!this.pools.length) return createMat4();
|
|
5770
|
+
const m = this.pools.pop();
|
|
5771
|
+
return DefaultMat4Allocate.identity(m), m;
|
|
5336
5772
|
}
|
|
5337
|
-
|
|
5338
|
-
|
|
5773
|
+
allocateByObj(d) {
|
|
5774
|
+
let m;
|
|
5775
|
+
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
5776
|
+
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
5777
|
+
return m;
|
|
5339
5778
|
}
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
var _a, _b;
|
|
5343
|
-
const {
|
|
5344
|
-
dx = attr.dx,
|
|
5345
|
-
dy = attr.dy
|
|
5346
|
-
} = this.attribute;
|
|
5347
|
-
if (includeScroll && this.parent) {
|
|
5348
|
-
const attribute = this.parent.attribute;
|
|
5349
|
-
point.x = dx + (null !== (_a = attribute.scrollX) && void 0 !== _a ? _a : 0), point.y = dy + (null !== (_b = attribute.scrollY) && void 0 !== _b ? _b : 0);
|
|
5350
|
-
} else point.x = dx, point.y = dy;
|
|
5351
|
-
return point;
|
|
5779
|
+
free(m) {
|
|
5780
|
+
m && this.pools.push(m);
|
|
5352
5781
|
}
|
|
5353
|
-
|
|
5354
|
-
this.
|
|
5782
|
+
get length() {
|
|
5783
|
+
return this.pools.length;
|
|
5355
5784
|
}
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5359
|
-
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5360
|
-
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5361
|
-
const bounds = this.doUpdateAABBBounds(full);
|
|
5362
|
-
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
5785
|
+
release() {
|
|
5786
|
+
this.pools = [];
|
|
5363
5787
|
}
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5788
|
+
}
|
|
5789
|
+
const matrixAllocate = new DefaultMatrixAllocate();
|
|
5790
|
+
const mat4Allocate = new DefaultMat4Allocate();
|
|
5791
|
+
|
|
5792
|
+
var __decorate$L = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
5793
|
+
var d,
|
|
5794
|
+
c = arguments.length,
|
|
5795
|
+
r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
5796
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
5797
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5798
|
+
},
|
|
5799
|
+
__metadata$D = undefined && undefined.__metadata || function (k, v) {
|
|
5800
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
5801
|
+
};
|
|
5802
|
+
const initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
|
|
5803
|
+
globalPoint = {
|
|
5804
|
+
x: 0,
|
|
5805
|
+
y: 0
|
|
5806
|
+
};
|
|
5807
|
+
let EmptyContext2d = class {
|
|
5808
|
+
get nativeContext() {
|
|
5809
|
+
return this.path;
|
|
5810
|
+
}
|
|
5811
|
+
constructor(canvas, dpr) {
|
|
5812
|
+
this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.path = new CustomPath2D(), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
5813
|
+
}
|
|
5814
|
+
getCanvas() {
|
|
5815
|
+
throw new Error("不支持getCanvas");
|
|
5816
|
+
}
|
|
5817
|
+
getContext() {
|
|
5818
|
+
throw new Error("不支持getContext");
|
|
5819
|
+
}
|
|
5820
|
+
setTransformForCurrent() {
|
|
5821
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
5822
|
+
!force && this.applyedMatrix.equalToMatrix(this.matrix) || (this.applyedMatrix = this.cloneMatrix(this.matrix));
|
|
5823
|
+
}
|
|
5824
|
+
get currentMatrix() {
|
|
5825
|
+
return this.matrix;
|
|
5826
|
+
}
|
|
5827
|
+
cloneMatrix(m) {
|
|
5828
|
+
return matrixAllocate.allocateByObj(m);
|
|
5829
|
+
}
|
|
5830
|
+
clear() {
|
|
5831
|
+
this.save(), this.resetTransform(), this.restore();
|
|
5832
|
+
}
|
|
5833
|
+
reset() {
|
|
5834
|
+
this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0;
|
|
5835
|
+
}
|
|
5836
|
+
restore() {
|
|
5837
|
+
this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent());
|
|
5838
|
+
}
|
|
5839
|
+
highPerformanceRestore() {
|
|
5840
|
+
this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop());
|
|
5841
|
+
}
|
|
5842
|
+
rotate(rad) {
|
|
5843
|
+
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5844
|
+
this.matrix.rotate(rad), setTransform && this.setTransformForCurrent();
|
|
5845
|
+
}
|
|
5846
|
+
save() {
|
|
5847
|
+
const matrix = this.cloneMatrix(this.matrix);
|
|
5848
|
+
this.stack.push(matrix);
|
|
5849
|
+
}
|
|
5850
|
+
highPerformanceSave() {
|
|
5851
|
+
const matrix = this.cloneMatrix(this.matrix);
|
|
5852
|
+
this.stack.push(matrix);
|
|
5853
|
+
}
|
|
5854
|
+
scale(sx, sy) {
|
|
5855
|
+
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5856
|
+
this.matrix.scale(sx, sy), setTransform && this.setTransformForCurrent();
|
|
5857
|
+
}
|
|
5858
|
+
setScale(sx, sy) {
|
|
5859
|
+
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5860
|
+
this.matrix.setScale(sx, sy), setTransform && this.setTransformForCurrent();
|
|
5861
|
+
}
|
|
5862
|
+
scalePoint(sx, sy, px, py) {
|
|
5863
|
+
let setTransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
|
|
5864
|
+
this.translate(px, py, !1), this.scale(sx, sy, !1), this.translate(-px, -py, !1), setTransform && this.setTransformForCurrent();
|
|
5865
|
+
}
|
|
5866
|
+
setTransform(a, b, c, d, e, f) {
|
|
5867
|
+
let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
5868
|
+
let dpr = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : this.dpr;
|
|
5869
|
+
this.matrix.setValue(dpr * a, dpr * b, dpr * c, dpr * d, dpr * e, dpr * f), setTransform && this.setTransformForCurrent();
|
|
5870
|
+
}
|
|
5871
|
+
setTransformFromMatrix(matrix) {
|
|
5872
|
+
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5873
|
+
let dpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.dpr;
|
|
5874
|
+
this.matrix.setValue(matrix.a * dpr, matrix.b * dpr, matrix.c * dpr, matrix.d * dpr, matrix.e * dpr, matrix.f * dpr), setTransform && this.setTransformForCurrent();
|
|
5875
|
+
}
|
|
5876
|
+
resetTransform() {
|
|
5877
|
+
let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
5878
|
+
let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
5879
|
+
this.setTransform(dpr, 0, 0, dpr, 0, 0), setTransform && this.setTransformForCurrent();
|
|
5880
|
+
}
|
|
5881
|
+
transform(a, b, c, d, e, f) {
|
|
5882
|
+
let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
5883
|
+
this.matrix.multiply(a, b, c, d, e, f), setTransform && this.setTransformForCurrent();
|
|
5884
|
+
}
|
|
5885
|
+
transformFromMatrix(matrix, setTransform) {
|
|
5886
|
+
this.matrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), setTransform && this.setTransformForCurrent();
|
|
5887
|
+
}
|
|
5888
|
+
translate(x, y) {
|
|
5889
|
+
let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
5890
|
+
this.matrix.translate(x, y), setTransform && this.setTransformForCurrent();
|
|
5891
|
+
}
|
|
5892
|
+
rotateDegrees(deg) {
|
|
5893
|
+
let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
5894
|
+
const rad = deg * Math.PI / 180;
|
|
5895
|
+
this.rotate(rad, setTransform);
|
|
5896
|
+
}
|
|
5897
|
+
rotateAbout(rad, x, y) {
|
|
5898
|
+
let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
|
|
5899
|
+
this.translate(x, y, !1), this.rotate(rad, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
|
|
5900
|
+
}
|
|
5901
|
+
rotateDegreesAbout(deg, x, y) {
|
|
5902
|
+
let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
|
|
5903
|
+
this.translate(x, y, !1), this.rotateDegrees(deg, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
|
|
5904
|
+
}
|
|
5905
|
+
beginPath() {
|
|
5906
|
+
this.path.clear();
|
|
5907
|
+
}
|
|
5908
|
+
clip(path, fillRule) {}
|
|
5909
|
+
arc(x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
5910
|
+
this.path.arc(x, y, radius, startAngle, endAngle, anticlockwise);
|
|
5911
|
+
}
|
|
5912
|
+
arcTo(x1, y1, x2, y2, radiusX) {
|
|
5913
|
+
this.path.arcTo(x1, y1, x2, y2, radiusX);
|
|
5914
|
+
}
|
|
5915
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
5916
|
+
this.path.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
|
|
5917
|
+
}
|
|
5918
|
+
closePath() {
|
|
5919
|
+
this.path.closePath();
|
|
5920
|
+
}
|
|
5921
|
+
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {}
|
|
5922
|
+
lineTo(x, y) {
|
|
5923
|
+
this.path.lineTo(x, y);
|
|
5924
|
+
}
|
|
5925
|
+
moveTo(x, y) {
|
|
5926
|
+
this.path.moveTo(x, y);
|
|
5927
|
+
}
|
|
5928
|
+
quadraticCurveTo(cpx, cpy, x, y) {
|
|
5929
|
+
this.path.quadraticCurveTo(cpx, cpy, x, y);
|
|
5930
|
+
}
|
|
5931
|
+
rect(x, y, w, h) {
|
|
5932
|
+
this.path.rect(x, y, w, h);
|
|
5933
|
+
}
|
|
5934
|
+
createImageData(imageDataOrSw, sh) {
|
|
5935
|
+
return null;
|
|
5936
|
+
}
|
|
5937
|
+
createLinearGradient(x0, y0, x1, y1) {
|
|
5938
|
+
throw new Error("不支持createLinearGradient");
|
|
5939
|
+
}
|
|
5940
|
+
createPattern(image, repetition) {
|
|
5941
|
+
throw new Error("不支持createPattern");
|
|
5942
|
+
}
|
|
5943
|
+
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
5944
|
+
throw new Error("不支持createRadialGradient");
|
|
5945
|
+
}
|
|
5946
|
+
createConicGradient(x, y, startAngle, endAngle) {
|
|
5947
|
+
return null;
|
|
5948
|
+
}
|
|
5949
|
+
fill(path, fillRule) {}
|
|
5950
|
+
fillRect(x, y, width, height) {
|
|
5951
|
+
this.path.rect(x, y, width, height);
|
|
5952
|
+
}
|
|
5953
|
+
clearRect(x, y, w, h) {}
|
|
5954
|
+
fillText(text, x, y) {}
|
|
5955
|
+
getImageData(sx, sy, sw, sh) {
|
|
5956
|
+
return null;
|
|
5957
|
+
}
|
|
5958
|
+
getLineDash() {
|
|
5959
|
+
return [];
|
|
5960
|
+
}
|
|
5961
|
+
isPointInPath(x, y) {
|
|
5962
|
+
return this.matrix.transformPoint({
|
|
5963
|
+
x: x,
|
|
5964
|
+
y: y
|
|
5965
|
+
}, globalPoint), contain(this.path.commandList, globalPoint.x, globalPoint.y);
|
|
5966
|
+
}
|
|
5967
|
+
isPointInStroke(x, y) {
|
|
5968
|
+
if (!this.lineWidth) return !1;
|
|
5969
|
+
this.matrix.transformPoint({
|
|
5970
|
+
x: x,
|
|
5971
|
+
y: y
|
|
5972
|
+
}, globalPoint);
|
|
5973
|
+
const lineWidth = getScaledStroke(this, this.lineWidth, this.dpr);
|
|
5974
|
+
return containStroke(this.path.commandList, lineWidth, globalPoint.x, globalPoint.y);
|
|
5975
|
+
}
|
|
5976
|
+
measureText(text) {
|
|
5977
|
+
throw new Error("不支持measureText");
|
|
5978
|
+
}
|
|
5979
|
+
putImageData(imagedata, dx, dy) {
|
|
5980
|
+
throw new Error("不支持measureText");
|
|
5981
|
+
}
|
|
5982
|
+
setLineDash(segments) {}
|
|
5983
|
+
stroke(path) {}
|
|
5984
|
+
strokeRect(x, y, width, height) {
|
|
5985
|
+
this.path.rect(x, y, width, height);
|
|
5986
|
+
}
|
|
5987
|
+
strokeText(text, x, y) {}
|
|
5988
|
+
drawImage() {}
|
|
5989
|
+
setCommonStyle(params, attribute, offsetX, offsetY, defaultParams) {}
|
|
5990
|
+
_setCommonStyle(params, offsetX, offsetY, defaultParams) {}
|
|
5991
|
+
setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {}
|
|
5992
|
+
_setStrokeStyle(params, offsetX, offsetY, defaultParams) {}
|
|
5993
|
+
setTextStyleWithoutAlignBaseline(params, defaultParams) {}
|
|
5994
|
+
setTextStyle(params, defaultParams) {}
|
|
5995
|
+
draw() {}
|
|
5996
|
+
clearMatrix() {
|
|
5997
|
+
let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
5998
|
+
let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
5999
|
+
this.setTransformFromMatrix(initMatrix, setTransform, dpr);
|
|
6000
|
+
}
|
|
6001
|
+
setClearMatrix(a, b, c, d, e, f) {
|
|
6002
|
+
this._clearMatrix.setValue(a, b, c, d, e, f);
|
|
6003
|
+
}
|
|
6004
|
+
onlyTranslate() {
|
|
6005
|
+
let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
|
|
6006
|
+
return this.matrix.a === dpr && 0 === this.matrix.b && 0 === this.matrix.c && this.matrix.d === dpr;
|
|
6007
|
+
}
|
|
6008
|
+
release() {
|
|
6009
|
+
this.stack.forEach(m => matrixAllocate.free(m)), this.stack.length = 0;
|
|
6010
|
+
}
|
|
6011
|
+
};
|
|
6012
|
+
EmptyContext2d = __decorate$L([injectable(), __metadata$D("design:paramtypes", [Object, Number])], EmptyContext2d);
|
|
6013
|
+
|
|
6014
|
+
var ColorType;
|
|
6015
|
+
!function (ColorType) {
|
|
6016
|
+
ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
|
|
6017
|
+
}(ColorType || (ColorType = {}));
|
|
6018
|
+
class ColorStore {
|
|
6019
|
+
static Get(str) {
|
|
6020
|
+
let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
|
|
6021
|
+
let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
|
|
6022
|
+
if (size === ColorType.Color1) {
|
|
6023
|
+
const color = ColorStore.store1[str];
|
|
6024
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
6025
|
+
const c = Color.parseColorString(str);
|
|
6026
|
+
if (c) {
|
|
6027
|
+
const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
|
|
6028
|
+
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];
|
|
6029
|
+
}
|
|
6030
|
+
return arr;
|
|
6031
|
+
}
|
|
6032
|
+
const color = ColorStore.store255[str];
|
|
6033
|
+
if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
|
|
6034
|
+
const c = Color.parseColorString(str);
|
|
6035
|
+
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;
|
|
6036
|
+
}
|
|
6037
|
+
static Set(str, size, arr) {
|
|
6038
|
+
if (size === ColorType.Color1) {
|
|
6039
|
+
if (ColorStore.store1[str]) return;
|
|
6040
|
+
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])];
|
|
6041
|
+
} else {
|
|
6042
|
+
if (ColorStore.store255[str]) return;
|
|
6043
|
+
ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
}
|
|
6047
|
+
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
6048
|
+
|
|
6049
|
+
function colorArrayToString(color) {
|
|
6050
|
+
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6051
|
+
return Array.isArray(color) && isNumber(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
6052
|
+
}
|
|
6053
|
+
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
6054
|
+
if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
|
|
6055
|
+
return new Array(4).fill(0).map((_, index) => {
|
|
6056
|
+
var _a, _b;
|
|
6057
|
+
return _interpolateColor(isArray(from) ? null !== (_a = from[index]) && void 0 !== _a ? _a : from[0] : from, isArray(to) ? null !== (_b = to[index]) && void 0 !== _b ? _b : to[0] : to, ratio, alphaChannel);
|
|
6058
|
+
});
|
|
6059
|
+
}
|
|
6060
|
+
return _interpolateColor(from, to, ratio, alphaChannel, cb);
|
|
6061
|
+
}
|
|
6062
|
+
function _interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
6063
|
+
if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
|
|
6064
|
+
let fromArray,
|
|
6065
|
+
toArray,
|
|
6066
|
+
fromGradient = !1,
|
|
6067
|
+
toGradient = !1;
|
|
6068
|
+
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) {
|
|
6069
|
+
const gradient = fromGradient ? from : to,
|
|
6070
|
+
pure = fromGradient ? to : from,
|
|
6071
|
+
gradientFromPure = Object.assign(Object.assign({}, gradient), {
|
|
6072
|
+
stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
|
|
6073
|
+
color: colorArrayToString(pure)
|
|
6074
|
+
}))
|
|
6075
|
+
});
|
|
6076
|
+
return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
|
|
6077
|
+
}
|
|
6078
|
+
if (fromGradient) {
|
|
6079
|
+
if (from.gradient === to.gradient) {
|
|
6080
|
+
const fc = from,
|
|
6081
|
+
tc = to,
|
|
6082
|
+
fromStops = fc.stops,
|
|
6083
|
+
toStops = tc.stops;
|
|
6084
|
+
if (fromStops.length !== toStops.length) return !1;
|
|
6085
|
+
if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
|
|
6086
|
+
if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
|
|
6087
|
+
if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
|
|
6088
|
+
}
|
|
6089
|
+
return !1;
|
|
6090
|
+
}
|
|
6091
|
+
cb && cb(fromArray, toArray);
|
|
6092
|
+
return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
|
|
6093
|
+
}
|
|
6094
|
+
function interpolateGradientLinearColor(fc, tc, ratio) {
|
|
6095
|
+
const fStops = fc.stops,
|
|
6096
|
+
tStops = tc.stops;
|
|
6097
|
+
return {
|
|
6098
|
+
gradient: "linear",
|
|
6099
|
+
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
6100
|
+
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
6101
|
+
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
6102
|
+
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
6103
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6104
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6105
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6106
|
+
}))
|
|
6107
|
+
};
|
|
6108
|
+
}
|
|
6109
|
+
function interpolateGradientRadialColor(fc, tc, ratio) {
|
|
6110
|
+
const fStops = fc.stops,
|
|
6111
|
+
tStops = tc.stops;
|
|
6112
|
+
return {
|
|
6113
|
+
gradient: "radial",
|
|
6114
|
+
x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
|
|
6115
|
+
x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
|
|
6116
|
+
y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
|
|
6117
|
+
y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
|
|
6118
|
+
r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
|
|
6119
|
+
r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
|
|
6120
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6121
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6122
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6123
|
+
}))
|
|
6124
|
+
};
|
|
6125
|
+
}
|
|
6126
|
+
function interpolateGradientConicalColor(fc, tc, ratio) {
|
|
6127
|
+
const fStops = fc.stops,
|
|
6128
|
+
tStops = tc.stops;
|
|
6129
|
+
return {
|
|
6130
|
+
gradient: "conical",
|
|
6131
|
+
startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
|
|
6132
|
+
endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
|
|
6133
|
+
x: fc.x + (tc.x - fc.x) * ratio,
|
|
6134
|
+
y: fc.y + (tc.y - fc.y) * ratio,
|
|
6135
|
+
stops: new Array(fStops.length).fill(0).map((_, i) => ({
|
|
6136
|
+
color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
|
|
6137
|
+
offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
|
|
6138
|
+
}))
|
|
6139
|
+
};
|
|
6140
|
+
}
|
|
6141
|
+
function interpolatePureColorArray(from, to, ratio) {
|
|
6142
|
+
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];
|
|
6143
|
+
}
|
|
6144
|
+
function interpolatePureColorArrayToStr(from, to, ratio) {
|
|
6145
|
+
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})`;
|
|
6146
|
+
}
|
|
6147
|
+
const _fromColorRGB = [0, 0, 0, 0],
|
|
6148
|
+
_toColorRGB = [0, 0, 0, 0];
|
|
6149
|
+
function colorStringInterpolationToStr(fromColor, toColor, ratio) {
|
|
6150
|
+
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})`;
|
|
6151
|
+
}
|
|
6152
|
+
|
|
6153
|
+
function getConicGradientAt(x, y, angle, color) {
|
|
6154
|
+
const {
|
|
6155
|
+
stops: stops,
|
|
6156
|
+
startAngle: startAngle,
|
|
6157
|
+
endAngle: endAngle
|
|
6158
|
+
} = color;
|
|
6159
|
+
for (; angle < 0;) angle += pi2;
|
|
6160
|
+
for (; angle > pi2;) angle -= pi2;
|
|
6161
|
+
if (angle < startAngle) return stops[0].color;
|
|
6162
|
+
if (angle > endAngle) return stops[0].color;
|
|
6163
|
+
let startStop,
|
|
6164
|
+
endStop,
|
|
6165
|
+
percent = (angle - startAngle) / (endAngle - startAngle);
|
|
6166
|
+
for (let i = 0; i < stops.length; i++) if (stops[i].offset >= percent) {
|
|
6167
|
+
startStop = stops[i - 1], endStop = stops[i];
|
|
6168
|
+
break;
|
|
6169
|
+
}
|
|
6170
|
+
return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
|
|
6171
|
+
}
|
|
6172
|
+
|
|
6173
|
+
const _tempBounds = new AABBBounds(),
|
|
6174
|
+
tempMatrix = new Matrix();
|
|
6175
|
+
new AABBBounds();
|
|
6176
|
+
const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
|
|
6177
|
+
const tempConstantXYKey = ["x", "y"],
|
|
6178
|
+
tempConstantScaleXYKey = ["scaleX", "scaleY"],
|
|
6179
|
+
tempConstantAngleKey = ["angle"],
|
|
6180
|
+
point = new Point();
|
|
6181
|
+
const NOWORK_ANIMATE_ATTR = {
|
|
6182
|
+
strokeSeg: 1,
|
|
6183
|
+
boundsPadding: 2,
|
|
6184
|
+
pickMode: 1,
|
|
6185
|
+
boundsMode: 1,
|
|
6186
|
+
customPickShape: 1,
|
|
6187
|
+
pickable: 1,
|
|
6188
|
+
childrenPickable: 1,
|
|
6189
|
+
visible: 1,
|
|
6190
|
+
zIndex: 1,
|
|
6191
|
+
layout: 1,
|
|
6192
|
+
keepDirIn3d: 1,
|
|
6193
|
+
globalZIndex: 1,
|
|
6194
|
+
outerBorder: 1,
|
|
6195
|
+
innerBorder: 1,
|
|
6196
|
+
lineDash: 1,
|
|
6197
|
+
lineCap: 1,
|
|
6198
|
+
lineJoin: 1,
|
|
6199
|
+
miterLimit: 2,
|
|
6200
|
+
strokeBoundsBuffer: 2,
|
|
6201
|
+
scaleCenter: 1,
|
|
6202
|
+
anchor: 1,
|
|
6203
|
+
anchor3d: 1,
|
|
6204
|
+
postMatrix: 1,
|
|
6205
|
+
backgroundMode: 2,
|
|
6206
|
+
background: 1,
|
|
6207
|
+
texture: 1,
|
|
6208
|
+
cursor: 1,
|
|
6209
|
+
html: 1
|
|
6210
|
+
};
|
|
6211
|
+
class Graphic extends Node {
|
|
6212
|
+
static mixin(source) {
|
|
6213
|
+
const keys = Object.keys(source);
|
|
6214
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
6215
|
+
const propertyName = keys[i];
|
|
6216
|
+
Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
|
|
6217
|
+
}
|
|
6218
|
+
}
|
|
6219
|
+
get AABBBounds() {
|
|
6220
|
+
return this.tryUpdateAABBBounds();
|
|
6221
|
+
}
|
|
6222
|
+
get OBBBounds() {
|
|
6223
|
+
return this.tryUpdateOBBBounds();
|
|
6224
|
+
}
|
|
6225
|
+
get globalAABBBounds() {
|
|
6226
|
+
return this.tryUpdateGlobalAABBBounds();
|
|
6227
|
+
}
|
|
6228
|
+
get transMatrix() {
|
|
6229
|
+
return this.tryUpdateLocalTransMatrix(!0);
|
|
6230
|
+
}
|
|
6231
|
+
get globalTransMatrix() {
|
|
6232
|
+
return this.tryUpdateGlobalTransMatrix(!0);
|
|
6233
|
+
}
|
|
6234
|
+
constructor() {
|
|
6235
|
+
let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6236
|
+
var _a;
|
|
6237
|
+
super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
6238
|
+
}
|
|
6239
|
+
getAttributes() {
|
|
6240
|
+
return this.attribute;
|
|
6241
|
+
}
|
|
6242
|
+
setMode(mode) {
|
|
6243
|
+
"3d" === mode ? this.set3dMode() : this.set2dMode();
|
|
6244
|
+
}
|
|
6245
|
+
set3dMode() {
|
|
6246
|
+
this.in3dMode = !0;
|
|
6247
|
+
}
|
|
6248
|
+
set2dMode() {
|
|
6249
|
+
this.in3dMode = !1;
|
|
6250
|
+
}
|
|
6251
|
+
getOffsetXY(attr) {
|
|
6252
|
+
let includeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
6253
|
+
var _a, _b;
|
|
6254
|
+
const {
|
|
6255
|
+
dx = attr.dx,
|
|
6256
|
+
dy = attr.dy
|
|
6257
|
+
} = this.attribute;
|
|
6258
|
+
if (includeScroll && this.parent) {
|
|
6259
|
+
const attribute = this.parent.attribute;
|
|
6260
|
+
point.x = dx + (null !== (_a = attribute.scrollX) && void 0 !== _a ? _a : 0), point.y = dy + (null !== (_b = attribute.scrollY) && void 0 !== _b ? _b : 0);
|
|
6261
|
+
} else point.x = dx, point.y = dy;
|
|
6262
|
+
return point;
|
|
6263
|
+
}
|
|
6264
|
+
onAnimateBind(animate) {
|
|
6265
|
+
this._emitCustomEvent("animate-bind", animate);
|
|
6266
|
+
}
|
|
6267
|
+
tryUpdateAABBBounds() {
|
|
6268
|
+
var _a, _b;
|
|
6269
|
+
const full = "imprecise" === this.attribute.boundsMode;
|
|
6270
|
+
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6271
|
+
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
6272
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6273
|
+
const bounds = this.doUpdateAABBBounds(full);
|
|
6274
|
+
return null === (_b = this.stage) || void 0 === _b || _b.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6275
|
+
}
|
|
6276
|
+
tryUpdateOBBBounds() {
|
|
6277
|
+
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
6278
|
+
if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(), this._OBBBounds;
|
|
5367
6279
|
return this.doUpdateOBBBounds();
|
|
5368
6280
|
}
|
|
5369
6281
|
combindShadowAABBBounds(bounds) {
|
|
@@ -5499,6 +6411,9 @@ class Graphic extends Node {
|
|
|
5499
6411
|
y: y
|
|
5500
6412
|
});
|
|
5501
6413
|
}
|
|
6414
|
+
setWidthHeightWithoutTransform(aabbBounds) {
|
|
6415
|
+
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
6416
|
+
}
|
|
5502
6417
|
setAttributesAndPreventAnimate(params) {
|
|
5503
6418
|
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
5504
6419
|
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -5644,7 +6559,8 @@ class Graphic extends Node {
|
|
|
5644
6559
|
return this;
|
|
5645
6560
|
}
|
|
5646
6561
|
onAttributeUpdate(context) {
|
|
5647
|
-
|
|
6562
|
+
var _a;
|
|
6563
|
+
context && context.skipUpdateCallback || (null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
5648
6564
|
}
|
|
5649
6565
|
update(d) {
|
|
5650
6566
|
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
@@ -5666,7 +6582,7 @@ class Graphic extends Node {
|
|
|
5666
6582
|
keys.forEach(key => {
|
|
5667
6583
|
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
|
|
5668
6584
|
});
|
|
5669
|
-
const stateAnimateConfig = null !== (_b = null !== (_a = this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
6585
|
+
const stateAnimateConfig = null !== (_b = null !== (_a = this.context && this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
5670
6586
|
this.applyAnimationState(["state"], [{
|
|
5671
6587
|
name: "state",
|
|
5672
6588
|
animation: {
|
|
@@ -5681,6 +6597,9 @@ class Graphic extends Node {
|
|
|
5681
6597
|
} else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
|
|
5682
6598
|
type: AttributeUpdateType.STATE
|
|
5683
6599
|
});
|
|
6600
|
+
this._emitCustomEvent("afterStateUpdate", {
|
|
6601
|
+
type: AttributeUpdateType.STATE
|
|
6602
|
+
});
|
|
5684
6603
|
}
|
|
5685
6604
|
updateNormalAttrs(stateAttrs) {
|
|
5686
6605
|
const newNormalAttrs = {};
|
|
@@ -5774,24 +6693,12 @@ class Graphic extends Node {
|
|
|
5774
6693
|
needUpdateLayout() {
|
|
5775
6694
|
return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
|
|
5776
6695
|
}
|
|
5777
|
-
getAnchor(anchor, params) {
|
|
6696
|
+
getAnchor(anchor, params, resetScale) {
|
|
5778
6697
|
const _anchor = [0, 0],
|
|
5779
6698
|
getBounds = () => {
|
|
5780
6699
|
if (params.b) return params.b;
|
|
5781
|
-
const
|
|
5782
|
-
|
|
5783
|
-
scaleY: scaleY,
|
|
5784
|
-
angle: angle
|
|
5785
|
-
} = this.attribute;
|
|
5786
|
-
return tempBounds.copy(this._AABBBounds), this.setAttributes({
|
|
5787
|
-
scaleX: 1,
|
|
5788
|
-
scaleY: 1,
|
|
5789
|
-
angle: 0
|
|
5790
|
-
}), params.b = this.AABBBounds.clone(), this._AABBBounds.copy(tempBounds), this.setAttributes({
|
|
5791
|
-
scaleX: scaleX,
|
|
5792
|
-
scaleY: scaleY,
|
|
5793
|
-
angle: angle
|
|
5794
|
-
}), params.b;
|
|
6700
|
+
const graphic = this.clone();
|
|
6701
|
+
return graphic.attribute.angle = 0, graphic.attribute.scaleCenter = null, resetScale && (graphic.attribute.scaleX = 1, graphic.attribute.scaleY = 1), params.b = graphic.AABBBounds, params.b;
|
|
5795
6702
|
};
|
|
5796
6703
|
if ("string" == typeof anchor[0]) {
|
|
5797
6704
|
const ratio = parseFloat(anchor[0]) / 100,
|
|
@@ -5818,9 +6725,9 @@ class Graphic extends Node {
|
|
|
5818
6725
|
} = this.attribute;
|
|
5819
6726
|
let _anchor = [0, 0];
|
|
5820
6727
|
const params = {};
|
|
5821
|
-
if (anchor && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
|
|
6728
|
+
if (anchor && angle && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
|
|
5822
6729
|
const m = this._transMatrix;
|
|
5823
|
-
m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
|
|
6730
|
+
m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params, !0), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
|
|
5824
6731
|
x: _anchor[0],
|
|
5825
6732
|
y: _anchor[1]
|
|
5826
6733
|
});
|
|
@@ -5843,6 +6750,7 @@ class Graphic extends Node {
|
|
|
5843
6750
|
}
|
|
5844
6751
|
}
|
|
5845
6752
|
setStage(stage, layer) {
|
|
6753
|
+
var _a;
|
|
5846
6754
|
if (this.stage !== stage) {
|
|
5847
6755
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
5848
6756
|
const timeline = stage.getTimeline();
|
|
@@ -5850,7 +6758,7 @@ class Graphic extends Node {
|
|
|
5850
6758
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
5851
6759
|
});
|
|
5852
6760
|
}
|
|
5853
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
6761
|
+
this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage);
|
|
5854
6762
|
}
|
|
5855
6763
|
}
|
|
5856
6764
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -5938,6 +6846,15 @@ class Graphic extends Node {
|
|
|
5938
6846
|
changeEvent.bubbles = !1, changeEvent.manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager, this.dispatchEvent(changeEvent);
|
|
5939
6847
|
}
|
|
5940
6848
|
}
|
|
6849
|
+
toCustomPath() {
|
|
6850
|
+
var _a, _b, _c;
|
|
6851
|
+
const renderer = null === (_c = null === (_b = (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.renderService) || application.renderService) || void 0 === _b ? void 0 : _b.drawContribution) || void 0 === _c ? void 0 : _c.getRenderContribution(this);
|
|
6852
|
+
if (renderer) {
|
|
6853
|
+
const context = new EmptyContext2d(null, 1);
|
|
6854
|
+
return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
|
|
6855
|
+
}
|
|
6856
|
+
return null;
|
|
6857
|
+
}
|
|
5941
6858
|
}
|
|
5942
6859
|
function backgroundNotImage(image) {
|
|
5943
6860
|
return !(!image.fill && !image.stroke);
|
|
@@ -5989,11 +6906,12 @@ class Group extends Graphic {
|
|
|
5989
6906
|
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
5990
6907
|
}
|
|
5991
6908
|
tryUpdateAABBBounds() {
|
|
6909
|
+
var _a, _b;
|
|
5992
6910
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5993
|
-
|
|
6911
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5994
6912
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
5995
6913
|
bounds = this.doUpdateAABBBounds();
|
|
5996
|
-
return this.addUpdateLayoutTag(),
|
|
6914
|
+
return this.addUpdateLayoutTag(), null === (_b = this.stage) || void 0 === _b || _b.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
5997
6915
|
}
|
|
5998
6916
|
doUpdateLocalMatrix() {
|
|
5999
6917
|
const {
|
|
@@ -6053,11 +6971,13 @@ class Group extends Graphic {
|
|
|
6053
6971
|
return this.theme.getTheme(this);
|
|
6054
6972
|
}
|
|
6055
6973
|
incrementalAppendChild(node) {
|
|
6974
|
+
var _a;
|
|
6056
6975
|
const data = super.appendChild(node);
|
|
6057
|
-
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(),
|
|
6976
|
+
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onAddIncremental(node, this, this.stage), data;
|
|
6058
6977
|
}
|
|
6059
6978
|
incrementalClearChild() {
|
|
6060
|
-
|
|
6979
|
+
var _a;
|
|
6980
|
+
super.removeAllChild(), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onClearIncremental(this, this.stage);
|
|
6061
6981
|
}
|
|
6062
6982
|
_updateChildToStage(child) {
|
|
6063
6983
|
return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
|
|
@@ -6077,17 +6997,20 @@ class Group extends Graphic {
|
|
|
6077
6997
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6078
6998
|
}
|
|
6079
6999
|
removeChild(child) {
|
|
7000
|
+
var _a;
|
|
6080
7001
|
const data = super.removeChild(child);
|
|
6081
|
-
return child.stage = null,
|
|
7002
|
+
return child.stage = null, null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), this.addUpdateBoundTag(), data;
|
|
6082
7003
|
}
|
|
6083
7004
|
removeAllChild() {
|
|
6084
7005
|
let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
6085
7006
|
this.forEachChildren(child => {
|
|
6086
|
-
|
|
7007
|
+
var _a;
|
|
7008
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
6087
7009
|
}), super.removeAllChild(), this.addUpdateBoundTag();
|
|
6088
7010
|
}
|
|
6089
7011
|
setStage(stage, layer) {
|
|
6090
|
-
|
|
7012
|
+
var _a;
|
|
7013
|
+
this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage), this.forEachChildren(item => {
|
|
6091
7014
|
item.setStage(stage, this.layer);
|
|
6092
7015
|
}));
|
|
6093
7016
|
}
|
|
@@ -6448,227 +7371,71 @@ function calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerR
|
|
|
6448
7371
|
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
6449
7372
|
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
6450
7373
|
maxInnerCornerRadius: maxInnerCornerRadius,
|
|
6451
|
-
outerStartAngle: outerStartAngle,
|
|
6452
|
-
outerEndAngle: outerEndAngle,
|
|
6453
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
6454
|
-
innerEndAngle: innerEndAngle,
|
|
6455
|
-
innerStartAngle: innerStartAngle,
|
|
6456
|
-
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
6457
|
-
innerCornerRadiusEnd: innerCornerRadiusEnd
|
|
6458
|
-
};
|
|
6459
|
-
}
|
|
6460
|
-
function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
|
|
6461
|
-
const {
|
|
6462
|
-
startAngle: startAngle,
|
|
6463
|
-
endAngle: endAngle
|
|
6464
|
-
} = arc.getParsedAngle(),
|
|
6465
|
-
deltaAngle = abs(endAngle - startAngle),
|
|
6466
|
-
clockwise = endAngle > startAngle;
|
|
6467
|
-
let collapsedToLine = !1;
|
|
6468
|
-
if (outerRadius < innerRadius) {
|
|
6469
|
-
const temp = outerRadius;
|
|
6470
|
-
outerRadius = innerRadius, innerRadius = temp;
|
|
6471
|
-
}
|
|
6472
|
-
if (outerRadius <= epsilon) context.moveTo(cx, cy);else if (deltaAngle >= pi2 - epsilon) context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle)), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise));else {
|
|
6473
|
-
const {
|
|
6474
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
6475
|
-
xors: xors,
|
|
6476
|
-
yors: yors,
|
|
6477
|
-
xirs: xirs,
|
|
6478
|
-
yirs: yirs,
|
|
6479
|
-
limitedOcr: limitedOcr,
|
|
6480
|
-
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
6481
|
-
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
6482
|
-
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
6483
|
-
xore: xore,
|
|
6484
|
-
yore: yore,
|
|
6485
|
-
xire: xire,
|
|
6486
|
-
yire: yire,
|
|
6487
|
-
outerStartAngle: outerStartAngle,
|
|
6488
|
-
outerEndAngle: outerEndAngle,
|
|
6489
|
-
limitedIcr: limitedIcr,
|
|
6490
|
-
innerDeltaAngle: innerDeltaAngle,
|
|
6491
|
-
innerEndAngle: innerEndAngle,
|
|
6492
|
-
innerStartAngle: innerStartAngle,
|
|
6493
|
-
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
6494
|
-
innerCornerRadiusEnd: innerCornerRadiusEnd,
|
|
6495
|
-
maxInnerCornerRadius: maxInnerCornerRadius
|
|
6496
|
-
} = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
|
|
6497
|
-
if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
|
|
6498
|
-
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
|
|
6499
|
-
cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
|
|
6500
|
-
t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
|
|
6501
|
-
t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
6502
|
-
limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd ? !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise)) : context.moveTo(cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01))) : !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), cornerRadiusStart > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, outerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise), cornerRadiusEnd > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusEnd > 0 ? context.moveTo(cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));
|
|
6503
|
-
} else !partStroke || partStroke[0] ? (context.moveTo(cx + xors, cy + yors), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise)) : context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + outerRadius * sin(outerEndAngle));
|
|
6504
|
-
if (!(innerRadius > epsilon) || innerDeltaAngle < .001) !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), collapsedToLine = !0;else if (limitedIcr > epsilon) {
|
|
6505
|
-
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
|
|
6506
|
-
cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
|
|
6507
|
-
t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
|
|
6508
|
-
t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
6509
|
-
if (!partStroke || partStroke[1] ? context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01) : context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
6510
|
-
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
6511
|
-
!partStroke || partStroke[2] ? context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise) : context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));
|
|
6512
|
-
} else !partStroke || partStroke[2] ? (cornerRadiusEnd > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, innerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise), cornerRadiusStart > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusStart > 0 ? context.moveTo(cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xirs, cy + yirs);
|
|
6513
|
-
} else !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), !partStroke || partStroke[2] ? context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise) : context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
6514
|
-
}
|
|
6515
|
-
return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
|
|
6516
|
-
}
|
|
6517
|
-
|
|
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
|
-
}
|
|
6549
|
-
}
|
|
6550
|
-
}
|
|
6551
|
-
ColorStore.store255 = {}, ColorStore.store1 = {};
|
|
6552
|
-
|
|
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;
|
|
6556
|
-
}
|
|
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);
|
|
6562
|
-
}
|
|
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})`;
|
|
7374
|
+
outerStartAngle: outerStartAngle,
|
|
7375
|
+
outerEndAngle: outerEndAngle,
|
|
7376
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7377
|
+
innerEndAngle: innerEndAngle,
|
|
7378
|
+
innerStartAngle: innerStartAngle,
|
|
7379
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7380
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd
|
|
7381
|
+
};
|
|
6652
7382
|
}
|
|
6653
|
-
|
|
6654
|
-
function getConicGradientAt(x, y, angle, color) {
|
|
7383
|
+
function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
|
|
6655
7384
|
const {
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
if (
|
|
6663
|
-
|
|
6664
|
-
|
|
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;
|
|
7385
|
+
startAngle: startAngle,
|
|
7386
|
+
endAngle: endAngle
|
|
7387
|
+
} = arc.getParsedAngle(),
|
|
7388
|
+
deltaAngle = abs(endAngle - startAngle),
|
|
7389
|
+
clockwise = endAngle > startAngle;
|
|
7390
|
+
let collapsedToLine = !1;
|
|
7391
|
+
if (outerRadius < innerRadius) {
|
|
7392
|
+
const temp = outerRadius;
|
|
7393
|
+
outerRadius = innerRadius, innerRadius = temp;
|
|
6670
7394
|
}
|
|
6671
|
-
|
|
7395
|
+
if (outerRadius <= epsilon) context.moveTo(cx, cy);else if (deltaAngle >= pi2 - epsilon) context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle)), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise));else {
|
|
7396
|
+
const {
|
|
7397
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
7398
|
+
xors: xors,
|
|
7399
|
+
yors: yors,
|
|
7400
|
+
xirs: xirs,
|
|
7401
|
+
yirs: yirs,
|
|
7402
|
+
limitedOcr: limitedOcr,
|
|
7403
|
+
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
7404
|
+
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
7405
|
+
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
7406
|
+
xore: xore,
|
|
7407
|
+
yore: yore,
|
|
7408
|
+
xire: xire,
|
|
7409
|
+
yire: yire,
|
|
7410
|
+
outerStartAngle: outerStartAngle,
|
|
7411
|
+
outerEndAngle: outerEndAngle,
|
|
7412
|
+
limitedIcr: limitedIcr,
|
|
7413
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7414
|
+
innerEndAngle: innerEndAngle,
|
|
7415
|
+
innerStartAngle: innerStartAngle,
|
|
7416
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7417
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd,
|
|
7418
|
+
maxInnerCornerRadius: maxInnerCornerRadius
|
|
7419
|
+
} = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
|
|
7420
|
+
if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
|
|
7421
|
+
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
|
|
7422
|
+
cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
|
|
7423
|
+
t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
|
|
7424
|
+
t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
7425
|
+
limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd ? !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise)) : context.moveTo(cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01))) : !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), cornerRadiusStart > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, outerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise), cornerRadiusEnd > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusEnd > 0 ? context.moveTo(cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));
|
|
7426
|
+
} else !partStroke || partStroke[0] ? (context.moveTo(cx + xors, cy + yors), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise)) : context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + outerRadius * sin(outerEndAngle));
|
|
7427
|
+
if (!(innerRadius > epsilon) || innerDeltaAngle < .001) !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), collapsedToLine = !0;else if (limitedIcr > epsilon) {
|
|
7428
|
+
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
|
|
7429
|
+
cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
|
|
7430
|
+
t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
|
|
7431
|
+
t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
7432
|
+
if (!partStroke || partStroke[1] ? context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01) : context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
|
|
7433
|
+
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
7434
|
+
!partStroke || partStroke[2] ? context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise) : context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));
|
|
7435
|
+
} else !partStroke || partStroke[2] ? (cornerRadiusEnd > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, innerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise), cornerRadiusStart > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusStart > 0 ? context.moveTo(cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xirs, cy + yirs);
|
|
7436
|
+
} else !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), !partStroke || partStroke[2] ? context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise) : context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
|
|
7437
|
+
}
|
|
7438
|
+
return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
|
|
6672
7439
|
}
|
|
6673
7440
|
|
|
6674
7441
|
const ArcRenderContribution = Symbol.for("ArcRenderContribution");
|
|
@@ -6691,146 +7458,6 @@ function textLayoutOffsetY(baseline, lineHeight, fontSize) {
|
|
|
6691
7458
|
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
7459
|
}
|
|
6693
7460
|
|
|
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;
|
|
6696
|
-
}
|
|
6697
|
-
function rotateX(out, a, rad) {
|
|
6698
|
-
const s = Math.sin(rad),
|
|
6699
|
-
c = Math.cos(rad),
|
|
6700
|
-
a10 = a[4],
|
|
6701
|
-
a11 = a[5],
|
|
6702
|
-
a12 = a[6],
|
|
6703
|
-
a13 = a[7],
|
|
6704
|
-
a20 = a[8],
|
|
6705
|
-
a21 = a[9],
|
|
6706
|
-
a22 = a[10],
|
|
6707
|
-
a23 = a[11];
|
|
6708
|
-
return a !== out && (out[0] = a[0], out[1] = a[1], out[2] = a[2], out[3] = a[3], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[4] = a10 * c + a20 * s, out[5] = a11 * c + a21 * s, out[6] = a12 * c + a22 * s, out[7] = a13 * c + a23 * s, out[8] = a20 * c - a10 * s, out[9] = a21 * c - a11 * s, out[10] = a22 * c - a12 * s, out[11] = a23 * c - a13 * s, out;
|
|
6709
|
-
}
|
|
6710
|
-
function rotateY(out, a, rad) {
|
|
6711
|
-
const s = Math.sin(rad),
|
|
6712
|
-
c = Math.cos(rad),
|
|
6713
|
-
a00 = a[0],
|
|
6714
|
-
a01 = a[1],
|
|
6715
|
-
a02 = a[2],
|
|
6716
|
-
a03 = a[3],
|
|
6717
|
-
a20 = a[8],
|
|
6718
|
-
a21 = a[9],
|
|
6719
|
-
a22 = a[10],
|
|
6720
|
-
a23 = a[11];
|
|
6721
|
-
return a !== out && (out[4] = a[4], out[5] = a[5], out[6] = a[6], out[7] = a[7], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c - a20 * s, out[1] = a01 * c - a21 * s, out[2] = a02 * c - a22 * s, out[3] = a03 * c - a23 * s, out[8] = a00 * s + a20 * c, out[9] = a01 * s + a21 * c, out[10] = a02 * s + a22 * c, out[11] = a03 * s + a23 * c, out;
|
|
6722
|
-
}
|
|
6723
|
-
function rotateZ(out, a, rad) {
|
|
6724
|
-
const s = Math.sin(rad),
|
|
6725
|
-
c = Math.cos(rad),
|
|
6726
|
-
a00 = a[0],
|
|
6727
|
-
a01 = a[1],
|
|
6728
|
-
a02 = a[2],
|
|
6729
|
-
a03 = a[3],
|
|
6730
|
-
a10 = a[4],
|
|
6731
|
-
a11 = a[5],
|
|
6732
|
-
a12 = a[6],
|
|
6733
|
-
a13 = a[7];
|
|
6734
|
-
return a !== out && (out[8] = a[8], out[9] = a[9], out[10] = a[10], out[11] = a[11], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c + a10 * s, out[1] = a01 * c + a11 * s, out[2] = a02 * c + a12 * s, out[3] = a03 * c + a13 * s, out[4] = a10 * c - a00 * s, out[5] = a11 * c - a01 * s, out[6] = a12 * c - a02 * s, out[7] = a13 * c - a03 * s, out;
|
|
6735
|
-
}
|
|
6736
|
-
function translate(out, a, v) {
|
|
6737
|
-
const x = v[0],
|
|
6738
|
-
y = v[1],
|
|
6739
|
-
z = v[2];
|
|
6740
|
-
let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
|
|
6741
|
-
return a === out ? (out[12] = a[0] * x + a[4] * y + a[8] * z + a[12], out[13] = a[1] * x + a[5] * y + a[9] * z + a[13], out[14] = a[2] * x + a[6] * y + a[10] * z + a[14], out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]) : (a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], out[0] = a00, out[1] = a01, out[2] = a02, out[3] = a03, out[4] = a10, out[5] = a11, out[6] = a12, out[7] = a13, out[8] = a20, out[9] = a21, out[10] = a22, out[11] = a23, out[12] = a00 * x + a10 * y + a20 * z + a[12], out[13] = a01 * x + a11 * y + a21 * z + a[13], out[14] = a02 * x + a12 * y + a22 * z + a[14], out[15] = a03 * x + a13 * y + a23 * z + a[15]), out;
|
|
6742
|
-
}
|
|
6743
|
-
function mat3Tomat4(out, b) {
|
|
6744
|
-
out[0] = b.a, out[1] = b.b, out[2] = 0, out[3] = 0, out[4] = b.c, out[5] = b.d, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = b.e, out[13] = b.f, out[14] = 0, out[15] = 1;
|
|
6745
|
-
}
|
|
6746
|
-
function scaleMat4(out, a, v) {
|
|
6747
|
-
const x = v[0],
|
|
6748
|
-
y = v[1],
|
|
6749
|
-
z = v[2];
|
|
6750
|
-
return out[0] = a[0] * x, out[1] = a[1] * x, out[2] = a[2] * x, out[3] = a[3] * x, out[4] = a[4] * y, out[5] = a[5] * y, out[6] = a[6] * y, out[7] = a[7] * y, out[8] = a[8] * z, out[9] = a[9] * z, out[10] = a[10] * z, out[11] = a[11] * z, out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15], out;
|
|
6751
|
-
}
|
|
6752
|
-
function multiplyMat4Mat4(out, a, b) {
|
|
6753
|
-
const a00 = a[0],
|
|
6754
|
-
a01 = a[1],
|
|
6755
|
-
a02 = a[2],
|
|
6756
|
-
a03 = a[3],
|
|
6757
|
-
a10 = a[4],
|
|
6758
|
-
a11 = a[5],
|
|
6759
|
-
a12 = a[6],
|
|
6760
|
-
a13 = a[7],
|
|
6761
|
-
a20 = a[8],
|
|
6762
|
-
a21 = a[9],
|
|
6763
|
-
a22 = a[10],
|
|
6764
|
-
a23 = a[11],
|
|
6765
|
-
a30 = a[12],
|
|
6766
|
-
a31 = a[13],
|
|
6767
|
-
a32 = a[14],
|
|
6768
|
-
a33 = a[15];
|
|
6769
|
-
let b0 = b[0],
|
|
6770
|
-
b1 = b[1],
|
|
6771
|
-
b2 = b[2],
|
|
6772
|
-
b3 = b[3];
|
|
6773
|
-
return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10], b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
|
|
6774
|
-
}
|
|
6775
|
-
|
|
6776
|
-
function createMat4() {
|
|
6777
|
-
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
6778
|
-
}
|
|
6779
|
-
class DefaultMatrixAllocate {
|
|
6780
|
-
constructor() {
|
|
6781
|
-
this.pools = [];
|
|
6782
|
-
}
|
|
6783
|
-
allocate(a, b, c, d, e, f) {
|
|
6784
|
-
if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
|
|
6785
|
-
const m = this.pools.pop();
|
|
6786
|
-
return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
|
|
6787
|
-
}
|
|
6788
|
-
allocateByObj(matrix) {
|
|
6789
|
-
if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
|
|
6790
|
-
const m = this.pools.pop();
|
|
6791
|
-
return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
|
|
6792
|
-
}
|
|
6793
|
-
free(d) {
|
|
6794
|
-
this.pools.push(d);
|
|
6795
|
-
}
|
|
6796
|
-
get length() {
|
|
6797
|
-
return this.pools.length;
|
|
6798
|
-
}
|
|
6799
|
-
release() {
|
|
6800
|
-
this.pools = [];
|
|
6801
|
-
}
|
|
6802
|
-
}
|
|
6803
|
-
class DefaultMat4Allocate {
|
|
6804
|
-
constructor() {
|
|
6805
|
-
this.pools = [];
|
|
6806
|
-
}
|
|
6807
|
-
static identity(out) {
|
|
6808
|
-
return identityMat4(out);
|
|
6809
|
-
}
|
|
6810
|
-
allocate() {
|
|
6811
|
-
if (!this.pools.length) return createMat4();
|
|
6812
|
-
const m = this.pools.pop();
|
|
6813
|
-
return DefaultMat4Allocate.identity(m), m;
|
|
6814
|
-
}
|
|
6815
|
-
allocateByObj(d) {
|
|
6816
|
-
let m;
|
|
6817
|
-
m = this.pools.length ? this.pools.pop() : createMat4();
|
|
6818
|
-
for (let i = 0; i < m.length; i++) m[i] = d[i];
|
|
6819
|
-
return m;
|
|
6820
|
-
}
|
|
6821
|
-
free(m) {
|
|
6822
|
-
m && this.pools.push(m);
|
|
6823
|
-
}
|
|
6824
|
-
get length() {
|
|
6825
|
-
return this.pools.length;
|
|
6826
|
-
}
|
|
6827
|
-
release() {
|
|
6828
|
-
this.pools = [];
|
|
6829
|
-
}
|
|
6830
|
-
}
|
|
6831
|
-
const matrixAllocate = new DefaultMatrixAllocate();
|
|
6832
|
-
const mat4Allocate = new DefaultMat4Allocate();
|
|
6833
|
-
|
|
6834
7461
|
var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
6835
7462
|
var d,
|
|
6836
7463
|
c = arguments.length,
|
|
@@ -7067,7 +7694,7 @@ class Circle extends Graphic {
|
|
|
7067
7694
|
tb1: tb1,
|
|
7068
7695
|
tb2: tb2
|
|
7069
7696
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
7070
|
-
return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
|
|
7697
|
+
return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
|
|
7071
7698
|
}
|
|
7072
7699
|
updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) {
|
|
7073
7700
|
const {
|
|
@@ -7091,12 +7718,13 @@ class Circle extends Graphic {
|
|
|
7091
7718
|
}
|
|
7092
7719
|
toCustomPath() {
|
|
7093
7720
|
var _a, _b, _c;
|
|
7721
|
+
let path = super.toCustomPath();
|
|
7722
|
+
if (path) return path;
|
|
7094
7723
|
const attribute = this.attribute,
|
|
7095
7724
|
radius = null !== (_a = attribute.radius) && void 0 !== _a ? _a : this.getDefaultAttribute("radius"),
|
|
7096
7725
|
startAngle = null !== (_b = attribute.startAngle) && void 0 !== _b ? _b : this.getDefaultAttribute("startAngle"),
|
|
7097
|
-
endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle")
|
|
7098
|
-
|
|
7099
|
-
return path.arc(0, 0, radius, startAngle, endAngle), path;
|
|
7726
|
+
endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle");
|
|
7727
|
+
return path = new CustomPath2D(), path.arc(0, 0, radius, startAngle, endAngle), path;
|
|
7100
7728
|
}
|
|
7101
7729
|
clone() {
|
|
7102
7730
|
return new Circle(Object.assign({}, this.attribute));
|
|
@@ -7317,7 +7945,7 @@ class Text extends Graphic {
|
|
|
7317
7945
|
const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
|
|
7318
7946
|
boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
|
|
7319
7947
|
}
|
|
7320
|
-
return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
|
|
7948
|
+
return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
|
|
7321
7949
|
}
|
|
7322
7950
|
updateSingallineAABBBounds(text) {
|
|
7323
7951
|
this.updateMultilineAABBBounds([text]);
|
|
@@ -7842,7 +8470,7 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
7842
8470
|
tb1: tb1,
|
|
7843
8471
|
tb2: tb2
|
|
7844
8472
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
7845
|
-
updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
8473
|
+
updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, this.x1WithoutTransform = aabbBounds.x1, this.y1WithoutTransform = aabbBounds.y1;
|
|
7846
8474
|
const {
|
|
7847
8475
|
lineJoin = symbolTheme.lineJoin
|
|
7848
8476
|
} = attribute;
|
|
@@ -7914,7 +8542,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
7914
8542
|
return getTheme(this).line;
|
|
7915
8543
|
}
|
|
7916
8544
|
updateAABBBounds(attribute, lineTheme, aabbBounds) {
|
|
7917
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
8545
|
+
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
7918
8546
|
const {
|
|
7919
8547
|
lineJoin = lineTheme.lineJoin
|
|
7920
8548
|
} = attribute;
|
|
@@ -7949,9 +8577,11 @@ let Line$1 = class Line extends Graphic {
|
|
|
7949
8577
|
return super.needUpdateTag(key, LINE_UPDATE_TAG_KEY);
|
|
7950
8578
|
}
|
|
7951
8579
|
toCustomPath() {
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
8580
|
+
let path = super.toCustomPath();
|
|
8581
|
+
if (path) return path;
|
|
8582
|
+
const attribute = this.attribute;
|
|
8583
|
+
path = new CustomPath2D();
|
|
8584
|
+
const segments = attribute.segments,
|
|
7955
8585
|
parsePoints = points => {
|
|
7956
8586
|
if (points && points.length) {
|
|
7957
8587
|
let isFirst = !0;
|
|
@@ -8030,7 +8660,7 @@ class Rect extends Graphic {
|
|
|
8030
8660
|
tb1: tb1,
|
|
8031
8661
|
tb2: tb2
|
|
8032
8662
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
8033
|
-
return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
|
|
8663
|
+
return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
|
|
8034
8664
|
}
|
|
8035
8665
|
needUpdateTags(keys) {
|
|
8036
8666
|
return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
|
|
@@ -8039,15 +8669,16 @@ class Rect extends Graphic {
|
|
|
8039
8669
|
return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
|
|
8040
8670
|
}
|
|
8041
8671
|
toCustomPath() {
|
|
8672
|
+
let path = super.toCustomPath();
|
|
8673
|
+
if (path) return path;
|
|
8042
8674
|
const attribute = this.attribute,
|
|
8043
8675
|
{
|
|
8044
8676
|
x: x,
|
|
8045
8677
|
y: y,
|
|
8046
8678
|
width: width,
|
|
8047
8679
|
height: height
|
|
8048
|
-
} = normalizeRectAttributes(attribute)
|
|
8049
|
-
|
|
8050
|
-
return path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8680
|
+
} = normalizeRectAttributes(attribute);
|
|
8681
|
+
return path = new CustomPath2D(), path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8051
8682
|
}
|
|
8052
8683
|
clone() {
|
|
8053
8684
|
return new Rect(Object.assign({}, this.attribute));
|
|
@@ -8427,7 +9058,7 @@ class Image extends Graphic {
|
|
|
8427
9058
|
tb1: tb1,
|
|
8428
9059
|
tb2: tb2
|
|
8429
9060
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
8430
|
-
return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
|
|
9061
|
+
return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
|
|
8431
9062
|
}
|
|
8432
9063
|
getDefaultAttribute(name) {
|
|
8433
9064
|
return DefaultImageAttribute[name];
|
|
@@ -8770,7 +9401,7 @@ class RichText extends Graphic {
|
|
|
8770
9401
|
maxWidth = richtextTheme.maxWidth,
|
|
8771
9402
|
maxHeight = richtextTheme.maxHeight,
|
|
8772
9403
|
textAlign = richtextTheme.textAlign,
|
|
8773
|
-
|
|
9404
|
+
textBaseline = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : "top",
|
|
8774
9405
|
editOptions: editOptions
|
|
8775
9406
|
} = attribute;
|
|
8776
9407
|
if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
|
|
@@ -8785,7 +9416,7 @@ class RichText extends Graphic {
|
|
|
8785
9416
|
}
|
|
8786
9417
|
editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
|
|
8787
9418
|
let deltaY = 0;
|
|
8788
|
-
switch (
|
|
9419
|
+
switch (textBaseline) {
|
|
8789
9420
|
case "top":
|
|
8790
9421
|
deltaY = 0;
|
|
8791
9422
|
break;
|
|
@@ -8806,7 +9437,7 @@ class RichText extends Graphic {
|
|
|
8806
9437
|
case "right":
|
|
8807
9438
|
deltaX = -aabbBounds.width();
|
|
8808
9439
|
}
|
|
8809
|
-
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
9440
|
+
return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
|
|
8810
9441
|
}
|
|
8811
9442
|
needUpdateTags(keys) {
|
|
8812
9443
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -9024,7 +9655,7 @@ class Path extends Graphic {
|
|
|
9024
9655
|
tb1: tb1,
|
|
9025
9656
|
tb2: tb2
|
|
9026
9657
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9027
|
-
updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9658
|
+
updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
9028
9659
|
const {
|
|
9029
9660
|
lineJoin = pathTheme.lineJoin
|
|
9030
9661
|
} = attribute;
|
|
@@ -9081,7 +9712,7 @@ class Area extends Graphic {
|
|
|
9081
9712
|
return getTheme(this).area;
|
|
9082
9713
|
}
|
|
9083
9714
|
updateAABBBounds(attribute, areaTheme, aabbBounds) {
|
|
9084
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9715
|
+
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9085
9716
|
const {
|
|
9086
9717
|
lineJoin = areaTheme.lineJoin
|
|
9087
9718
|
} = attribute;
|
|
@@ -9119,8 +9750,10 @@ class Area extends Graphic {
|
|
|
9119
9750
|
return super.needUpdateTag(key, AREA_UPDATE_TAG_KEY);
|
|
9120
9751
|
}
|
|
9121
9752
|
toCustomPath() {
|
|
9122
|
-
|
|
9123
|
-
|
|
9753
|
+
let path = super.toCustomPath();
|
|
9754
|
+
if (path) return path;
|
|
9755
|
+
path = new CustomPath2D();
|
|
9756
|
+
const attribute = this.attribute,
|
|
9124
9757
|
segments = attribute.segments,
|
|
9125
9758
|
parsePoints = points => {
|
|
9126
9759
|
if (points && points.length) {
|
|
@@ -9286,7 +9919,7 @@ class Arc extends Graphic {
|
|
|
9286
9919
|
tb1: tb1,
|
|
9287
9920
|
tb2: tb2
|
|
9288
9921
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9289
|
-
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9922
|
+
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9290
9923
|
const {
|
|
9291
9924
|
lineJoin = arcTheme.lineJoin
|
|
9292
9925
|
} = attribute;
|
|
@@ -9334,6 +9967,8 @@ class Arc extends Graphic {
|
|
|
9334
9967
|
}
|
|
9335
9968
|
toCustomPath() {
|
|
9336
9969
|
var _a, _b, _c, _d;
|
|
9970
|
+
let path = super.toCustomPath();
|
|
9971
|
+
if (path) return path;
|
|
9337
9972
|
const attribute = this.attribute,
|
|
9338
9973
|
{
|
|
9339
9974
|
startAngle: startAngle,
|
|
@@ -9347,8 +9982,7 @@ class Arc extends Graphic {
|
|
|
9347
9982
|
const temp = outerRadius;
|
|
9348
9983
|
outerRadius = innerRadius, innerRadius = temp;
|
|
9349
9984
|
}
|
|
9350
|
-
|
|
9351
|
-
if (outerRadius <= epsilon) path.moveTo(0, 0);else if (deltaAngle >= pi2 - epsilon) path.moveTo(0 + outerRadius * cos(startAngle), 0 + outerRadius * sin(startAngle)), path.arc(0, 0, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (path.moveTo(0 + innerRadius * cos(endAngle), 0 + innerRadius * sin(endAngle)), path.arc(0, 0, innerRadius, endAngle, startAngle, clockwise));else {
|
|
9985
|
+
if (path = new CustomPath2D(), outerRadius <= epsilon) path.moveTo(0, 0);else if (deltaAngle >= pi2 - epsilon) path.moveTo(0 + outerRadius * cos(startAngle), 0 + outerRadius * sin(startAngle)), path.arc(0, 0, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (path.moveTo(0 + innerRadius * cos(endAngle), 0 + innerRadius * sin(endAngle)), path.arc(0, 0, innerRadius, endAngle, startAngle, clockwise));else {
|
|
9352
9986
|
const xors = outerRadius * cos(startAngle),
|
|
9353
9987
|
yors = outerRadius * sin(startAngle),
|
|
9354
9988
|
xire = innerRadius * cos(endAngle),
|
|
@@ -9389,7 +10023,7 @@ class Polygon extends Graphic {
|
|
|
9389
10023
|
return getTheme(this).polygon;
|
|
9390
10024
|
}
|
|
9391
10025
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
9392
|
-
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
10026
|
+
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
9393
10027
|
const {
|
|
9394
10028
|
lineJoin = polygonTheme.lineJoin
|
|
9395
10029
|
} = attribute;
|
|
@@ -10735,7 +11369,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
10735
11369
|
if (!cache) return;
|
|
10736
11370
|
context.beginPath();
|
|
10737
11371
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
10738
|
-
drawSegments(context
|
|
11372
|
+
drawSegments(context, cache, clipRange, clipRangeByDimension, {
|
|
10739
11373
|
offsetX: offsetX,
|
|
10740
11374
|
offsetY: offsetY,
|
|
10741
11375
|
offsetZ: z
|
|
@@ -11138,7 +11772,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11138
11772
|
} else startP = points[0], endP = points[points.length - 1];
|
|
11139
11773
|
const xTotalLength = abs(endP.x - startP.x),
|
|
11140
11774
|
yTotalLength = abs(endP.y - startP.y);
|
|
11141
|
-
direction = null == endP.x1 ? Direction.ROW : null == endP.y1 ? Direction.COLUMN : Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context
|
|
11775
|
+
direction = null == endP.x1 ? Direction.ROW : null == endP.y1 ? Direction.COLUMN : Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context, cache, clipRange, {
|
|
11142
11776
|
offsetX: offsetX,
|
|
11143
11777
|
offsetY: offsetY,
|
|
11144
11778
|
offsetZ: offsetZ,
|
|
@@ -11157,7 +11791,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11157
11791
|
const {
|
|
11158
11792
|
stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
|
|
11159
11793
|
} = attribute;
|
|
11160
|
-
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context
|
|
11794
|
+
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction.ROW ? "x" : "y", {
|
|
11161
11795
|
offsetX: offsetX,
|
|
11162
11796
|
offsetY: offsetY,
|
|
11163
11797
|
offsetZ: offsetZ
|
|
@@ -12328,7 +12962,7 @@ var pickModule = new ContainerModule((bind, unbind, isBound) => {
|
|
|
12328
12962
|
});
|
|
12329
12963
|
|
|
12330
12964
|
var graphicModule = new ContainerModule(bind => {
|
|
12331
|
-
bind(GraphicService).to(DefaultGraphicService)
|
|
12965
|
+
bind(GraphicService).to(DefaultGraphicService), bind(GraphicCreator$1).toConstantValue(graphicCreator);
|
|
12332
12966
|
});
|
|
12333
12967
|
|
|
12334
12968
|
const AutoEnablePlugins = Symbol.for("AutoEnablePlugins");
|
|
@@ -12646,7 +13280,7 @@ let DefaultDrawContribution = class {
|
|
|
12646
13280
|
dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
|
|
12647
13281
|
}
|
|
12648
13282
|
const d = context.dpr % 1;
|
|
12649
|
-
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.
|
|
13283
|
+
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.reset(!1), context.save(), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), renderService.renderTreeRoots.sort((a, b) => {
|
|
12650
13284
|
var _a, _b;
|
|
12651
13285
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
12652
13286
|
}).forEach(group => {
|
|
@@ -13070,6 +13704,8 @@ const transformUtil = container.get(TransformUtil);
|
|
|
13070
13704
|
application.transformUtil = transformUtil;
|
|
13071
13705
|
const graphicService = container.get(GraphicService);
|
|
13072
13706
|
application.graphicService = graphicService;
|
|
13707
|
+
const renderService = container.get(RenderService);
|
|
13708
|
+
application.renderService = renderService;
|
|
13073
13709
|
const layerService = container.get(LayerService);
|
|
13074
13710
|
application.layerService = layerService;
|
|
13075
13711
|
|
|
@@ -14323,6 +14959,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
|
14323
14959
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14324
14960
|
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14325
14961
|
|
|
14962
|
+
function getEndTriggersOfDrag() {
|
|
14963
|
+
if (vglobal.env === 'browser') {
|
|
14964
|
+
return ['pointerup', 'pointerleave', 'pointercancel'];
|
|
14965
|
+
}
|
|
14966
|
+
return ['pointerup', 'pointerleave', 'pointerupoutside'];
|
|
14967
|
+
}
|
|
14968
|
+
|
|
14326
14969
|
const delayMap$2 = {
|
|
14327
14970
|
debounce: debounce,
|
|
14328
14971
|
throttle: throttle
|
|
@@ -14356,6 +14999,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14356
14999
|
}
|
|
14357
15000
|
};
|
|
14358
15001
|
this._onSliderPointerDown = (e) => {
|
|
15002
|
+
this._clearDragEvents();
|
|
14359
15003
|
const { stopSliderDownPropagation = true } = this.attribute;
|
|
14360
15004
|
if (stopSliderDownPropagation) {
|
|
14361
15005
|
e.stopPropagation();
|
|
@@ -14367,15 +15011,12 @@ class ScrollBar extends AbstractComponent {
|
|
|
14367
15011
|
pos: this._prePos,
|
|
14368
15012
|
event: e
|
|
14369
15013
|
});
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
this.stage.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14377
|
-
this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14378
|
-
}
|
|
15014
|
+
const triggers = getEndTriggersOfDrag();
|
|
15015
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15016
|
+
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
|
|
15017
|
+
triggers.forEach((trigger) => {
|
|
15018
|
+
obj.addEventListener(trigger, this._onSliderPointerUp);
|
|
15019
|
+
});
|
|
14379
15020
|
};
|
|
14380
15021
|
this._computeScrollValue = (e) => {
|
|
14381
15022
|
const { direction } = this.attribute;
|
|
@@ -14397,6 +15038,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14397
15038
|
return [currentPos, currentScrollValue];
|
|
14398
15039
|
};
|
|
14399
15040
|
this._onSliderPointerMove = (e) => {
|
|
15041
|
+
e.preventDefault();
|
|
14400
15042
|
const { stopSliderMovePropagation = true } = this.attribute;
|
|
14401
15043
|
if (stopSliderMovePropagation) {
|
|
14402
15044
|
e.stopPropagation();
|
|
@@ -14410,7 +15052,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
14410
15052
|
? this._onSliderPointerMove
|
|
14411
15053
|
: delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
|
|
14412
15054
|
this._onSliderPointerUp = (e) => {
|
|
14413
|
-
e.preventDefault();
|
|
14414
15055
|
const { range: preRange, limitRange = [0, 1] } = this.attribute;
|
|
14415
15056
|
const preScrollRange = this.getScrollRange();
|
|
14416
15057
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
@@ -14419,15 +15060,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14419
15060
|
pre: preRange,
|
|
14420
15061
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
14421
15062
|
});
|
|
14422
|
-
|
|
14423
|
-
vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14424
|
-
vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
14425
|
-
}
|
|
14426
|
-
else {
|
|
14427
|
-
this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14428
|
-
this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
14429
|
-
this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14430
|
-
}
|
|
15063
|
+
this._clearDragEvents();
|
|
14431
15064
|
};
|
|
14432
15065
|
}
|
|
14433
15066
|
setScrollRange(range, render = true) {
|
|
@@ -14560,6 +15193,14 @@ class ScrollBar extends AbstractComponent {
|
|
|
14560
15193
|
? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
|
|
14561
15194
|
: clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
14562
15195
|
}
|
|
15196
|
+
_clearDragEvents() {
|
|
15197
|
+
const triggers = getEndTriggersOfDrag();
|
|
15198
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15199
|
+
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
|
|
15200
|
+
triggers.forEach((trigger) => {
|
|
15201
|
+
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15202
|
+
});
|
|
15203
|
+
}
|
|
14563
15204
|
_reset() {
|
|
14564
15205
|
this._sliderRenderBounds = null;
|
|
14565
15206
|
this._sliderLimitRange = null;
|
|
@@ -16861,24 +17502,17 @@ function getPolygonPath(points, closed) {
|
|
|
16861
17502
|
}
|
|
16862
17503
|
function textIntersect(textA, textB, sep) {
|
|
16863
17504
|
var _a;
|
|
16864
|
-
let a;
|
|
16865
|
-
let b;
|
|
16866
17505
|
const angle = (_a = textA.attribute) === null || _a === void 0 ? void 0 : _a.angle;
|
|
16867
17506
|
const isHorizontal = isAngleHorizontal(angle, Number.EPSILON);
|
|
16868
|
-
const isAABBIntersects = (textA, textB, sep) => {
|
|
16869
|
-
a = textA.AABBBounds;
|
|
16870
|
-
b = textB.AABBBounds;
|
|
16871
|
-
return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
|
|
16872
|
-
};
|
|
16873
17507
|
if (isHorizontal) {
|
|
16874
|
-
return
|
|
17508
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16875
17509
|
}
|
|
16876
|
-
a = textA.OBBBounds;
|
|
16877
|
-
b = textB.OBBBounds;
|
|
17510
|
+
const a = textA.OBBBounds;
|
|
17511
|
+
const b = textB.OBBBounds;
|
|
16878
17512
|
if (!a || !b || a.empty() || b.empty()) {
|
|
16879
|
-
return
|
|
17513
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16880
17514
|
}
|
|
16881
|
-
return a.intersects(b);
|
|
17515
|
+
return a.intersects(b) || sep > obbSeparation(a, b);
|
|
16882
17516
|
}
|
|
16883
17517
|
function hasOverlap(items, pad) {
|
|
16884
17518
|
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
@@ -16997,7 +17631,7 @@ class AxisBase extends AnimateComponent {
|
|
|
16997
17631
|
getBoundsWithoutRender(attributes) {
|
|
16998
17632
|
const currentAttribute = cloneDeep(this.attribute);
|
|
16999
17633
|
currentAttribute.scale = this.attribute.scale;
|
|
17000
|
-
|
|
17634
|
+
this.attribute = attributes;
|
|
17001
17635
|
const offscreenGroup = graphicCreator.group({
|
|
17002
17636
|
x: this.attribute.x,
|
|
17003
17637
|
y: this.attribute.y
|
|
@@ -18091,10 +18725,12 @@ function commonInterpolateUpdate(key, from, to, ratio, step, target) {
|
|
|
18091
18725
|
function noop() {}
|
|
18092
18726
|
class Step {
|
|
18093
18727
|
constructor(type, props, duration, easing) {
|
|
18094
|
-
this._startTime = 0, this._hasFirstRun = !1, this.
|
|
18728
|
+
this._startTime = 0, this._hasFirstRun = !1, this._syncAttributeUpdate = () => {
|
|
18729
|
+
this.target.setAttributes(this.target.attribute);
|
|
18730
|
+
}, 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;
|
|
18095
18731
|
}
|
|
18096
18732
|
bind(target, animate) {
|
|
18097
|
-
this.target = target, this.animate = animate, this.onBind();
|
|
18733
|
+
this.target = target, this.animate = animate, this.onBind(), this.syncAttributeUpdate();
|
|
18098
18734
|
}
|
|
18099
18735
|
append(step) {
|
|
18100
18736
|
this.next = step, step.prev = this, step.setStartTime(this.getStartTime() + this.duration, !1);
|
|
@@ -18137,7 +18773,9 @@ class Step {
|
|
|
18137
18773
|
getStartTime() {
|
|
18138
18774
|
return this._startTime;
|
|
18139
18775
|
}
|
|
18140
|
-
onBind() {
|
|
18776
|
+
onBind() {
|
|
18777
|
+
"glyph" === this.target.type && (this.syncAttributeUpdate = this._syncAttributeUpdate);
|
|
18778
|
+
}
|
|
18141
18779
|
onFirstRun() {}
|
|
18142
18780
|
onStart() {
|
|
18143
18781
|
if (!this._hasFirstRun) {
|
|
@@ -18152,7 +18790,7 @@ class Step {
|
|
|
18152
18790
|
tryPreventConflict() {
|
|
18153
18791
|
const animate = this.animate;
|
|
18154
18792
|
this.target.animates.forEach(a => {
|
|
18155
|
-
if (a === animate || a.priority > animate.priority) return;
|
|
18793
|
+
if (a === animate || a.priority > animate.priority || a.priority === 1 / 0) return;
|
|
18156
18794
|
const fromProps = a.getStartProps();
|
|
18157
18795
|
this.propKeys.forEach(key => {
|
|
18158
18796
|
null != fromProps[key] && a.preventAttr(key);
|
|
@@ -18177,7 +18815,7 @@ class Step {
|
|
|
18177
18815
|
if (!this.animate.validAttr(this.propKeys[index])) return;
|
|
18178
18816
|
const key = this.propKeys[index];
|
|
18179
18817
|
func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target);
|
|
18180
|
-
}), this.onUpdate(end, easedRatio, out);
|
|
18818
|
+
}), this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
18181
18819
|
}
|
|
18182
18820
|
onUpdate(end, ratio, out) {}
|
|
18183
18821
|
onEnd(cb) {
|
|
@@ -18198,6 +18836,13 @@ class WaitStep extends Step {
|
|
|
18198
18836
|
constructor(type, props, duration, easing) {
|
|
18199
18837
|
super(type, props, duration, easing);
|
|
18200
18838
|
}
|
|
18839
|
+
onStart() {
|
|
18840
|
+
super.onStart();
|
|
18841
|
+
}
|
|
18842
|
+
onFirstRun() {
|
|
18843
|
+
const fromProps = this.getFromProps();
|
|
18844
|
+
this.target.setAttributes(fromProps);
|
|
18845
|
+
}
|
|
18201
18846
|
update(end, ratio, out) {
|
|
18202
18847
|
this.onStart();
|
|
18203
18848
|
}
|
|
@@ -18206,19 +18851,29 @@ class WaitStep extends Step {
|
|
|
18206
18851
|
|
|
18207
18852
|
class DefaultTimeline {
|
|
18208
18853
|
get animateCount() {
|
|
18209
|
-
return this.
|
|
18854
|
+
return this._animateCount;
|
|
18210
18855
|
}
|
|
18211
18856
|
constructor() {
|
|
18212
|
-
this.
|
|
18857
|
+
this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
|
|
18213
18858
|
}
|
|
18214
18859
|
isRunning() {
|
|
18215
|
-
return !this.paused && this.
|
|
18860
|
+
return !this.paused && this._animateCount > 0;
|
|
18216
18861
|
}
|
|
18217
18862
|
forEachAccessAnimate(cb) {
|
|
18218
|
-
|
|
18863
|
+
let current = this.head,
|
|
18864
|
+
index = 0;
|
|
18865
|
+
for (; current;) {
|
|
18866
|
+
const next = current.next;
|
|
18867
|
+
cb(current.animate, index), index++, current = next;
|
|
18868
|
+
}
|
|
18219
18869
|
}
|
|
18220
18870
|
addAnimate(animate) {
|
|
18221
|
-
|
|
18871
|
+
const newNode = {
|
|
18872
|
+
animate: animate,
|
|
18873
|
+
next: null,
|
|
18874
|
+
prev: null
|
|
18875
|
+
};
|
|
18876
|
+
this.head ? this.tail && (this.tail.next = newNode, newNode.prev = this.tail, this.tail = newNode) : (this.head = newNode, this.tail = newNode), this.animateMap.set(animate, newNode), this._animateCount++, this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18222
18877
|
}
|
|
18223
18878
|
pause() {
|
|
18224
18879
|
this.paused = !0;
|
|
@@ -18230,21 +18885,21 @@ class DefaultTimeline {
|
|
|
18230
18885
|
if (this.paused) return;
|
|
18231
18886
|
const scaledDelta = delta * this._playSpeed;
|
|
18232
18887
|
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18233
|
-
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0
|
|
18888
|
+
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
18234
18889
|
});
|
|
18235
18890
|
}
|
|
18236
18891
|
clear() {
|
|
18237
18892
|
this.forEachAccessAnimate(animate => {
|
|
18238
18893
|
animate.release();
|
|
18239
|
-
}), this.
|
|
18894
|
+
}), this.head = null, this.tail = null, this.animateMap.clear(), this._animateCount = 0, this._totalDuration = 0;
|
|
18240
18895
|
}
|
|
18241
18896
|
removeAnimate(animate) {
|
|
18242
18897
|
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18243
|
-
|
|
18244
|
-
|
|
18898
|
+
const node = this.animateMap.get(animate);
|
|
18899
|
+
node && (release && (animate._onRemove && animate._onRemove.forEach(cb => cb()), animate.release()), node.prev ? node.prev.next = node.next : this.head = node.next, node.next ? node.next.prev = node.prev : this.tail = node.prev, this.animateMap.delete(animate), this._animateCount--, animate.getStartTime() + animate.getDuration() >= this._totalDuration && this.recalculateTotalDuration());
|
|
18245
18900
|
}
|
|
18246
18901
|
recalculateTotalDuration() {
|
|
18247
|
-
this._totalDuration = 0, this.
|
|
18902
|
+
this._totalDuration = 0, this.forEachAccessAnimate(animate => {
|
|
18248
18903
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18249
18904
|
});
|
|
18250
18905
|
}
|
|
@@ -18395,7 +19050,7 @@ class Animate {
|
|
|
18395
19050
|
stop(type) {
|
|
18396
19051
|
let step = this._firstStep;
|
|
18397
19052
|
for (; step;) step.stop(), step = step.next;
|
|
18398
|
-
this.status
|
|
19053
|
+
this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
|
|
18399
19054
|
}
|
|
18400
19055
|
release() {
|
|
18401
19056
|
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
|
|
@@ -18429,11 +19084,11 @@ class Animate {
|
|
|
18429
19084
|
return this._bounce = b, this;
|
|
18430
19085
|
}
|
|
18431
19086
|
advance(delta) {
|
|
18432
|
-
var _a;
|
|
19087
|
+
var _a, _b, _c;
|
|
18433
19088
|
if (this.status === AnimateStatus.END) return void console.warn("aaa 动画已经结束,不能推进");
|
|
18434
19089
|
const nextTime = this.currentTime + delta;
|
|
18435
19090
|
if (nextTime < this._startTime) return void (this.currentTime = nextTime);
|
|
18436
|
-
if (nextTime >= this._startTime + this._totalDuration) return null === (_a = this._lastStep) || void 0 === _a || _a.onEnd(), this.onEnd(), void (this.status = AnimateStatus.END);
|
|
19091
|
+
if (nextTime >= this._startTime + this._totalDuration) return null === (_a = this._lastStep) || void 0 === _a || _a.onUpdate(!0, 1, {}), null === (_b = this._lastStep) || void 0 === _b || _b.onEnd(), this.onEnd(), void (this.status = AnimateStatus.END);
|
|
18437
19092
|
this.status = AnimateStatus.RUNNING, this.currentTime <= this._startTime && this.onStart(), this.currentTime = nextTime;
|
|
18438
19093
|
let cycleTime = nextTime - this._startTime,
|
|
18439
19094
|
newLoop = !1,
|
|
@@ -18458,9 +19113,10 @@ class Animate {
|
|
|
18458
19113
|
}
|
|
18459
19114
|
}
|
|
18460
19115
|
if (!targetStep) return;
|
|
19116
|
+
targetStep !== this.lastRunStep && (null === (_c = this.lastRunStep) || void 0 === _c || _c.onEnd()), this.lastRunStep = targetStep;
|
|
18461
19117
|
const ratio = (cycleTime - targetStep.getStartTime()) / targetStep.getDuration(),
|
|
18462
19118
|
isEnd = ratio >= 1;
|
|
18463
|
-
targetStep.update(isEnd, ratio, {}), isEnd && targetStep.onEnd();
|
|
19119
|
+
targetStep.update(isEnd, ratio, {}), isEnd && (targetStep.onEnd(), this.lastRunStep = null);
|
|
18464
19120
|
}
|
|
18465
19121
|
updateDuration() {
|
|
18466
19122
|
this._lastStep ? (this._duration = this._lastStep.getStartTime() + this._lastStep.getDuration(), this._totalDuration = this._duration * (this._loopCount + 1)) : this._duration = 0;
|
|
@@ -18497,55 +19153,62 @@ class AnimateExecutor {
|
|
|
18497
19153
|
index >= 0 && this._animates.splice(index, 1), 0 === this._activeCount && this._started && (this._started = !1, this.onEnd());
|
|
18498
19154
|
});
|
|
18499
19155
|
}
|
|
18500
|
-
parseParams(params, isTimeline) {
|
|
19156
|
+
parseParams(params, isTimeline, child) {
|
|
18501
19157
|
var _a, _b;
|
|
18502
19158
|
const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
|
|
18503
19159
|
startTime = this.resolveValue(params.startTime, void 0, 0),
|
|
18504
19160
|
parsedParams = Object.assign({}, params);
|
|
18505
19161
|
parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
|
|
18506
|
-
const oneByOne = this.resolveValue(params.oneByOne,
|
|
19162
|
+
const oneByOne = this.resolveValue(params.oneByOne, child, !1);
|
|
18507
19163
|
if (isTimeline) {
|
|
18508
19164
|
const timeSlices = parsedParams.timeSlices;
|
|
18509
19165
|
isArray(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
|
|
18510
19166
|
let sliceTime = 0;
|
|
18511
|
-
parsedParams.timeSlices.
|
|
18512
|
-
|
|
19167
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
19168
|
+
const delay = this.resolveValue(slice.delay, child, 0),
|
|
19169
|
+
delayAfter = this.resolveValue(slice.delayAfter, child, 0),
|
|
19170
|
+
duration = this.resolveValue(slice.duration, child, 300);
|
|
19171
|
+
return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
|
|
19172
|
+
delay: delay,
|
|
19173
|
+
delayAfter: delayAfter,
|
|
19174
|
+
duration: duration
|
|
19175
|
+
});
|
|
18513
19176
|
});
|
|
18514
|
-
let oneByOneDelay = 0
|
|
18515
|
-
|
|
18516
|
-
|
|
18517
|
-
|
|
18518
|
-
|
|
18519
|
-
|
|
18520
|
-
let effects = slice.effects;
|
|
18521
|
-
return Array.isArray(effects) || (effects = [effects]), Object.assign(Object.assign({}, slice), {
|
|
18522
|
-
delay: slice.delay * scale,
|
|
18523
|
-
delayAfter: slice.delayAfter * scale,
|
|
18524
|
-
duration: slice.duration * scale,
|
|
18525
|
-
effects: effects.map(effect => {
|
|
18526
|
-
var _a, _b;
|
|
18527
|
-
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
|
|
18528
|
-
customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
18529
|
-
return Object.assign(Object.assign({}, effect), {
|
|
18530
|
-
custom: custom,
|
|
18531
|
-
customType: customType
|
|
18532
|
-
});
|
|
18533
|
-
})
|
|
18534
|
-
});
|
|
18535
|
-
}), parsedParams.oneByOne = oneByOneTime * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
|
|
19177
|
+
let oneByOneDelay = 0;
|
|
19178
|
+
oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
|
|
19179
|
+
let scale = 1;
|
|
19180
|
+
if (totalTime) {
|
|
19181
|
+
const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
|
|
19182
|
+
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18536
19183
|
}
|
|
19184
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
19185
|
+
let effects = slice.effects;
|
|
19186
|
+
return Array.isArray(effects) || (effects = [effects]), Object.assign(Object.assign({}, slice), {
|
|
19187
|
+
delay: slice.delay * scale,
|
|
19188
|
+
delayAfter: slice.delayAfter * scale,
|
|
19189
|
+
duration: slice.duration * scale,
|
|
19190
|
+
effects: effects.map(effect => {
|
|
19191
|
+
var _a, _b;
|
|
19192
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = effect.type) && void 0 !== _b ? _b : "fromTo"],
|
|
19193
|
+
customType = custom && isFunction(custom) ? /^class\s/.test(Function.prototype.toString.call(custom)) ? 1 : 2 : 0;
|
|
19194
|
+
return Object.assign(Object.assign({}, effect), {
|
|
19195
|
+
custom: custom,
|
|
19196
|
+
customType: customType
|
|
19197
|
+
});
|
|
19198
|
+
})
|
|
19199
|
+
});
|
|
19200
|
+
}), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
|
|
18537
19201
|
} else {
|
|
18538
|
-
const delay = this.resolveValue(params.delay,
|
|
18539
|
-
delayAfter = this.resolveValue(params.delayAfter,
|
|
18540
|
-
duration = this.resolveValue(params.duration,
|
|
18541
|
-
let oneByOneDelay = 0
|
|
18542
|
-
|
|
18543
|
-
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"];
|
|
19202
|
+
const delay = this.resolveValue(params.delay, child, 0),
|
|
19203
|
+
delayAfter = this.resolveValue(params.delayAfter, child, 0),
|
|
19204
|
+
duration = this.resolveValue(params.duration, child, 300);
|
|
19205
|
+
let oneByOneDelay = 0;
|
|
19206
|
+
oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? delay + delayAfter + duration : 0), parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
|
|
18544
19207
|
const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
|
|
18545
19208
|
if (parsedParams.customType = customType, totalTime) {
|
|
18546
19209
|
const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
|
|
18547
19210
|
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18548
|
-
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.
|
|
19211
|
+
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
|
|
18549
19212
|
}
|
|
18550
19213
|
}
|
|
18551
19214
|
return parsedParams;
|
|
@@ -18558,20 +19221,21 @@ class AnimateExecutor {
|
|
|
18558
19221
|
const isTimeline = ("timeSlices" in params);
|
|
18559
19222
|
let filteredChildren;
|
|
18560
19223
|
isTimeline && params.partitioner && (filteredChildren = (null != filteredChildren ? filteredChildren : this._target.getChildren()).filter(child => {
|
|
18561
|
-
var _a;
|
|
18562
|
-
return params.partitioner(null === (_a = child.context) || void 0 === _a ? void 0 : _a.data, child, {});
|
|
18563
|
-
})), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
|
|
18564
19224
|
var _a, _b;
|
|
18565
|
-
return params.
|
|
19225
|
+
return params.partitioner(null === (_b = null === (_a = child.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], child, {});
|
|
19226
|
+
})), isTimeline && params.sort && (filteredChildren = null != filteredChildren ? filteredChildren : this._target.getChildren(), filteredChildren.sort((a, b) => {
|
|
19227
|
+
var _a, _b, _c, _d;
|
|
19228
|
+
return params.sort(null === (_b = null === (_a = a.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], null === (_d = null === (_c = b.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], a, b, {});
|
|
18566
19229
|
}));
|
|
18567
|
-
const
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
animate
|
|
18574
|
-
|
|
19230
|
+
const cb = isTimeline ? (child, index, count) => {
|
|
19231
|
+
const parsedParams = this.parseParams(params, isTimeline, child),
|
|
19232
|
+
animate = this.executeTimelineItem(parsedParams, child, index, count);
|
|
19233
|
+
animate && this._trackAnimation(animate);
|
|
19234
|
+
} : (child, index, count) => {
|
|
19235
|
+
const parsedParams = this.parseParams(params, isTimeline, child),
|
|
19236
|
+
animate = this.executeTypeConfigItem(parsedParams, child, index, count);
|
|
19237
|
+
animate && this._trackAnimation(animate);
|
|
19238
|
+
};
|
|
18575
19239
|
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));
|
|
18576
19240
|
}
|
|
18577
19241
|
executeTypeConfigItem(params, graphic, index, count) {
|
|
@@ -18599,22 +19263,24 @@ class AnimateExecutor {
|
|
|
18599
19263
|
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,
|
|
18600
19264
|
datum = null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0],
|
|
18601
19265
|
indexKey = null === (_e = graphic.context) || void 0 === _e ? void 0 : _e.indexKey;
|
|
18602
|
-
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime
|
|
18603
|
-
const wait = index * oneByOneDelay;
|
|
19266
|
+
datum && indexKey && (index = null !== (_f = datum[indexKey]) && void 0 !== _f ? _f : index), animate.startAt(startTime);
|
|
19267
|
+
const wait = index * oneByOneDelay + delayValue;
|
|
18604
19268
|
wait > 0 && animate.wait(wait);
|
|
18605
19269
|
let parsedFromProps = null,
|
|
18606
19270
|
props = params.to,
|
|
18607
19271
|
from = params.from;
|
|
18608
|
-
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)
|
|
19272
|
+
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, controlOptions, options, type, graphic);
|
|
19273
|
+
let totalDelay = 0;
|
|
19274
|
+
oneByOneDelay && (totalDelay = oneByOneDelay * (count - index - 1));
|
|
18609
19275
|
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;
|
|
18610
|
-
return delayAfterValue > 0 && animate.wait(
|
|
19276
|
+
return delayAfterValue > 0 && (totalDelay += delayAfterValue), totalDelay > 0 && animate.wait(totalDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0), animate;
|
|
18611
19277
|
}
|
|
18612
|
-
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, options, type, graphic) {
|
|
19278
|
+
_handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic) {
|
|
18613
19279
|
var _a, _b, _c, _d;
|
|
18614
19280
|
if (custom && customType) {
|
|
18615
19281
|
const customParams = this.resolveValue(customParameters, graphic, {}),
|
|
18616
|
-
objOptions = isFunction(options) ? options.call(null, null !== (_b =
|
|
18617
|
-
customParams.options = objOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
19282
|
+
objOptions = isFunction(options) ? options.call(null, null !== (_b = customParams && (null === (_a = customParams.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, customParams) : options;
|
|
19283
|
+
customParams.options = objOptions, customParams.controlOptions = controlOptions, 1 === customType ? this.createCustomAnimation(animate, custom, from, props, duration, easing, customParams) : 2 === customType && this.createCustomInterpolatorAnimation(animate, custom, props, duration, easing, customParams);
|
|
18618
19284
|
} else "to" === type ? animate.to(props, duration, easing) : "from" === type && animate.from(props, duration, easing);
|
|
18619
19285
|
}
|
|
18620
19286
|
executeTimelineItem(params, graphic, index, count) {
|
|
@@ -18634,10 +19300,10 @@ class AnimateExecutor {
|
|
|
18634
19300
|
const animate = graphic.animate();
|
|
18635
19301
|
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
18636
19302
|
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
18637
|
-
this.applyTimeSliceToAnimate(slice, animate, graphic);
|
|
19303
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
18638
19304
|
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
18639
19305
|
}
|
|
18640
|
-
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
19306
|
+
applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
|
|
18641
19307
|
var _a, _b, _c, _d;
|
|
18642
19308
|
const {
|
|
18643
19309
|
effects: effects,
|
|
@@ -18649,6 +19315,7 @@ class AnimateExecutor {
|
|
|
18649
19315
|
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;
|
|
18650
19316
|
delayValue > 0 && animate.wait(delayValue);
|
|
18651
19317
|
(Array.isArray(effects) ? effects : [effects]).forEach(effect => {
|
|
19318
|
+
var _a;
|
|
18652
19319
|
const {
|
|
18653
19320
|
type = "fromTo",
|
|
18654
19321
|
channel: channel,
|
|
@@ -18659,7 +19326,10 @@ class AnimateExecutor {
|
|
|
18659
19326
|
let parsedFromProps = null,
|
|
18660
19327
|
props = effect.to,
|
|
18661
19328
|
from = effect.from;
|
|
18662
|
-
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from)
|
|
19329
|
+
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
19330
|
+
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
19331
|
+
customType = effect.customType;
|
|
19332
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
18663
19333
|
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
18664
19334
|
}
|
|
18665
19335
|
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
@@ -18681,10 +19351,10 @@ class AnimateExecutor {
|
|
|
18681
19351
|
var _a, _b;
|
|
18682
19352
|
const value = null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.diffAttrs) || void 0 === _b ? void 0 : _b[key];
|
|
18683
19353
|
void 0 !== value && (props[key] = value);
|
|
18684
|
-
}) : Object.
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
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 === (
|
|
19354
|
+
}) : Object.keys(channel).forEach(key => {
|
|
19355
|
+
var _a, _b, _c, _d;
|
|
19356
|
+
const config = channel[key];
|
|
19357
|
+
void 0 !== config.to && ("function" == typeof config.to ? props[key] = config.to(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : props[key] = config.to), void 0 !== config.from && (from || (from = {}), "function" == typeof config.from ? from[key] = config.from(null === (_d = null === (_c = graphic.context) || void 0 === _c ? void 0 : _c.data) || void 0 === _d ? void 0 : _d[0], graphic, {}) : from[key] = config.from);
|
|
18688
19358
|
}), {
|
|
18689
19359
|
from: from,
|
|
18690
19360
|
props: props
|
|
@@ -18694,8 +19364,8 @@ class AnimateExecutor {
|
|
|
18694
19364
|
};
|
|
18695
19365
|
}
|
|
18696
19366
|
resolveValue(value, graphic, defaultValue) {
|
|
18697
|
-
var _a;
|
|
18698
|
-
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data, graphic, {}) : value;
|
|
19367
|
+
var _a, _b;
|
|
19368
|
+
return void 0 === value ? defaultValue : "function" == typeof value && graphic ? value(null === (_b = null === (_a = graphic.context) || void 0 === _a ? void 0 : _a.data) || void 0 === _b ? void 0 : _b[0], graphic, {}) : value;
|
|
18699
19369
|
}
|
|
18700
19370
|
executeItem(params, graphic) {
|
|
18701
19371
|
let index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
@@ -18728,7 +19398,7 @@ class ACustomAnimate extends Step {
|
|
|
18728
19398
|
update(end, ratio, out) {
|
|
18729
19399
|
if (this.onStart(), !this.props || !this.propKeys) return;
|
|
18730
19400
|
const easedRatio = this.easing(ratio);
|
|
18731
|
-
this.onUpdate(end, easedRatio, out);
|
|
19401
|
+
this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate();
|
|
18732
19402
|
}
|
|
18733
19403
|
setProps(props) {
|
|
18734
19404
|
this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps();
|
|
@@ -18803,9 +19473,9 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18803
19473
|
const easing = this.easing;
|
|
18804
19474
|
const { config, lastScale, getTickCoord } = this.params;
|
|
18805
19475
|
let ratio = 1;
|
|
18806
|
-
|
|
19476
|
+
const currData = this.target.data;
|
|
19477
|
+
if (lastScale && getTickCoord && currData) {
|
|
18807
19478
|
ratio = 0.7;
|
|
18808
|
-
const currData = this.target.data;
|
|
18809
19479
|
const oldValue = lastScale.scale(currData.rawValue);
|
|
18810
19480
|
const point = getTickCoord(oldValue);
|
|
18811
19481
|
const newX = this.target.attribute.x;
|
|
@@ -18829,14 +19499,13 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18829
19499
|
}
|
|
18830
19500
|
class AxisUpdate extends AComponentAnimate {
|
|
18831
19501
|
onBind() {
|
|
18832
|
-
var _a;
|
|
18833
19502
|
const animator = createComponentAnimator(this.target);
|
|
18834
19503
|
this._animator = animator;
|
|
18835
19504
|
const duration = this.duration;
|
|
18836
19505
|
const easing = this.easing;
|
|
18837
19506
|
const { config, diffAttrs } = this.params;
|
|
18838
19507
|
animator.animate(this.target, {
|
|
18839
|
-
type:
|
|
19508
|
+
type: 'to',
|
|
18840
19509
|
to: Object.assign({}, diffAttrs),
|
|
18841
19510
|
duration,
|
|
18842
19511
|
easing,
|
|
@@ -21293,6 +21962,13 @@ class LabelBase extends AnimateComponent {
|
|
|
21293
21962
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
21294
21963
|
return;
|
|
21295
21964
|
}
|
|
21965
|
+
const markAttributeList = [];
|
|
21966
|
+
if (this._enableAnimation !== false) {
|
|
21967
|
+
this._baseMarks.forEach(mark => {
|
|
21968
|
+
markAttributeList.push(mark.attribute);
|
|
21969
|
+
mark.initAttributes(mark.getAttributes(true));
|
|
21970
|
+
});
|
|
21971
|
+
}
|
|
21296
21972
|
const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
|
|
21297
21973
|
let data = this.attribute.data;
|
|
21298
21974
|
if (isFunction(dataFilter)) {
|
|
@@ -21330,6 +22006,11 @@ class LabelBase extends AnimateComponent {
|
|
|
21330
22006
|
this._smartInvert(labels);
|
|
21331
22007
|
}
|
|
21332
22008
|
this._renderLabels(labels);
|
|
22009
|
+
if (this._enableAnimation !== false) {
|
|
22010
|
+
this._baseMarks.forEach((mark, index) => {
|
|
22011
|
+
mark.initAttributes(markAttributeList[index]);
|
|
22012
|
+
});
|
|
22013
|
+
}
|
|
21333
22014
|
}
|
|
21334
22015
|
_bindEvent(target) {
|
|
21335
22016
|
if (this.attribute.disableTriggerEvent) {
|
|
@@ -21672,8 +22353,14 @@ class LabelBase extends AnimateComponent {
|
|
|
21672
22353
|
return this.getRootNode().find(node => node.name === baseMarkGroupName, true);
|
|
21673
22354
|
}
|
|
21674
22355
|
getGraphicBounds(graphic, point = {}, position) {
|
|
22356
|
+
var _a;
|
|
21675
22357
|
if (graphic) {
|
|
21676
22358
|
if (graphic.attribute.visible !== false) {
|
|
22359
|
+
if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
|
|
22360
|
+
const clonedGraphic = graphic.clone();
|
|
22361
|
+
Object.assign(clonedGraphic.attribute, graphic.getAttributes(true));
|
|
22362
|
+
return clonedGraphic.AABBBounds;
|
|
22363
|
+
}
|
|
21677
22364
|
return graphic.AABBBounds;
|
|
21678
22365
|
}
|
|
21679
22366
|
const { x, y } = graphic.attribute;
|
|
@@ -21739,7 +22426,7 @@ class LabelBase extends AnimateComponent {
|
|
|
21739
22426
|
animation: Object.assign(Object.assign({}, enter), { type: 'labelEnter', selfOnly: true, customParameters: {
|
|
21740
22427
|
relatedGraphic,
|
|
21741
22428
|
relatedGraphics: this._idToGraphic,
|
|
21742
|
-
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : '
|
|
22429
|
+
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'fadeIn' })
|
|
21743
22430
|
} })
|
|
21744
22431
|
}
|
|
21745
22432
|
]));
|
|
@@ -21768,8 +22455,15 @@ class LabelBase extends AnimateComponent {
|
|
|
21768
22455
|
}
|
|
21769
22456
|
]);
|
|
21770
22457
|
}
|
|
22458
|
+
_syncStateWithRelatedGraphic(relatedGraphic) {
|
|
22459
|
+
if (this.attribute.syncState && relatedGraphic) {
|
|
22460
|
+
relatedGraphic.on('afterStateUpdate', this._handleRelatedGraphicSetState);
|
|
22461
|
+
}
|
|
22462
|
+
}
|
|
21771
22463
|
_addLabel(label, texts, labelLines, index) {
|
|
21772
22464
|
const { text, labelLine } = label;
|
|
22465
|
+
const relatedGraphic = this.getRelatedGraphic(text.attribute);
|
|
22466
|
+
this._syncStateWithRelatedGraphic(relatedGraphic);
|
|
21773
22467
|
if (text) {
|
|
21774
22468
|
this.add(text);
|
|
21775
22469
|
}
|
|
@@ -23502,8 +24196,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23502
24196
|
end: 1
|
|
23503
24197
|
};
|
|
23504
24198
|
this._statePointToData = state => state;
|
|
24199
|
+
this._handleTouchMove = (e) => {
|
|
24200
|
+
if (this._activeState) {
|
|
24201
|
+
e.preventDefault();
|
|
24202
|
+
}
|
|
24203
|
+
};
|
|
23505
24204
|
this._onHandlerPointerDown = (e, tag) => {
|
|
23506
|
-
|
|
24205
|
+
this._clearDragEvents();
|
|
23507
24206
|
if (tag === 'start') {
|
|
23508
24207
|
this._activeTag = DataZoomActiveTag.startHandler;
|
|
23509
24208
|
this._activeItem = this._startHandlerMask;
|
|
@@ -23527,14 +24226,16 @@ class DataZoom extends AbstractComponent {
|
|
|
23527
24226
|
this._activeState = true;
|
|
23528
24227
|
this._activeCache.startPos = this.eventPosToStagePos(e);
|
|
23529
24228
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
23530
|
-
|
|
23531
|
-
|
|
23532
|
-
|
|
23533
|
-
}
|
|
24229
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24230
|
+
const triggers = getEndTriggersOfDrag();
|
|
24231
|
+
evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23534
24232
|
this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24233
|
+
triggers.forEach((trigger) => {
|
|
24234
|
+
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
24235
|
+
});
|
|
23535
24236
|
};
|
|
23536
24237
|
this._pointerMove = (e) => {
|
|
23537
|
-
e.
|
|
24238
|
+
e.preventDefault();
|
|
23538
24239
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
23539
24240
|
const pos = this.eventPosToStagePos(e);
|
|
23540
24241
|
const { attPos, max } = this._layoutCache;
|
|
@@ -23584,7 +24285,6 @@ class DataZoom extends AbstractComponent {
|
|
|
23584
24285
|
? this._pointerMove
|
|
23585
24286
|
: delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
|
|
23586
24287
|
this._onHandlerPointerUp = (e) => {
|
|
23587
|
-
e.preventDefault();
|
|
23588
24288
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
23589
24289
|
if (this._activeState) {
|
|
23590
24290
|
if (this._activeTag === DataZoomActiveTag.background) {
|
|
@@ -23599,12 +24299,7 @@ class DataZoom extends AbstractComponent {
|
|
|
23599
24299
|
end: this.state.end,
|
|
23600
24300
|
tag: this._activeTag
|
|
23601
24301
|
});
|
|
23602
|
-
|
|
23603
|
-
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23604
|
-
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
23605
|
-
}
|
|
23606
|
-
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23607
|
-
this.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
24302
|
+
this._clearDragEvents();
|
|
23608
24303
|
};
|
|
23609
24304
|
const { position, showDetail } = attributes;
|
|
23610
24305
|
this._activeCache.startPos = position;
|
|
@@ -23652,12 +24347,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23652
24347
|
if (this._selectedPreviewGroup) {
|
|
23653
24348
|
this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
|
|
23654
24349
|
}
|
|
23655
|
-
this.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
23656
|
-
this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
23657
24350
|
if (showDetail === 'auto') {
|
|
23658
24351
|
this.addEventListener('pointerenter', this._onHandlerPointerEnter);
|
|
23659
24352
|
this.addEventListener('pointerleave', this._onHandlerPointerLeave);
|
|
23660
24353
|
}
|
|
24354
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24355
|
+
passive: false
|
|
24356
|
+
});
|
|
23661
24357
|
}
|
|
23662
24358
|
dragMaskSize() {
|
|
23663
24359
|
const { position } = this.attribute;
|
|
@@ -23685,13 +24381,20 @@ class DataZoom extends AbstractComponent {
|
|
|
23685
24381
|
var _a, _b;
|
|
23686
24382
|
return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
23687
24383
|
}
|
|
24384
|
+
_clearDragEvents() {
|
|
24385
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24386
|
+
const triggers = getEndTriggersOfDrag();
|
|
24387
|
+
evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24388
|
+
triggers.forEach((trigger) => {
|
|
24389
|
+
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
24390
|
+
});
|
|
24391
|
+
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24392
|
+
}
|
|
23688
24393
|
_onHandlerPointerEnter(e) {
|
|
23689
|
-
e.stopPropagation();
|
|
23690
24394
|
this._showText = true;
|
|
23691
24395
|
this.renderText();
|
|
23692
24396
|
}
|
|
23693
24397
|
_onHandlerPointerLeave(e) {
|
|
23694
|
-
e.stopPropagation();
|
|
23695
24398
|
this._showText = false;
|
|
23696
24399
|
this.renderText();
|
|
23697
24400
|
}
|
|
@@ -24201,6 +24904,13 @@ class DataZoom extends AbstractComponent {
|
|
|
24201
24904
|
setStatePointToData(callback) {
|
|
24202
24905
|
isFunction(callback) && (this._statePointToData = callback);
|
|
24203
24906
|
}
|
|
24907
|
+
release(all) {
|
|
24908
|
+
super.release(all);
|
|
24909
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24910
|
+
passive: false
|
|
24911
|
+
});
|
|
24912
|
+
this._clearDragEvents();
|
|
24913
|
+
}
|
|
24204
24914
|
}
|
|
24205
24915
|
DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
24206
24916
|
|
|
@@ -24490,21 +25200,30 @@ function commonLineClipIn(line, label, duration, delay, easing) {
|
|
|
24490
25200
|
.to({ clipRange: 1 }, stepDuration, easing);
|
|
24491
25201
|
});
|
|
24492
25202
|
graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);
|
|
24493
|
-
|
|
24494
|
-
|
|
25203
|
+
array(label).forEach(labelNode => {
|
|
25204
|
+
const delayTime = delay + startSymbolDuration + lineDuration + endSymbolDuration;
|
|
25205
|
+
graphicFadeIn(labelNode.getTextShape(), delayTime, labelDuration, easing);
|
|
25206
|
+
graphicFadeIn(labelNode.getBgRect(), delayTime, labelDuration, easing);
|
|
25207
|
+
});
|
|
24495
25208
|
}
|
|
24496
25209
|
|
|
24497
25210
|
function commonLineFadeIn(line, label, duration, delay, easing) {
|
|
24498
25211
|
segmentFadeIn(line, delay, duration, easing);
|
|
24499
|
-
|
|
25212
|
+
array(label).forEach(labelNode => {
|
|
25213
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25214
|
+
});
|
|
24500
25215
|
}
|
|
24501
25216
|
function areaFadeIn(area, label, duration, delay, easing) {
|
|
24502
25217
|
graphicFadeIn(area, delay, duration, easing);
|
|
24503
|
-
|
|
25218
|
+
array(label).forEach(labelNode => {
|
|
25219
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25220
|
+
});
|
|
24504
25221
|
}
|
|
24505
25222
|
function arcAreaFadeIn(area, label, duration, delay, easing) {
|
|
24506
25223
|
graphicFadeIn(area, delay, duration, easing);
|
|
24507
|
-
|
|
25224
|
+
array(label).forEach(labelNode => {
|
|
25225
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25226
|
+
});
|
|
24508
25227
|
}
|
|
24509
25228
|
function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24510
25229
|
var _a;
|
|
@@ -24520,15 +25239,21 @@ function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
|
24520
25239
|
|
|
24521
25240
|
function commonLineFadeOut(line, label, duration, delay, easing) {
|
|
24522
25241
|
segmentFadeOut(line, delay, duration, easing);
|
|
24523
|
-
|
|
25242
|
+
array(label).forEach(labelNode => {
|
|
25243
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25244
|
+
});
|
|
24524
25245
|
}
|
|
24525
25246
|
function areaFadeOut(area, label, duration, delay, easing) {
|
|
24526
25247
|
graphicFadeOut(area, delay, duration, easing);
|
|
24527
|
-
|
|
25248
|
+
array(label).forEach(labelNode => {
|
|
25249
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25250
|
+
});
|
|
24528
25251
|
}
|
|
24529
25252
|
function arcAreaFadeOut(area, label, duration, delay, easing) {
|
|
24530
25253
|
graphicFadeOut(area, delay, duration, easing);
|
|
24531
|
-
|
|
25254
|
+
array(label).forEach(labelNode => {
|
|
25255
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25256
|
+
});
|
|
24532
25257
|
}
|
|
24533
25258
|
function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24534
25259
|
var _a;
|
|
@@ -24682,6 +25407,48 @@ const DefaultExitMarkerAnimation = {
|
|
|
24682
25407
|
delay: 0
|
|
24683
25408
|
};
|
|
24684
25409
|
|
|
25410
|
+
class MarkLabelMixin {
|
|
25411
|
+
getLabel() {
|
|
25412
|
+
return this._label;
|
|
25413
|
+
}
|
|
25414
|
+
_addMarkLabels(container, labelName, defaultLabelAttrs) {
|
|
25415
|
+
const { label, state } = this.attribute;
|
|
25416
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25417
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25418
|
+
const labelShapes = array(label).map((labelAttrs, index) => {
|
|
25419
|
+
var _a, _b;
|
|
25420
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labelAttrs);
|
|
25421
|
+
const markLabel = new Tag(Object.assign(Object.assign({}, finalLabelAttrs), { state: {
|
|
25422
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25423
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25424
|
+
} }));
|
|
25425
|
+
markLabel.name = labelName;
|
|
25426
|
+
container.add(markLabel);
|
|
25427
|
+
this.setLabelPos(markLabel, finalLabelAttrs);
|
|
25428
|
+
return markLabel;
|
|
25429
|
+
});
|
|
25430
|
+
this._label = array(labelShapes).length === 1 ? labelShapes[0] : labelShapes;
|
|
25431
|
+
}
|
|
25432
|
+
_updateMarkLabels(defaultLabelAttrs) {
|
|
25433
|
+
const { label, state } = this.attribute;
|
|
25434
|
+
const labelShapes = array(this._label);
|
|
25435
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25436
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25437
|
+
if (labelShapes.length) {
|
|
25438
|
+
const labels = array(label);
|
|
25439
|
+
labelShapes.forEach((labelItem, index) => {
|
|
25440
|
+
var _a, _b;
|
|
25441
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labels[index]);
|
|
25442
|
+
labelItem.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, finalLabelAttrs), { state: {
|
|
25443
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25444
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25445
|
+
} }));
|
|
25446
|
+
this.setLabelPos(labelItem, finalLabelAttrs);
|
|
25447
|
+
});
|
|
25448
|
+
}
|
|
25449
|
+
}
|
|
25450
|
+
}
|
|
25451
|
+
|
|
24685
25452
|
class MarkCommonLine extends Marker {
|
|
24686
25453
|
constructor() {
|
|
24687
25454
|
super(...arguments);
|
|
@@ -24692,20 +25459,17 @@ class MarkCommonLine extends Marker {
|
|
|
24692
25459
|
getLine() {
|
|
24693
25460
|
return this._line;
|
|
24694
25461
|
}
|
|
24695
|
-
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
const { label = {}, limitRect } = this.attribute;
|
|
24700
|
-
const { position, confine, autoRotate } = label;
|
|
24701
|
-
const labelPoint = this.getPointAttrByPosition(position);
|
|
25462
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25463
|
+
const { limitRect } = this.attribute;
|
|
25464
|
+
const { position, confine, autoRotate } = labelAttrs;
|
|
25465
|
+
const labelPoint = this.getPointAttrByPosition(position, labelAttrs);
|
|
24702
25466
|
const labelAngle = position.toString().toLocaleLowerCase().includes('start')
|
|
24703
25467
|
? this._line.getStartAngle() || 0
|
|
24704
25468
|
: this._line.getEndAngle() || 0;
|
|
24705
|
-
|
|
25469
|
+
labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle, labelAttrs) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), labelAttrs.textStyle) }));
|
|
24706
25470
|
if (limitRect && confine) {
|
|
24707
25471
|
const { x, y, width, height } = limitRect;
|
|
24708
|
-
limitShapeInBounds(
|
|
25472
|
+
limitShapeInBounds(labelNode, {
|
|
24709
25473
|
x1: x,
|
|
24710
25474
|
y1: y,
|
|
24711
25475
|
x2: x + width,
|
|
@@ -24714,32 +25478,18 @@ class MarkCommonLine extends Marker {
|
|
|
24714
25478
|
}
|
|
24715
25479
|
}
|
|
24716
25480
|
initMarker(container) {
|
|
24717
|
-
const { label, state } = this.attribute;
|
|
24718
25481
|
const line = this.createSegment();
|
|
24719
25482
|
line.name = 'mark-common-line-line';
|
|
24720
25483
|
this._line = line;
|
|
24721
25484
|
container.add(line);
|
|
24722
|
-
|
|
24723
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24724
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24725
|
-
} }));
|
|
24726
|
-
markLabel.name = 'mark-common-line-label';
|
|
24727
|
-
this._label = markLabel;
|
|
24728
|
-
container.add(markLabel);
|
|
24729
|
-
this.setLabelPos();
|
|
25485
|
+
this.addMarkLineLabels(container);
|
|
24730
25486
|
}
|
|
24731
25487
|
updateMarker() {
|
|
24732
|
-
const { label, state } = this.attribute;
|
|
24733
25488
|
this.setLineAttributes();
|
|
24734
|
-
|
|
24735
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
24736
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24737
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24738
|
-
} }));
|
|
24739
|
-
this.setLabelPos();
|
|
24740
|
-
}
|
|
25489
|
+
this.updateMarkLineLabels();
|
|
24741
25490
|
}
|
|
24742
25491
|
}
|
|
25492
|
+
mixin(MarkCommonLine, MarkLabelMixin);
|
|
24743
25493
|
|
|
24744
25494
|
const FUZZY_EQUAL_DELTA = 0.001;
|
|
24745
25495
|
const DEFAULT_MARK_LINE_THEME = {
|
|
@@ -24928,6 +25678,7 @@ const DEFAULT_MARK_ARC_LINE_THEME = {
|
|
|
24928
25678
|
lineWidth: 0
|
|
24929
25679
|
},
|
|
24930
25680
|
label: {
|
|
25681
|
+
autoRotate: true,
|
|
24931
25682
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
24932
25683
|
refX: 0,
|
|
24933
25684
|
refY: 0,
|
|
@@ -24982,6 +25733,7 @@ const DEFAULT_MARK_AREA_THEME = {
|
|
|
24982
25733
|
const DEFAULT_MARK_ARC_AREA_THEME = {
|
|
24983
25734
|
interactive: true,
|
|
24984
25735
|
label: {
|
|
25736
|
+
autoRotate: true,
|
|
24985
25737
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
24986
25738
|
textStyle: {
|
|
24987
25739
|
fill: '#fff',
|
|
@@ -25240,10 +25992,9 @@ class MarkLine extends MarkCommonLine {
|
|
|
25240
25992
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkLine.defaultAttributes, attributes));
|
|
25241
25993
|
this.name = 'markLine';
|
|
25242
25994
|
}
|
|
25243
|
-
getPointAttrByPosition(position) {
|
|
25995
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
25244
25996
|
var _a;
|
|
25245
|
-
const {
|
|
25246
|
-
const { refX = 0, refY = 0 } = label;
|
|
25997
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25247
25998
|
const points = this._line.getMainSegmentPoints();
|
|
25248
25999
|
const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
25249
26000
|
const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
|
|
@@ -25275,10 +26026,10 @@ class MarkLine extends MarkCommonLine {
|
|
|
25275
26026
|
angle: labelAngle
|
|
25276
26027
|
};
|
|
25277
26028
|
}
|
|
25278
|
-
getRotateByAngle(angle) {
|
|
26029
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25279
26030
|
var _a;
|
|
25280
26031
|
const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
|
|
25281
|
-
return itemAngle + ((_a =
|
|
26032
|
+
return itemAngle + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25282
26033
|
}
|
|
25283
26034
|
getTextStyle(position, labelAngle, autoRotate) {
|
|
25284
26035
|
if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
|
|
@@ -25349,6 +26100,12 @@ class MarkLine extends MarkCommonLine {
|
|
|
25349
26100
|
});
|
|
25350
26101
|
return validFlag;
|
|
25351
26102
|
}
|
|
26103
|
+
addMarkLineLabels(container) {
|
|
26104
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkLine.defaultAttributes.label);
|
|
26105
|
+
}
|
|
26106
|
+
updateMarkLineLabels() {
|
|
26107
|
+
this._updateMarkLabels(MarkLine.defaultAttributes.label);
|
|
26108
|
+
}
|
|
25352
26109
|
}
|
|
25353
26110
|
MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
|
|
25354
26111
|
|
|
@@ -25365,9 +26122,6 @@ class MarkArea extends Marker {
|
|
|
25365
26122
|
getArea() {
|
|
25366
26123
|
return this._area;
|
|
25367
26124
|
}
|
|
25368
|
-
getLabel() {
|
|
25369
|
-
return this._label;
|
|
25370
|
-
}
|
|
25371
26125
|
constructor(attributes, options) {
|
|
25372
26126
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArea.defaultAttributes, attributes));
|
|
25373
26127
|
this.name = 'markArea';
|
|
@@ -25394,16 +26148,15 @@ class MarkArea extends Marker {
|
|
|
25394
26148
|
}
|
|
25395
26149
|
return result;
|
|
25396
26150
|
}
|
|
25397
|
-
setLabelPos() {
|
|
26151
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25398
26152
|
var _a;
|
|
25399
|
-
if (this.
|
|
25400
|
-
const
|
|
25401
|
-
const labelPosition = (_a = label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
26153
|
+
if (this._area) {
|
|
26154
|
+
const labelPosition = (_a = labelAttrs.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
25402
26155
|
const labelPoint = this.getPointAttrByPosition(labelPosition);
|
|
25403
|
-
|
|
25404
|
-
if (this.attribute.limitRect &&
|
|
26156
|
+
labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
|
|
26157
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25405
26158
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25406
|
-
limitShapeInBounds(
|
|
26159
|
+
limitShapeInBounds(labelNode, {
|
|
25407
26160
|
x1: x,
|
|
25408
26161
|
y1: y,
|
|
25409
26162
|
x2: x + width,
|
|
@@ -25413,34 +26166,21 @@ class MarkArea extends Marker {
|
|
|
25413
26166
|
}
|
|
25414
26167
|
}
|
|
25415
26168
|
initMarker(container) {
|
|
25416
|
-
const { points,
|
|
26169
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25417
26170
|
const area = graphicCreator.polygon(Object.assign({ points: points }, areaStyle));
|
|
25418
26171
|
area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25419
26172
|
area.name = 'mark-area-polygon';
|
|
25420
26173
|
this._area = area;
|
|
25421
26174
|
container.add(area);
|
|
25422
|
-
|
|
25423
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25424
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25425
|
-
} }));
|
|
25426
|
-
markLabel.name = 'mark-area-label';
|
|
25427
|
-
this._label = markLabel;
|
|
25428
|
-
container.add(markLabel);
|
|
25429
|
-
this.setLabelPos();
|
|
26175
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArea.defaultAttributes.label);
|
|
25430
26176
|
}
|
|
25431
26177
|
updateMarker() {
|
|
25432
|
-
const { points,
|
|
26178
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25433
26179
|
if (this._area) {
|
|
25434
26180
|
this._area.setAttributes(Object.assign({ points: points }, areaStyle));
|
|
25435
26181
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25436
26182
|
}
|
|
25437
|
-
|
|
25438
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25439
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25440
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25441
|
-
} }));
|
|
25442
|
-
}
|
|
25443
|
-
this.setLabelPos();
|
|
26183
|
+
this._updateMarkLabels(MarkArea.defaultAttributes.label);
|
|
25444
26184
|
}
|
|
25445
26185
|
isValidPoints() {
|
|
25446
26186
|
const { points } = this.attribute;
|
|
@@ -25458,6 +26198,7 @@ class MarkArea extends Marker {
|
|
|
25458
26198
|
}
|
|
25459
26199
|
}
|
|
25460
26200
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
26201
|
+
mixin(MarkArea, MarkLabelMixin);
|
|
25461
26202
|
|
|
25462
26203
|
loadMarkArcLineComponent();
|
|
25463
26204
|
function registerMarkArcLineAnimate() {
|
|
@@ -25470,14 +26211,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25470
26211
|
}
|
|
25471
26212
|
}
|
|
25472
26213
|
constructor(attributes, options) {
|
|
25473
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25474
|
-
? attributes
|
|
25475
|
-
: merge({}, MarkArcLine.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26214
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));
|
|
25476
26215
|
this.name = 'markArcLine';
|
|
25477
26216
|
}
|
|
25478
|
-
getPointAttrByPosition(direction) {
|
|
25479
|
-
const { center, radius, startAngle, endAngle
|
|
25480
|
-
const { refX = 0, refY = 0 } =
|
|
26217
|
+
getPointAttrByPosition(direction, labelAttrs) {
|
|
26218
|
+
const { center, radius, startAngle, endAngle } = this.attribute;
|
|
26219
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25481
26220
|
let angle;
|
|
25482
26221
|
switch (direction) {
|
|
25483
26222
|
case IMarkCommonArcLabelPosition.arcInnerStart:
|
|
@@ -25509,9 +26248,9 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25509
26248
|
getTextStyle(position) {
|
|
25510
26249
|
return DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[position];
|
|
25511
26250
|
}
|
|
25512
|
-
getRotateByAngle(angle) {
|
|
26251
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25513
26252
|
var _a;
|
|
25514
|
-
return angle - Math.PI / 2 + ((_a =
|
|
26253
|
+
return angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25515
26254
|
}
|
|
25516
26255
|
createSegment() {
|
|
25517
26256
|
const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this
|
|
@@ -25554,6 +26293,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25554
26293
|
isValidPoints() {
|
|
25555
26294
|
return true;
|
|
25556
26295
|
}
|
|
26296
|
+
addMarkLineLabels(container) {
|
|
26297
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkArcLine.defaultAttributes.label);
|
|
26298
|
+
}
|
|
26299
|
+
updateMarkLineLabels() {
|
|
26300
|
+
this._updateMarkLabels(MarkArcLine.defaultAttributes.label);
|
|
26301
|
+
}
|
|
25557
26302
|
}
|
|
25558
26303
|
MarkArcLine.defaultAttributes = DEFAULT_MARK_ARC_LINE_THEME;
|
|
25559
26304
|
|
|
@@ -25570,20 +26315,15 @@ class MarkArcArea extends Marker {
|
|
|
25570
26315
|
getArea() {
|
|
25571
26316
|
return this._area;
|
|
25572
26317
|
}
|
|
25573
|
-
getLabel() {
|
|
25574
|
-
return this._label;
|
|
25575
|
-
}
|
|
25576
26318
|
constructor(attributes, options) {
|
|
25577
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25578
|
-
? attributes
|
|
25579
|
-
: merge({}, MarkArcArea.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26319
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));
|
|
25580
26320
|
this.name = 'markArcArea';
|
|
25581
26321
|
this.defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;
|
|
25582
26322
|
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
25583
26323
|
}
|
|
25584
|
-
getPointAttrByPosition(position) {
|
|
25585
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle
|
|
25586
|
-
const { refX = 0, refY = 0 } =
|
|
26324
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
26325
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute;
|
|
26326
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25587
26327
|
let radius;
|
|
25588
26328
|
let angle;
|
|
25589
26329
|
switch (position) {
|
|
@@ -25627,16 +26367,15 @@ class MarkArcArea extends Marker {
|
|
|
25627
26367
|
angle
|
|
25628
26368
|
};
|
|
25629
26369
|
}
|
|
25630
|
-
setLabelPos() {
|
|
26370
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25631
26371
|
var _a;
|
|
25632
|
-
if (this.
|
|
25633
|
-
const {
|
|
25634
|
-
const
|
|
25635
|
-
|
|
25636
|
-
this.
|
|
25637
|
-
if (this.attribute.limitRect && label.confine) {
|
|
26372
|
+
if (this._area) {
|
|
26373
|
+
const { position: labelPosition = 'arcInnerMiddle', autoRotate } = labelAttrs;
|
|
26374
|
+
const labelAttr = this.getPointAttrByPosition(labelPosition, labelAttrs);
|
|
26375
|
+
labelNode.setAttributes(Object.assign(Object.assign({}, labelAttr.position), { angle: autoRotate ? labelAttr.angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
|
|
26376
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25638
26377
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25639
|
-
limitShapeInBounds(
|
|
26378
|
+
limitShapeInBounds(labelNode, {
|
|
25640
26379
|
x1: x,
|
|
25641
26380
|
y1: y,
|
|
25642
26381
|
x2: x + width,
|
|
@@ -25646,7 +26385,7 @@ class MarkArcArea extends Marker {
|
|
|
25646
26385
|
}
|
|
25647
26386
|
}
|
|
25648
26387
|
initMarker(container) {
|
|
25649
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle,
|
|
26388
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, state } = this
|
|
25650
26389
|
.attribute;
|
|
25651
26390
|
const area = graphicCreator.arc(Object.assign({ x: center.x, y: center.y, innerRadius,
|
|
25652
26391
|
outerRadius,
|
|
@@ -25656,14 +26395,7 @@ class MarkArcArea extends Marker {
|
|
|
25656
26395
|
area.name = 'polar-mark-area-area';
|
|
25657
26396
|
this._area = area;
|
|
25658
26397
|
container.add(area);
|
|
25659
|
-
|
|
25660
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25661
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25662
|
-
} }));
|
|
25663
|
-
markLabel.name = 'mark-area-label';
|
|
25664
|
-
this._label = markLabel;
|
|
25665
|
-
container.add(markLabel);
|
|
25666
|
-
this.setLabelPos();
|
|
26398
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArcArea.defaultAttributes.label);
|
|
25667
26399
|
}
|
|
25668
26400
|
updateMarker() {
|
|
25669
26401
|
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
|
|
@@ -25675,19 +26407,14 @@ class MarkArcArea extends Marker {
|
|
|
25675
26407
|
endAngle }, areaStyle));
|
|
25676
26408
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25677
26409
|
}
|
|
25678
|
-
|
|
25679
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25680
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25681
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25682
|
-
} }));
|
|
25683
|
-
this.setLabelPos();
|
|
25684
|
-
}
|
|
26410
|
+
this._updateMarkLabels(MarkArcArea.defaultAttributes.label);
|
|
25685
26411
|
}
|
|
25686
26412
|
isValidPoints() {
|
|
25687
26413
|
return true;
|
|
25688
26414
|
}
|
|
25689
26415
|
}
|
|
25690
26416
|
MarkArcArea.defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;
|
|
26417
|
+
mixin(MarkArcArea, MarkLabelMixin);
|
|
25691
26418
|
|
|
25692
26419
|
loadMarkPointComponent();
|
|
25693
26420
|
function registerMarkPointAnimate() {
|
|
@@ -27708,28 +28435,21 @@ class Slider extends AbstractComponent {
|
|
|
27708
28435
|
this._dispatchTooltipEvent('sliderTooltipHide');
|
|
27709
28436
|
};
|
|
27710
28437
|
this._onHandlerPointerdown = (e) => {
|
|
27711
|
-
|
|
28438
|
+
this._clearAllDragEvents();
|
|
27712
28439
|
this._isChanging = true;
|
|
27713
28440
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27714
28441
|
this._currentHandler = e.target;
|
|
27715
28442
|
this._prePos = this._isHorizontal ? x : y;
|
|
27716
|
-
|
|
27717
|
-
|
|
27718
|
-
|
|
27719
|
-
|
|
27720
|
-
|
|
27721
|
-
}
|
|
27722
|
-
else {
|
|
27723
|
-
this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27724
|
-
capture: true
|
|
27725
|
-
});
|
|
27726
|
-
this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27727
|
-
this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27728
|
-
}
|
|
28443
|
+
const triggers = getEndTriggersOfDrag();
|
|
28444
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28445
|
+
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28446
|
+
triggers.forEach((trigger) => {
|
|
28447
|
+
obj.addEventListener(trigger, this._onHandlerPointerUp);
|
|
28448
|
+
});
|
|
27729
28449
|
};
|
|
27730
28450
|
this._onHandlerPointerMove = (e) => {
|
|
27731
28451
|
var _a, _b;
|
|
27732
|
-
e.
|
|
28452
|
+
e.preventDefault();
|
|
27733
28453
|
this._isChanging = true;
|
|
27734
28454
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27735
28455
|
if (max === min) {
|
|
@@ -27765,44 +28485,29 @@ class Slider extends AbstractComponent {
|
|
|
27765
28485
|
this._dispatchChangeEvent();
|
|
27766
28486
|
};
|
|
27767
28487
|
this._onHandlerPointerUp = (e) => {
|
|
27768
|
-
e.preventDefault();
|
|
27769
28488
|
this._isChanging = false;
|
|
27770
28489
|
this._currentHandler = null;
|
|
27771
|
-
|
|
27772
|
-
|
|
27773
|
-
|
|
27774
|
-
|
|
27775
|
-
|
|
27776
|
-
}
|
|
27777
|
-
else {
|
|
27778
|
-
this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27779
|
-
capture: true
|
|
27780
|
-
});
|
|
27781
|
-
this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27782
|
-
this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
28490
|
+
this._clearAllDragEvents();
|
|
28491
|
+
};
|
|
28492
|
+
this._handleTouchMove = (e) => {
|
|
28493
|
+
if (this._isChanging) {
|
|
28494
|
+
e.preventDefault();
|
|
27783
28495
|
}
|
|
27784
28496
|
};
|
|
27785
28497
|
this._onTrackPointerdown = (e) => {
|
|
27786
|
-
|
|
28498
|
+
this._clearAllDragEvents();
|
|
27787
28499
|
this._isChanging = true;
|
|
27788
28500
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27789
28501
|
this._prePos = this._isHorizontal ? x : y;
|
|
27790
|
-
|
|
27791
|
-
|
|
27792
|
-
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
}
|
|
27796
|
-
else {
|
|
27797
|
-
this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27798
|
-
capture: true
|
|
27799
|
-
});
|
|
27800
|
-
this.stage.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27801
|
-
this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27802
|
-
}
|
|
28502
|
+
const triggers = getEndTriggersOfDrag();
|
|
28503
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28504
|
+
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28505
|
+
triggers.forEach((trigger) => {
|
|
28506
|
+
obj.addEventListener(trigger, this._onTrackPointerUp);
|
|
28507
|
+
});
|
|
27803
28508
|
};
|
|
27804
28509
|
this._onTrackPointerMove = (e) => {
|
|
27805
|
-
e.
|
|
28510
|
+
e.preventDefault();
|
|
27806
28511
|
this._isChanging = true;
|
|
27807
28512
|
const { railWidth, railHeight, min, max, inverse } = this.attribute;
|
|
27808
28513
|
if (max === min) {
|
|
@@ -27854,24 +28559,11 @@ class Slider extends AbstractComponent {
|
|
|
27854
28559
|
this._dispatchChangeEvent();
|
|
27855
28560
|
};
|
|
27856
28561
|
this._onTrackPointerUp = (e) => {
|
|
27857
|
-
e.preventDefault();
|
|
27858
28562
|
this._isChanging = false;
|
|
27859
|
-
|
|
27860
|
-
vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27861
|
-
capture: true
|
|
27862
|
-
});
|
|
27863
|
-
vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27864
|
-
}
|
|
27865
|
-
else {
|
|
27866
|
-
this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27867
|
-
capture: true
|
|
27868
|
-
});
|
|
27869
|
-
this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27870
|
-
this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27871
|
-
}
|
|
28563
|
+
this._clearAllDragEvents();
|
|
27872
28564
|
};
|
|
27873
28565
|
this._onRailPointerDown = (e) => {
|
|
27874
|
-
|
|
28566
|
+
this._clearAllDragEvents();
|
|
27875
28567
|
this._isChanging = true;
|
|
27876
28568
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27877
28569
|
if (max === min) {
|
|
@@ -28249,6 +28941,9 @@ class Slider extends AbstractComponent {
|
|
|
28249
28941
|
this._track.addEventListener('pointerdown', this._onTrackPointerdown);
|
|
28250
28942
|
}
|
|
28251
28943
|
this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
|
|
28944
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
28945
|
+
passive: false
|
|
28946
|
+
});
|
|
28252
28947
|
}
|
|
28253
28948
|
}
|
|
28254
28949
|
_bindTooltipEvents() {
|
|
@@ -28259,6 +28954,18 @@ class Slider extends AbstractComponent {
|
|
|
28259
28954
|
this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
|
|
28260
28955
|
this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
|
|
28261
28956
|
}
|
|
28957
|
+
_clearAllDragEvents() {
|
|
28958
|
+
const triggers = getEndTriggersOfDrag();
|
|
28959
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28960
|
+
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28961
|
+
triggers.forEach((trigger) => {
|
|
28962
|
+
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
28963
|
+
});
|
|
28964
|
+
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28965
|
+
triggers.forEach((trigger) => {
|
|
28966
|
+
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
28967
|
+
});
|
|
28968
|
+
}
|
|
28262
28969
|
_updateTrack() {
|
|
28263
28970
|
const { inverse, railWidth, railHeight } = this.attribute;
|
|
28264
28971
|
const startHandler = this._startHandler;
|
|
@@ -28399,6 +29106,13 @@ class Slider extends AbstractComponent {
|
|
|
28399
29106
|
endHandler
|
|
28400
29107
|
};
|
|
28401
29108
|
}
|
|
29109
|
+
release(all) {
|
|
29110
|
+
super.release(all);
|
|
29111
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
29112
|
+
passive: false
|
|
29113
|
+
});
|
|
29114
|
+
this._clearAllDragEvents();
|
|
29115
|
+
}
|
|
28402
29116
|
}
|
|
28403
29117
|
Slider.defaultAttributes = {
|
|
28404
29118
|
slidable: true,
|
|
@@ -30092,13 +30806,14 @@ var IOperateType;
|
|
|
30092
30806
|
IOperateType["moving"] = "moving";
|
|
30093
30807
|
IOperateType["moveStart"] = "moveStart";
|
|
30094
30808
|
IOperateType["moveEnd"] = "moveEnd";
|
|
30809
|
+
IOperateType["brushActive"] = "brushActive";
|
|
30095
30810
|
IOperateType["brushClear"] = "brushClear";
|
|
30096
30811
|
})(IOperateType || (IOperateType = {}));
|
|
30097
30812
|
|
|
30098
30813
|
const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
30099
30814
|
trigger: 'pointerdown',
|
|
30100
30815
|
updateTrigger: 'pointermove',
|
|
30101
|
-
endTrigger: 'pointerup',
|
|
30816
|
+
endTrigger: ['pointerup', 'pointerleave'],
|
|
30102
30817
|
resetTrigger: 'pointerupoutside',
|
|
30103
30818
|
hasMask: true,
|
|
30104
30819
|
brushMode: 'single',
|
|
@@ -30114,10 +30829,10 @@ const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
|
30114
30829
|
delayType: 'throttle',
|
|
30115
30830
|
delayTime: 10,
|
|
30116
30831
|
interactiveRange: {
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
30120
|
-
|
|
30832
|
+
minY: -Infinity,
|
|
30833
|
+
maxY: Infinity,
|
|
30834
|
+
minX: -Infinity,
|
|
30835
|
+
maxX: Infinity
|
|
30121
30836
|
}
|
|
30122
30837
|
};
|
|
30123
30838
|
const DEFAULT_SIZE_THRESHOLD = 5;
|
|
@@ -30138,145 +30853,87 @@ class Brush extends AbstractComponent {
|
|
|
30138
30853
|
this.name = 'brush';
|
|
30139
30854
|
this._activeDrawState = false;
|
|
30140
30855
|
this._cacheDrawPoints = [];
|
|
30141
|
-
this._isDrawedBeforeEnd = false;
|
|
30142
|
-
this._isDownBeforeUpOutside = false;
|
|
30143
30856
|
this._activeMoveState = false;
|
|
30144
30857
|
this._operatingMaskMoveDx = 0;
|
|
30145
30858
|
this._operatingMaskMoveDy = 0;
|
|
30146
30859
|
this._operatingMaskMoveRangeX = [-Infinity, Infinity];
|
|
30147
30860
|
this._operatingMaskMoveRangeY = [-Infinity, Infinity];
|
|
30148
30861
|
this._brushMaskAABBBoundsDict = {};
|
|
30862
|
+
this._firstUpdate = true;
|
|
30149
30863
|
this._onBrushStart = (e) => {
|
|
30150
|
-
var _a;
|
|
30151
30864
|
if (this._outOfInteractiveRange(e)) {
|
|
30152
|
-
this.
|
|
30865
|
+
if (!this._isEmptyMask()) {
|
|
30866
|
+
this._clearMask();
|
|
30867
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30868
|
+
}
|
|
30153
30869
|
return;
|
|
30154
30870
|
}
|
|
30871
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
|
|
30872
|
+
array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
|
|
30873
|
+
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30155
30874
|
e.stopPropagation();
|
|
30156
|
-
|
|
30875
|
+
this._firstUpdate = true;
|
|
30157
30876
|
this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
|
|
30158
30877
|
this._activeDrawState = !this._activeMoveState;
|
|
30159
|
-
this.
|
|
30160
|
-
this.
|
|
30878
|
+
this._startPos = this.eventPosToStagePos(e);
|
|
30879
|
+
this._cacheDrawPoints = [this._startPos];
|
|
30161
30880
|
};
|
|
30162
30881
|
this._onBrushing = (e) => {
|
|
30163
30882
|
if (this._outOfInteractiveRange(e)) {
|
|
30164
30883
|
return;
|
|
30165
30884
|
}
|
|
30166
|
-
|
|
30167
|
-
|
|
30885
|
+
e.stopPropagation();
|
|
30886
|
+
if (this._firstUpdate) {
|
|
30887
|
+
this._activeDrawState && this._initDraw(e);
|
|
30888
|
+
this._activeMoveState && this._initMove(e);
|
|
30889
|
+
this._firstUpdate = false;
|
|
30890
|
+
}
|
|
30891
|
+
else {
|
|
30892
|
+
this._activeDrawState && this._drawing(e);
|
|
30893
|
+
this._activeMoveState && this._moving(e);
|
|
30168
30894
|
}
|
|
30169
|
-
this._activeDrawState && this._drawing(e);
|
|
30170
|
-
this._activeMoveState && this._moving(e);
|
|
30171
30895
|
};
|
|
30172
30896
|
this._onBrushingWithDelay = this.attribute.delayTime === 0
|
|
30173
30897
|
? this._onBrushing
|
|
30174
30898
|
: delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);
|
|
30175
30899
|
this._onBrushEnd = (e) => {
|
|
30176
|
-
|
|
30177
|
-
if (!this._activeDrawState && !this._activeMoveState) {
|
|
30178
|
-
return;
|
|
30179
|
-
}
|
|
30900
|
+
this._releaseBrushUpdateEvents();
|
|
30180
30901
|
e.preventDefault();
|
|
30181
|
-
|
|
30182
|
-
|
|
30183
|
-
if ((_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds.empty()) {
|
|
30184
|
-
this._dispatchEvent(IOperateType.brushClear, {
|
|
30185
|
-
operateMask: this._operatingMask,
|
|
30186
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30187
|
-
event: e
|
|
30188
|
-
});
|
|
30189
|
-
}
|
|
30190
|
-
this._container.incrementalClearChild();
|
|
30191
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30192
|
-
}
|
|
30193
|
-
else {
|
|
30194
|
-
if (this._activeDrawState) {
|
|
30195
|
-
this._dispatchEvent(IOperateType.drawEnd, {
|
|
30196
|
-
operateMask: this._operatingMask,
|
|
30197
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30198
|
-
event: e
|
|
30199
|
-
});
|
|
30200
|
-
}
|
|
30201
|
-
if (this._activeMoveState) {
|
|
30202
|
-
this._dispatchEvent(IOperateType.moveEnd, {
|
|
30203
|
-
operateMask: this._operatingMask,
|
|
30204
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30205
|
-
event: e
|
|
30206
|
-
});
|
|
30207
|
-
}
|
|
30208
|
-
}
|
|
30902
|
+
this._activeDrawState && this._drawEnd(e);
|
|
30903
|
+
this._activeMoveState && this._moveEnd(e);
|
|
30209
30904
|
this._activeDrawState = false;
|
|
30210
30905
|
this._activeMoveState = false;
|
|
30211
|
-
this._isDrawedBeforeEnd = false;
|
|
30212
|
-
if (this._operatingMask) {
|
|
30213
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30214
|
-
}
|
|
30215
30906
|
};
|
|
30216
30907
|
this._onBrushClear = (e) => {
|
|
30217
30908
|
e.preventDefault();
|
|
30218
|
-
|
|
30219
|
-
|
|
30220
|
-
this.
|
|
30221
|
-
operateMask: this._operatingMask,
|
|
30222
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30223
|
-
event: e
|
|
30224
|
-
});
|
|
30225
|
-
this._container.incrementalClearChild();
|
|
30226
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30909
|
+
if (!this._isEmptyMask()) {
|
|
30910
|
+
this._clearMask();
|
|
30911
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30227
30912
|
}
|
|
30228
30913
|
this._activeDrawState = false;
|
|
30229
30914
|
this._activeMoveState = false;
|
|
30230
|
-
this._isDrawedBeforeEnd = false;
|
|
30231
|
-
this._isDownBeforeUpOutside = false;
|
|
30232
|
-
if (this._operatingMask) {
|
|
30233
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30234
|
-
}
|
|
30235
30915
|
};
|
|
30236
30916
|
}
|
|
30237
30917
|
_bindBrushEvents() {
|
|
30918
|
+
this.releaseBrushEvents();
|
|
30238
30919
|
if (this.attribute.disableTriggerEvent) {
|
|
30239
30920
|
return;
|
|
30240
30921
|
}
|
|
30241
|
-
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
|
|
30242
|
-
|
|
30243
|
-
array(
|
|
30244
|
-
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30922
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
30923
|
+
.attribute;
|
|
30924
|
+
array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart));
|
|
30245
30925
|
array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
|
|
30246
30926
|
}
|
|
30247
|
-
_isPosInBrushMask(e) {
|
|
30248
|
-
const pos = this.eventPosToStagePos(e);
|
|
30249
|
-
const brushMasks = this._container.getChildren();
|
|
30250
|
-
for (let i = 0; i < brushMasks.length; i++) {
|
|
30251
|
-
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
30252
|
-
const pointsConsiderOffset = points.map((point) => {
|
|
30253
|
-
return {
|
|
30254
|
-
x: point.x + dx,
|
|
30255
|
-
y: point.y + dy
|
|
30256
|
-
};
|
|
30257
|
-
});
|
|
30258
|
-
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
30259
|
-
this._operatingMask = brushMasks[i];
|
|
30260
|
-
return true;
|
|
30261
|
-
}
|
|
30262
|
-
}
|
|
30263
|
-
return false;
|
|
30264
|
-
}
|
|
30265
30927
|
_initDraw(e) {
|
|
30266
30928
|
const { brushMode } = this.attribute;
|
|
30267
30929
|
const pos = this.eventPosToStagePos(e);
|
|
30268
|
-
this._cacheDrawPoints
|
|
30269
|
-
this.
|
|
30270
|
-
if (brushMode === 'single') {
|
|
30271
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30272
|
-
this._container.incrementalClearChild();
|
|
30273
|
-
}
|
|
30930
|
+
this._cacheDrawPoints.push(pos);
|
|
30931
|
+
brushMode === 'single' && this._clearMask();
|
|
30274
30932
|
this._addBrushMask();
|
|
30275
|
-
this.
|
|
30276
|
-
|
|
30277
|
-
|
|
30278
|
-
|
|
30279
|
-
});
|
|
30933
|
+
this._dispatchBrushEvent(IOperateType.drawStart, e);
|
|
30934
|
+
if (Object.keys(this._brushMaskAABBBoundsDict).length === 1) {
|
|
30935
|
+
this._dispatchBrushEvent(IOperateType.brushActive, e);
|
|
30936
|
+
}
|
|
30280
30937
|
}
|
|
30281
30938
|
_initMove(e) {
|
|
30282
30939
|
var _a, _b;
|
|
@@ -30293,16 +30950,12 @@ class Brush extends AbstractComponent {
|
|
|
30293
30950
|
this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
|
|
30294
30951
|
this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
|
|
30295
30952
|
this._operatingMask.setAttribute('pickable', true);
|
|
30296
|
-
this.
|
|
30297
|
-
operateMask: this._operatingMask,
|
|
30298
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30299
|
-
event: e
|
|
30300
|
-
});
|
|
30953
|
+
this._dispatchBrushEvent(IOperateType.moveStart, e);
|
|
30301
30954
|
}
|
|
30302
30955
|
_drawing(e) {
|
|
30303
|
-
var _a
|
|
30956
|
+
var _a;
|
|
30304
30957
|
const pos = this.eventPosToStagePos(e);
|
|
30305
|
-
const {
|
|
30958
|
+
const { brushType } = this.attribute;
|
|
30306
30959
|
const cacheLength = this._cacheDrawPoints.length;
|
|
30307
30960
|
if (cacheLength > 0) {
|
|
30308
30961
|
const lastPos = (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) !== null && _a !== void 0 ? _a : {};
|
|
@@ -30318,18 +30971,7 @@ class Brush extends AbstractComponent {
|
|
|
30318
30971
|
}
|
|
30319
30972
|
const maskPoints = this._computeMaskPoints();
|
|
30320
30973
|
this._operatingMask.setAttribute('points', maskPoints);
|
|
30321
|
-
|
|
30322
|
-
this._isDrawedBeforeEnd =
|
|
30323
|
-
!this._operatingMask._AABBBounds.empty() &&
|
|
30324
|
-
!!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
|
|
30325
|
-
if (this._isDrawedBeforeEnd) {
|
|
30326
|
-
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30327
|
-
this._dispatchEvent(IOperateType.drawing, {
|
|
30328
|
-
operateMask: this._operatingMask,
|
|
30329
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30330
|
-
event: e
|
|
30331
|
-
});
|
|
30332
|
-
}
|
|
30974
|
+
this._dispatchBrushEvent(IOperateType.drawing, e);
|
|
30333
30975
|
}
|
|
30334
30976
|
_moving(e) {
|
|
30335
30977
|
const startPos = this._cacheMovePoint;
|
|
@@ -30348,11 +30990,61 @@ class Brush extends AbstractComponent {
|
|
|
30348
30990
|
dy: moveY
|
|
30349
30991
|
});
|
|
30350
30992
|
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30351
|
-
this.
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30993
|
+
this._dispatchBrushEvent(IOperateType.moving, e);
|
|
30994
|
+
}
|
|
30995
|
+
_drawEnd(e) {
|
|
30996
|
+
const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
|
|
30997
|
+
if (this._outOfInteractiveRange(e)) {
|
|
30998
|
+
if (!this._isEmptyMask()) {
|
|
30999
|
+
this._clearMask();
|
|
31000
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31001
|
+
}
|
|
31002
|
+
}
|
|
31003
|
+
else {
|
|
31004
|
+
const { x: x1, y: y1 } = this._startPos;
|
|
31005
|
+
const { x: x2, y: y2 } = this.eventPosToStagePos(e);
|
|
31006
|
+
if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {
|
|
31007
|
+
if (!this._isEmptyMask()) {
|
|
31008
|
+
this._clearMask();
|
|
31009
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31010
|
+
}
|
|
31011
|
+
}
|
|
31012
|
+
else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {
|
|
31013
|
+
delete this._brushMaskAABBBoundsDict[this._operatingMask.name];
|
|
31014
|
+
this._container.setAttributes({});
|
|
31015
|
+
this._container.removeChild(this._operatingMask);
|
|
31016
|
+
if (this._isEmptyMask()) {
|
|
31017
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31018
|
+
}
|
|
31019
|
+
}
|
|
31020
|
+
else {
|
|
31021
|
+
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
31022
|
+
this._dispatchBrushEvent(IOperateType.drawEnd, e);
|
|
31023
|
+
}
|
|
31024
|
+
}
|
|
31025
|
+
}
|
|
31026
|
+
_moveEnd(e) {
|
|
31027
|
+
if (this._operatingMask) {
|
|
31028
|
+
this._operatingMask.setAttribute('pickable', false);
|
|
31029
|
+
}
|
|
31030
|
+
this._dispatchBrushEvent(IOperateType.moveEnd, e);
|
|
31031
|
+
}
|
|
31032
|
+
render() {
|
|
31033
|
+
this._bindBrushEvents();
|
|
31034
|
+
const group = this.createOrUpdateChild('brush-container', {}, 'group');
|
|
31035
|
+
this._container = group;
|
|
31036
|
+
}
|
|
31037
|
+
releaseBrushEvents() {
|
|
31038
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
31039
|
+
.attribute;
|
|
31040
|
+
array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart));
|
|
31041
|
+
array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
|
|
31042
|
+
this._releaseBrushUpdateEvents();
|
|
31043
|
+
}
|
|
31044
|
+
_releaseBrushUpdateEvents() {
|
|
31045
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } = this.attribute;
|
|
31046
|
+
array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
|
|
31047
|
+
array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
|
|
30356
31048
|
}
|
|
30357
31049
|
_computeMaskPoints() {
|
|
30358
31050
|
const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
|
|
@@ -30421,12 +31113,30 @@ class Brush extends AbstractComponent {
|
|
|
30421
31113
|
_addBrushMask() {
|
|
30422
31114
|
var _a;
|
|
30423
31115
|
const { brushStyle, hasMask } = this.attribute;
|
|
30424
|
-
const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
|
|
31116
|
+
const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? ((_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1) : 0 }));
|
|
30425
31117
|
brushMask.name = `brush-${Date.now()}`;
|
|
30426
31118
|
this._operatingMask = brushMask;
|
|
30427
31119
|
this._container.add(brushMask);
|
|
30428
31120
|
this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
|
|
30429
31121
|
}
|
|
31122
|
+
_isPosInBrushMask(e) {
|
|
31123
|
+
const pos = this.eventPosToStagePos(e);
|
|
31124
|
+
const brushMasks = this._container.getChildren();
|
|
31125
|
+
for (let i = 0; i < brushMasks.length; i++) {
|
|
31126
|
+
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
31127
|
+
const pointsConsiderOffset = points.map((point) => {
|
|
31128
|
+
return {
|
|
31129
|
+
x: point.x + dx,
|
|
31130
|
+
y: point.y + dy
|
|
31131
|
+
};
|
|
31132
|
+
});
|
|
31133
|
+
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
31134
|
+
this._operatingMask = brushMasks[i];
|
|
31135
|
+
return true;
|
|
31136
|
+
}
|
|
31137
|
+
}
|
|
31138
|
+
return false;
|
|
31139
|
+
}
|
|
30430
31140
|
_outOfInteractiveRange(e) {
|
|
30431
31141
|
const { interactiveRange } = this.attribute;
|
|
30432
31142
|
const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;
|
|
@@ -30439,17 +31149,21 @@ class Brush extends AbstractComponent {
|
|
|
30439
31149
|
eventPosToStagePos(e) {
|
|
30440
31150
|
return this.stage.eventPointTransform(e);
|
|
30441
31151
|
}
|
|
30442
|
-
|
|
30443
|
-
this.
|
|
30444
|
-
|
|
30445
|
-
|
|
31152
|
+
_dispatchBrushEvent(operateType, e) {
|
|
31153
|
+
this._dispatchEvent(operateType, {
|
|
31154
|
+
operateMask: this._operatingMask,
|
|
31155
|
+
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
31156
|
+
event: e
|
|
31157
|
+
});
|
|
30446
31158
|
}
|
|
30447
|
-
|
|
30448
|
-
|
|
30449
|
-
|
|
30450
|
-
|
|
30451
|
-
|
|
30452
|
-
|
|
31159
|
+
_clearMask() {
|
|
31160
|
+
this._brushMaskAABBBoundsDict = {};
|
|
31161
|
+
this._container.incrementalClearChild();
|
|
31162
|
+
this._operatingMask = null;
|
|
31163
|
+
}
|
|
31164
|
+
_isEmptyMask() {
|
|
31165
|
+
return (isEmpty(this._brushMaskAABBBoundsDict) ||
|
|
31166
|
+
Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty()));
|
|
30453
31167
|
}
|
|
30454
31168
|
}
|
|
30455
31169
|
Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
|
|
@@ -31751,10 +32465,10 @@ class Switch extends AbstractComponent {
|
|
|
31751
32465
|
});
|
|
31752
32466
|
this._circle.setAttributes({
|
|
31753
32467
|
y: circleY,
|
|
31754
|
-
x: this.attribute.checked ? circleX : maxWidth - circleX
|
|
32468
|
+
x: !this.attribute.checked ? circleX : maxWidth - circleX
|
|
31755
32469
|
});
|
|
31756
32470
|
this._text.setAttributes({
|
|
31757
|
-
x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
32471
|
+
x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
31758
32472
|
y: textY
|
|
31759
32473
|
});
|
|
31760
32474
|
}
|
|
@@ -31901,6 +32615,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31901
32615
|
theme: 'default'
|
|
31902
32616
|
};
|
|
31903
32617
|
|
|
31904
|
-
const version = "1.0.0-alpha.
|
|
32618
|
+
const version = "1.0.0-alpha.10";
|
|
31905
32619
|
|
|
31906
32620
|
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 };
|