@visactor/vrender-components 1.0.0-alpha.5 → 1.0.0-alpha.7
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 +1 -0
- package/cjs/axis/base.js +6 -4
- 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.js +17 -3
- 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 +1606 -924
- package/es/animation/axis-animate.js +4 -4
- package/es/animation/axis-animate.js.map +1 -1
- package/es/axis/base.d.ts +1 -0
- package/es/axis/base.js +7 -5
- 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.js +17 -3
- 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 +9 -9
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: {
|
|
@@ -5774,24 +6690,12 @@ class Graphic extends Node {
|
|
|
5774
6690
|
needUpdateLayout() {
|
|
5775
6691
|
return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
|
|
5776
6692
|
}
|
|
5777
|
-
getAnchor(anchor, params) {
|
|
6693
|
+
getAnchor(anchor, params, resetScale) {
|
|
5778
6694
|
const _anchor = [0, 0],
|
|
5779
6695
|
getBounds = () => {
|
|
5780
6696
|
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;
|
|
6697
|
+
const graphic = this.clone();
|
|
6698
|
+
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
6699
|
};
|
|
5796
6700
|
if ("string" == typeof anchor[0]) {
|
|
5797
6701
|
const ratio = parseFloat(anchor[0]) / 100,
|
|
@@ -5818,9 +6722,9 @@ class Graphic extends Node {
|
|
|
5818
6722
|
} = this.attribute;
|
|
5819
6723
|
let _anchor = [0, 0];
|
|
5820
6724
|
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 {
|
|
6725
|
+
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
6726
|
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, {
|
|
6727
|
+
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
6728
|
x: _anchor[0],
|
|
5825
6729
|
y: _anchor[1]
|
|
5826
6730
|
});
|
|
@@ -5843,6 +6747,7 @@ class Graphic extends Node {
|
|
|
5843
6747
|
}
|
|
5844
6748
|
}
|
|
5845
6749
|
setStage(stage, layer) {
|
|
6750
|
+
var _a;
|
|
5846
6751
|
if (this.stage !== stage) {
|
|
5847
6752
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
5848
6753
|
const timeline = stage.getTimeline();
|
|
@@ -5850,7 +6755,7 @@ class Graphic extends Node {
|
|
|
5850
6755
|
a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
|
|
5851
6756
|
});
|
|
5852
6757
|
}
|
|
5853
|
-
this._onSetStage && this._onSetStage(this, stage, layer),
|
|
6758
|
+
this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage);
|
|
5854
6759
|
}
|
|
5855
6760
|
}
|
|
5856
6761
|
setStageToShadowRoot(stage, layer) {
|
|
@@ -5938,6 +6843,15 @@ class Graphic extends Node {
|
|
|
5938
6843
|
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
6844
|
}
|
|
5940
6845
|
}
|
|
6846
|
+
toCustomPath() {
|
|
6847
|
+
var _a, _b, _c;
|
|
6848
|
+
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);
|
|
6849
|
+
if (renderer) {
|
|
6850
|
+
const context = new EmptyContext2d(null, 1);
|
|
6851
|
+
return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
|
|
6852
|
+
}
|
|
6853
|
+
return null;
|
|
6854
|
+
}
|
|
5941
6855
|
}
|
|
5942
6856
|
function backgroundNotImage(image) {
|
|
5943
6857
|
return !(!image.fill && !image.stroke);
|
|
@@ -5989,11 +6903,12 @@ class Group extends Graphic {
|
|
|
5989
6903
|
return !!super.shouldUpdateAABBBounds() || !!(this._childUpdateTag & UpdateTag.UPDATE_BOUNDS);
|
|
5990
6904
|
}
|
|
5991
6905
|
tryUpdateAABBBounds() {
|
|
6906
|
+
var _a, _b;
|
|
5992
6907
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5993
|
-
|
|
6908
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5994
6909
|
const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
|
|
5995
6910
|
bounds = this.doUpdateAABBBounds();
|
|
5996
|
-
return this.addUpdateLayoutTag(),
|
|
6911
|
+
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
6912
|
}
|
|
5998
6913
|
doUpdateLocalMatrix() {
|
|
5999
6914
|
const {
|
|
@@ -6053,11 +6968,13 @@ class Group extends Graphic {
|
|
|
6053
6968
|
return this.theme.getTheme(this);
|
|
6054
6969
|
}
|
|
6055
6970
|
incrementalAppendChild(node) {
|
|
6971
|
+
var _a;
|
|
6056
6972
|
const data = super.appendChild(node);
|
|
6057
|
-
return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(),
|
|
6973
|
+
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
6974
|
}
|
|
6059
6975
|
incrementalClearChild() {
|
|
6060
|
-
|
|
6976
|
+
var _a;
|
|
6977
|
+
super.removeAllChild(), this.addUpdateBoundTag(), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onClearIncremental(this, this.stage);
|
|
6061
6978
|
}
|
|
6062
6979
|
_updateChildToStage(child) {
|
|
6063
6980
|
return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
|
|
@@ -6077,17 +6994,20 @@ class Group extends Graphic {
|
|
|
6077
6994
|
return this._updateChildToStage(super.insertInto(newNode, idx));
|
|
6078
6995
|
}
|
|
6079
6996
|
removeChild(child) {
|
|
6997
|
+
var _a;
|
|
6080
6998
|
const data = super.removeChild(child);
|
|
6081
|
-
return child.stage = null,
|
|
6999
|
+
return child.stage = null, null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), this.addUpdateBoundTag(), data;
|
|
6082
7000
|
}
|
|
6083
7001
|
removeAllChild() {
|
|
6084
7002
|
let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
|
|
6085
7003
|
this.forEachChildren(child => {
|
|
6086
|
-
|
|
7004
|
+
var _a;
|
|
7005
|
+
null === (_a = this.stage) || void 0 === _a || _a.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
|
|
6087
7006
|
}), super.removeAllChild(), this.addUpdateBoundTag();
|
|
6088
7007
|
}
|
|
6089
7008
|
setStage(stage, layer) {
|
|
6090
|
-
|
|
7009
|
+
var _a;
|
|
7010
|
+
this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), null === (_a = this.stage) || void 0 === _a || _a.graphicService.onSetStage(this, stage), this.forEachChildren(item => {
|
|
6091
7011
|
item.setStage(stage, this.layer);
|
|
6092
7012
|
}));
|
|
6093
7013
|
}
|
|
@@ -6433,242 +7353,86 @@ function calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerR
|
|
|
6433
7353
|
}
|
|
6434
7354
|
}
|
|
6435
7355
|
return {
|
|
6436
|
-
outerDeltaAngle: outerDeltaAngle,
|
|
6437
|
-
xors: xors,
|
|
6438
|
-
yors: yors,
|
|
6439
|
-
xirs: xirs,
|
|
6440
|
-
yirs: yirs,
|
|
6441
|
-
xore: xore,
|
|
6442
|
-
yore: yore,
|
|
6443
|
-
xire: xire,
|
|
6444
|
-
yire: yire,
|
|
6445
|
-
limitedOcr: limitedOcr,
|
|
6446
|
-
limitedIcr: limitedIcr,
|
|
6447
|
-
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
6448
|
-
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
6449
|
-
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
6450
|
-
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
|
-
}))
|
|
7356
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
7357
|
+
xors: xors,
|
|
7358
|
+
yors: yors,
|
|
7359
|
+
xirs: xirs,
|
|
7360
|
+
yirs: yirs,
|
|
7361
|
+
xore: xore,
|
|
7362
|
+
yore: yore,
|
|
7363
|
+
xire: xire,
|
|
7364
|
+
yire: yire,
|
|
7365
|
+
limitedOcr: limitedOcr,
|
|
7366
|
+
limitedIcr: limitedIcr,
|
|
7367
|
+
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
7368
|
+
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
7369
|
+
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
7370
|
+
maxInnerCornerRadius: maxInnerCornerRadius,
|
|
7371
|
+
outerStartAngle: outerStartAngle,
|
|
7372
|
+
outerEndAngle: outerEndAngle,
|
|
7373
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7374
|
+
innerEndAngle: innerEndAngle,
|
|
7375
|
+
innerStartAngle: innerStartAngle,
|
|
7376
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7377
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd
|
|
6640
7378
|
};
|
|
6641
7379
|
}
|
|
6642
|
-
function
|
|
6643
|
-
return [from[0] + (to[0] - from[0]) * ratio, from[1] + (to[1] - from[1]) * ratio, from[2] + (to[2] - from[2]) * ratio, from[3] + (to[3] - from[3]) * ratio];
|
|
6644
|
-
}
|
|
6645
|
-
function interpolatePureColorArrayToStr(from, to, ratio) {
|
|
6646
|
-
return `rgba(${from[0] + (to[0] - from[0]) * ratio},${from[1] + (to[1] - from[1]) * ratio},${from[2] + (to[2] - from[2]) * ratio},${from[3] + (to[3] - from[3]) * ratio})`;
|
|
6647
|
-
}
|
|
6648
|
-
const _fromColorRGB = [0, 0, 0, 0],
|
|
6649
|
-
_toColorRGB = [0, 0, 0, 0];
|
|
6650
|
-
function colorStringInterpolationToStr(fromColor, toColor, ratio) {
|
|
6651
|
-
return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB), `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
|
|
6652
|
-
}
|
|
6653
|
-
|
|
6654
|
-
function getConicGradientAt(x, y, angle, color) {
|
|
7380
|
+
function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
|
|
6655
7381
|
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;
|
|
7382
|
+
startAngle: startAngle,
|
|
7383
|
+
endAngle: endAngle
|
|
7384
|
+
} = arc.getParsedAngle(),
|
|
7385
|
+
deltaAngle = abs(endAngle - startAngle),
|
|
7386
|
+
clockwise = endAngle > startAngle;
|
|
7387
|
+
let collapsedToLine = !1;
|
|
7388
|
+
if (outerRadius < innerRadius) {
|
|
7389
|
+
const temp = outerRadius;
|
|
7390
|
+
outerRadius = innerRadius, innerRadius = temp;
|
|
6670
7391
|
}
|
|
6671
|
-
|
|
7392
|
+
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 {
|
|
7393
|
+
const {
|
|
7394
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
7395
|
+
xors: xors,
|
|
7396
|
+
yors: yors,
|
|
7397
|
+
xirs: xirs,
|
|
7398
|
+
yirs: yirs,
|
|
7399
|
+
limitedOcr: limitedOcr,
|
|
7400
|
+
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
7401
|
+
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
7402
|
+
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
7403
|
+
xore: xore,
|
|
7404
|
+
yore: yore,
|
|
7405
|
+
xire: xire,
|
|
7406
|
+
yire: yire,
|
|
7407
|
+
outerStartAngle: outerStartAngle,
|
|
7408
|
+
outerEndAngle: outerEndAngle,
|
|
7409
|
+
limitedIcr: limitedIcr,
|
|
7410
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7411
|
+
innerEndAngle: innerEndAngle,
|
|
7412
|
+
innerStartAngle: innerStartAngle,
|
|
7413
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7414
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd,
|
|
7415
|
+
maxInnerCornerRadius: maxInnerCornerRadius
|
|
7416
|
+
} = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
|
|
7417
|
+
if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
|
|
7418
|
+
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
|
|
7419
|
+
cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
|
|
7420
|
+
t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
|
|
7421
|
+
t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
7422
|
+
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));
|
|
7423
|
+
} 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));
|
|
7424
|
+
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) {
|
|
7425
|
+
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
|
|
7426
|
+
cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
|
|
7427
|
+
t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
|
|
7428
|
+
t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
7429
|
+
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) {
|
|
7430
|
+
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
7431
|
+
!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));
|
|
7432
|
+
} 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);
|
|
7433
|
+
} 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));
|
|
7434
|
+
}
|
|
7435
|
+
return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
|
|
6672
7436
|
}
|
|
6673
7437
|
|
|
6674
7438
|
const ArcRenderContribution = Symbol.for("ArcRenderContribution");
|
|
@@ -6691,146 +7455,6 @@ function textLayoutOffsetY(baseline, lineHeight, fontSize) {
|
|
|
6691
7455
|
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
7456
|
}
|
|
6693
7457
|
|
|
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
7458
|
var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
6835
7459
|
var d,
|
|
6836
7460
|
c = arguments.length,
|
|
@@ -7067,7 +7691,7 @@ class Circle extends Graphic {
|
|
|
7067
7691
|
tb1: tb1,
|
|
7068
7692
|
tb2: tb2
|
|
7069
7693
|
} = 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;
|
|
7694
|
+
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
7695
|
}
|
|
7072
7696
|
updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) {
|
|
7073
7697
|
const {
|
|
@@ -7091,12 +7715,13 @@ class Circle extends Graphic {
|
|
|
7091
7715
|
}
|
|
7092
7716
|
toCustomPath() {
|
|
7093
7717
|
var _a, _b, _c;
|
|
7718
|
+
let path = super.toCustomPath();
|
|
7719
|
+
if (path) return path;
|
|
7094
7720
|
const attribute = this.attribute,
|
|
7095
7721
|
radius = null !== (_a = attribute.radius) && void 0 !== _a ? _a : this.getDefaultAttribute("radius"),
|
|
7096
7722
|
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;
|
|
7723
|
+
endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle");
|
|
7724
|
+
return path = new CustomPath2D(), path.arc(0, 0, radius, startAngle, endAngle), path;
|
|
7100
7725
|
}
|
|
7101
7726
|
clone() {
|
|
7102
7727
|
return new Circle(Object.assign({}, this.attribute));
|
|
@@ -7317,7 +7942,7 @@ class Text extends Graphic {
|
|
|
7317
7942
|
const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
|
|
7318
7943
|
boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
|
|
7319
7944
|
}
|
|
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;
|
|
7945
|
+
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
7946
|
}
|
|
7322
7947
|
updateSingallineAABBBounds(text) {
|
|
7323
7948
|
this.updateMultilineAABBBounds([text]);
|
|
@@ -7842,7 +8467,7 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
7842
8467
|
tb1: tb1,
|
|
7843
8468
|
tb2: tb2
|
|
7844
8469
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
7845
|
-
updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
8470
|
+
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
8471
|
const {
|
|
7847
8472
|
lineJoin = symbolTheme.lineJoin
|
|
7848
8473
|
} = attribute;
|
|
@@ -7914,7 +8539,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
7914
8539
|
return getTheme(this).line;
|
|
7915
8540
|
}
|
|
7916
8541
|
updateAABBBounds(attribute, lineTheme, aabbBounds) {
|
|
7917
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
8542
|
+
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
8543
|
const {
|
|
7919
8544
|
lineJoin = lineTheme.lineJoin
|
|
7920
8545
|
} = attribute;
|
|
@@ -7949,9 +8574,11 @@ let Line$1 = class Line extends Graphic {
|
|
|
7949
8574
|
return super.needUpdateTag(key, LINE_UPDATE_TAG_KEY);
|
|
7950
8575
|
}
|
|
7951
8576
|
toCustomPath() {
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
8577
|
+
let path = super.toCustomPath();
|
|
8578
|
+
if (path) return path;
|
|
8579
|
+
const attribute = this.attribute;
|
|
8580
|
+
path = new CustomPath2D();
|
|
8581
|
+
const segments = attribute.segments,
|
|
7955
8582
|
parsePoints = points => {
|
|
7956
8583
|
if (points && points.length) {
|
|
7957
8584
|
let isFirst = !0;
|
|
@@ -8030,7 +8657,7 @@ class Rect extends Graphic {
|
|
|
8030
8657
|
tb1: tb1,
|
|
8031
8658
|
tb2: tb2
|
|
8032
8659
|
} = 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;
|
|
8660
|
+
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
8661
|
}
|
|
8035
8662
|
needUpdateTags(keys) {
|
|
8036
8663
|
return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
|
|
@@ -8039,15 +8666,16 @@ class Rect extends Graphic {
|
|
|
8039
8666
|
return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
|
|
8040
8667
|
}
|
|
8041
8668
|
toCustomPath() {
|
|
8669
|
+
let path = super.toCustomPath();
|
|
8670
|
+
if (path) return path;
|
|
8042
8671
|
const attribute = this.attribute,
|
|
8043
8672
|
{
|
|
8044
8673
|
x: x,
|
|
8045
8674
|
y: y,
|
|
8046
8675
|
width: width,
|
|
8047
8676
|
height: height
|
|
8048
|
-
} = normalizeRectAttributes(attribute)
|
|
8049
|
-
|
|
8050
|
-
return path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8677
|
+
} = normalizeRectAttributes(attribute);
|
|
8678
|
+
return path = new CustomPath2D(), path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8051
8679
|
}
|
|
8052
8680
|
clone() {
|
|
8053
8681
|
return new Rect(Object.assign({}, this.attribute));
|
|
@@ -8427,7 +9055,7 @@ class Image extends Graphic {
|
|
|
8427
9055
|
tb1: tb1,
|
|
8428
9056
|
tb2: tb2
|
|
8429
9057
|
} = 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;
|
|
9058
|
+
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
9059
|
}
|
|
8432
9060
|
getDefaultAttribute(name) {
|
|
8433
9061
|
return DefaultImageAttribute[name];
|
|
@@ -8770,7 +9398,7 @@ class RichText extends Graphic {
|
|
|
8770
9398
|
maxWidth = richtextTheme.maxWidth,
|
|
8771
9399
|
maxHeight = richtextTheme.maxHeight,
|
|
8772
9400
|
textAlign = richtextTheme.textAlign,
|
|
8773
|
-
|
|
9401
|
+
textBaseline = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : "top",
|
|
8774
9402
|
editOptions: editOptions
|
|
8775
9403
|
} = attribute;
|
|
8776
9404
|
if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
|
|
@@ -8785,7 +9413,7 @@ class RichText extends Graphic {
|
|
|
8785
9413
|
}
|
|
8786
9414
|
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
9415
|
let deltaY = 0;
|
|
8788
|
-
switch (
|
|
9416
|
+
switch (textBaseline) {
|
|
8789
9417
|
case "top":
|
|
8790
9418
|
deltaY = 0;
|
|
8791
9419
|
break;
|
|
@@ -8806,7 +9434,7 @@ class RichText extends Graphic {
|
|
|
8806
9434
|
case "right":
|
|
8807
9435
|
deltaX = -aabbBounds.width();
|
|
8808
9436
|
}
|
|
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;
|
|
9437
|
+
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
9438
|
}
|
|
8811
9439
|
needUpdateTags(keys) {
|
|
8812
9440
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -9024,7 +9652,7 @@ class Path extends Graphic {
|
|
|
9024
9652
|
tb1: tb1,
|
|
9025
9653
|
tb2: tb2
|
|
9026
9654
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9027
|
-
updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9655
|
+
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
9656
|
const {
|
|
9029
9657
|
lineJoin = pathTheme.lineJoin
|
|
9030
9658
|
} = attribute;
|
|
@@ -9081,7 +9709,7 @@ class Area extends Graphic {
|
|
|
9081
9709
|
return getTheme(this).area;
|
|
9082
9710
|
}
|
|
9083
9711
|
updateAABBBounds(attribute, areaTheme, aabbBounds) {
|
|
9084
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9712
|
+
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9085
9713
|
const {
|
|
9086
9714
|
lineJoin = areaTheme.lineJoin
|
|
9087
9715
|
} = attribute;
|
|
@@ -9119,8 +9747,10 @@ class Area extends Graphic {
|
|
|
9119
9747
|
return super.needUpdateTag(key, AREA_UPDATE_TAG_KEY);
|
|
9120
9748
|
}
|
|
9121
9749
|
toCustomPath() {
|
|
9122
|
-
|
|
9123
|
-
|
|
9750
|
+
let path = super.toCustomPath();
|
|
9751
|
+
if (path) return path;
|
|
9752
|
+
path = new CustomPath2D();
|
|
9753
|
+
const attribute = this.attribute,
|
|
9124
9754
|
segments = attribute.segments,
|
|
9125
9755
|
parsePoints = points => {
|
|
9126
9756
|
if (points && points.length) {
|
|
@@ -9286,7 +9916,7 @@ class Arc extends Graphic {
|
|
|
9286
9916
|
tb1: tb1,
|
|
9287
9917
|
tb2: tb2
|
|
9288
9918
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9289
|
-
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9919
|
+
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9290
9920
|
const {
|
|
9291
9921
|
lineJoin = arcTheme.lineJoin
|
|
9292
9922
|
} = attribute;
|
|
@@ -9334,6 +9964,8 @@ class Arc extends Graphic {
|
|
|
9334
9964
|
}
|
|
9335
9965
|
toCustomPath() {
|
|
9336
9966
|
var _a, _b, _c, _d;
|
|
9967
|
+
let path = super.toCustomPath();
|
|
9968
|
+
if (path) return path;
|
|
9337
9969
|
const attribute = this.attribute,
|
|
9338
9970
|
{
|
|
9339
9971
|
startAngle: startAngle,
|
|
@@ -9347,8 +9979,7 @@ class Arc extends Graphic {
|
|
|
9347
9979
|
const temp = outerRadius;
|
|
9348
9980
|
outerRadius = innerRadius, innerRadius = temp;
|
|
9349
9981
|
}
|
|
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 {
|
|
9982
|
+
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
9983
|
const xors = outerRadius * cos(startAngle),
|
|
9353
9984
|
yors = outerRadius * sin(startAngle),
|
|
9354
9985
|
xire = innerRadius * cos(endAngle),
|
|
@@ -9389,7 +10020,7 @@ class Polygon extends Graphic {
|
|
|
9389
10020
|
return getTheme(this).polygon;
|
|
9390
10021
|
}
|
|
9391
10022
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
9392
|
-
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
10023
|
+
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
10024
|
const {
|
|
9394
10025
|
lineJoin = polygonTheme.lineJoin
|
|
9395
10026
|
} = attribute;
|
|
@@ -10735,7 +11366,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
10735
11366
|
if (!cache) return;
|
|
10736
11367
|
context.beginPath();
|
|
10737
11368
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
10738
|
-
drawSegments(context
|
|
11369
|
+
drawSegments(context, cache, clipRange, clipRangeByDimension, {
|
|
10739
11370
|
offsetX: offsetX,
|
|
10740
11371
|
offsetY: offsetY,
|
|
10741
11372
|
offsetZ: z
|
|
@@ -11138,7 +11769,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11138
11769
|
} else startP = points[0], endP = points[points.length - 1];
|
|
11139
11770
|
const xTotalLength = abs(endP.x - startP.x),
|
|
11140
11771
|
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
|
|
11772
|
+
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
11773
|
offsetX: offsetX,
|
|
11143
11774
|
offsetY: offsetY,
|
|
11144
11775
|
offsetZ: offsetZ,
|
|
@@ -11157,7 +11788,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11157
11788
|
const {
|
|
11158
11789
|
stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
|
|
11159
11790
|
} = attribute;
|
|
11160
|
-
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context
|
|
11791
|
+
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
11792
|
offsetX: offsetX,
|
|
11162
11793
|
offsetY: offsetY,
|
|
11163
11794
|
offsetZ: offsetZ
|
|
@@ -12328,7 +12959,7 @@ var pickModule = new ContainerModule((bind, unbind, isBound) => {
|
|
|
12328
12959
|
});
|
|
12329
12960
|
|
|
12330
12961
|
var graphicModule = new ContainerModule(bind => {
|
|
12331
|
-
bind(GraphicService).to(DefaultGraphicService)
|
|
12962
|
+
bind(GraphicService).to(DefaultGraphicService), bind(GraphicCreator$1).toConstantValue(graphicCreator);
|
|
12332
12963
|
});
|
|
12333
12964
|
|
|
12334
12965
|
const AutoEnablePlugins = Symbol.for("AutoEnablePlugins");
|
|
@@ -13070,6 +13701,8 @@ const transformUtil = container.get(TransformUtil);
|
|
|
13070
13701
|
application.transformUtil = transformUtil;
|
|
13071
13702
|
const graphicService = container.get(GraphicService);
|
|
13072
13703
|
application.graphicService = graphicService;
|
|
13704
|
+
const renderService = container.get(RenderService);
|
|
13705
|
+
application.renderService = renderService;
|
|
13073
13706
|
const layerService = container.get(LayerService);
|
|
13074
13707
|
application.layerService = layerService;
|
|
13075
13708
|
|
|
@@ -14323,6 +14956,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
|
14323
14956
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14324
14957
|
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14325
14958
|
|
|
14959
|
+
function getEndTriggersOfDrag() {
|
|
14960
|
+
if (vglobal.env === 'browser') {
|
|
14961
|
+
return ['pointerup', 'pointerleave', 'pointercancel'];
|
|
14962
|
+
}
|
|
14963
|
+
return ['pointerup', 'pointerleave', 'pointerupoutside'];
|
|
14964
|
+
}
|
|
14965
|
+
|
|
14326
14966
|
const delayMap$2 = {
|
|
14327
14967
|
debounce: debounce,
|
|
14328
14968
|
throttle: throttle
|
|
@@ -14356,6 +14996,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14356
14996
|
}
|
|
14357
14997
|
};
|
|
14358
14998
|
this._onSliderPointerDown = (e) => {
|
|
14999
|
+
this._clearDragEvents();
|
|
14359
15000
|
const { stopSliderDownPropagation = true } = this.attribute;
|
|
14360
15001
|
if (stopSliderDownPropagation) {
|
|
14361
15002
|
e.stopPropagation();
|
|
@@ -14367,15 +15008,12 @@ class ScrollBar extends AbstractComponent {
|
|
|
14367
15008
|
pos: this._prePos,
|
|
14368
15009
|
event: e
|
|
14369
15010
|
});
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
this.stage.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14377
|
-
this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14378
|
-
}
|
|
15011
|
+
const triggers = getEndTriggersOfDrag();
|
|
15012
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15013
|
+
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
|
|
15014
|
+
triggers.forEach((trigger) => {
|
|
15015
|
+
obj.addEventListener(trigger, this._onSliderPointerUp);
|
|
15016
|
+
});
|
|
14379
15017
|
};
|
|
14380
15018
|
this._computeScrollValue = (e) => {
|
|
14381
15019
|
const { direction } = this.attribute;
|
|
@@ -14397,6 +15035,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14397
15035
|
return [currentPos, currentScrollValue];
|
|
14398
15036
|
};
|
|
14399
15037
|
this._onSliderPointerMove = (e) => {
|
|
15038
|
+
e.preventDefault();
|
|
14400
15039
|
const { stopSliderMovePropagation = true } = this.attribute;
|
|
14401
15040
|
if (stopSliderMovePropagation) {
|
|
14402
15041
|
e.stopPropagation();
|
|
@@ -14410,7 +15049,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
14410
15049
|
? this._onSliderPointerMove
|
|
14411
15050
|
: delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
|
|
14412
15051
|
this._onSliderPointerUp = (e) => {
|
|
14413
|
-
e.preventDefault();
|
|
14414
15052
|
const { range: preRange, limitRange = [0, 1] } = this.attribute;
|
|
14415
15053
|
const preScrollRange = this.getScrollRange();
|
|
14416
15054
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
@@ -14419,15 +15057,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14419
15057
|
pre: preRange,
|
|
14420
15058
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
14421
15059
|
});
|
|
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
|
-
}
|
|
15060
|
+
this._clearDragEvents();
|
|
14431
15061
|
};
|
|
14432
15062
|
}
|
|
14433
15063
|
setScrollRange(range, render = true) {
|
|
@@ -14560,6 +15190,14 @@ class ScrollBar extends AbstractComponent {
|
|
|
14560
15190
|
? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
|
|
14561
15191
|
: clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
14562
15192
|
}
|
|
15193
|
+
_clearDragEvents() {
|
|
15194
|
+
const triggers = getEndTriggersOfDrag();
|
|
15195
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15196
|
+
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
|
|
15197
|
+
triggers.forEach((trigger) => {
|
|
15198
|
+
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15199
|
+
});
|
|
15200
|
+
}
|
|
14563
15201
|
_reset() {
|
|
14564
15202
|
this._sliderRenderBounds = null;
|
|
14565
15203
|
this._sliderLimitRange = null;
|
|
@@ -16861,24 +17499,17 @@ function getPolygonPath(points, closed) {
|
|
|
16861
17499
|
}
|
|
16862
17500
|
function textIntersect(textA, textB, sep) {
|
|
16863
17501
|
var _a;
|
|
16864
|
-
let a;
|
|
16865
|
-
let b;
|
|
16866
17502
|
const angle = (_a = textA.attribute) === null || _a === void 0 ? void 0 : _a.angle;
|
|
16867
17503
|
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
17504
|
if (isHorizontal) {
|
|
16874
|
-
return
|
|
17505
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16875
17506
|
}
|
|
16876
|
-
a = textA.OBBBounds;
|
|
16877
|
-
b = textB.OBBBounds;
|
|
17507
|
+
const a = textA.OBBBounds;
|
|
17508
|
+
const b = textB.OBBBounds;
|
|
16878
17509
|
if (!a || !b || a.empty() || b.empty()) {
|
|
16879
|
-
return
|
|
17510
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16880
17511
|
}
|
|
16881
|
-
return a.intersects(b);
|
|
17512
|
+
return a.intersects(b) || sep > obbSeparation(a, b);
|
|
16882
17513
|
}
|
|
16883
17514
|
function hasOverlap(items, pad) {
|
|
16884
17515
|
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
@@ -16997,6 +17628,9 @@ class AxisBase extends AnimateComponent {
|
|
|
16997
17628
|
getBoundsWithoutRender(attributes) {
|
|
16998
17629
|
const currentAttribute = cloneDeep(this.attribute);
|
|
16999
17630
|
currentAttribute.scale = this.attribute.scale;
|
|
17631
|
+
if (isEqual(currentAttribute, this.attribute)) {
|
|
17632
|
+
return this.AABBBounds;
|
|
17633
|
+
}
|
|
17000
17634
|
merge(this.attribute, attributes);
|
|
17001
17635
|
const offscreenGroup = graphicCreator.group({
|
|
17002
17636
|
x: this.attribute.x,
|
|
@@ -17009,6 +17643,12 @@ class AxisBase extends AnimateComponent {
|
|
|
17009
17643
|
return offscreenGroup.AABBBounds;
|
|
17010
17644
|
}
|
|
17011
17645
|
render() {
|
|
17646
|
+
if (this.lastAttribute) {
|
|
17647
|
+
this.lastAttribute.scale = this.attribute.scale;
|
|
17648
|
+
}
|
|
17649
|
+
if (this.lastAttribute && isEqual(this.lastAttribute, this.attribute)) {
|
|
17650
|
+
return;
|
|
17651
|
+
}
|
|
17012
17652
|
this._prepare();
|
|
17013
17653
|
this._prevInnerView = this._innerView && getElMap(this._innerView);
|
|
17014
17654
|
this.removeAllChild(true);
|
|
@@ -18416,7 +19056,7 @@ class Animate {
|
|
|
18416
19056
|
stop(type) {
|
|
18417
19057
|
let step = this._firstStep;
|
|
18418
19058
|
for (; step;) step.stop(), step = step.next;
|
|
18419
|
-
this.status
|
|
19059
|
+
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));
|
|
18420
19060
|
}
|
|
18421
19061
|
release() {
|
|
18422
19062
|
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
|
|
@@ -18523,19 +19163,25 @@ class AnimateExecutor {
|
|
|
18523
19163
|
var _a, _b;
|
|
18524
19164
|
const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
|
|
18525
19165
|
startTime = this.resolveValue(params.startTime, void 0, 0),
|
|
18526
|
-
parsedParams =
|
|
19166
|
+
parsedParams = Object.assign({}, params);
|
|
18527
19167
|
parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
|
|
18528
19168
|
const oneByOne = this.resolveValue(params.oneByOne, child, !1);
|
|
18529
19169
|
if (isTimeline) {
|
|
18530
19170
|
const timeSlices = parsedParams.timeSlices;
|
|
18531
19171
|
isArray(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
|
|
18532
19172
|
let sliceTime = 0;
|
|
18533
|
-
parsedParams.timeSlices.
|
|
18534
|
-
|
|
19173
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
19174
|
+
const delay = this.resolveValue(slice.delay, child, 0),
|
|
19175
|
+
delayAfter = this.resolveValue(slice.delayAfter, child, 0),
|
|
19176
|
+
duration = this.resolveValue(slice.duration, child, 300);
|
|
19177
|
+
return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
|
|
19178
|
+
delay: delay,
|
|
19179
|
+
delayAfter: delayAfter,
|
|
19180
|
+
duration: duration
|
|
19181
|
+
});
|
|
18535
19182
|
});
|
|
18536
|
-
let oneByOneDelay = 0
|
|
18537
|
-
|
|
18538
|
-
oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay;
|
|
19183
|
+
let oneByOneDelay = 0;
|
|
19184
|
+
oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
|
|
18539
19185
|
let scale = 1;
|
|
18540
19186
|
if (totalTime) {
|
|
18541
19187
|
const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
|
|
@@ -18557,19 +19203,18 @@ class AnimateExecutor {
|
|
|
18557
19203
|
});
|
|
18558
19204
|
})
|
|
18559
19205
|
});
|
|
18560
|
-
}), parsedParams.
|
|
19206
|
+
}), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
|
|
18561
19207
|
} else {
|
|
18562
19208
|
const delay = this.resolveValue(params.delay, child, 0),
|
|
18563
19209
|
delayAfter = this.resolveValue(params.delayAfter, child, 0),
|
|
18564
19210
|
duration = this.resolveValue(params.duration, child, 300);
|
|
18565
|
-
let oneByOneDelay = 0
|
|
18566
|
-
|
|
18567
|
-
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"];
|
|
19211
|
+
let oneByOneDelay = 0;
|
|
19212
|
+
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"];
|
|
18568
19213
|
const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
|
|
18569
19214
|
if (parsedParams.customType = customType, totalTime) {
|
|
18570
19215
|
const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
|
|
18571
19216
|
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18572
|
-
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.
|
|
19217
|
+
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
|
|
18573
19218
|
}
|
|
18574
19219
|
}
|
|
18575
19220
|
return parsedParams;
|
|
@@ -18661,10 +19306,10 @@ class AnimateExecutor {
|
|
|
18661
19306
|
const animate = graphic.animate();
|
|
18662
19307
|
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
18663
19308
|
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
18664
|
-
this.applyTimeSliceToAnimate(slice, animate, graphic);
|
|
19309
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
18665
19310
|
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
18666
19311
|
}
|
|
18667
|
-
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
19312
|
+
applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
|
|
18668
19313
|
var _a, _b, _c, _d;
|
|
18669
19314
|
const {
|
|
18670
19315
|
effects: effects,
|
|
@@ -18690,7 +19335,7 @@ class AnimateExecutor {
|
|
|
18690
19335
|
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
18691
19336
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
18692
19337
|
customType = effect.customType;
|
|
18693
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters,
|
|
19338
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
18694
19339
|
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
18695
19340
|
}
|
|
18696
19341
|
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
@@ -18834,9 +19479,9 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18834
19479
|
const easing = this.easing;
|
|
18835
19480
|
const { config, lastScale, getTickCoord } = this.params;
|
|
18836
19481
|
let ratio = 1;
|
|
18837
|
-
|
|
19482
|
+
const currData = this.target.data;
|
|
19483
|
+
if (lastScale && getTickCoord && currData) {
|
|
18838
19484
|
ratio = 0.7;
|
|
18839
|
-
const currData = this.target.data;
|
|
18840
19485
|
const oldValue = lastScale.scale(currData.rawValue);
|
|
18841
19486
|
const point = getTickCoord(oldValue);
|
|
18842
19487
|
const newX = this.target.attribute.x;
|
|
@@ -18860,14 +19505,13 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18860
19505
|
}
|
|
18861
19506
|
class AxisUpdate extends AComponentAnimate {
|
|
18862
19507
|
onBind() {
|
|
18863
|
-
var _a;
|
|
18864
19508
|
const animator = createComponentAnimator(this.target);
|
|
18865
19509
|
this._animator = animator;
|
|
18866
19510
|
const duration = this.duration;
|
|
18867
19511
|
const easing = this.easing;
|
|
18868
19512
|
const { config, diffAttrs } = this.params;
|
|
18869
19513
|
animator.animate(this.target, {
|
|
18870
|
-
type:
|
|
19514
|
+
type: 'to',
|
|
18871
19515
|
to: Object.assign({}, diffAttrs),
|
|
18872
19516
|
duration,
|
|
18873
19517
|
easing,
|
|
@@ -21324,6 +21968,13 @@ class LabelBase extends AnimateComponent {
|
|
|
21324
21968
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
21325
21969
|
return;
|
|
21326
21970
|
}
|
|
21971
|
+
const markAttributeList = [];
|
|
21972
|
+
if (this._enableAnimation !== false) {
|
|
21973
|
+
this._baseMarks.forEach(mark => {
|
|
21974
|
+
markAttributeList.push(mark.attribute);
|
|
21975
|
+
mark.initAttributes(mark.getAttributes(true));
|
|
21976
|
+
});
|
|
21977
|
+
}
|
|
21327
21978
|
const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
|
|
21328
21979
|
let data = this.attribute.data;
|
|
21329
21980
|
if (isFunction(dataFilter)) {
|
|
@@ -21361,6 +22012,11 @@ class LabelBase extends AnimateComponent {
|
|
|
21361
22012
|
this._smartInvert(labels);
|
|
21362
22013
|
}
|
|
21363
22014
|
this._renderLabels(labels);
|
|
22015
|
+
if (this._enableAnimation !== false) {
|
|
22016
|
+
this._baseMarks.forEach((mark, index) => {
|
|
22017
|
+
mark.initAttributes(markAttributeList[index]);
|
|
22018
|
+
});
|
|
22019
|
+
}
|
|
21364
22020
|
}
|
|
21365
22021
|
_bindEvent(target) {
|
|
21366
22022
|
if (this.attribute.disableTriggerEvent) {
|
|
@@ -21703,8 +22359,14 @@ class LabelBase extends AnimateComponent {
|
|
|
21703
22359
|
return this.getRootNode().find(node => node.name === baseMarkGroupName, true);
|
|
21704
22360
|
}
|
|
21705
22361
|
getGraphicBounds(graphic, point = {}, position) {
|
|
22362
|
+
var _a;
|
|
21706
22363
|
if (graphic) {
|
|
21707
22364
|
if (graphic.attribute.visible !== false) {
|
|
22365
|
+
if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
|
|
22366
|
+
const clonedGraphic = graphic.clone();
|
|
22367
|
+
Object.assign(clonedGraphic.attribute, graphic.getAttributes(true));
|
|
22368
|
+
return clonedGraphic.AABBBounds;
|
|
22369
|
+
}
|
|
21708
22370
|
return graphic.AABBBounds;
|
|
21709
22371
|
}
|
|
21710
22372
|
const { x, y } = graphic.attribute;
|
|
@@ -21770,7 +22432,7 @@ class LabelBase extends AnimateComponent {
|
|
|
21770
22432
|
animation: Object.assign(Object.assign({}, enter), { type: 'labelEnter', selfOnly: true, customParameters: {
|
|
21771
22433
|
relatedGraphic,
|
|
21772
22434
|
relatedGraphics: this._idToGraphic,
|
|
21773
|
-
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : '
|
|
22435
|
+
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'fadeIn' })
|
|
21774
22436
|
} })
|
|
21775
22437
|
}
|
|
21776
22438
|
]));
|
|
@@ -23533,8 +24195,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23533
24195
|
end: 1
|
|
23534
24196
|
};
|
|
23535
24197
|
this._statePointToData = state => state;
|
|
24198
|
+
this._handleTouchMove = (e) => {
|
|
24199
|
+
if (this._activeState) {
|
|
24200
|
+
e.preventDefault();
|
|
24201
|
+
}
|
|
24202
|
+
};
|
|
23536
24203
|
this._onHandlerPointerDown = (e, tag) => {
|
|
23537
|
-
|
|
24204
|
+
this._clearDragEvents();
|
|
23538
24205
|
if (tag === 'start') {
|
|
23539
24206
|
this._activeTag = DataZoomActiveTag.startHandler;
|
|
23540
24207
|
this._activeItem = this._startHandlerMask;
|
|
@@ -23558,14 +24225,16 @@ class DataZoom extends AbstractComponent {
|
|
|
23558
24225
|
this._activeState = true;
|
|
23559
24226
|
this._activeCache.startPos = this.eventPosToStagePos(e);
|
|
23560
24227
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
23561
|
-
|
|
23562
|
-
|
|
23563
|
-
|
|
23564
|
-
}
|
|
24228
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24229
|
+
const triggers = getEndTriggersOfDrag();
|
|
24230
|
+
evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23565
24231
|
this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24232
|
+
triggers.forEach((trigger) => {
|
|
24233
|
+
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
24234
|
+
});
|
|
23566
24235
|
};
|
|
23567
24236
|
this._pointerMove = (e) => {
|
|
23568
|
-
e.
|
|
24237
|
+
e.preventDefault();
|
|
23569
24238
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
23570
24239
|
const pos = this.eventPosToStagePos(e);
|
|
23571
24240
|
const { attPos, max } = this._layoutCache;
|
|
@@ -23615,7 +24284,6 @@ class DataZoom extends AbstractComponent {
|
|
|
23615
24284
|
? this._pointerMove
|
|
23616
24285
|
: delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
|
|
23617
24286
|
this._onHandlerPointerUp = (e) => {
|
|
23618
|
-
e.preventDefault();
|
|
23619
24287
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
23620
24288
|
if (this._activeState) {
|
|
23621
24289
|
if (this._activeTag === DataZoomActiveTag.background) {
|
|
@@ -23630,12 +24298,7 @@ class DataZoom extends AbstractComponent {
|
|
|
23630
24298
|
end: this.state.end,
|
|
23631
24299
|
tag: this._activeTag
|
|
23632
24300
|
});
|
|
23633
|
-
|
|
23634
|
-
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23635
|
-
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
23636
|
-
}
|
|
23637
|
-
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23638
|
-
this.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
24301
|
+
this._clearDragEvents();
|
|
23639
24302
|
};
|
|
23640
24303
|
const { position, showDetail } = attributes;
|
|
23641
24304
|
this._activeCache.startPos = position;
|
|
@@ -23683,12 +24346,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23683
24346
|
if (this._selectedPreviewGroup) {
|
|
23684
24347
|
this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
|
|
23685
24348
|
}
|
|
23686
|
-
this.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
23687
|
-
this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
23688
24349
|
if (showDetail === 'auto') {
|
|
23689
24350
|
this.addEventListener('pointerenter', this._onHandlerPointerEnter);
|
|
23690
24351
|
this.addEventListener('pointerleave', this._onHandlerPointerLeave);
|
|
23691
24352
|
}
|
|
24353
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24354
|
+
passive: false
|
|
24355
|
+
});
|
|
23692
24356
|
}
|
|
23693
24357
|
dragMaskSize() {
|
|
23694
24358
|
const { position } = this.attribute;
|
|
@@ -23716,13 +24380,20 @@ class DataZoom extends AbstractComponent {
|
|
|
23716
24380
|
var _a, _b;
|
|
23717
24381
|
return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
23718
24382
|
}
|
|
24383
|
+
_clearDragEvents() {
|
|
24384
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24385
|
+
const triggers = getEndTriggersOfDrag();
|
|
24386
|
+
evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24387
|
+
triggers.forEach((trigger) => {
|
|
24388
|
+
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
24389
|
+
});
|
|
24390
|
+
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24391
|
+
}
|
|
23719
24392
|
_onHandlerPointerEnter(e) {
|
|
23720
|
-
e.stopPropagation();
|
|
23721
24393
|
this._showText = true;
|
|
23722
24394
|
this.renderText();
|
|
23723
24395
|
}
|
|
23724
24396
|
_onHandlerPointerLeave(e) {
|
|
23725
|
-
e.stopPropagation();
|
|
23726
24397
|
this._showText = false;
|
|
23727
24398
|
this.renderText();
|
|
23728
24399
|
}
|
|
@@ -24232,6 +24903,13 @@ class DataZoom extends AbstractComponent {
|
|
|
24232
24903
|
setStatePointToData(callback) {
|
|
24233
24904
|
isFunction(callback) && (this._statePointToData = callback);
|
|
24234
24905
|
}
|
|
24906
|
+
release(all) {
|
|
24907
|
+
super.release(all);
|
|
24908
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24909
|
+
passive: false
|
|
24910
|
+
});
|
|
24911
|
+
this._clearDragEvents();
|
|
24912
|
+
}
|
|
24235
24913
|
}
|
|
24236
24914
|
DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
24237
24915
|
|
|
@@ -24521,21 +25199,30 @@ function commonLineClipIn(line, label, duration, delay, easing) {
|
|
|
24521
25199
|
.to({ clipRange: 1 }, stepDuration, easing);
|
|
24522
25200
|
});
|
|
24523
25201
|
graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);
|
|
24524
|
-
|
|
24525
|
-
|
|
25202
|
+
array(label).forEach(labelNode => {
|
|
25203
|
+
const delayTime = delay + startSymbolDuration + lineDuration + endSymbolDuration;
|
|
25204
|
+
graphicFadeIn(labelNode.getTextShape(), delayTime, labelDuration, easing);
|
|
25205
|
+
graphicFadeIn(labelNode.getBgRect(), delayTime, labelDuration, easing);
|
|
25206
|
+
});
|
|
24526
25207
|
}
|
|
24527
25208
|
|
|
24528
25209
|
function commonLineFadeIn(line, label, duration, delay, easing) {
|
|
24529
25210
|
segmentFadeIn(line, delay, duration, easing);
|
|
24530
|
-
|
|
25211
|
+
array(label).forEach(labelNode => {
|
|
25212
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25213
|
+
});
|
|
24531
25214
|
}
|
|
24532
25215
|
function areaFadeIn(area, label, duration, delay, easing) {
|
|
24533
25216
|
graphicFadeIn(area, delay, duration, easing);
|
|
24534
|
-
|
|
25217
|
+
array(label).forEach(labelNode => {
|
|
25218
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25219
|
+
});
|
|
24535
25220
|
}
|
|
24536
25221
|
function arcAreaFadeIn(area, label, duration, delay, easing) {
|
|
24537
25222
|
graphicFadeIn(area, delay, duration, easing);
|
|
24538
|
-
|
|
25223
|
+
array(label).forEach(labelNode => {
|
|
25224
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25225
|
+
});
|
|
24539
25226
|
}
|
|
24540
25227
|
function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24541
25228
|
var _a;
|
|
@@ -24551,15 +25238,21 @@ function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
|
24551
25238
|
|
|
24552
25239
|
function commonLineFadeOut(line, label, duration, delay, easing) {
|
|
24553
25240
|
segmentFadeOut(line, delay, duration, easing);
|
|
24554
|
-
|
|
25241
|
+
array(label).forEach(labelNode => {
|
|
25242
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25243
|
+
});
|
|
24555
25244
|
}
|
|
24556
25245
|
function areaFadeOut(area, label, duration, delay, easing) {
|
|
24557
25246
|
graphicFadeOut(area, delay, duration, easing);
|
|
24558
|
-
|
|
25247
|
+
array(label).forEach(labelNode => {
|
|
25248
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25249
|
+
});
|
|
24559
25250
|
}
|
|
24560
25251
|
function arcAreaFadeOut(area, label, duration, delay, easing) {
|
|
24561
25252
|
graphicFadeOut(area, delay, duration, easing);
|
|
24562
|
-
|
|
25253
|
+
array(label).forEach(labelNode => {
|
|
25254
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25255
|
+
});
|
|
24563
25256
|
}
|
|
24564
25257
|
function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24565
25258
|
var _a;
|
|
@@ -24713,6 +25406,48 @@ const DefaultExitMarkerAnimation = {
|
|
|
24713
25406
|
delay: 0
|
|
24714
25407
|
};
|
|
24715
25408
|
|
|
25409
|
+
class MarkLabelMixin {
|
|
25410
|
+
getLabel() {
|
|
25411
|
+
return this._label;
|
|
25412
|
+
}
|
|
25413
|
+
_addMarkLabels(container, labelName, defaultLabelAttrs) {
|
|
25414
|
+
const { label, state } = this.attribute;
|
|
25415
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25416
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25417
|
+
const labelShapes = array(label).map((labelAttrs, index) => {
|
|
25418
|
+
var _a, _b;
|
|
25419
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labelAttrs);
|
|
25420
|
+
const markLabel = new Tag(Object.assign(Object.assign({}, finalLabelAttrs), { state: {
|
|
25421
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25422
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25423
|
+
} }));
|
|
25424
|
+
markLabel.name = labelName;
|
|
25425
|
+
container.add(markLabel);
|
|
25426
|
+
this.setLabelPos(markLabel, finalLabelAttrs);
|
|
25427
|
+
return markLabel;
|
|
25428
|
+
});
|
|
25429
|
+
this._label = array(labelShapes).length === 1 ? labelShapes[0] : labelShapes;
|
|
25430
|
+
}
|
|
25431
|
+
_updateMarkLabels(defaultLabelAttrs) {
|
|
25432
|
+
const { label, state } = this.attribute;
|
|
25433
|
+
const labelShapes = array(this._label);
|
|
25434
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25435
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25436
|
+
if (labelShapes.length) {
|
|
25437
|
+
const labels = array(label);
|
|
25438
|
+
labelShapes.forEach((labelItem, index) => {
|
|
25439
|
+
var _a, _b;
|
|
25440
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labels[index]);
|
|
25441
|
+
labelItem.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, finalLabelAttrs), { state: {
|
|
25442
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25443
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25444
|
+
} }));
|
|
25445
|
+
this.setLabelPos(labelItem, finalLabelAttrs);
|
|
25446
|
+
});
|
|
25447
|
+
}
|
|
25448
|
+
}
|
|
25449
|
+
}
|
|
25450
|
+
|
|
24716
25451
|
class MarkCommonLine extends Marker {
|
|
24717
25452
|
constructor() {
|
|
24718
25453
|
super(...arguments);
|
|
@@ -24723,20 +25458,17 @@ class MarkCommonLine extends Marker {
|
|
|
24723
25458
|
getLine() {
|
|
24724
25459
|
return this._line;
|
|
24725
25460
|
}
|
|
24726
|
-
|
|
24727
|
-
|
|
24728
|
-
|
|
24729
|
-
|
|
24730
|
-
const { label = {}, limitRect } = this.attribute;
|
|
24731
|
-
const { position, confine, autoRotate } = label;
|
|
24732
|
-
const labelPoint = this.getPointAttrByPosition(position);
|
|
25461
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25462
|
+
const { limitRect } = this.attribute;
|
|
25463
|
+
const { position, confine, autoRotate } = labelAttrs;
|
|
25464
|
+
const labelPoint = this.getPointAttrByPosition(position, labelAttrs);
|
|
24733
25465
|
const labelAngle = position.toString().toLocaleLowerCase().includes('start')
|
|
24734
25466
|
? this._line.getStartAngle() || 0
|
|
24735
25467
|
: this._line.getEndAngle() || 0;
|
|
24736
|
-
|
|
25468
|
+
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) }));
|
|
24737
25469
|
if (limitRect && confine) {
|
|
24738
25470
|
const { x, y, width, height } = limitRect;
|
|
24739
|
-
limitShapeInBounds(
|
|
25471
|
+
limitShapeInBounds(labelNode, {
|
|
24740
25472
|
x1: x,
|
|
24741
25473
|
y1: y,
|
|
24742
25474
|
x2: x + width,
|
|
@@ -24745,32 +25477,18 @@ class MarkCommonLine extends Marker {
|
|
|
24745
25477
|
}
|
|
24746
25478
|
}
|
|
24747
25479
|
initMarker(container) {
|
|
24748
|
-
const { label, state } = this.attribute;
|
|
24749
25480
|
const line = this.createSegment();
|
|
24750
25481
|
line.name = 'mark-common-line-line';
|
|
24751
25482
|
this._line = line;
|
|
24752
25483
|
container.add(line);
|
|
24753
|
-
|
|
24754
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24755
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24756
|
-
} }));
|
|
24757
|
-
markLabel.name = 'mark-common-line-label';
|
|
24758
|
-
this._label = markLabel;
|
|
24759
|
-
container.add(markLabel);
|
|
24760
|
-
this.setLabelPos();
|
|
25484
|
+
this.addMarkLineLabels(container);
|
|
24761
25485
|
}
|
|
24762
25486
|
updateMarker() {
|
|
24763
|
-
const { label, state } = this.attribute;
|
|
24764
25487
|
this.setLineAttributes();
|
|
24765
|
-
|
|
24766
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
24767
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24768
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24769
|
-
} }));
|
|
24770
|
-
this.setLabelPos();
|
|
24771
|
-
}
|
|
25488
|
+
this.updateMarkLineLabels();
|
|
24772
25489
|
}
|
|
24773
25490
|
}
|
|
25491
|
+
mixin(MarkCommonLine, MarkLabelMixin);
|
|
24774
25492
|
|
|
24775
25493
|
const FUZZY_EQUAL_DELTA = 0.001;
|
|
24776
25494
|
const DEFAULT_MARK_LINE_THEME = {
|
|
@@ -24959,6 +25677,7 @@ const DEFAULT_MARK_ARC_LINE_THEME = {
|
|
|
24959
25677
|
lineWidth: 0
|
|
24960
25678
|
},
|
|
24961
25679
|
label: {
|
|
25680
|
+
autoRotate: true,
|
|
24962
25681
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
24963
25682
|
refX: 0,
|
|
24964
25683
|
refY: 0,
|
|
@@ -25013,6 +25732,7 @@ const DEFAULT_MARK_AREA_THEME = {
|
|
|
25013
25732
|
const DEFAULT_MARK_ARC_AREA_THEME = {
|
|
25014
25733
|
interactive: true,
|
|
25015
25734
|
label: {
|
|
25735
|
+
autoRotate: true,
|
|
25016
25736
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
25017
25737
|
textStyle: {
|
|
25018
25738
|
fill: '#fff',
|
|
@@ -25271,10 +25991,9 @@ class MarkLine extends MarkCommonLine {
|
|
|
25271
25991
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkLine.defaultAttributes, attributes));
|
|
25272
25992
|
this.name = 'markLine';
|
|
25273
25993
|
}
|
|
25274
|
-
getPointAttrByPosition(position) {
|
|
25994
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
25275
25995
|
var _a;
|
|
25276
|
-
const {
|
|
25277
|
-
const { refX = 0, refY = 0 } = label;
|
|
25996
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25278
25997
|
const points = this._line.getMainSegmentPoints();
|
|
25279
25998
|
const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
25280
25999
|
const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
|
|
@@ -25306,10 +26025,10 @@ class MarkLine extends MarkCommonLine {
|
|
|
25306
26025
|
angle: labelAngle
|
|
25307
26026
|
};
|
|
25308
26027
|
}
|
|
25309
|
-
getRotateByAngle(angle) {
|
|
26028
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25310
26029
|
var _a;
|
|
25311
26030
|
const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
|
|
25312
|
-
return itemAngle + ((_a =
|
|
26031
|
+
return itemAngle + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25313
26032
|
}
|
|
25314
26033
|
getTextStyle(position, labelAngle, autoRotate) {
|
|
25315
26034
|
if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
|
|
@@ -25380,6 +26099,12 @@ class MarkLine extends MarkCommonLine {
|
|
|
25380
26099
|
});
|
|
25381
26100
|
return validFlag;
|
|
25382
26101
|
}
|
|
26102
|
+
addMarkLineLabels(container) {
|
|
26103
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkLine.defaultAttributes.label);
|
|
26104
|
+
}
|
|
26105
|
+
updateMarkLineLabels() {
|
|
26106
|
+
this._updateMarkLabels(MarkLine.defaultAttributes.label);
|
|
26107
|
+
}
|
|
25383
26108
|
}
|
|
25384
26109
|
MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
|
|
25385
26110
|
|
|
@@ -25396,9 +26121,6 @@ class MarkArea extends Marker {
|
|
|
25396
26121
|
getArea() {
|
|
25397
26122
|
return this._area;
|
|
25398
26123
|
}
|
|
25399
|
-
getLabel() {
|
|
25400
|
-
return this._label;
|
|
25401
|
-
}
|
|
25402
26124
|
constructor(attributes, options) {
|
|
25403
26125
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArea.defaultAttributes, attributes));
|
|
25404
26126
|
this.name = 'markArea';
|
|
@@ -25425,16 +26147,15 @@ class MarkArea extends Marker {
|
|
|
25425
26147
|
}
|
|
25426
26148
|
return result;
|
|
25427
26149
|
}
|
|
25428
|
-
setLabelPos() {
|
|
26150
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25429
26151
|
var _a;
|
|
25430
|
-
if (this.
|
|
25431
|
-
const
|
|
25432
|
-
const labelPosition = (_a = label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
26152
|
+
if (this._area) {
|
|
26153
|
+
const labelPosition = (_a = labelAttrs.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
25433
26154
|
const labelPoint = this.getPointAttrByPosition(labelPosition);
|
|
25434
|
-
|
|
25435
|
-
if (this.attribute.limitRect &&
|
|
26155
|
+
labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
|
|
26156
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25436
26157
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25437
|
-
limitShapeInBounds(
|
|
26158
|
+
limitShapeInBounds(labelNode, {
|
|
25438
26159
|
x1: x,
|
|
25439
26160
|
y1: y,
|
|
25440
26161
|
x2: x + width,
|
|
@@ -25444,34 +26165,21 @@ class MarkArea extends Marker {
|
|
|
25444
26165
|
}
|
|
25445
26166
|
}
|
|
25446
26167
|
initMarker(container) {
|
|
25447
|
-
const { points,
|
|
26168
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25448
26169
|
const area = graphicCreator.polygon(Object.assign({ points: points }, areaStyle));
|
|
25449
26170
|
area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25450
26171
|
area.name = 'mark-area-polygon';
|
|
25451
26172
|
this._area = area;
|
|
25452
26173
|
container.add(area);
|
|
25453
|
-
|
|
25454
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25455
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25456
|
-
} }));
|
|
25457
|
-
markLabel.name = 'mark-area-label';
|
|
25458
|
-
this._label = markLabel;
|
|
25459
|
-
container.add(markLabel);
|
|
25460
|
-
this.setLabelPos();
|
|
26174
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArea.defaultAttributes.label);
|
|
25461
26175
|
}
|
|
25462
26176
|
updateMarker() {
|
|
25463
|
-
const { points,
|
|
26177
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25464
26178
|
if (this._area) {
|
|
25465
26179
|
this._area.setAttributes(Object.assign({ points: points }, areaStyle));
|
|
25466
26180
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25467
26181
|
}
|
|
25468
|
-
|
|
25469
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25470
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25471
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25472
|
-
} }));
|
|
25473
|
-
}
|
|
25474
|
-
this.setLabelPos();
|
|
26182
|
+
this._updateMarkLabels(MarkArea.defaultAttributes.label);
|
|
25475
26183
|
}
|
|
25476
26184
|
isValidPoints() {
|
|
25477
26185
|
const { points } = this.attribute;
|
|
@@ -25489,6 +26197,7 @@ class MarkArea extends Marker {
|
|
|
25489
26197
|
}
|
|
25490
26198
|
}
|
|
25491
26199
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
26200
|
+
mixin(MarkArea, MarkLabelMixin);
|
|
25492
26201
|
|
|
25493
26202
|
loadMarkArcLineComponent();
|
|
25494
26203
|
function registerMarkArcLineAnimate() {
|
|
@@ -25501,14 +26210,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25501
26210
|
}
|
|
25502
26211
|
}
|
|
25503
26212
|
constructor(attributes, options) {
|
|
25504
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25505
|
-
? attributes
|
|
25506
|
-
: merge({}, MarkArcLine.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26213
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));
|
|
25507
26214
|
this.name = 'markArcLine';
|
|
25508
26215
|
}
|
|
25509
|
-
getPointAttrByPosition(direction) {
|
|
25510
|
-
const { center, radius, startAngle, endAngle
|
|
25511
|
-
const { refX = 0, refY = 0 } =
|
|
26216
|
+
getPointAttrByPosition(direction, labelAttrs) {
|
|
26217
|
+
const { center, radius, startAngle, endAngle } = this.attribute;
|
|
26218
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25512
26219
|
let angle;
|
|
25513
26220
|
switch (direction) {
|
|
25514
26221
|
case IMarkCommonArcLabelPosition.arcInnerStart:
|
|
@@ -25540,9 +26247,9 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25540
26247
|
getTextStyle(position) {
|
|
25541
26248
|
return DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[position];
|
|
25542
26249
|
}
|
|
25543
|
-
getRotateByAngle(angle) {
|
|
26250
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25544
26251
|
var _a;
|
|
25545
|
-
return angle - Math.PI / 2 + ((_a =
|
|
26252
|
+
return angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25546
26253
|
}
|
|
25547
26254
|
createSegment() {
|
|
25548
26255
|
const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this
|
|
@@ -25585,6 +26292,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25585
26292
|
isValidPoints() {
|
|
25586
26293
|
return true;
|
|
25587
26294
|
}
|
|
26295
|
+
addMarkLineLabels(container) {
|
|
26296
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkArcLine.defaultAttributes.label);
|
|
26297
|
+
}
|
|
26298
|
+
updateMarkLineLabels() {
|
|
26299
|
+
this._updateMarkLabels(MarkArcLine.defaultAttributes.label);
|
|
26300
|
+
}
|
|
25588
26301
|
}
|
|
25589
26302
|
MarkArcLine.defaultAttributes = DEFAULT_MARK_ARC_LINE_THEME;
|
|
25590
26303
|
|
|
@@ -25601,20 +26314,15 @@ class MarkArcArea extends Marker {
|
|
|
25601
26314
|
getArea() {
|
|
25602
26315
|
return this._area;
|
|
25603
26316
|
}
|
|
25604
|
-
getLabel() {
|
|
25605
|
-
return this._label;
|
|
25606
|
-
}
|
|
25607
26317
|
constructor(attributes, options) {
|
|
25608
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25609
|
-
? attributes
|
|
25610
|
-
: merge({}, MarkArcArea.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26318
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));
|
|
25611
26319
|
this.name = 'markArcArea';
|
|
25612
26320
|
this.defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;
|
|
25613
26321
|
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
25614
26322
|
}
|
|
25615
|
-
getPointAttrByPosition(position) {
|
|
25616
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle
|
|
25617
|
-
const { refX = 0, refY = 0 } =
|
|
26323
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
26324
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute;
|
|
26325
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25618
26326
|
let radius;
|
|
25619
26327
|
let angle;
|
|
25620
26328
|
switch (position) {
|
|
@@ -25658,16 +26366,15 @@ class MarkArcArea extends Marker {
|
|
|
25658
26366
|
angle
|
|
25659
26367
|
};
|
|
25660
26368
|
}
|
|
25661
|
-
setLabelPos() {
|
|
26369
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25662
26370
|
var _a;
|
|
25663
|
-
if (this.
|
|
25664
|
-
const {
|
|
25665
|
-
const
|
|
25666
|
-
|
|
25667
|
-
this.
|
|
25668
|
-
if (this.attribute.limitRect && label.confine) {
|
|
26371
|
+
if (this._area) {
|
|
26372
|
+
const { position: labelPosition = 'arcInnerMiddle', autoRotate } = labelAttrs;
|
|
26373
|
+
const labelAttr = this.getPointAttrByPosition(labelPosition, labelAttrs);
|
|
26374
|
+
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) }));
|
|
26375
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25669
26376
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25670
|
-
limitShapeInBounds(
|
|
26377
|
+
limitShapeInBounds(labelNode, {
|
|
25671
26378
|
x1: x,
|
|
25672
26379
|
y1: y,
|
|
25673
26380
|
x2: x + width,
|
|
@@ -25677,7 +26384,7 @@ class MarkArcArea extends Marker {
|
|
|
25677
26384
|
}
|
|
25678
26385
|
}
|
|
25679
26386
|
initMarker(container) {
|
|
25680
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle,
|
|
26387
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, state } = this
|
|
25681
26388
|
.attribute;
|
|
25682
26389
|
const area = graphicCreator.arc(Object.assign({ x: center.x, y: center.y, innerRadius,
|
|
25683
26390
|
outerRadius,
|
|
@@ -25687,14 +26394,7 @@ class MarkArcArea extends Marker {
|
|
|
25687
26394
|
area.name = 'polar-mark-area-area';
|
|
25688
26395
|
this._area = area;
|
|
25689
26396
|
container.add(area);
|
|
25690
|
-
|
|
25691
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25692
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25693
|
-
} }));
|
|
25694
|
-
markLabel.name = 'mark-area-label';
|
|
25695
|
-
this._label = markLabel;
|
|
25696
|
-
container.add(markLabel);
|
|
25697
|
-
this.setLabelPos();
|
|
26397
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArcArea.defaultAttributes.label);
|
|
25698
26398
|
}
|
|
25699
26399
|
updateMarker() {
|
|
25700
26400
|
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
|
|
@@ -25706,19 +26406,14 @@ class MarkArcArea extends Marker {
|
|
|
25706
26406
|
endAngle }, areaStyle));
|
|
25707
26407
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25708
26408
|
}
|
|
25709
|
-
|
|
25710
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25711
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25712
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25713
|
-
} }));
|
|
25714
|
-
this.setLabelPos();
|
|
25715
|
-
}
|
|
26409
|
+
this._updateMarkLabels(MarkArcArea.defaultAttributes.label);
|
|
25716
26410
|
}
|
|
25717
26411
|
isValidPoints() {
|
|
25718
26412
|
return true;
|
|
25719
26413
|
}
|
|
25720
26414
|
}
|
|
25721
26415
|
MarkArcArea.defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;
|
|
26416
|
+
mixin(MarkArcArea, MarkLabelMixin);
|
|
25722
26417
|
|
|
25723
26418
|
loadMarkPointComponent();
|
|
25724
26419
|
function registerMarkPointAnimate() {
|
|
@@ -27739,28 +28434,21 @@ class Slider extends AbstractComponent {
|
|
|
27739
28434
|
this._dispatchTooltipEvent('sliderTooltipHide');
|
|
27740
28435
|
};
|
|
27741
28436
|
this._onHandlerPointerdown = (e) => {
|
|
27742
|
-
|
|
28437
|
+
this._clearAllDragEvents();
|
|
27743
28438
|
this._isChanging = true;
|
|
27744
28439
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27745
28440
|
this._currentHandler = e.target;
|
|
27746
28441
|
this._prePos = this._isHorizontal ? x : y;
|
|
27747
|
-
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
}
|
|
27753
|
-
else {
|
|
27754
|
-
this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27755
|
-
capture: true
|
|
27756
|
-
});
|
|
27757
|
-
this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27758
|
-
this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27759
|
-
}
|
|
28442
|
+
const triggers = getEndTriggersOfDrag();
|
|
28443
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28444
|
+
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28445
|
+
triggers.forEach((trigger) => {
|
|
28446
|
+
obj.addEventListener(trigger, this._onHandlerPointerUp);
|
|
28447
|
+
});
|
|
27760
28448
|
};
|
|
27761
28449
|
this._onHandlerPointerMove = (e) => {
|
|
27762
28450
|
var _a, _b;
|
|
27763
|
-
e.
|
|
28451
|
+
e.preventDefault();
|
|
27764
28452
|
this._isChanging = true;
|
|
27765
28453
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27766
28454
|
if (max === min) {
|
|
@@ -27796,44 +28484,29 @@ class Slider extends AbstractComponent {
|
|
|
27796
28484
|
this._dispatchChangeEvent();
|
|
27797
28485
|
};
|
|
27798
28486
|
this._onHandlerPointerUp = (e) => {
|
|
27799
|
-
e.preventDefault();
|
|
27800
28487
|
this._isChanging = false;
|
|
27801
28488
|
this._currentHandler = null;
|
|
27802
|
-
|
|
27803
|
-
|
|
27804
|
-
|
|
27805
|
-
|
|
27806
|
-
|
|
27807
|
-
}
|
|
27808
|
-
else {
|
|
27809
|
-
this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27810
|
-
capture: true
|
|
27811
|
-
});
|
|
27812
|
-
this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27813
|
-
this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
28489
|
+
this._clearAllDragEvents();
|
|
28490
|
+
};
|
|
28491
|
+
this._handleTouchMove = (e) => {
|
|
28492
|
+
if (this._isChanging) {
|
|
28493
|
+
e.preventDefault();
|
|
27814
28494
|
}
|
|
27815
28495
|
};
|
|
27816
28496
|
this._onTrackPointerdown = (e) => {
|
|
27817
|
-
|
|
28497
|
+
this._clearAllDragEvents();
|
|
27818
28498
|
this._isChanging = true;
|
|
27819
28499
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27820
28500
|
this._prePos = this._isHorizontal ? x : y;
|
|
27821
|
-
|
|
27822
|
-
|
|
27823
|
-
|
|
27824
|
-
|
|
27825
|
-
|
|
27826
|
-
}
|
|
27827
|
-
else {
|
|
27828
|
-
this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27829
|
-
capture: true
|
|
27830
|
-
});
|
|
27831
|
-
this.stage.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27832
|
-
this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27833
|
-
}
|
|
28501
|
+
const triggers = getEndTriggersOfDrag();
|
|
28502
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28503
|
+
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28504
|
+
triggers.forEach((trigger) => {
|
|
28505
|
+
obj.addEventListener(trigger, this._onTrackPointerUp);
|
|
28506
|
+
});
|
|
27834
28507
|
};
|
|
27835
28508
|
this._onTrackPointerMove = (e) => {
|
|
27836
|
-
e.
|
|
28509
|
+
e.preventDefault();
|
|
27837
28510
|
this._isChanging = true;
|
|
27838
28511
|
const { railWidth, railHeight, min, max, inverse } = this.attribute;
|
|
27839
28512
|
if (max === min) {
|
|
@@ -27885,24 +28558,11 @@ class Slider extends AbstractComponent {
|
|
|
27885
28558
|
this._dispatchChangeEvent();
|
|
27886
28559
|
};
|
|
27887
28560
|
this._onTrackPointerUp = (e) => {
|
|
27888
|
-
e.preventDefault();
|
|
27889
28561
|
this._isChanging = false;
|
|
27890
|
-
|
|
27891
|
-
vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27892
|
-
capture: true
|
|
27893
|
-
});
|
|
27894
|
-
vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27895
|
-
}
|
|
27896
|
-
else {
|
|
27897
|
-
this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27898
|
-
capture: true
|
|
27899
|
-
});
|
|
27900
|
-
this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27901
|
-
this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27902
|
-
}
|
|
28562
|
+
this._clearAllDragEvents();
|
|
27903
28563
|
};
|
|
27904
28564
|
this._onRailPointerDown = (e) => {
|
|
27905
|
-
|
|
28565
|
+
this._clearAllDragEvents();
|
|
27906
28566
|
this._isChanging = true;
|
|
27907
28567
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27908
28568
|
if (max === min) {
|
|
@@ -28280,6 +28940,9 @@ class Slider extends AbstractComponent {
|
|
|
28280
28940
|
this._track.addEventListener('pointerdown', this._onTrackPointerdown);
|
|
28281
28941
|
}
|
|
28282
28942
|
this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
|
|
28943
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
28944
|
+
passive: false
|
|
28945
|
+
});
|
|
28283
28946
|
}
|
|
28284
28947
|
}
|
|
28285
28948
|
_bindTooltipEvents() {
|
|
@@ -28290,6 +28953,18 @@ class Slider extends AbstractComponent {
|
|
|
28290
28953
|
this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
|
|
28291
28954
|
this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
|
|
28292
28955
|
}
|
|
28956
|
+
_clearAllDragEvents() {
|
|
28957
|
+
const triggers = getEndTriggersOfDrag();
|
|
28958
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28959
|
+
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28960
|
+
triggers.forEach((trigger) => {
|
|
28961
|
+
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
28962
|
+
});
|
|
28963
|
+
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28964
|
+
triggers.forEach((trigger) => {
|
|
28965
|
+
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
28966
|
+
});
|
|
28967
|
+
}
|
|
28293
28968
|
_updateTrack() {
|
|
28294
28969
|
const { inverse, railWidth, railHeight } = this.attribute;
|
|
28295
28970
|
const startHandler = this._startHandler;
|
|
@@ -28430,6 +29105,13 @@ class Slider extends AbstractComponent {
|
|
|
28430
29105
|
endHandler
|
|
28431
29106
|
};
|
|
28432
29107
|
}
|
|
29108
|
+
release(all) {
|
|
29109
|
+
super.release(all);
|
|
29110
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
29111
|
+
passive: false
|
|
29112
|
+
});
|
|
29113
|
+
this._clearAllDragEvents();
|
|
29114
|
+
}
|
|
28433
29115
|
}
|
|
28434
29116
|
Slider.defaultAttributes = {
|
|
28435
29117
|
slidable: true,
|
|
@@ -30123,13 +30805,14 @@ var IOperateType;
|
|
|
30123
30805
|
IOperateType["moving"] = "moving";
|
|
30124
30806
|
IOperateType["moveStart"] = "moveStart";
|
|
30125
30807
|
IOperateType["moveEnd"] = "moveEnd";
|
|
30808
|
+
IOperateType["brushActive"] = "brushActive";
|
|
30126
30809
|
IOperateType["brushClear"] = "brushClear";
|
|
30127
30810
|
})(IOperateType || (IOperateType = {}));
|
|
30128
30811
|
|
|
30129
30812
|
const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
30130
30813
|
trigger: 'pointerdown',
|
|
30131
30814
|
updateTrigger: 'pointermove',
|
|
30132
|
-
endTrigger: 'pointerup',
|
|
30815
|
+
endTrigger: ['pointerup', 'pointerleave'],
|
|
30133
30816
|
resetTrigger: 'pointerupoutside',
|
|
30134
30817
|
hasMask: true,
|
|
30135
30818
|
brushMode: 'single',
|
|
@@ -30145,10 +30828,10 @@ const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
|
30145
30828
|
delayType: 'throttle',
|
|
30146
30829
|
delayTime: 10,
|
|
30147
30830
|
interactiveRange: {
|
|
30148
|
-
|
|
30149
|
-
|
|
30150
|
-
|
|
30151
|
-
|
|
30831
|
+
minY: -Infinity,
|
|
30832
|
+
maxY: Infinity,
|
|
30833
|
+
minX: -Infinity,
|
|
30834
|
+
maxX: Infinity
|
|
30152
30835
|
}
|
|
30153
30836
|
};
|
|
30154
30837
|
const DEFAULT_SIZE_THRESHOLD = 5;
|
|
@@ -30169,145 +30852,87 @@ class Brush extends AbstractComponent {
|
|
|
30169
30852
|
this.name = 'brush';
|
|
30170
30853
|
this._activeDrawState = false;
|
|
30171
30854
|
this._cacheDrawPoints = [];
|
|
30172
|
-
this._isDrawedBeforeEnd = false;
|
|
30173
|
-
this._isDownBeforeUpOutside = false;
|
|
30174
30855
|
this._activeMoveState = false;
|
|
30175
30856
|
this._operatingMaskMoveDx = 0;
|
|
30176
30857
|
this._operatingMaskMoveDy = 0;
|
|
30177
30858
|
this._operatingMaskMoveRangeX = [-Infinity, Infinity];
|
|
30178
30859
|
this._operatingMaskMoveRangeY = [-Infinity, Infinity];
|
|
30179
30860
|
this._brushMaskAABBBoundsDict = {};
|
|
30861
|
+
this._firstUpdate = true;
|
|
30180
30862
|
this._onBrushStart = (e) => {
|
|
30181
|
-
var _a;
|
|
30182
30863
|
if (this._outOfInteractiveRange(e)) {
|
|
30183
|
-
this.
|
|
30864
|
+
if (!this._isEmptyMask()) {
|
|
30865
|
+
this._clearMask();
|
|
30866
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30867
|
+
}
|
|
30184
30868
|
return;
|
|
30185
30869
|
}
|
|
30870
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
|
|
30871
|
+
array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
|
|
30872
|
+
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30186
30873
|
e.stopPropagation();
|
|
30187
|
-
|
|
30874
|
+
this._firstUpdate = true;
|
|
30188
30875
|
this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
|
|
30189
30876
|
this._activeDrawState = !this._activeMoveState;
|
|
30190
|
-
this.
|
|
30191
|
-
this.
|
|
30877
|
+
this._startPos = this.eventPosToStagePos(e);
|
|
30878
|
+
this._cacheDrawPoints = [this._startPos];
|
|
30192
30879
|
};
|
|
30193
30880
|
this._onBrushing = (e) => {
|
|
30194
30881
|
if (this._outOfInteractiveRange(e)) {
|
|
30195
30882
|
return;
|
|
30196
30883
|
}
|
|
30197
|
-
|
|
30198
|
-
|
|
30884
|
+
e.stopPropagation();
|
|
30885
|
+
if (this._firstUpdate) {
|
|
30886
|
+
this._activeDrawState && this._initDraw(e);
|
|
30887
|
+
this._activeMoveState && this._initMove(e);
|
|
30888
|
+
this._firstUpdate = false;
|
|
30889
|
+
}
|
|
30890
|
+
else {
|
|
30891
|
+
this._activeDrawState && this._drawing(e);
|
|
30892
|
+
this._activeMoveState && this._moving(e);
|
|
30199
30893
|
}
|
|
30200
|
-
this._activeDrawState && this._drawing(e);
|
|
30201
|
-
this._activeMoveState && this._moving(e);
|
|
30202
30894
|
};
|
|
30203
30895
|
this._onBrushingWithDelay = this.attribute.delayTime === 0
|
|
30204
30896
|
? this._onBrushing
|
|
30205
30897
|
: delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);
|
|
30206
30898
|
this._onBrushEnd = (e) => {
|
|
30207
|
-
|
|
30208
|
-
if (!this._activeDrawState && !this._activeMoveState) {
|
|
30209
|
-
return;
|
|
30210
|
-
}
|
|
30899
|
+
this._releaseBrushUpdateEvents();
|
|
30211
30900
|
e.preventDefault();
|
|
30212
|
-
|
|
30213
|
-
|
|
30214
|
-
if ((_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds.empty()) {
|
|
30215
|
-
this._dispatchEvent(IOperateType.brushClear, {
|
|
30216
|
-
operateMask: this._operatingMask,
|
|
30217
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30218
|
-
event: e
|
|
30219
|
-
});
|
|
30220
|
-
}
|
|
30221
|
-
this._container.incrementalClearChild();
|
|
30222
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30223
|
-
}
|
|
30224
|
-
else {
|
|
30225
|
-
if (this._activeDrawState) {
|
|
30226
|
-
this._dispatchEvent(IOperateType.drawEnd, {
|
|
30227
|
-
operateMask: this._operatingMask,
|
|
30228
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30229
|
-
event: e
|
|
30230
|
-
});
|
|
30231
|
-
}
|
|
30232
|
-
if (this._activeMoveState) {
|
|
30233
|
-
this._dispatchEvent(IOperateType.moveEnd, {
|
|
30234
|
-
operateMask: this._operatingMask,
|
|
30235
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30236
|
-
event: e
|
|
30237
|
-
});
|
|
30238
|
-
}
|
|
30239
|
-
}
|
|
30901
|
+
this._activeDrawState && this._drawEnd(e);
|
|
30902
|
+
this._activeMoveState && this._moveEnd(e);
|
|
30240
30903
|
this._activeDrawState = false;
|
|
30241
30904
|
this._activeMoveState = false;
|
|
30242
|
-
this._isDrawedBeforeEnd = false;
|
|
30243
|
-
if (this._operatingMask) {
|
|
30244
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30245
|
-
}
|
|
30246
30905
|
};
|
|
30247
30906
|
this._onBrushClear = (e) => {
|
|
30248
30907
|
e.preventDefault();
|
|
30249
|
-
|
|
30250
|
-
|
|
30251
|
-
this.
|
|
30252
|
-
operateMask: this._operatingMask,
|
|
30253
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30254
|
-
event: e
|
|
30255
|
-
});
|
|
30256
|
-
this._container.incrementalClearChild();
|
|
30257
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30908
|
+
if (!this._isEmptyMask()) {
|
|
30909
|
+
this._clearMask();
|
|
30910
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30258
30911
|
}
|
|
30259
30912
|
this._activeDrawState = false;
|
|
30260
30913
|
this._activeMoveState = false;
|
|
30261
|
-
this._isDrawedBeforeEnd = false;
|
|
30262
|
-
this._isDownBeforeUpOutside = false;
|
|
30263
|
-
if (this._operatingMask) {
|
|
30264
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30265
|
-
}
|
|
30266
30914
|
};
|
|
30267
30915
|
}
|
|
30268
30916
|
_bindBrushEvents() {
|
|
30917
|
+
this.releaseBrushEvents();
|
|
30269
30918
|
if (this.attribute.disableTriggerEvent) {
|
|
30270
30919
|
return;
|
|
30271
30920
|
}
|
|
30272
|
-
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
|
|
30273
|
-
|
|
30274
|
-
array(
|
|
30275
|
-
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30921
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
30922
|
+
.attribute;
|
|
30923
|
+
array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart));
|
|
30276
30924
|
array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
|
|
30277
30925
|
}
|
|
30278
|
-
_isPosInBrushMask(e) {
|
|
30279
|
-
const pos = this.eventPosToStagePos(e);
|
|
30280
|
-
const brushMasks = this._container.getChildren();
|
|
30281
|
-
for (let i = 0; i < brushMasks.length; i++) {
|
|
30282
|
-
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
30283
|
-
const pointsConsiderOffset = points.map((point) => {
|
|
30284
|
-
return {
|
|
30285
|
-
x: point.x + dx,
|
|
30286
|
-
y: point.y + dy
|
|
30287
|
-
};
|
|
30288
|
-
});
|
|
30289
|
-
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
30290
|
-
this._operatingMask = brushMasks[i];
|
|
30291
|
-
return true;
|
|
30292
|
-
}
|
|
30293
|
-
}
|
|
30294
|
-
return false;
|
|
30295
|
-
}
|
|
30296
30926
|
_initDraw(e) {
|
|
30297
30927
|
const { brushMode } = this.attribute;
|
|
30298
30928
|
const pos = this.eventPosToStagePos(e);
|
|
30299
|
-
this._cacheDrawPoints
|
|
30300
|
-
this.
|
|
30301
|
-
if (brushMode === 'single') {
|
|
30302
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30303
|
-
this._container.incrementalClearChild();
|
|
30304
|
-
}
|
|
30929
|
+
this._cacheDrawPoints.push(pos);
|
|
30930
|
+
brushMode === 'single' && this._clearMask();
|
|
30305
30931
|
this._addBrushMask();
|
|
30306
|
-
this.
|
|
30307
|
-
|
|
30308
|
-
|
|
30309
|
-
|
|
30310
|
-
});
|
|
30932
|
+
this._dispatchBrushEvent(IOperateType.drawStart, e);
|
|
30933
|
+
if (Object.keys(this._brushMaskAABBBoundsDict).length === 1) {
|
|
30934
|
+
this._dispatchBrushEvent(IOperateType.brushActive, e);
|
|
30935
|
+
}
|
|
30311
30936
|
}
|
|
30312
30937
|
_initMove(e) {
|
|
30313
30938
|
var _a, _b;
|
|
@@ -30324,16 +30949,12 @@ class Brush extends AbstractComponent {
|
|
|
30324
30949
|
this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
|
|
30325
30950
|
this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
|
|
30326
30951
|
this._operatingMask.setAttribute('pickable', true);
|
|
30327
|
-
this.
|
|
30328
|
-
operateMask: this._operatingMask,
|
|
30329
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30330
|
-
event: e
|
|
30331
|
-
});
|
|
30952
|
+
this._dispatchBrushEvent(IOperateType.moveStart, e);
|
|
30332
30953
|
}
|
|
30333
30954
|
_drawing(e) {
|
|
30334
|
-
var _a
|
|
30955
|
+
var _a;
|
|
30335
30956
|
const pos = this.eventPosToStagePos(e);
|
|
30336
|
-
const {
|
|
30957
|
+
const { brushType } = this.attribute;
|
|
30337
30958
|
const cacheLength = this._cacheDrawPoints.length;
|
|
30338
30959
|
if (cacheLength > 0) {
|
|
30339
30960
|
const lastPos = (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) !== null && _a !== void 0 ? _a : {};
|
|
@@ -30349,18 +30970,7 @@ class Brush extends AbstractComponent {
|
|
|
30349
30970
|
}
|
|
30350
30971
|
const maskPoints = this._computeMaskPoints();
|
|
30351
30972
|
this._operatingMask.setAttribute('points', maskPoints);
|
|
30352
|
-
|
|
30353
|
-
this._isDrawedBeforeEnd =
|
|
30354
|
-
!this._operatingMask._AABBBounds.empty() &&
|
|
30355
|
-
!!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
|
|
30356
|
-
if (this._isDrawedBeforeEnd) {
|
|
30357
|
-
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30358
|
-
this._dispatchEvent(IOperateType.drawing, {
|
|
30359
|
-
operateMask: this._operatingMask,
|
|
30360
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30361
|
-
event: e
|
|
30362
|
-
});
|
|
30363
|
-
}
|
|
30973
|
+
this._dispatchBrushEvent(IOperateType.drawing, e);
|
|
30364
30974
|
}
|
|
30365
30975
|
_moving(e) {
|
|
30366
30976
|
const startPos = this._cacheMovePoint;
|
|
@@ -30379,11 +30989,61 @@ class Brush extends AbstractComponent {
|
|
|
30379
30989
|
dy: moveY
|
|
30380
30990
|
});
|
|
30381
30991
|
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30382
|
-
this.
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30992
|
+
this._dispatchBrushEvent(IOperateType.moving, e);
|
|
30993
|
+
}
|
|
30994
|
+
_drawEnd(e) {
|
|
30995
|
+
const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
|
|
30996
|
+
if (this._outOfInteractiveRange(e)) {
|
|
30997
|
+
if (!this._isEmptyMask()) {
|
|
30998
|
+
this._clearMask();
|
|
30999
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31000
|
+
}
|
|
31001
|
+
}
|
|
31002
|
+
else {
|
|
31003
|
+
const { x: x1, y: y1 } = this._startPos;
|
|
31004
|
+
const { x: x2, y: y2 } = this.eventPosToStagePos(e);
|
|
31005
|
+
if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {
|
|
31006
|
+
if (!this._isEmptyMask()) {
|
|
31007
|
+
this._clearMask();
|
|
31008
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31009
|
+
}
|
|
31010
|
+
}
|
|
31011
|
+
else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {
|
|
31012
|
+
delete this._brushMaskAABBBoundsDict[this._operatingMask.name];
|
|
31013
|
+
this._container.setAttributes({});
|
|
31014
|
+
this._container.removeChild(this._operatingMask);
|
|
31015
|
+
if (this._isEmptyMask()) {
|
|
31016
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
31017
|
+
}
|
|
31018
|
+
}
|
|
31019
|
+
else {
|
|
31020
|
+
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
31021
|
+
this._dispatchBrushEvent(IOperateType.drawEnd, e);
|
|
31022
|
+
}
|
|
31023
|
+
}
|
|
31024
|
+
}
|
|
31025
|
+
_moveEnd(e) {
|
|
31026
|
+
if (this._operatingMask) {
|
|
31027
|
+
this._operatingMask.setAttribute('pickable', false);
|
|
31028
|
+
}
|
|
31029
|
+
this._dispatchBrushEvent(IOperateType.moveEnd, e);
|
|
31030
|
+
}
|
|
31031
|
+
render() {
|
|
31032
|
+
this._bindBrushEvents();
|
|
31033
|
+
const group = this.createOrUpdateChild('brush-container', {}, 'group');
|
|
31034
|
+
this._container = group;
|
|
31035
|
+
}
|
|
31036
|
+
releaseBrushEvents() {
|
|
31037
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
31038
|
+
.attribute;
|
|
31039
|
+
array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart));
|
|
31040
|
+
array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
|
|
31041
|
+
this._releaseBrushUpdateEvents();
|
|
31042
|
+
}
|
|
31043
|
+
_releaseBrushUpdateEvents() {
|
|
31044
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } = this.attribute;
|
|
31045
|
+
array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
|
|
31046
|
+
array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
|
|
30387
31047
|
}
|
|
30388
31048
|
_computeMaskPoints() {
|
|
30389
31049
|
const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
|
|
@@ -30452,12 +31112,30 @@ class Brush extends AbstractComponent {
|
|
|
30452
31112
|
_addBrushMask() {
|
|
30453
31113
|
var _a;
|
|
30454
31114
|
const { brushStyle, hasMask } = this.attribute;
|
|
30455
|
-
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 }));
|
|
31115
|
+
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 }));
|
|
30456
31116
|
brushMask.name = `brush-${Date.now()}`;
|
|
30457
31117
|
this._operatingMask = brushMask;
|
|
30458
31118
|
this._container.add(brushMask);
|
|
30459
31119
|
this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
|
|
30460
31120
|
}
|
|
31121
|
+
_isPosInBrushMask(e) {
|
|
31122
|
+
const pos = this.eventPosToStagePos(e);
|
|
31123
|
+
const brushMasks = this._container.getChildren();
|
|
31124
|
+
for (let i = 0; i < brushMasks.length; i++) {
|
|
31125
|
+
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
31126
|
+
const pointsConsiderOffset = points.map((point) => {
|
|
31127
|
+
return {
|
|
31128
|
+
x: point.x + dx,
|
|
31129
|
+
y: point.y + dy
|
|
31130
|
+
};
|
|
31131
|
+
});
|
|
31132
|
+
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
31133
|
+
this._operatingMask = brushMasks[i];
|
|
31134
|
+
return true;
|
|
31135
|
+
}
|
|
31136
|
+
}
|
|
31137
|
+
return false;
|
|
31138
|
+
}
|
|
30461
31139
|
_outOfInteractiveRange(e) {
|
|
30462
31140
|
const { interactiveRange } = this.attribute;
|
|
30463
31141
|
const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;
|
|
@@ -30470,17 +31148,21 @@ class Brush extends AbstractComponent {
|
|
|
30470
31148
|
eventPosToStagePos(e) {
|
|
30471
31149
|
return this.stage.eventPointTransform(e);
|
|
30472
31150
|
}
|
|
30473
|
-
|
|
30474
|
-
this.
|
|
30475
|
-
|
|
30476
|
-
|
|
31151
|
+
_dispatchBrushEvent(operateType, e) {
|
|
31152
|
+
this._dispatchEvent(operateType, {
|
|
31153
|
+
operateMask: this._operatingMask,
|
|
31154
|
+
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
31155
|
+
event: e
|
|
31156
|
+
});
|
|
30477
31157
|
}
|
|
30478
|
-
|
|
30479
|
-
|
|
30480
|
-
|
|
30481
|
-
|
|
30482
|
-
|
|
30483
|
-
|
|
31158
|
+
_clearMask() {
|
|
31159
|
+
this._brushMaskAABBBoundsDict = {};
|
|
31160
|
+
this._container.incrementalClearChild();
|
|
31161
|
+
this._operatingMask = null;
|
|
31162
|
+
}
|
|
31163
|
+
_isEmptyMask() {
|
|
31164
|
+
return (isEmpty(this._brushMaskAABBBoundsDict) ||
|
|
31165
|
+
Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty()));
|
|
30484
31166
|
}
|
|
30485
31167
|
}
|
|
30486
31168
|
Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
|
|
@@ -31782,10 +32464,10 @@ class Switch extends AbstractComponent {
|
|
|
31782
32464
|
});
|
|
31783
32465
|
this._circle.setAttributes({
|
|
31784
32466
|
y: circleY,
|
|
31785
|
-
x: this.attribute.checked ? circleX : maxWidth - circleX
|
|
32467
|
+
x: !this.attribute.checked ? circleX : maxWidth - circleX
|
|
31786
32468
|
});
|
|
31787
32469
|
this._text.setAttributes({
|
|
31788
|
-
x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
32470
|
+
x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
31789
32471
|
y: textY
|
|
31790
32472
|
});
|
|
31791
32473
|
}
|
|
@@ -31932,6 +32614,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31932
32614
|
theme: 'default'
|
|
31933
32615
|
};
|
|
31934
32616
|
|
|
31935
|
-
const version = "1.0.0-alpha.
|
|
32617
|
+
const version = "1.0.0-alpha.7";
|
|
31936
32618
|
|
|
31937
32619
|
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 };
|