@visactor/vrender-components 1.0.0-alpha.4 → 1.0.0-alpha.6
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/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 +1597 -923
- package/es/animation/axis-animate.js +4 -4
- package/es/animation/axis-animate.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 +4 -4
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,109 +5649,630 @@ 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
|
-
|
|
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
|
+
const full = "imprecise" === this.attribute.boundsMode;
|
|
6269
|
+
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
6270
|
+
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
6271
|
+
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
6272
|
+
const bounds = this.doUpdateAABBBounds(full);
|
|
6273
|
+
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
|
|
6274
|
+
}
|
|
6275
|
+
tryUpdateOBBBounds() {
|
|
5365
6276
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
5366
6277
|
if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(), this._OBBBounds;
|
|
5367
6278
|
return this.doUpdateOBBBounds();
|
|
@@ -5499,6 +6410,9 @@ class Graphic extends Node {
|
|
|
5499
6410
|
y: y
|
|
5500
6411
|
});
|
|
5501
6412
|
}
|
|
6413
|
+
setWidthHeightWithoutTransform(aabbBounds) {
|
|
6414
|
+
this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
|
|
6415
|
+
}
|
|
5502
6416
|
setAttributesAndPreventAnimate(params) {
|
|
5503
6417
|
let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
5504
6418
|
let context = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -5666,7 +6580,7 @@ class Graphic extends Node {
|
|
|
5666
6580
|
keys.forEach(key => {
|
|
5667
6581
|
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
|
|
5668
6582
|
});
|
|
5669
|
-
const stateAnimateConfig = null !== (_b = null !== (_a = this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
6583
|
+
const stateAnimateConfig = null !== (_b = null !== (_a = this.context && this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
|
|
5670
6584
|
this.applyAnimationState(["state"], [{
|
|
5671
6585
|
name: "state",
|
|
5672
6586
|
animation: {
|
|
@@ -5774,24 +6688,12 @@ class Graphic extends Node {
|
|
|
5774
6688
|
needUpdateLayout() {
|
|
5775
6689
|
return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
|
|
5776
6690
|
}
|
|
5777
|
-
getAnchor(anchor, params) {
|
|
6691
|
+
getAnchor(anchor, params, resetScale) {
|
|
5778
6692
|
const _anchor = [0, 0],
|
|
5779
6693
|
getBounds = () => {
|
|
5780
6694
|
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;
|
|
6695
|
+
const graphic = this.clone();
|
|
6696
|
+
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
6697
|
};
|
|
5796
6698
|
if ("string" == typeof anchor[0]) {
|
|
5797
6699
|
const ratio = parseFloat(anchor[0]) / 100,
|
|
@@ -5818,9 +6720,9 @@ class Graphic extends Node {
|
|
|
5818
6720
|
} = this.attribute;
|
|
5819
6721
|
let _anchor = [0, 0];
|
|
5820
6722
|
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 {
|
|
6723
|
+
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
6724
|
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, {
|
|
6725
|
+
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
6726
|
x: _anchor[0],
|
|
5825
6727
|
y: _anchor[1]
|
|
5826
6728
|
});
|
|
@@ -5938,6 +6840,15 @@ class Graphic extends Node {
|
|
|
5938
6840
|
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
6841
|
}
|
|
5940
6842
|
}
|
|
6843
|
+
toCustomPath() {
|
|
6844
|
+
var _a, _b, _c;
|
|
6845
|
+
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);
|
|
6846
|
+
if (renderer) {
|
|
6847
|
+
const context = new EmptyContext2d(null, 1);
|
|
6848
|
+
return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
|
|
6849
|
+
}
|
|
6850
|
+
return null;
|
|
6851
|
+
}
|
|
5941
6852
|
}
|
|
5942
6853
|
function backgroundNotImage(image) {
|
|
5943
6854
|
return !(!image.fill && !image.stroke);
|
|
@@ -6432,243 +7343,87 @@ function calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerR
|
|
|
6432
7343
|
limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1)), limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
|
|
6433
7344
|
}
|
|
6434
7345
|
}
|
|
6435
|
-
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
|
-
}))
|
|
7346
|
+
return {
|
|
7347
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
7348
|
+
xors: xors,
|
|
7349
|
+
yors: yors,
|
|
7350
|
+
xirs: xirs,
|
|
7351
|
+
yirs: yirs,
|
|
7352
|
+
xore: xore,
|
|
7353
|
+
yore: yore,
|
|
7354
|
+
xire: xire,
|
|
7355
|
+
yire: yire,
|
|
7356
|
+
limitedOcr: limitedOcr,
|
|
7357
|
+
limitedIcr: limitedIcr,
|
|
7358
|
+
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
7359
|
+
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
7360
|
+
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
7361
|
+
maxInnerCornerRadius: maxInnerCornerRadius,
|
|
7362
|
+
outerStartAngle: outerStartAngle,
|
|
7363
|
+
outerEndAngle: outerEndAngle,
|
|
7364
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7365
|
+
innerEndAngle: innerEndAngle,
|
|
7366
|
+
innerStartAngle: innerStartAngle,
|
|
7367
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7368
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd
|
|
6640
7369
|
};
|
|
6641
7370
|
}
|
|
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) {
|
|
7371
|
+
function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
|
|
6655
7372
|
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;
|
|
7373
|
+
startAngle: startAngle,
|
|
7374
|
+
endAngle: endAngle
|
|
7375
|
+
} = arc.getParsedAngle(),
|
|
7376
|
+
deltaAngle = abs(endAngle - startAngle),
|
|
7377
|
+
clockwise = endAngle > startAngle;
|
|
7378
|
+
let collapsedToLine = !1;
|
|
7379
|
+
if (outerRadius < innerRadius) {
|
|
7380
|
+
const temp = outerRadius;
|
|
7381
|
+
outerRadius = innerRadius, innerRadius = temp;
|
|
6670
7382
|
}
|
|
6671
|
-
|
|
7383
|
+
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 {
|
|
7384
|
+
const {
|
|
7385
|
+
outerDeltaAngle: outerDeltaAngle,
|
|
7386
|
+
xors: xors,
|
|
7387
|
+
yors: yors,
|
|
7388
|
+
xirs: xirs,
|
|
7389
|
+
yirs: yirs,
|
|
7390
|
+
limitedOcr: limitedOcr,
|
|
7391
|
+
outerCornerRadiusStart: outerCornerRadiusStart,
|
|
7392
|
+
outerCornerRadiusEnd: outerCornerRadiusEnd,
|
|
7393
|
+
maxOuterCornerRadius: maxOuterCornerRadius,
|
|
7394
|
+
xore: xore,
|
|
7395
|
+
yore: yore,
|
|
7396
|
+
xire: xire,
|
|
7397
|
+
yire: yire,
|
|
7398
|
+
outerStartAngle: outerStartAngle,
|
|
7399
|
+
outerEndAngle: outerEndAngle,
|
|
7400
|
+
limitedIcr: limitedIcr,
|
|
7401
|
+
innerDeltaAngle: innerDeltaAngle,
|
|
7402
|
+
innerEndAngle: innerEndAngle,
|
|
7403
|
+
innerStartAngle: innerStartAngle,
|
|
7404
|
+
innerCornerRadiusStart: innerCornerRadiusStart,
|
|
7405
|
+
innerCornerRadiusEnd: innerCornerRadiusEnd,
|
|
7406
|
+
maxInnerCornerRadius: maxInnerCornerRadius
|
|
7407
|
+
} = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
|
|
7408
|
+
if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
|
|
7409
|
+
const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
|
|
7410
|
+
cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
|
|
7411
|
+
t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
|
|
7412
|
+
t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
|
|
7413
|
+
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));
|
|
7414
|
+
} 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));
|
|
7415
|
+
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) {
|
|
7416
|
+
const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
|
|
7417
|
+
cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
|
|
7418
|
+
t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
|
|
7419
|
+
t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
|
|
7420
|
+
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) {
|
|
7421
|
+
const arcEndAngle = atan2(t1.y01, t1.x01);
|
|
7422
|
+
!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));
|
|
7423
|
+
} 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);
|
|
7424
|
+
} 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));
|
|
7425
|
+
}
|
|
7426
|
+
return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
|
|
6672
7427
|
}
|
|
6673
7428
|
|
|
6674
7429
|
const ArcRenderContribution = Symbol.for("ArcRenderContribution");
|
|
@@ -6691,146 +7446,6 @@ function textLayoutOffsetY(baseline, lineHeight, fontSize) {
|
|
|
6691
7446
|
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
7447
|
}
|
|
6693
7448
|
|
|
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
7449
|
var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
6835
7450
|
var d,
|
|
6836
7451
|
c = arguments.length,
|
|
@@ -7067,7 +7682,7 @@ class Circle extends Graphic {
|
|
|
7067
7682
|
tb1: tb1,
|
|
7068
7683
|
tb2: tb2
|
|
7069
7684
|
} = 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;
|
|
7685
|
+
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
7686
|
}
|
|
7072
7687
|
updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) {
|
|
7073
7688
|
const {
|
|
@@ -7091,12 +7706,13 @@ class Circle extends Graphic {
|
|
|
7091
7706
|
}
|
|
7092
7707
|
toCustomPath() {
|
|
7093
7708
|
var _a, _b, _c;
|
|
7709
|
+
let path = super.toCustomPath();
|
|
7710
|
+
if (path) return path;
|
|
7094
7711
|
const attribute = this.attribute,
|
|
7095
7712
|
radius = null !== (_a = attribute.radius) && void 0 !== _a ? _a : this.getDefaultAttribute("radius"),
|
|
7096
7713
|
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;
|
|
7714
|
+
endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle");
|
|
7715
|
+
return path = new CustomPath2D(), path.arc(0, 0, radius, startAngle, endAngle), path;
|
|
7100
7716
|
}
|
|
7101
7717
|
clone() {
|
|
7102
7718
|
return new Circle(Object.assign({}, this.attribute));
|
|
@@ -7317,7 +7933,7 @@ class Text extends Graphic {
|
|
|
7317
7933
|
const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
|
|
7318
7934
|
boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
|
|
7319
7935
|
}
|
|
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;
|
|
7936
|
+
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
7937
|
}
|
|
7322
7938
|
updateSingallineAABBBounds(text) {
|
|
7323
7939
|
this.updateMultilineAABBBounds([text]);
|
|
@@ -7842,7 +8458,7 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
7842
8458
|
tb1: tb1,
|
|
7843
8459
|
tb2: tb2
|
|
7844
8460
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
7845
|
-
updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
8461
|
+
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
8462
|
const {
|
|
7847
8463
|
lineJoin = symbolTheme.lineJoin
|
|
7848
8464
|
} = attribute;
|
|
@@ -7914,7 +8530,7 @@ let Line$1 = class Line extends Graphic {
|
|
|
7914
8530
|
return getTheme(this).line;
|
|
7915
8531
|
}
|
|
7916
8532
|
updateAABBBounds(attribute, lineTheme, aabbBounds) {
|
|
7917
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
8533
|
+
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
8534
|
const {
|
|
7919
8535
|
lineJoin = lineTheme.lineJoin
|
|
7920
8536
|
} = attribute;
|
|
@@ -7949,9 +8565,11 @@ let Line$1 = class Line extends Graphic {
|
|
|
7949
8565
|
return super.needUpdateTag(key, LINE_UPDATE_TAG_KEY);
|
|
7950
8566
|
}
|
|
7951
8567
|
toCustomPath() {
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
8568
|
+
let path = super.toCustomPath();
|
|
8569
|
+
if (path) return path;
|
|
8570
|
+
const attribute = this.attribute;
|
|
8571
|
+
path = new CustomPath2D();
|
|
8572
|
+
const segments = attribute.segments,
|
|
7955
8573
|
parsePoints = points => {
|
|
7956
8574
|
if (points && points.length) {
|
|
7957
8575
|
let isFirst = !0;
|
|
@@ -8030,7 +8648,7 @@ class Rect extends Graphic {
|
|
|
8030
8648
|
tb1: tb1,
|
|
8031
8649
|
tb2: tb2
|
|
8032
8650
|
} = 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;
|
|
8651
|
+
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
8652
|
}
|
|
8035
8653
|
needUpdateTags(keys) {
|
|
8036
8654
|
return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
|
|
@@ -8039,15 +8657,16 @@ class Rect extends Graphic {
|
|
|
8039
8657
|
return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
|
|
8040
8658
|
}
|
|
8041
8659
|
toCustomPath() {
|
|
8660
|
+
let path = super.toCustomPath();
|
|
8661
|
+
if (path) return path;
|
|
8042
8662
|
const attribute = this.attribute,
|
|
8043
8663
|
{
|
|
8044
8664
|
x: x,
|
|
8045
8665
|
y: y,
|
|
8046
8666
|
width: width,
|
|
8047
8667
|
height: height
|
|
8048
|
-
} = normalizeRectAttributes(attribute)
|
|
8049
|
-
|
|
8050
|
-
return path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8668
|
+
} = normalizeRectAttributes(attribute);
|
|
8669
|
+
return path = new CustomPath2D(), path.moveTo(x, y), path.rect(x, y, width, height), path;
|
|
8051
8670
|
}
|
|
8052
8671
|
clone() {
|
|
8053
8672
|
return new Rect(Object.assign({}, this.attribute));
|
|
@@ -8427,7 +9046,7 @@ class Image extends Graphic {
|
|
|
8427
9046
|
tb1: tb1,
|
|
8428
9047
|
tb2: tb2
|
|
8429
9048
|
} = 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;
|
|
9049
|
+
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
9050
|
}
|
|
8432
9051
|
getDefaultAttribute(name) {
|
|
8433
9052
|
return DefaultImageAttribute[name];
|
|
@@ -8770,7 +9389,7 @@ class RichText extends Graphic {
|
|
|
8770
9389
|
maxWidth = richtextTheme.maxWidth,
|
|
8771
9390
|
maxHeight = richtextTheme.maxHeight,
|
|
8772
9391
|
textAlign = richtextTheme.textAlign,
|
|
8773
|
-
|
|
9392
|
+
textBaseline = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : "top",
|
|
8774
9393
|
editOptions: editOptions
|
|
8775
9394
|
} = attribute;
|
|
8776
9395
|
if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
|
|
@@ -8785,7 +9404,7 @@ class RichText extends Graphic {
|
|
|
8785
9404
|
}
|
|
8786
9405
|
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
9406
|
let deltaY = 0;
|
|
8788
|
-
switch (
|
|
9407
|
+
switch (textBaseline) {
|
|
8789
9408
|
case "top":
|
|
8790
9409
|
deltaY = 0;
|
|
8791
9410
|
break;
|
|
@@ -8806,7 +9425,7 @@ class RichText extends Graphic {
|
|
|
8806
9425
|
case "right":
|
|
8807
9426
|
deltaX = -aabbBounds.width();
|
|
8808
9427
|
}
|
|
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;
|
|
9428
|
+
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
9429
|
}
|
|
8811
9430
|
needUpdateTags(keys) {
|
|
8812
9431
|
return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
|
|
@@ -9024,7 +9643,7 @@ class Path extends Graphic {
|
|
|
9024
9643
|
tb1: tb1,
|
|
9025
9644
|
tb2: tb2
|
|
9026
9645
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9027
|
-
updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9646
|
+
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
9647
|
const {
|
|
9029
9648
|
lineJoin = pathTheme.lineJoin
|
|
9030
9649
|
} = attribute;
|
|
@@ -9081,7 +9700,7 @@ class Area extends Graphic {
|
|
|
9081
9700
|
return getTheme(this).area;
|
|
9082
9701
|
}
|
|
9083
9702
|
updateAABBBounds(attribute, areaTheme, aabbBounds) {
|
|
9084
|
-
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9703
|
+
this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9085
9704
|
const {
|
|
9086
9705
|
lineJoin = areaTheme.lineJoin
|
|
9087
9706
|
} = attribute;
|
|
@@ -9119,8 +9738,10 @@ class Area extends Graphic {
|
|
|
9119
9738
|
return super.needUpdateTag(key, AREA_UPDATE_TAG_KEY);
|
|
9120
9739
|
}
|
|
9121
9740
|
toCustomPath() {
|
|
9122
|
-
|
|
9123
|
-
|
|
9741
|
+
let path = super.toCustomPath();
|
|
9742
|
+
if (path) return path;
|
|
9743
|
+
path = new CustomPath2D();
|
|
9744
|
+
const attribute = this.attribute,
|
|
9124
9745
|
segments = attribute.segments,
|
|
9125
9746
|
parsePoints = points => {
|
|
9126
9747
|
if (points && points.length) {
|
|
@@ -9286,7 +9907,7 @@ class Arc extends Graphic {
|
|
|
9286
9907
|
tb1: tb1,
|
|
9287
9908
|
tb2: tb2
|
|
9288
9909
|
} = application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
9289
|
-
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
9910
|
+
updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.setWidthHeightWithoutTransform(aabbBounds);
|
|
9290
9911
|
const {
|
|
9291
9912
|
lineJoin = arcTheme.lineJoin
|
|
9292
9913
|
} = attribute;
|
|
@@ -9334,6 +9955,8 @@ class Arc extends Graphic {
|
|
|
9334
9955
|
}
|
|
9335
9956
|
toCustomPath() {
|
|
9336
9957
|
var _a, _b, _c, _d;
|
|
9958
|
+
let path = super.toCustomPath();
|
|
9959
|
+
if (path) return path;
|
|
9337
9960
|
const attribute = this.attribute,
|
|
9338
9961
|
{
|
|
9339
9962
|
startAngle: startAngle,
|
|
@@ -9347,8 +9970,7 @@ class Arc extends Graphic {
|
|
|
9347
9970
|
const temp = outerRadius;
|
|
9348
9971
|
outerRadius = innerRadius, innerRadius = temp;
|
|
9349
9972
|
}
|
|
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 {
|
|
9973
|
+
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
9974
|
const xors = outerRadius * cos(startAngle),
|
|
9353
9975
|
yors = outerRadius * sin(startAngle),
|
|
9354
9976
|
xire = innerRadius * cos(endAngle),
|
|
@@ -9389,7 +10011,7 @@ class Polygon extends Graphic {
|
|
|
9389
10011
|
return getTheme(this).polygon;
|
|
9390
10012
|
}
|
|
9391
10013
|
updateAABBBounds(attribute, polygonTheme, aabbBounds) {
|
|
9392
|
-
this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
|
|
10014
|
+
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
10015
|
const {
|
|
9394
10016
|
lineJoin = polygonTheme.lineJoin
|
|
9395
10017
|
} = attribute;
|
|
@@ -10735,7 +11357,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
|
|
|
10735
11357
|
if (!cache) return;
|
|
10736
11358
|
context.beginPath();
|
|
10737
11359
|
const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
|
|
10738
|
-
drawSegments(context
|
|
11360
|
+
drawSegments(context, cache, clipRange, clipRangeByDimension, {
|
|
10739
11361
|
offsetX: offsetX,
|
|
10740
11362
|
offsetY: offsetY,
|
|
10741
11363
|
offsetZ: z
|
|
@@ -11138,7 +11760,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11138
11760
|
} else startP = points[0], endP = points[points.length - 1];
|
|
11139
11761
|
const xTotalLength = abs(endP.x - startP.x),
|
|
11140
11762
|
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
|
|
11763
|
+
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
11764
|
offsetX: offsetX,
|
|
11143
11765
|
offsetY: offsetY,
|
|
11144
11766
|
offsetZ: offsetZ,
|
|
@@ -11157,7 +11779,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
|
|
|
11157
11779
|
const {
|
|
11158
11780
|
stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
|
|
11159
11781
|
} = attribute;
|
|
11160
|
-
isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context
|
|
11782
|
+
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
11783
|
offsetX: offsetX,
|
|
11162
11784
|
offsetY: offsetY,
|
|
11163
11785
|
offsetZ: offsetZ
|
|
@@ -13070,6 +13692,8 @@ const transformUtil = container.get(TransformUtil);
|
|
|
13070
13692
|
application.transformUtil = transformUtil;
|
|
13071
13693
|
const graphicService = container.get(GraphicService);
|
|
13072
13694
|
application.graphicService = graphicService;
|
|
13695
|
+
const renderService = container.get(RenderService);
|
|
13696
|
+
application.renderService = renderService;
|
|
13073
13697
|
const layerService = container.get(LayerService);
|
|
13074
13698
|
application.layerService = layerService;
|
|
13075
13699
|
|
|
@@ -14323,6 +14947,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
|
14323
14947
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14324
14948
|
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14325
14949
|
|
|
14950
|
+
function getEndTriggersOfDrag() {
|
|
14951
|
+
if (vglobal.env === 'browser') {
|
|
14952
|
+
return ['pointerup', 'pointerleave', 'pointercancel'];
|
|
14953
|
+
}
|
|
14954
|
+
return ['pointerup', 'pointerleave', 'pointerupoutside'];
|
|
14955
|
+
}
|
|
14956
|
+
|
|
14326
14957
|
const delayMap$2 = {
|
|
14327
14958
|
debounce: debounce,
|
|
14328
14959
|
throttle: throttle
|
|
@@ -14356,6 +14987,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14356
14987
|
}
|
|
14357
14988
|
};
|
|
14358
14989
|
this._onSliderPointerDown = (e) => {
|
|
14990
|
+
this._clearDragEvents();
|
|
14359
14991
|
const { stopSliderDownPropagation = true } = this.attribute;
|
|
14360
14992
|
if (stopSliderDownPropagation) {
|
|
14361
14993
|
e.stopPropagation();
|
|
@@ -14367,15 +14999,12 @@ class ScrollBar extends AbstractComponent {
|
|
|
14367
14999
|
pos: this._prePos,
|
|
14368
15000
|
event: e
|
|
14369
15001
|
});
|
|
14370
|
-
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14375
|
-
|
|
14376
|
-
this.stage.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14377
|
-
this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14378
|
-
}
|
|
15002
|
+
const triggers = getEndTriggersOfDrag();
|
|
15003
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15004
|
+
obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
|
|
15005
|
+
triggers.forEach((trigger) => {
|
|
15006
|
+
obj.addEventListener(trigger, this._onSliderPointerUp);
|
|
15007
|
+
});
|
|
14379
15008
|
};
|
|
14380
15009
|
this._computeScrollValue = (e) => {
|
|
14381
15010
|
const { direction } = this.attribute;
|
|
@@ -14397,6 +15026,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14397
15026
|
return [currentPos, currentScrollValue];
|
|
14398
15027
|
};
|
|
14399
15028
|
this._onSliderPointerMove = (e) => {
|
|
15029
|
+
e.preventDefault();
|
|
14400
15030
|
const { stopSliderMovePropagation = true } = this.attribute;
|
|
14401
15031
|
if (stopSliderMovePropagation) {
|
|
14402
15032
|
e.stopPropagation();
|
|
@@ -14410,7 +15040,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
14410
15040
|
? this._onSliderPointerMove
|
|
14411
15041
|
: delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
|
|
14412
15042
|
this._onSliderPointerUp = (e) => {
|
|
14413
|
-
e.preventDefault();
|
|
14414
15043
|
const { range: preRange, limitRange = [0, 1] } = this.attribute;
|
|
14415
15044
|
const preScrollRange = this.getScrollRange();
|
|
14416
15045
|
const [currentPos, currentScrollValue] = this._computeScrollValue(e);
|
|
@@ -14419,15 +15048,7 @@ class ScrollBar extends AbstractComponent {
|
|
|
14419
15048
|
pre: preRange,
|
|
14420
15049
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
14421
15050
|
});
|
|
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
|
-
}
|
|
15051
|
+
this._clearDragEvents();
|
|
14431
15052
|
};
|
|
14432
15053
|
}
|
|
14433
15054
|
setScrollRange(range, render = true) {
|
|
@@ -14560,6 +15181,14 @@ class ScrollBar extends AbstractComponent {
|
|
|
14560
15181
|
? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
|
|
14561
15182
|
: clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
14562
15183
|
}
|
|
15184
|
+
_clearDragEvents() {
|
|
15185
|
+
const triggers = getEndTriggersOfDrag();
|
|
15186
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15187
|
+
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
|
|
15188
|
+
triggers.forEach((trigger) => {
|
|
15189
|
+
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15190
|
+
});
|
|
15191
|
+
}
|
|
14563
15192
|
_reset() {
|
|
14564
15193
|
this._sliderRenderBounds = null;
|
|
14565
15194
|
this._sliderLimitRange = null;
|
|
@@ -16861,24 +17490,17 @@ function getPolygonPath(points, closed) {
|
|
|
16861
17490
|
}
|
|
16862
17491
|
function textIntersect(textA, textB, sep) {
|
|
16863
17492
|
var _a;
|
|
16864
|
-
let a;
|
|
16865
|
-
let b;
|
|
16866
17493
|
const angle = (_a = textA.attribute) === null || _a === void 0 ? void 0 : _a.angle;
|
|
16867
17494
|
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
17495
|
if (isHorizontal) {
|
|
16874
|
-
return
|
|
17496
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16875
17497
|
}
|
|
16876
|
-
a = textA.OBBBounds;
|
|
16877
|
-
b = textB.OBBBounds;
|
|
17498
|
+
const a = textA.OBBBounds;
|
|
17499
|
+
const b = textB.OBBBounds;
|
|
16878
17500
|
if (!a || !b || a.empty() || b.empty()) {
|
|
16879
|
-
return
|
|
17501
|
+
return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
|
|
16880
17502
|
}
|
|
16881
|
-
return a.intersects(b);
|
|
17503
|
+
return a.intersects(b) || sep > obbSeparation(a, b);
|
|
16882
17504
|
}
|
|
16883
17505
|
function hasOverlap(items, pad) {
|
|
16884
17506
|
for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
|
|
@@ -18217,19 +18839,29 @@ class WaitStep extends Step {
|
|
|
18217
18839
|
|
|
18218
18840
|
class DefaultTimeline {
|
|
18219
18841
|
get animateCount() {
|
|
18220
|
-
return this.
|
|
18842
|
+
return this._animateCount;
|
|
18221
18843
|
}
|
|
18222
18844
|
constructor() {
|
|
18223
|
-
this.
|
|
18845
|
+
this.head = null, this.tail = null, this.animateMap = new Map(), this._animateCount = 0, this._playSpeed = 1, this._totalDuration = 0, this._startTime = 0, this._currentTime = 0, this.id = Generator.GenAutoIncrementId(), this.paused = !1;
|
|
18224
18846
|
}
|
|
18225
18847
|
isRunning() {
|
|
18226
|
-
return !this.paused && this.
|
|
18848
|
+
return !this.paused && this._animateCount > 0;
|
|
18227
18849
|
}
|
|
18228
18850
|
forEachAccessAnimate(cb) {
|
|
18229
|
-
|
|
18851
|
+
let current = this.head,
|
|
18852
|
+
index = 0;
|
|
18853
|
+
for (; current;) {
|
|
18854
|
+
const next = current.next;
|
|
18855
|
+
cb(current.animate, index), index++, current = next;
|
|
18856
|
+
}
|
|
18230
18857
|
}
|
|
18231
18858
|
addAnimate(animate) {
|
|
18232
|
-
|
|
18859
|
+
const newNode = {
|
|
18860
|
+
animate: animate,
|
|
18861
|
+
next: null,
|
|
18862
|
+
prev: null
|
|
18863
|
+
};
|
|
18864
|
+
this.head ? this.tail && (this.tail.next = newNode, newNode.prev = this.tail, this.tail = newNode) : (this.head = newNode, this.tail = newNode), this.animateMap.set(animate, newNode), this._animateCount++, this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18233
18865
|
}
|
|
18234
18866
|
pause() {
|
|
18235
18867
|
this.paused = !0;
|
|
@@ -18241,21 +18873,21 @@ class DefaultTimeline {
|
|
|
18241
18873
|
if (this.paused) return;
|
|
18242
18874
|
const scaledDelta = delta * this._playSpeed;
|
|
18243
18875
|
this._currentTime += scaledDelta, this.forEachAccessAnimate((animate, i) => {
|
|
18244
|
-
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0
|
|
18876
|
+
animate.status === AnimateStatus.END ? this.removeAnimate(animate, !0) : animate.status !== AnimateStatus.RUNNING && animate.status !== AnimateStatus.INITIAL || animate.advance(scaledDelta);
|
|
18245
18877
|
});
|
|
18246
18878
|
}
|
|
18247
18879
|
clear() {
|
|
18248
18880
|
this.forEachAccessAnimate(animate => {
|
|
18249
18881
|
animate.release();
|
|
18250
|
-
}), this.
|
|
18882
|
+
}), this.head = null, this.tail = null, this.animateMap.clear(), this._animateCount = 0, this._totalDuration = 0;
|
|
18251
18883
|
}
|
|
18252
18884
|
removeAnimate(animate) {
|
|
18253
18885
|
let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
|
|
18254
|
-
|
|
18255
|
-
|
|
18886
|
+
const node = this.animateMap.get(animate);
|
|
18887
|
+
node && (release && (animate._onRemove && animate._onRemove.forEach(cb => cb()), animate.release()), node.prev ? node.prev.next = node.next : this.head = node.next, node.next ? node.next.prev = node.prev : this.tail = node.prev, this.animateMap.delete(animate), this._animateCount--, animate.getStartTime() + animate.getDuration() >= this._totalDuration && this.recalculateTotalDuration());
|
|
18256
18888
|
}
|
|
18257
18889
|
recalculateTotalDuration() {
|
|
18258
|
-
this._totalDuration = 0, this.
|
|
18890
|
+
this._totalDuration = 0, this.forEachAccessAnimate(animate => {
|
|
18259
18891
|
this._totalDuration = Math.max(this._totalDuration, animate.getStartTime() + animate.getDuration());
|
|
18260
18892
|
});
|
|
18261
18893
|
}
|
|
@@ -18406,7 +19038,7 @@ class Animate {
|
|
|
18406
19038
|
stop(type) {
|
|
18407
19039
|
let step = this._firstStep;
|
|
18408
19040
|
for (; step;) step.stop(), step = step.next;
|
|
18409
|
-
this.status
|
|
19041
|
+
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));
|
|
18410
19042
|
}
|
|
18411
19043
|
release() {
|
|
18412
19044
|
this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
|
|
@@ -18513,19 +19145,25 @@ class AnimateExecutor {
|
|
|
18513
19145
|
var _a, _b;
|
|
18514
19146
|
const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
|
|
18515
19147
|
startTime = this.resolveValue(params.startTime, void 0, 0),
|
|
18516
|
-
parsedParams =
|
|
19148
|
+
parsedParams = Object.assign({}, params);
|
|
18517
19149
|
parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
|
|
18518
19150
|
const oneByOne = this.resolveValue(params.oneByOne, child, !1);
|
|
18519
19151
|
if (isTimeline) {
|
|
18520
19152
|
const timeSlices = parsedParams.timeSlices;
|
|
18521
19153
|
isArray(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
|
|
18522
19154
|
let sliceTime = 0;
|
|
18523
|
-
parsedParams.timeSlices.
|
|
18524
|
-
|
|
19155
|
+
parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
|
|
19156
|
+
const delay = this.resolveValue(slice.delay, child, 0),
|
|
19157
|
+
delayAfter = this.resolveValue(slice.delayAfter, child, 0),
|
|
19158
|
+
duration = this.resolveValue(slice.duration, child, 300);
|
|
19159
|
+
return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
|
|
19160
|
+
delay: delay,
|
|
19161
|
+
delayAfter: delayAfter,
|
|
19162
|
+
duration: duration
|
|
19163
|
+
});
|
|
18525
19164
|
});
|
|
18526
|
-
let oneByOneDelay = 0
|
|
18527
|
-
|
|
18528
|
-
oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay;
|
|
19165
|
+
let oneByOneDelay = 0;
|
|
19166
|
+
oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
|
|
18529
19167
|
let scale = 1;
|
|
18530
19168
|
if (totalTime) {
|
|
18531
19169
|
const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
|
|
@@ -18547,19 +19185,18 @@ class AnimateExecutor {
|
|
|
18547
19185
|
});
|
|
18548
19186
|
})
|
|
18549
19187
|
});
|
|
18550
|
-
}), parsedParams.
|
|
19188
|
+
}), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
|
|
18551
19189
|
} else {
|
|
18552
19190
|
const delay = this.resolveValue(params.delay, child, 0),
|
|
18553
19191
|
delayAfter = this.resolveValue(params.delayAfter, child, 0),
|
|
18554
19192
|
duration = this.resolveValue(params.duration, child, 300);
|
|
18555
|
-
let oneByOneDelay = 0
|
|
18556
|
-
|
|
18557
|
-
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"];
|
|
19193
|
+
let oneByOneDelay = 0;
|
|
19194
|
+
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"];
|
|
18558
19195
|
const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
|
|
18559
19196
|
if (parsedParams.customType = customType, totalTime) {
|
|
18560
19197
|
const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
|
|
18561
19198
|
scale = totalTime ? totalTime / _totalTime : 1;
|
|
18562
|
-
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.
|
|
19199
|
+
parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
|
|
18563
19200
|
}
|
|
18564
19201
|
}
|
|
18565
19202
|
return parsedParams;
|
|
@@ -18651,10 +19288,10 @@ class AnimateExecutor {
|
|
|
18651
19288
|
const animate = graphic.animate();
|
|
18652
19289
|
animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
|
|
18653
19290
|
return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
|
|
18654
|
-
this.applyTimeSliceToAnimate(slice, animate, graphic);
|
|
19291
|
+
this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
|
|
18655
19292
|
}), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
|
|
18656
19293
|
}
|
|
18657
|
-
applyTimeSliceToAnimate(slice, animate, graphic) {
|
|
19294
|
+
applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
|
|
18658
19295
|
var _a, _b, _c, _d;
|
|
18659
19296
|
const {
|
|
18660
19297
|
effects: effects,
|
|
@@ -18680,7 +19317,7 @@ class AnimateExecutor {
|
|
|
18680
19317
|
props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
|
|
18681
19318
|
const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
|
|
18682
19319
|
customType = effect.customType;
|
|
18683
|
-
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters,
|
|
19320
|
+
this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
|
|
18684
19321
|
}), delayAfterValue > 0 && animate.wait(delayAfterValue);
|
|
18685
19322
|
}
|
|
18686
19323
|
createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
|
|
@@ -18824,9 +19461,9 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18824
19461
|
const easing = this.easing;
|
|
18825
19462
|
const { config, lastScale, getTickCoord } = this.params;
|
|
18826
19463
|
let ratio = 1;
|
|
18827
|
-
|
|
19464
|
+
const currData = this.target.data;
|
|
19465
|
+
if (lastScale && getTickCoord && currData) {
|
|
18828
19466
|
ratio = 0.7;
|
|
18829
|
-
const currData = this.target.data;
|
|
18830
19467
|
const oldValue = lastScale.scale(currData.rawValue);
|
|
18831
19468
|
const point = getTickCoord(oldValue);
|
|
18832
19469
|
const newX = this.target.attribute.x;
|
|
@@ -18850,14 +19487,13 @@ class AxisEnter extends AComponentAnimate {
|
|
|
18850
19487
|
}
|
|
18851
19488
|
class AxisUpdate extends AComponentAnimate {
|
|
18852
19489
|
onBind() {
|
|
18853
|
-
var _a;
|
|
18854
19490
|
const animator = createComponentAnimator(this.target);
|
|
18855
19491
|
this._animator = animator;
|
|
18856
19492
|
const duration = this.duration;
|
|
18857
19493
|
const easing = this.easing;
|
|
18858
19494
|
const { config, diffAttrs } = this.params;
|
|
18859
19495
|
animator.animate(this.target, {
|
|
18860
|
-
type:
|
|
19496
|
+
type: 'to',
|
|
18861
19497
|
to: Object.assign({}, diffAttrs),
|
|
18862
19498
|
duration,
|
|
18863
19499
|
easing,
|
|
@@ -21314,6 +21950,13 @@ class LabelBase extends AnimateComponent {
|
|
|
21314
21950
|
if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
|
|
21315
21951
|
return;
|
|
21316
21952
|
}
|
|
21953
|
+
const markAttributeList = [];
|
|
21954
|
+
if (this._enableAnimation !== false) {
|
|
21955
|
+
this._baseMarks.forEach(mark => {
|
|
21956
|
+
markAttributeList.push(mark.attribute);
|
|
21957
|
+
mark.initAttributes(mark.getAttributes(true));
|
|
21958
|
+
});
|
|
21959
|
+
}
|
|
21317
21960
|
const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
|
|
21318
21961
|
let data = this.attribute.data;
|
|
21319
21962
|
if (isFunction(dataFilter)) {
|
|
@@ -21351,6 +21994,11 @@ class LabelBase extends AnimateComponent {
|
|
|
21351
21994
|
this._smartInvert(labels);
|
|
21352
21995
|
}
|
|
21353
21996
|
this._renderLabels(labels);
|
|
21997
|
+
if (this._enableAnimation !== false) {
|
|
21998
|
+
this._baseMarks.forEach((mark, index) => {
|
|
21999
|
+
mark.initAttributes(markAttributeList[index]);
|
|
22000
|
+
});
|
|
22001
|
+
}
|
|
21354
22002
|
}
|
|
21355
22003
|
_bindEvent(target) {
|
|
21356
22004
|
if (this.attribute.disableTriggerEvent) {
|
|
@@ -21693,8 +22341,14 @@ class LabelBase extends AnimateComponent {
|
|
|
21693
22341
|
return this.getRootNode().find(node => node.name === baseMarkGroupName, true);
|
|
21694
22342
|
}
|
|
21695
22343
|
getGraphicBounds(graphic, point = {}, position) {
|
|
22344
|
+
var _a;
|
|
21696
22345
|
if (graphic) {
|
|
21697
22346
|
if (graphic.attribute.visible !== false) {
|
|
22347
|
+
if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
|
|
22348
|
+
const clonedGraphic = graphic.clone();
|
|
22349
|
+
Object.assign(clonedGraphic.attribute, graphic.getAttributes(true));
|
|
22350
|
+
return clonedGraphic.AABBBounds;
|
|
22351
|
+
}
|
|
21698
22352
|
return graphic.AABBBounds;
|
|
21699
22353
|
}
|
|
21700
22354
|
const { x, y } = graphic.attribute;
|
|
@@ -21760,7 +22414,7 @@ class LabelBase extends AnimateComponent {
|
|
|
21760
22414
|
animation: Object.assign(Object.assign({}, enter), { type: 'labelEnter', selfOnly: true, customParameters: {
|
|
21761
22415
|
relatedGraphic,
|
|
21762
22416
|
relatedGraphics: this._idToGraphic,
|
|
21763
|
-
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : '
|
|
22417
|
+
config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'fadeIn' })
|
|
21764
22418
|
} })
|
|
21765
22419
|
}
|
|
21766
22420
|
]));
|
|
@@ -23523,8 +24177,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23523
24177
|
end: 1
|
|
23524
24178
|
};
|
|
23525
24179
|
this._statePointToData = state => state;
|
|
24180
|
+
this._handleTouchMove = (e) => {
|
|
24181
|
+
if (this._activeState) {
|
|
24182
|
+
e.preventDefault();
|
|
24183
|
+
}
|
|
24184
|
+
};
|
|
23526
24185
|
this._onHandlerPointerDown = (e, tag) => {
|
|
23527
|
-
|
|
24186
|
+
this._clearDragEvents();
|
|
23528
24187
|
if (tag === 'start') {
|
|
23529
24188
|
this._activeTag = DataZoomActiveTag.startHandler;
|
|
23530
24189
|
this._activeItem = this._startHandlerMask;
|
|
@@ -23548,14 +24207,16 @@ class DataZoom extends AbstractComponent {
|
|
|
23548
24207
|
this._activeState = true;
|
|
23549
24208
|
this._activeCache.startPos = this.eventPosToStagePos(e);
|
|
23550
24209
|
this._activeCache.lastPos = this.eventPosToStagePos(e);
|
|
23551
|
-
|
|
23552
|
-
|
|
23553
|
-
|
|
23554
|
-
}
|
|
24210
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24211
|
+
const triggers = getEndTriggersOfDrag();
|
|
24212
|
+
evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23555
24213
|
this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24214
|
+
triggers.forEach((trigger) => {
|
|
24215
|
+
evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
|
|
24216
|
+
});
|
|
23556
24217
|
};
|
|
23557
24218
|
this._pointerMove = (e) => {
|
|
23558
|
-
e.
|
|
24219
|
+
e.preventDefault();
|
|
23559
24220
|
const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
|
|
23560
24221
|
const pos = this.eventPosToStagePos(e);
|
|
23561
24222
|
const { attPos, max } = this._layoutCache;
|
|
@@ -23605,7 +24266,6 @@ class DataZoom extends AbstractComponent {
|
|
|
23605
24266
|
? this._pointerMove
|
|
23606
24267
|
: delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
|
|
23607
24268
|
this._onHandlerPointerUp = (e) => {
|
|
23608
|
-
e.preventDefault();
|
|
23609
24269
|
const { start, end, brushSelect, realTime = true } = this.attribute;
|
|
23610
24270
|
if (this._activeState) {
|
|
23611
24271
|
if (this._activeTag === DataZoomActiveTag.background) {
|
|
@@ -23620,12 +24280,7 @@ class DataZoom extends AbstractComponent {
|
|
|
23620
24280
|
end: this.state.end,
|
|
23621
24281
|
tag: this._activeTag
|
|
23622
24282
|
});
|
|
23623
|
-
|
|
23624
|
-
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23625
|
-
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
23626
|
-
}
|
|
23627
|
-
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
23628
|
-
this.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
24283
|
+
this._clearDragEvents();
|
|
23629
24284
|
};
|
|
23630
24285
|
const { position, showDetail } = attributes;
|
|
23631
24286
|
this._activeCache.startPos = position;
|
|
@@ -23673,12 +24328,13 @@ class DataZoom extends AbstractComponent {
|
|
|
23673
24328
|
if (this._selectedPreviewGroup) {
|
|
23674
24329
|
this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
|
|
23675
24330
|
}
|
|
23676
|
-
this.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
23677
|
-
this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
23678
24331
|
if (showDetail === 'auto') {
|
|
23679
24332
|
this.addEventListener('pointerenter', this._onHandlerPointerEnter);
|
|
23680
24333
|
this.addEventListener('pointerleave', this._onHandlerPointerLeave);
|
|
23681
24334
|
}
|
|
24335
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24336
|
+
passive: false
|
|
24337
|
+
});
|
|
23682
24338
|
}
|
|
23683
24339
|
dragMaskSize() {
|
|
23684
24340
|
const { position } = this.attribute;
|
|
@@ -23706,13 +24362,20 @@ class DataZoom extends AbstractComponent {
|
|
|
23706
24362
|
var _a, _b;
|
|
23707
24363
|
return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
|
|
23708
24364
|
}
|
|
24365
|
+
_clearDragEvents() {
|
|
24366
|
+
const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
24367
|
+
const triggers = getEndTriggersOfDrag();
|
|
24368
|
+
evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24369
|
+
triggers.forEach((trigger) => {
|
|
24370
|
+
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
24371
|
+
});
|
|
24372
|
+
this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
24373
|
+
}
|
|
23709
24374
|
_onHandlerPointerEnter(e) {
|
|
23710
|
-
e.stopPropagation();
|
|
23711
24375
|
this._showText = true;
|
|
23712
24376
|
this.renderText();
|
|
23713
24377
|
}
|
|
23714
24378
|
_onHandlerPointerLeave(e) {
|
|
23715
|
-
e.stopPropagation();
|
|
23716
24379
|
this._showText = false;
|
|
23717
24380
|
this.renderText();
|
|
23718
24381
|
}
|
|
@@ -24222,6 +24885,13 @@ class DataZoom extends AbstractComponent {
|
|
|
24222
24885
|
setStatePointToData(callback) {
|
|
24223
24886
|
isFunction(callback) && (this._statePointToData = callback);
|
|
24224
24887
|
}
|
|
24888
|
+
release(all) {
|
|
24889
|
+
super.release(all);
|
|
24890
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
24891
|
+
passive: false
|
|
24892
|
+
});
|
|
24893
|
+
this._clearDragEvents();
|
|
24894
|
+
}
|
|
24225
24895
|
}
|
|
24226
24896
|
DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
|
|
24227
24897
|
|
|
@@ -24511,21 +25181,30 @@ function commonLineClipIn(line, label, duration, delay, easing) {
|
|
|
24511
25181
|
.to({ clipRange: 1 }, stepDuration, easing);
|
|
24512
25182
|
});
|
|
24513
25183
|
graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);
|
|
24514
|
-
|
|
24515
|
-
|
|
25184
|
+
array(label).forEach(labelNode => {
|
|
25185
|
+
const delayTime = delay + startSymbolDuration + lineDuration + endSymbolDuration;
|
|
25186
|
+
graphicFadeIn(labelNode.getTextShape(), delayTime, labelDuration, easing);
|
|
25187
|
+
graphicFadeIn(labelNode.getBgRect(), delayTime, labelDuration, easing);
|
|
25188
|
+
});
|
|
24516
25189
|
}
|
|
24517
25190
|
|
|
24518
25191
|
function commonLineFadeIn(line, label, duration, delay, easing) {
|
|
24519
25192
|
segmentFadeIn(line, delay, duration, easing);
|
|
24520
|
-
|
|
25193
|
+
array(label).forEach(labelNode => {
|
|
25194
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25195
|
+
});
|
|
24521
25196
|
}
|
|
24522
25197
|
function areaFadeIn(area, label, duration, delay, easing) {
|
|
24523
25198
|
graphicFadeIn(area, delay, duration, easing);
|
|
24524
|
-
|
|
25199
|
+
array(label).forEach(labelNode => {
|
|
25200
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25201
|
+
});
|
|
24525
25202
|
}
|
|
24526
25203
|
function arcAreaFadeIn(area, label, duration, delay, easing) {
|
|
24527
25204
|
graphicFadeIn(area, delay, duration, easing);
|
|
24528
|
-
|
|
25205
|
+
array(label).forEach(labelNode => {
|
|
25206
|
+
tagFadeIn(labelNode, delay, duration, easing);
|
|
25207
|
+
});
|
|
24529
25208
|
}
|
|
24530
25209
|
function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24531
25210
|
var _a;
|
|
@@ -24541,15 +25220,21 @@ function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
|
24541
25220
|
|
|
24542
25221
|
function commonLineFadeOut(line, label, duration, delay, easing) {
|
|
24543
25222
|
segmentFadeOut(line, delay, duration, easing);
|
|
24544
|
-
|
|
25223
|
+
array(label).forEach(labelNode => {
|
|
25224
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25225
|
+
});
|
|
24545
25226
|
}
|
|
24546
25227
|
function areaFadeOut(area, label, duration, delay, easing) {
|
|
24547
25228
|
graphicFadeOut(area, delay, duration, easing);
|
|
24548
|
-
|
|
25229
|
+
array(label).forEach(labelNode => {
|
|
25230
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25231
|
+
});
|
|
24549
25232
|
}
|
|
24550
25233
|
function arcAreaFadeOut(area, label, duration, delay, easing) {
|
|
24551
25234
|
graphicFadeOut(area, delay, duration, easing);
|
|
24552
|
-
|
|
25235
|
+
array(label).forEach(labelNode => {
|
|
25236
|
+
tagFadeOut(labelNode, delay, duration, easing);
|
|
25237
|
+
});
|
|
24553
25238
|
}
|
|
24554
25239
|
function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
|
|
24555
25240
|
var _a;
|
|
@@ -24703,6 +25388,48 @@ const DefaultExitMarkerAnimation = {
|
|
|
24703
25388
|
delay: 0
|
|
24704
25389
|
};
|
|
24705
25390
|
|
|
25391
|
+
class MarkLabelMixin {
|
|
25392
|
+
getLabel() {
|
|
25393
|
+
return this._label;
|
|
25394
|
+
}
|
|
25395
|
+
_addMarkLabels(container, labelName, defaultLabelAttrs) {
|
|
25396
|
+
const { label, state } = this.attribute;
|
|
25397
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25398
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25399
|
+
const labelShapes = array(label).map((labelAttrs, index) => {
|
|
25400
|
+
var _a, _b;
|
|
25401
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labelAttrs);
|
|
25402
|
+
const markLabel = new Tag(Object.assign(Object.assign({}, finalLabelAttrs), { state: {
|
|
25403
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25404
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25405
|
+
} }));
|
|
25406
|
+
markLabel.name = labelName;
|
|
25407
|
+
container.add(markLabel);
|
|
25408
|
+
this.setLabelPos(markLabel, finalLabelAttrs);
|
|
25409
|
+
return markLabel;
|
|
25410
|
+
});
|
|
25411
|
+
this._label = array(labelShapes).length === 1 ? labelShapes[0] : labelShapes;
|
|
25412
|
+
}
|
|
25413
|
+
_updateMarkLabels(defaultLabelAttrs) {
|
|
25414
|
+
const { label, state } = this.attribute;
|
|
25415
|
+
const labelShapes = array(this._label);
|
|
25416
|
+
const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
|
|
25417
|
+
const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
|
|
25418
|
+
if (labelShapes.length) {
|
|
25419
|
+
const labels = array(label);
|
|
25420
|
+
labelShapes.forEach((labelItem, index) => {
|
|
25421
|
+
var _a, _b;
|
|
25422
|
+
const finalLabelAttrs = merge({}, defaultLabelAttrs, labels[index]);
|
|
25423
|
+
labelItem.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, finalLabelAttrs), { state: {
|
|
25424
|
+
panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
|
|
25425
|
+
text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
|
|
25426
|
+
} }));
|
|
25427
|
+
this.setLabelPos(labelItem, finalLabelAttrs);
|
|
25428
|
+
});
|
|
25429
|
+
}
|
|
25430
|
+
}
|
|
25431
|
+
}
|
|
25432
|
+
|
|
24706
25433
|
class MarkCommonLine extends Marker {
|
|
24707
25434
|
constructor() {
|
|
24708
25435
|
super(...arguments);
|
|
@@ -24713,20 +25440,17 @@ class MarkCommonLine extends Marker {
|
|
|
24713
25440
|
getLine() {
|
|
24714
25441
|
return this._line;
|
|
24715
25442
|
}
|
|
24716
|
-
|
|
24717
|
-
|
|
24718
|
-
|
|
24719
|
-
|
|
24720
|
-
const { label = {}, limitRect } = this.attribute;
|
|
24721
|
-
const { position, confine, autoRotate } = label;
|
|
24722
|
-
const labelPoint = this.getPointAttrByPosition(position);
|
|
25443
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25444
|
+
const { limitRect } = this.attribute;
|
|
25445
|
+
const { position, confine, autoRotate } = labelAttrs;
|
|
25446
|
+
const labelPoint = this.getPointAttrByPosition(position, labelAttrs);
|
|
24723
25447
|
const labelAngle = position.toString().toLocaleLowerCase().includes('start')
|
|
24724
25448
|
? this._line.getStartAngle() || 0
|
|
24725
25449
|
: this._line.getEndAngle() || 0;
|
|
24726
|
-
|
|
25450
|
+
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) }));
|
|
24727
25451
|
if (limitRect && confine) {
|
|
24728
25452
|
const { x, y, width, height } = limitRect;
|
|
24729
|
-
limitShapeInBounds(
|
|
25453
|
+
limitShapeInBounds(labelNode, {
|
|
24730
25454
|
x1: x,
|
|
24731
25455
|
y1: y,
|
|
24732
25456
|
x2: x + width,
|
|
@@ -24735,32 +25459,18 @@ class MarkCommonLine extends Marker {
|
|
|
24735
25459
|
}
|
|
24736
25460
|
}
|
|
24737
25461
|
initMarker(container) {
|
|
24738
|
-
const { label, state } = this.attribute;
|
|
24739
25462
|
const line = this.createSegment();
|
|
24740
25463
|
line.name = 'mark-common-line-line';
|
|
24741
25464
|
this._line = line;
|
|
24742
25465
|
container.add(line);
|
|
24743
|
-
|
|
24744
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24745
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24746
|
-
} }));
|
|
24747
|
-
markLabel.name = 'mark-common-line-label';
|
|
24748
|
-
this._label = markLabel;
|
|
24749
|
-
container.add(markLabel);
|
|
24750
|
-
this.setLabelPos();
|
|
25466
|
+
this.addMarkLineLabels(container);
|
|
24751
25467
|
}
|
|
24752
25468
|
updateMarker() {
|
|
24753
|
-
const { label, state } = this.attribute;
|
|
24754
25469
|
this.setLineAttributes();
|
|
24755
|
-
|
|
24756
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
24757
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
24758
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
24759
|
-
} }));
|
|
24760
|
-
this.setLabelPos();
|
|
24761
|
-
}
|
|
25470
|
+
this.updateMarkLineLabels();
|
|
24762
25471
|
}
|
|
24763
25472
|
}
|
|
25473
|
+
mixin(MarkCommonLine, MarkLabelMixin);
|
|
24764
25474
|
|
|
24765
25475
|
const FUZZY_EQUAL_DELTA = 0.001;
|
|
24766
25476
|
const DEFAULT_MARK_LINE_THEME = {
|
|
@@ -24949,6 +25659,7 @@ const DEFAULT_MARK_ARC_LINE_THEME = {
|
|
|
24949
25659
|
lineWidth: 0
|
|
24950
25660
|
},
|
|
24951
25661
|
label: {
|
|
25662
|
+
autoRotate: true,
|
|
24952
25663
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
24953
25664
|
refX: 0,
|
|
24954
25665
|
refY: 0,
|
|
@@ -25003,6 +25714,7 @@ const DEFAULT_MARK_AREA_THEME = {
|
|
|
25003
25714
|
const DEFAULT_MARK_ARC_AREA_THEME = {
|
|
25004
25715
|
interactive: true,
|
|
25005
25716
|
label: {
|
|
25717
|
+
autoRotate: true,
|
|
25006
25718
|
position: IMarkCommonArcLabelPosition.arcOuterMiddle,
|
|
25007
25719
|
textStyle: {
|
|
25008
25720
|
fill: '#fff',
|
|
@@ -25261,10 +25973,9 @@ class MarkLine extends MarkCommonLine {
|
|
|
25261
25973
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkLine.defaultAttributes, attributes));
|
|
25262
25974
|
this.name = 'markLine';
|
|
25263
25975
|
}
|
|
25264
|
-
getPointAttrByPosition(position) {
|
|
25976
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
25265
25977
|
var _a;
|
|
25266
|
-
const {
|
|
25267
|
-
const { refX = 0, refY = 0 } = label;
|
|
25978
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25268
25979
|
const points = this._line.getMainSegmentPoints();
|
|
25269
25980
|
const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
|
|
25270
25981
|
const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
|
|
@@ -25296,10 +26007,10 @@ class MarkLine extends MarkCommonLine {
|
|
|
25296
26007
|
angle: labelAngle
|
|
25297
26008
|
};
|
|
25298
26009
|
}
|
|
25299
|
-
getRotateByAngle(angle) {
|
|
26010
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25300
26011
|
var _a;
|
|
25301
26012
|
const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
|
|
25302
|
-
return itemAngle + ((_a =
|
|
26013
|
+
return itemAngle + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25303
26014
|
}
|
|
25304
26015
|
getTextStyle(position, labelAngle, autoRotate) {
|
|
25305
26016
|
if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
|
|
@@ -25370,6 +26081,12 @@ class MarkLine extends MarkCommonLine {
|
|
|
25370
26081
|
});
|
|
25371
26082
|
return validFlag;
|
|
25372
26083
|
}
|
|
26084
|
+
addMarkLineLabels(container) {
|
|
26085
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkLine.defaultAttributes.label);
|
|
26086
|
+
}
|
|
26087
|
+
updateMarkLineLabels() {
|
|
26088
|
+
this._updateMarkLabels(MarkLine.defaultAttributes.label);
|
|
26089
|
+
}
|
|
25373
26090
|
}
|
|
25374
26091
|
MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
|
|
25375
26092
|
|
|
@@ -25386,9 +26103,6 @@ class MarkArea extends Marker {
|
|
|
25386
26103
|
getArea() {
|
|
25387
26104
|
return this._area;
|
|
25388
26105
|
}
|
|
25389
|
-
getLabel() {
|
|
25390
|
-
return this._label;
|
|
25391
|
-
}
|
|
25392
26106
|
constructor(attributes, options) {
|
|
25393
26107
|
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArea.defaultAttributes, attributes));
|
|
25394
26108
|
this.name = 'markArea';
|
|
@@ -25415,16 +26129,15 @@ class MarkArea extends Marker {
|
|
|
25415
26129
|
}
|
|
25416
26130
|
return result;
|
|
25417
26131
|
}
|
|
25418
|
-
setLabelPos() {
|
|
26132
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25419
26133
|
var _a;
|
|
25420
|
-
if (this.
|
|
25421
|
-
const
|
|
25422
|
-
const labelPosition = (_a = label.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
26134
|
+
if (this._area) {
|
|
26135
|
+
const labelPosition = (_a = labelAttrs.position) !== null && _a !== void 0 ? _a : 'middle';
|
|
25423
26136
|
const labelPoint = this.getPointAttrByPosition(labelPosition);
|
|
25424
|
-
|
|
25425
|
-
if (this.attribute.limitRect &&
|
|
26137
|
+
labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
|
|
26138
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25426
26139
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25427
|
-
limitShapeInBounds(
|
|
26140
|
+
limitShapeInBounds(labelNode, {
|
|
25428
26141
|
x1: x,
|
|
25429
26142
|
y1: y,
|
|
25430
26143
|
x2: x + width,
|
|
@@ -25434,34 +26147,21 @@ class MarkArea extends Marker {
|
|
|
25434
26147
|
}
|
|
25435
26148
|
}
|
|
25436
26149
|
initMarker(container) {
|
|
25437
|
-
const { points,
|
|
26150
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25438
26151
|
const area = graphicCreator.polygon(Object.assign({ points: points }, areaStyle));
|
|
25439
26152
|
area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25440
26153
|
area.name = 'mark-area-polygon';
|
|
25441
26154
|
this._area = area;
|
|
25442
26155
|
container.add(area);
|
|
25443
|
-
|
|
25444
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25445
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25446
|
-
} }));
|
|
25447
|
-
markLabel.name = 'mark-area-label';
|
|
25448
|
-
this._label = markLabel;
|
|
25449
|
-
container.add(markLabel);
|
|
25450
|
-
this.setLabelPos();
|
|
26156
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArea.defaultAttributes.label);
|
|
25451
26157
|
}
|
|
25452
26158
|
updateMarker() {
|
|
25453
|
-
const { points,
|
|
26159
|
+
const { points, areaStyle, state } = this.attribute;
|
|
25454
26160
|
if (this._area) {
|
|
25455
26161
|
this._area.setAttributes(Object.assign({ points: points }, areaStyle));
|
|
25456
26162
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25457
26163
|
}
|
|
25458
|
-
|
|
25459
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25460
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25461
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25462
|
-
} }));
|
|
25463
|
-
}
|
|
25464
|
-
this.setLabelPos();
|
|
26164
|
+
this._updateMarkLabels(MarkArea.defaultAttributes.label);
|
|
25465
26165
|
}
|
|
25466
26166
|
isValidPoints() {
|
|
25467
26167
|
const { points } = this.attribute;
|
|
@@ -25479,6 +26179,7 @@ class MarkArea extends Marker {
|
|
|
25479
26179
|
}
|
|
25480
26180
|
}
|
|
25481
26181
|
MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
|
|
26182
|
+
mixin(MarkArea, MarkLabelMixin);
|
|
25482
26183
|
|
|
25483
26184
|
loadMarkArcLineComponent();
|
|
25484
26185
|
function registerMarkArcLineAnimate() {
|
|
@@ -25491,14 +26192,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25491
26192
|
}
|
|
25492
26193
|
}
|
|
25493
26194
|
constructor(attributes, options) {
|
|
25494
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25495
|
-
? attributes
|
|
25496
|
-
: merge({}, MarkArcLine.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26195
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));
|
|
25497
26196
|
this.name = 'markArcLine';
|
|
25498
26197
|
}
|
|
25499
|
-
getPointAttrByPosition(direction) {
|
|
25500
|
-
const { center, radius, startAngle, endAngle
|
|
25501
|
-
const { refX = 0, refY = 0 } =
|
|
26198
|
+
getPointAttrByPosition(direction, labelAttrs) {
|
|
26199
|
+
const { center, radius, startAngle, endAngle } = this.attribute;
|
|
26200
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25502
26201
|
let angle;
|
|
25503
26202
|
switch (direction) {
|
|
25504
26203
|
case IMarkCommonArcLabelPosition.arcInnerStart:
|
|
@@ -25530,9 +26229,9 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25530
26229
|
getTextStyle(position) {
|
|
25531
26230
|
return DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[position];
|
|
25532
26231
|
}
|
|
25533
|
-
getRotateByAngle(angle) {
|
|
26232
|
+
getRotateByAngle(angle, labelAttrs) {
|
|
25534
26233
|
var _a;
|
|
25535
|
-
return angle - Math.PI / 2 + ((_a =
|
|
26234
|
+
return angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
|
|
25536
26235
|
}
|
|
25537
26236
|
createSegment() {
|
|
25538
26237
|
const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this
|
|
@@ -25575,6 +26274,12 @@ class MarkArcLine extends MarkCommonLine {
|
|
|
25575
26274
|
isValidPoints() {
|
|
25576
26275
|
return true;
|
|
25577
26276
|
}
|
|
26277
|
+
addMarkLineLabels(container) {
|
|
26278
|
+
this._addMarkLabels(container, 'mark-common-line-label', MarkArcLine.defaultAttributes.label);
|
|
26279
|
+
}
|
|
26280
|
+
updateMarkLineLabels() {
|
|
26281
|
+
this._updateMarkLabels(MarkArcLine.defaultAttributes.label);
|
|
26282
|
+
}
|
|
25578
26283
|
}
|
|
25579
26284
|
MarkArcLine.defaultAttributes = DEFAULT_MARK_ARC_LINE_THEME;
|
|
25580
26285
|
|
|
@@ -25591,20 +26296,15 @@ class MarkArcArea extends Marker {
|
|
|
25591
26296
|
getArea() {
|
|
25592
26297
|
return this._area;
|
|
25593
26298
|
}
|
|
25594
|
-
getLabel() {
|
|
25595
|
-
return this._label;
|
|
25596
|
-
}
|
|
25597
26299
|
constructor(attributes, options) {
|
|
25598
|
-
super((options === null || options === void 0 ? void 0 : options.skipDefault)
|
|
25599
|
-
? attributes
|
|
25600
|
-
: merge({}, MarkArcArea.defaultAttributes, attributes, { label: { autoRotate: true } }));
|
|
26300
|
+
super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));
|
|
25601
26301
|
this.name = 'markArcArea';
|
|
25602
26302
|
this.defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;
|
|
25603
26303
|
this.defaultExitAnimation = DefaultExitMarkerAnimation;
|
|
25604
26304
|
}
|
|
25605
|
-
getPointAttrByPosition(position) {
|
|
25606
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle
|
|
25607
|
-
const { refX = 0, refY = 0 } =
|
|
26305
|
+
getPointAttrByPosition(position, labelAttrs) {
|
|
26306
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute;
|
|
26307
|
+
const { refX = 0, refY = 0 } = labelAttrs;
|
|
25608
26308
|
let radius;
|
|
25609
26309
|
let angle;
|
|
25610
26310
|
switch (position) {
|
|
@@ -25648,16 +26348,15 @@ class MarkArcArea extends Marker {
|
|
|
25648
26348
|
angle
|
|
25649
26349
|
};
|
|
25650
26350
|
}
|
|
25651
|
-
setLabelPos() {
|
|
26351
|
+
setLabelPos(labelNode, labelAttrs) {
|
|
25652
26352
|
var _a;
|
|
25653
|
-
if (this.
|
|
25654
|
-
const {
|
|
25655
|
-
const
|
|
25656
|
-
|
|
25657
|
-
this.
|
|
25658
|
-
if (this.attribute.limitRect && label.confine) {
|
|
26353
|
+
if (this._area) {
|
|
26354
|
+
const { position: labelPosition = 'arcInnerMiddle', autoRotate } = labelAttrs;
|
|
26355
|
+
const labelAttr = this.getPointAttrByPosition(labelPosition, labelAttrs);
|
|
26356
|
+
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) }));
|
|
26357
|
+
if (this.attribute.limitRect && labelAttrs.confine) {
|
|
25659
26358
|
const { x, y, width, height } = this.attribute.limitRect;
|
|
25660
|
-
limitShapeInBounds(
|
|
26359
|
+
limitShapeInBounds(labelNode, {
|
|
25661
26360
|
x1: x,
|
|
25662
26361
|
y1: y,
|
|
25663
26362
|
x2: x + width,
|
|
@@ -25667,7 +26366,7 @@ class MarkArcArea extends Marker {
|
|
|
25667
26366
|
}
|
|
25668
26367
|
}
|
|
25669
26368
|
initMarker(container) {
|
|
25670
|
-
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle,
|
|
26369
|
+
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, state } = this
|
|
25671
26370
|
.attribute;
|
|
25672
26371
|
const area = graphicCreator.arc(Object.assign({ x: center.x, y: center.y, innerRadius,
|
|
25673
26372
|
outerRadius,
|
|
@@ -25677,14 +26376,7 @@ class MarkArcArea extends Marker {
|
|
|
25677
26376
|
area.name = 'polar-mark-area-area';
|
|
25678
26377
|
this._area = area;
|
|
25679
26378
|
container.add(area);
|
|
25680
|
-
|
|
25681
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25682
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25683
|
-
} }));
|
|
25684
|
-
markLabel.name = 'mark-area-label';
|
|
25685
|
-
this._label = markLabel;
|
|
25686
|
-
container.add(markLabel);
|
|
25687
|
-
this.setLabelPos();
|
|
26379
|
+
this._addMarkLabels(container, 'mark-area-label', MarkArcArea.defaultAttributes.label);
|
|
25688
26380
|
}
|
|
25689
26381
|
updateMarker() {
|
|
25690
26382
|
const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
|
|
@@ -25696,19 +26388,14 @@ class MarkArcArea extends Marker {
|
|
|
25696
26388
|
endAngle }, areaStyle));
|
|
25697
26389
|
this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
|
|
25698
26390
|
}
|
|
25699
|
-
|
|
25700
|
-
this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
|
|
25701
|
-
panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
|
|
25702
|
-
text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
|
|
25703
|
-
} }));
|
|
25704
|
-
this.setLabelPos();
|
|
25705
|
-
}
|
|
26391
|
+
this._updateMarkLabels(MarkArcArea.defaultAttributes.label);
|
|
25706
26392
|
}
|
|
25707
26393
|
isValidPoints() {
|
|
25708
26394
|
return true;
|
|
25709
26395
|
}
|
|
25710
26396
|
}
|
|
25711
26397
|
MarkArcArea.defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;
|
|
26398
|
+
mixin(MarkArcArea, MarkLabelMixin);
|
|
25712
26399
|
|
|
25713
26400
|
loadMarkPointComponent();
|
|
25714
26401
|
function registerMarkPointAnimate() {
|
|
@@ -27729,28 +28416,21 @@ class Slider extends AbstractComponent {
|
|
|
27729
28416
|
this._dispatchTooltipEvent('sliderTooltipHide');
|
|
27730
28417
|
};
|
|
27731
28418
|
this._onHandlerPointerdown = (e) => {
|
|
27732
|
-
|
|
28419
|
+
this._clearAllDragEvents();
|
|
27733
28420
|
this._isChanging = true;
|
|
27734
28421
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27735
28422
|
this._currentHandler = e.target;
|
|
27736
28423
|
this._prePos = this._isHorizontal ? x : y;
|
|
27737
|
-
|
|
27738
|
-
|
|
27739
|
-
|
|
27740
|
-
|
|
27741
|
-
|
|
27742
|
-
}
|
|
27743
|
-
else {
|
|
27744
|
-
this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27745
|
-
capture: true
|
|
27746
|
-
});
|
|
27747
|
-
this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27748
|
-
this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27749
|
-
}
|
|
28424
|
+
const triggers = getEndTriggersOfDrag();
|
|
28425
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28426
|
+
obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28427
|
+
triggers.forEach((trigger) => {
|
|
28428
|
+
obj.addEventListener(trigger, this._onHandlerPointerUp);
|
|
28429
|
+
});
|
|
27750
28430
|
};
|
|
27751
28431
|
this._onHandlerPointerMove = (e) => {
|
|
27752
28432
|
var _a, _b;
|
|
27753
|
-
e.
|
|
28433
|
+
e.preventDefault();
|
|
27754
28434
|
this._isChanging = true;
|
|
27755
28435
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27756
28436
|
if (max === min) {
|
|
@@ -27786,44 +28466,29 @@ class Slider extends AbstractComponent {
|
|
|
27786
28466
|
this._dispatchChangeEvent();
|
|
27787
28467
|
};
|
|
27788
28468
|
this._onHandlerPointerUp = (e) => {
|
|
27789
|
-
e.preventDefault();
|
|
27790
28469
|
this._isChanging = false;
|
|
27791
28470
|
this._currentHandler = null;
|
|
27792
|
-
|
|
27793
|
-
|
|
27794
|
-
|
|
27795
|
-
|
|
27796
|
-
|
|
27797
|
-
}
|
|
27798
|
-
else {
|
|
27799
|
-
this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27800
|
-
capture: true
|
|
27801
|
-
});
|
|
27802
|
-
this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27803
|
-
this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
28471
|
+
this._clearAllDragEvents();
|
|
28472
|
+
};
|
|
28473
|
+
this._handleTouchMove = (e) => {
|
|
28474
|
+
if (this._isChanging) {
|
|
28475
|
+
e.preventDefault();
|
|
27804
28476
|
}
|
|
27805
28477
|
};
|
|
27806
28478
|
this._onTrackPointerdown = (e) => {
|
|
27807
|
-
|
|
28479
|
+
this._clearAllDragEvents();
|
|
27808
28480
|
this._isChanging = true;
|
|
27809
28481
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27810
28482
|
this._prePos = this._isHorizontal ? x : y;
|
|
27811
|
-
|
|
27812
|
-
|
|
27813
|
-
|
|
27814
|
-
|
|
27815
|
-
|
|
27816
|
-
}
|
|
27817
|
-
else {
|
|
27818
|
-
this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27819
|
-
capture: true
|
|
27820
|
-
});
|
|
27821
|
-
this.stage.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27822
|
-
this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27823
|
-
}
|
|
28483
|
+
const triggers = getEndTriggersOfDrag();
|
|
28484
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28485
|
+
obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28486
|
+
triggers.forEach((trigger) => {
|
|
28487
|
+
obj.addEventListener(trigger, this._onTrackPointerUp);
|
|
28488
|
+
});
|
|
27824
28489
|
};
|
|
27825
28490
|
this._onTrackPointerMove = (e) => {
|
|
27826
|
-
e.
|
|
28491
|
+
e.preventDefault();
|
|
27827
28492
|
this._isChanging = true;
|
|
27828
28493
|
const { railWidth, railHeight, min, max, inverse } = this.attribute;
|
|
27829
28494
|
if (max === min) {
|
|
@@ -27875,24 +28540,11 @@ class Slider extends AbstractComponent {
|
|
|
27875
28540
|
this._dispatchChangeEvent();
|
|
27876
28541
|
};
|
|
27877
28542
|
this._onTrackPointerUp = (e) => {
|
|
27878
|
-
e.preventDefault();
|
|
27879
28543
|
this._isChanging = false;
|
|
27880
|
-
|
|
27881
|
-
vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27882
|
-
capture: true
|
|
27883
|
-
});
|
|
27884
|
-
vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27885
|
-
}
|
|
27886
|
-
else {
|
|
27887
|
-
this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27888
|
-
capture: true
|
|
27889
|
-
});
|
|
27890
|
-
this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27891
|
-
this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27892
|
-
}
|
|
28544
|
+
this._clearAllDragEvents();
|
|
27893
28545
|
};
|
|
27894
28546
|
this._onRailPointerDown = (e) => {
|
|
27895
|
-
|
|
28547
|
+
this._clearAllDragEvents();
|
|
27896
28548
|
this._isChanging = true;
|
|
27897
28549
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27898
28550
|
if (max === min) {
|
|
@@ -28270,6 +28922,9 @@ class Slider extends AbstractComponent {
|
|
|
28270
28922
|
this._track.addEventListener('pointerdown', this._onTrackPointerdown);
|
|
28271
28923
|
}
|
|
28272
28924
|
this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
|
|
28925
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
28926
|
+
passive: false
|
|
28927
|
+
});
|
|
28273
28928
|
}
|
|
28274
28929
|
}
|
|
28275
28930
|
_bindTooltipEvents() {
|
|
@@ -28280,6 +28935,18 @@ class Slider extends AbstractComponent {
|
|
|
28280
28935
|
this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
|
|
28281
28936
|
this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
|
|
28282
28937
|
}
|
|
28938
|
+
_clearAllDragEvents() {
|
|
28939
|
+
const triggers = getEndTriggersOfDrag();
|
|
28940
|
+
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
28941
|
+
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
|
|
28942
|
+
triggers.forEach((trigger) => {
|
|
28943
|
+
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
28944
|
+
});
|
|
28945
|
+
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
|
|
28946
|
+
triggers.forEach((trigger) => {
|
|
28947
|
+
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
28948
|
+
});
|
|
28949
|
+
}
|
|
28283
28950
|
_updateTrack() {
|
|
28284
28951
|
const { inverse, railWidth, railHeight } = this.attribute;
|
|
28285
28952
|
const startHandler = this._startHandler;
|
|
@@ -28420,6 +29087,13 @@ class Slider extends AbstractComponent {
|
|
|
28420
29087
|
endHandler
|
|
28421
29088
|
};
|
|
28422
29089
|
}
|
|
29090
|
+
release(all) {
|
|
29091
|
+
super.release(all);
|
|
29092
|
+
(vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
|
|
29093
|
+
passive: false
|
|
29094
|
+
});
|
|
29095
|
+
this._clearAllDragEvents();
|
|
29096
|
+
}
|
|
28423
29097
|
}
|
|
28424
29098
|
Slider.defaultAttributes = {
|
|
28425
29099
|
slidable: true,
|
|
@@ -30113,13 +30787,14 @@ var IOperateType;
|
|
|
30113
30787
|
IOperateType["moving"] = "moving";
|
|
30114
30788
|
IOperateType["moveStart"] = "moveStart";
|
|
30115
30789
|
IOperateType["moveEnd"] = "moveEnd";
|
|
30790
|
+
IOperateType["brushActive"] = "brushActive";
|
|
30116
30791
|
IOperateType["brushClear"] = "brushClear";
|
|
30117
30792
|
})(IOperateType || (IOperateType = {}));
|
|
30118
30793
|
|
|
30119
30794
|
const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
30120
30795
|
trigger: 'pointerdown',
|
|
30121
30796
|
updateTrigger: 'pointermove',
|
|
30122
|
-
endTrigger: 'pointerup',
|
|
30797
|
+
endTrigger: ['pointerup', 'pointerleave'],
|
|
30123
30798
|
resetTrigger: 'pointerupoutside',
|
|
30124
30799
|
hasMask: true,
|
|
30125
30800
|
brushMode: 'single',
|
|
@@ -30135,10 +30810,10 @@ const DEFAULT_BRUSH_ATTRIBUTES = {
|
|
|
30135
30810
|
delayType: 'throttle',
|
|
30136
30811
|
delayTime: 10,
|
|
30137
30812
|
interactiveRange: {
|
|
30138
|
-
|
|
30139
|
-
|
|
30140
|
-
|
|
30141
|
-
|
|
30813
|
+
minY: -Infinity,
|
|
30814
|
+
maxY: Infinity,
|
|
30815
|
+
minX: -Infinity,
|
|
30816
|
+
maxX: Infinity
|
|
30142
30817
|
}
|
|
30143
30818
|
};
|
|
30144
30819
|
const DEFAULT_SIZE_THRESHOLD = 5;
|
|
@@ -30159,145 +30834,87 @@ class Brush extends AbstractComponent {
|
|
|
30159
30834
|
this.name = 'brush';
|
|
30160
30835
|
this._activeDrawState = false;
|
|
30161
30836
|
this._cacheDrawPoints = [];
|
|
30162
|
-
this._isDrawedBeforeEnd = false;
|
|
30163
|
-
this._isDownBeforeUpOutside = false;
|
|
30164
30837
|
this._activeMoveState = false;
|
|
30165
30838
|
this._operatingMaskMoveDx = 0;
|
|
30166
30839
|
this._operatingMaskMoveDy = 0;
|
|
30167
30840
|
this._operatingMaskMoveRangeX = [-Infinity, Infinity];
|
|
30168
30841
|
this._operatingMaskMoveRangeY = [-Infinity, Infinity];
|
|
30169
30842
|
this._brushMaskAABBBoundsDict = {};
|
|
30843
|
+
this._firstUpdate = true;
|
|
30170
30844
|
this._onBrushStart = (e) => {
|
|
30171
|
-
var _a;
|
|
30172
30845
|
if (this._outOfInteractiveRange(e)) {
|
|
30173
|
-
this.
|
|
30846
|
+
if (!this._isEmptyMask()) {
|
|
30847
|
+
this._clearMask();
|
|
30848
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30849
|
+
}
|
|
30174
30850
|
return;
|
|
30175
30851
|
}
|
|
30852
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
|
|
30853
|
+
array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
|
|
30854
|
+
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30176
30855
|
e.stopPropagation();
|
|
30177
|
-
|
|
30856
|
+
this._firstUpdate = true;
|
|
30178
30857
|
this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
|
|
30179
30858
|
this._activeDrawState = !this._activeMoveState;
|
|
30180
|
-
this.
|
|
30181
|
-
this.
|
|
30859
|
+
this._startPos = this.eventPosToStagePos(e);
|
|
30860
|
+
this._cacheDrawPoints = [this._startPos];
|
|
30182
30861
|
};
|
|
30183
30862
|
this._onBrushing = (e) => {
|
|
30184
30863
|
if (this._outOfInteractiveRange(e)) {
|
|
30185
30864
|
return;
|
|
30186
30865
|
}
|
|
30187
|
-
|
|
30188
|
-
|
|
30866
|
+
e.stopPropagation();
|
|
30867
|
+
if (this._firstUpdate) {
|
|
30868
|
+
this._activeDrawState && this._initDraw(e);
|
|
30869
|
+
this._activeMoveState && this._initMove(e);
|
|
30870
|
+
this._firstUpdate = false;
|
|
30871
|
+
}
|
|
30872
|
+
else {
|
|
30873
|
+
this._activeDrawState && this._drawing(e);
|
|
30874
|
+
this._activeMoveState && this._moving(e);
|
|
30189
30875
|
}
|
|
30190
|
-
this._activeDrawState && this._drawing(e);
|
|
30191
|
-
this._activeMoveState && this._moving(e);
|
|
30192
30876
|
};
|
|
30193
30877
|
this._onBrushingWithDelay = this.attribute.delayTime === 0
|
|
30194
30878
|
? this._onBrushing
|
|
30195
30879
|
: delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);
|
|
30196
30880
|
this._onBrushEnd = (e) => {
|
|
30197
|
-
|
|
30198
|
-
if (!this._activeDrawState && !this._activeMoveState) {
|
|
30199
|
-
return;
|
|
30200
|
-
}
|
|
30881
|
+
this._releaseBrushUpdateEvents();
|
|
30201
30882
|
e.preventDefault();
|
|
30202
|
-
|
|
30203
|
-
|
|
30204
|
-
if ((_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds.empty()) {
|
|
30205
|
-
this._dispatchEvent(IOperateType.brushClear, {
|
|
30206
|
-
operateMask: this._operatingMask,
|
|
30207
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30208
|
-
event: e
|
|
30209
|
-
});
|
|
30210
|
-
}
|
|
30211
|
-
this._container.incrementalClearChild();
|
|
30212
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30213
|
-
}
|
|
30214
|
-
else {
|
|
30215
|
-
if (this._activeDrawState) {
|
|
30216
|
-
this._dispatchEvent(IOperateType.drawEnd, {
|
|
30217
|
-
operateMask: this._operatingMask,
|
|
30218
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30219
|
-
event: e
|
|
30220
|
-
});
|
|
30221
|
-
}
|
|
30222
|
-
if (this._activeMoveState) {
|
|
30223
|
-
this._dispatchEvent(IOperateType.moveEnd, {
|
|
30224
|
-
operateMask: this._operatingMask,
|
|
30225
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30226
|
-
event: e
|
|
30227
|
-
});
|
|
30228
|
-
}
|
|
30229
|
-
}
|
|
30883
|
+
this._activeDrawState && this._drawEnd(e);
|
|
30884
|
+
this._activeMoveState && this._moveEnd(e);
|
|
30230
30885
|
this._activeDrawState = false;
|
|
30231
30886
|
this._activeMoveState = false;
|
|
30232
|
-
this._isDrawedBeforeEnd = false;
|
|
30233
|
-
if (this._operatingMask) {
|
|
30234
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30235
|
-
}
|
|
30236
30887
|
};
|
|
30237
30888
|
this._onBrushClear = (e) => {
|
|
30238
30889
|
e.preventDefault();
|
|
30239
|
-
|
|
30240
|
-
|
|
30241
|
-
this.
|
|
30242
|
-
operateMask: this._operatingMask,
|
|
30243
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30244
|
-
event: e
|
|
30245
|
-
});
|
|
30246
|
-
this._container.incrementalClearChild();
|
|
30247
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30890
|
+
if (!this._isEmptyMask()) {
|
|
30891
|
+
this._clearMask();
|
|
30892
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30248
30893
|
}
|
|
30249
30894
|
this._activeDrawState = false;
|
|
30250
30895
|
this._activeMoveState = false;
|
|
30251
|
-
this._isDrawedBeforeEnd = false;
|
|
30252
|
-
this._isDownBeforeUpOutside = false;
|
|
30253
|
-
if (this._operatingMask) {
|
|
30254
|
-
this._operatingMask.setAttribute('pickable', false);
|
|
30255
|
-
}
|
|
30256
30896
|
};
|
|
30257
30897
|
}
|
|
30258
30898
|
_bindBrushEvents() {
|
|
30899
|
+
this.releaseBrushEvents();
|
|
30259
30900
|
if (this.attribute.disableTriggerEvent) {
|
|
30260
30901
|
return;
|
|
30261
30902
|
}
|
|
30262
|
-
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger,
|
|
30263
|
-
|
|
30264
|
-
array(
|
|
30265
|
-
array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
|
|
30903
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
30904
|
+
.attribute;
|
|
30905
|
+
array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart));
|
|
30266
30906
|
array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
|
|
30267
30907
|
}
|
|
30268
|
-
_isPosInBrushMask(e) {
|
|
30269
|
-
const pos = this.eventPosToStagePos(e);
|
|
30270
|
-
const brushMasks = this._container.getChildren();
|
|
30271
|
-
for (let i = 0; i < brushMasks.length; i++) {
|
|
30272
|
-
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
30273
|
-
const pointsConsiderOffset = points.map((point) => {
|
|
30274
|
-
return {
|
|
30275
|
-
x: point.x + dx,
|
|
30276
|
-
y: point.y + dy
|
|
30277
|
-
};
|
|
30278
|
-
});
|
|
30279
|
-
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
30280
|
-
this._operatingMask = brushMasks[i];
|
|
30281
|
-
return true;
|
|
30282
|
-
}
|
|
30283
|
-
}
|
|
30284
|
-
return false;
|
|
30285
|
-
}
|
|
30286
30908
|
_initDraw(e) {
|
|
30287
30909
|
const { brushMode } = this.attribute;
|
|
30288
30910
|
const pos = this.eventPosToStagePos(e);
|
|
30289
|
-
this._cacheDrawPoints
|
|
30290
|
-
this.
|
|
30291
|
-
if (brushMode === 'single') {
|
|
30292
|
-
this._brushMaskAABBBoundsDict = {};
|
|
30293
|
-
this._container.incrementalClearChild();
|
|
30294
|
-
}
|
|
30911
|
+
this._cacheDrawPoints.push(pos);
|
|
30912
|
+
brushMode === 'single' && this._clearMask();
|
|
30295
30913
|
this._addBrushMask();
|
|
30296
|
-
this.
|
|
30297
|
-
|
|
30298
|
-
|
|
30299
|
-
|
|
30300
|
-
});
|
|
30914
|
+
this._dispatchBrushEvent(IOperateType.drawStart, e);
|
|
30915
|
+
if (Object.keys(this._brushMaskAABBBoundsDict).length === 1) {
|
|
30916
|
+
this._dispatchBrushEvent(IOperateType.brushActive, e);
|
|
30917
|
+
}
|
|
30301
30918
|
}
|
|
30302
30919
|
_initMove(e) {
|
|
30303
30920
|
var _a, _b;
|
|
@@ -30314,16 +30931,12 @@ class Brush extends AbstractComponent {
|
|
|
30314
30931
|
this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
|
|
30315
30932
|
this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
|
|
30316
30933
|
this._operatingMask.setAttribute('pickable', true);
|
|
30317
|
-
this.
|
|
30318
|
-
operateMask: this._operatingMask,
|
|
30319
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30320
|
-
event: e
|
|
30321
|
-
});
|
|
30934
|
+
this._dispatchBrushEvent(IOperateType.moveStart, e);
|
|
30322
30935
|
}
|
|
30323
30936
|
_drawing(e) {
|
|
30324
|
-
var _a
|
|
30937
|
+
var _a;
|
|
30325
30938
|
const pos = this.eventPosToStagePos(e);
|
|
30326
|
-
const {
|
|
30939
|
+
const { brushType } = this.attribute;
|
|
30327
30940
|
const cacheLength = this._cacheDrawPoints.length;
|
|
30328
30941
|
if (cacheLength > 0) {
|
|
30329
30942
|
const lastPos = (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) !== null && _a !== void 0 ? _a : {};
|
|
@@ -30339,18 +30952,7 @@ class Brush extends AbstractComponent {
|
|
|
30339
30952
|
}
|
|
30340
30953
|
const maskPoints = this._computeMaskPoints();
|
|
30341
30954
|
this._operatingMask.setAttribute('points', maskPoints);
|
|
30342
|
-
|
|
30343
|
-
this._isDrawedBeforeEnd =
|
|
30344
|
-
!this._operatingMask._AABBBounds.empty() &&
|
|
30345
|
-
!!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
|
|
30346
|
-
if (this._isDrawedBeforeEnd) {
|
|
30347
|
-
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30348
|
-
this._dispatchEvent(IOperateType.drawing, {
|
|
30349
|
-
operateMask: this._operatingMask,
|
|
30350
|
-
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
30351
|
-
event: e
|
|
30352
|
-
});
|
|
30353
|
-
}
|
|
30955
|
+
this._dispatchBrushEvent(IOperateType.drawing, e);
|
|
30354
30956
|
}
|
|
30355
30957
|
_moving(e) {
|
|
30356
30958
|
const startPos = this._cacheMovePoint;
|
|
@@ -30369,11 +30971,61 @@ class Brush extends AbstractComponent {
|
|
|
30369
30971
|
dy: moveY
|
|
30370
30972
|
});
|
|
30371
30973
|
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
30372
|
-
this.
|
|
30373
|
-
|
|
30374
|
-
|
|
30375
|
-
|
|
30376
|
-
|
|
30974
|
+
this._dispatchBrushEvent(IOperateType.moving, e);
|
|
30975
|
+
}
|
|
30976
|
+
_drawEnd(e) {
|
|
30977
|
+
const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
|
|
30978
|
+
if (this._outOfInteractiveRange(e)) {
|
|
30979
|
+
if (!this._isEmptyMask()) {
|
|
30980
|
+
this._clearMask();
|
|
30981
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30982
|
+
}
|
|
30983
|
+
}
|
|
30984
|
+
else {
|
|
30985
|
+
const { x: x1, y: y1 } = this._startPos;
|
|
30986
|
+
const { x: x2, y: y2 } = this.eventPosToStagePos(e);
|
|
30987
|
+
if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {
|
|
30988
|
+
if (!this._isEmptyMask()) {
|
|
30989
|
+
this._clearMask();
|
|
30990
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30991
|
+
}
|
|
30992
|
+
}
|
|
30993
|
+
else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {
|
|
30994
|
+
delete this._brushMaskAABBBoundsDict[this._operatingMask.name];
|
|
30995
|
+
this._container.setAttributes({});
|
|
30996
|
+
this._container.removeChild(this._operatingMask);
|
|
30997
|
+
if (this._isEmptyMask()) {
|
|
30998
|
+
this._dispatchBrushEvent(IOperateType.brushClear, e);
|
|
30999
|
+
}
|
|
31000
|
+
}
|
|
31001
|
+
else {
|
|
31002
|
+
this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
|
|
31003
|
+
this._dispatchBrushEvent(IOperateType.drawEnd, e);
|
|
31004
|
+
}
|
|
31005
|
+
}
|
|
31006
|
+
}
|
|
31007
|
+
_moveEnd(e) {
|
|
31008
|
+
if (this._operatingMask) {
|
|
31009
|
+
this._operatingMask.setAttribute('pickable', false);
|
|
31010
|
+
}
|
|
31011
|
+
this._dispatchBrushEvent(IOperateType.moveEnd, e);
|
|
31012
|
+
}
|
|
31013
|
+
render() {
|
|
31014
|
+
this._bindBrushEvents();
|
|
31015
|
+
const group = this.createOrUpdateChild('brush-container', {}, 'group');
|
|
31016
|
+
this._container = group;
|
|
31017
|
+
}
|
|
31018
|
+
releaseBrushEvents() {
|
|
31019
|
+
const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
|
|
31020
|
+
.attribute;
|
|
31021
|
+
array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart));
|
|
31022
|
+
array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
|
|
31023
|
+
this._releaseBrushUpdateEvents();
|
|
31024
|
+
}
|
|
31025
|
+
_releaseBrushUpdateEvents() {
|
|
31026
|
+
const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } = this.attribute;
|
|
31027
|
+
array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
|
|
31028
|
+
array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
|
|
30377
31029
|
}
|
|
30378
31030
|
_computeMaskPoints() {
|
|
30379
31031
|
const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
|
|
@@ -30442,12 +31094,30 @@ class Brush extends AbstractComponent {
|
|
|
30442
31094
|
_addBrushMask() {
|
|
30443
31095
|
var _a;
|
|
30444
31096
|
const { brushStyle, hasMask } = this.attribute;
|
|
30445
|
-
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 }));
|
|
31097
|
+
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 }));
|
|
30446
31098
|
brushMask.name = `brush-${Date.now()}`;
|
|
30447
31099
|
this._operatingMask = brushMask;
|
|
30448
31100
|
this._container.add(brushMask);
|
|
30449
31101
|
this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
|
|
30450
31102
|
}
|
|
31103
|
+
_isPosInBrushMask(e) {
|
|
31104
|
+
const pos = this.eventPosToStagePos(e);
|
|
31105
|
+
const brushMasks = this._container.getChildren();
|
|
31106
|
+
for (let i = 0; i < brushMasks.length; i++) {
|
|
31107
|
+
const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
|
|
31108
|
+
const pointsConsiderOffset = points.map((point) => {
|
|
31109
|
+
return {
|
|
31110
|
+
x: point.x + dx,
|
|
31111
|
+
y: point.y + dy
|
|
31112
|
+
};
|
|
31113
|
+
});
|
|
31114
|
+
if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
|
|
31115
|
+
this._operatingMask = brushMasks[i];
|
|
31116
|
+
return true;
|
|
31117
|
+
}
|
|
31118
|
+
}
|
|
31119
|
+
return false;
|
|
31120
|
+
}
|
|
30451
31121
|
_outOfInteractiveRange(e) {
|
|
30452
31122
|
const { interactiveRange } = this.attribute;
|
|
30453
31123
|
const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;
|
|
@@ -30460,17 +31130,21 @@ class Brush extends AbstractComponent {
|
|
|
30460
31130
|
eventPosToStagePos(e) {
|
|
30461
31131
|
return this.stage.eventPointTransform(e);
|
|
30462
31132
|
}
|
|
30463
|
-
|
|
30464
|
-
this.
|
|
30465
|
-
|
|
30466
|
-
|
|
31133
|
+
_dispatchBrushEvent(operateType, e) {
|
|
31134
|
+
this._dispatchEvent(operateType, {
|
|
31135
|
+
operateMask: this._operatingMask,
|
|
31136
|
+
operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
|
|
31137
|
+
event: e
|
|
31138
|
+
});
|
|
30467
31139
|
}
|
|
30468
|
-
|
|
30469
|
-
|
|
30470
|
-
|
|
30471
|
-
|
|
30472
|
-
|
|
30473
|
-
|
|
31140
|
+
_clearMask() {
|
|
31141
|
+
this._brushMaskAABBBoundsDict = {};
|
|
31142
|
+
this._container.incrementalClearChild();
|
|
31143
|
+
this._operatingMask = null;
|
|
31144
|
+
}
|
|
31145
|
+
_isEmptyMask() {
|
|
31146
|
+
return (isEmpty(this._brushMaskAABBBoundsDict) ||
|
|
31147
|
+
Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty()));
|
|
30474
31148
|
}
|
|
30475
31149
|
}
|
|
30476
31150
|
Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
|
|
@@ -31772,10 +32446,10 @@ class Switch extends AbstractComponent {
|
|
|
31772
32446
|
});
|
|
31773
32447
|
this._circle.setAttributes({
|
|
31774
32448
|
y: circleY,
|
|
31775
|
-
x: this.attribute.checked ? circleX : maxWidth - circleX
|
|
32449
|
+
x: !this.attribute.checked ? circleX : maxWidth - circleX
|
|
31776
32450
|
});
|
|
31777
32451
|
this._text.setAttributes({
|
|
31778
|
-
x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
32452
|
+
x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
31779
32453
|
y: textY
|
|
31780
32454
|
});
|
|
31781
32455
|
}
|
|
@@ -31922,6 +32596,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31922
32596
|
theme: 'default'
|
|
31923
32597
|
};
|
|
31924
32598
|
|
|
31925
|
-
const version = "1.0.0-alpha.
|
|
32599
|
+
const version = "1.0.0-alpha.6";
|
|
31926
32600
|
|
|
31927
32601
|
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 };
|