@wcardinal/wcardinal-ui 0.468.0 → 0.469.0-beta.0
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/dist/types/wcardinal/ui/d-diagram-serialized.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/e-shape-capability.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/e-shape-defaults.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/e-shape-type.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/e-shape.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/load/index.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/load/load-shape-fan.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/load/load-shape-semicircle-legacy.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/build-semicircle-legacy.d.ts +9 -0
- package/dist/types/wcardinal/ui/shape/variant/build-semicircle.d.ts +1 -9
- package/dist/types/wcardinal/ui/shape/variant/builder-semicircle-legacy.d.ts +10 -0
- package/dist/types/wcardinal/ui/shape/variant/builder-semicircle.d.ts +1 -10
- package/dist/types/wcardinal/ui/shape/variant/create-semicircle-legacy-uploaded.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/create-semicircle-uploaded.d.ts +1 -4
- package/dist/types/wcardinal/ui/shape/variant/deserialize-fan.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/deserialize-semicircle-legacy.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-base.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-button.d.ts +2 -1
- package/dist/types/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.d.ts +200 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-fan-triangulated.d.ts +3 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-fan.d.ts +26 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-group-viewer.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-group.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-primitive.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-semicircle-legacy.d.ts +10 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-semicircle.d.ts +9 -2
- package/dist/types/wcardinal/ui/shape/variant/e-shape-triangle-triangulated-impl.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/variant/hit-test-fan.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/variant/index.d.ts +11 -0
- package/dist/types/wcardinal/ui/shape/variant/to-fan-angle-centric.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/to-fan-angle-eccentric.d.ts +5 -0
- package/dist/types/wcardinal/ui/theme/dark/e-theme-dark-shape.d.ts +1 -0
- package/dist/types/wcardinal/ui/theme/white/e-theme-white-shape.d.ts +1 -0
- package/dist/wcardinal/ui/d-diagram-serialized.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-capability.js +6 -1
- package/dist/wcardinal/ui/shape/e-shape-capability.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-defaults.js +7 -0
- package/dist/wcardinal/ui/shape/e-shape-defaults.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-type.js +2 -0
- package/dist/wcardinal/ui/shape/e-shape-type.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/index.js +2 -0
- package/dist/wcardinal/ui/shape/load/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/load-shape-all.js +4 -0
- package/dist/wcardinal/ui/shape/load/load-shape-all.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/load-shape-fan.js +17 -0
- package/dist/wcardinal/ui/shape/load/load-shape-fan.js.map +1 -0
- package/dist/wcardinal/ui/shape/load/load-shape-semicircle-legacy.js +14 -0
- package/dist/wcardinal/ui/shape/load/load-shape-semicircle-legacy.js.map +1 -0
- package/dist/wcardinal/ui/shape/load/load-shape-semicircle.js +5 -2
- package/dist/wcardinal/ui/shape/load/load-shape-semicircle.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/build-semicircle-legacy.js +137 -0
- package/dist/wcardinal/ui/shape/variant/build-semicircle-legacy.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/build-semicircle.js +1 -139
- package/dist/wcardinal/ui/shape/variant/build-semicircle.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/builder-semicircle-legacy.js +76 -0
- package/dist/wcardinal/ui/shape/variant/builder-semicircle-legacy.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/builder-semicircle.js +1 -71
- package/dist/wcardinal/ui/shape/variant/builder-semicircle.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/create-semicircle-legacy-uploaded.js +24 -0
- package/dist/wcardinal/ui/shape/variant/create-semicircle-legacy-uploaded.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/create-semicircle-uploaded.js +1 -19
- package/dist/wcardinal/ui/shape/variant/create-semicircle-uploaded.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/deserialize-fan.js +12 -0
- package/dist/wcardinal/ui/shape/variant/deserialize-fan.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/deserialize-semicircle-legacy.js +10 -0
- package/dist/wcardinal/ui/shape/variant/deserialize-semicircle-legacy.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-base.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-button.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js +0 -2
- package/dist/wcardinal/ui/shape/variant/e-shape-connector-line.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-embedded-acceptor-edge.js +0 -2
- package/dist/wcardinal/ui/shape/variant/e-shape-embedded-acceptor-edge.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.js +724 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated.js +6 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-fan.js +85 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-fan.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-group-viewer.js +10 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-group-viewer.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-group.js +18 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-group.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-polygon.js +3 -4
- package/dist/wcardinal/ui/shape/variant/e-shape-polygon.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-primitive.js +10 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-primitive.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle-legacy.js +33 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle-legacy.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle.js +36 -6
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-triangle-triangulated-impl.js +31 -30
- package/dist/wcardinal/ui/shape/variant/e-shape-triangle-triangulated-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/hit-test-fan.js +79 -0
- package/dist/wcardinal/ui/shape/variant/hit-test-fan.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/index.js +11 -0
- package/dist/wcardinal/ui/shape/variant/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-centric.js +11 -0
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-centric.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-eccentric.js +12 -0
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-eccentric.js.map +1 -0
- package/dist/wcardinal/ui/theme/dark/e-theme-dark-shape.js +3 -0
- package/dist/wcardinal/ui/theme/dark/e-theme-dark-shape.js.map +1 -1
- package/dist/wcardinal/ui/theme/white/e-theme-white-shape.js +3 -0
- package/dist/wcardinal/ui/theme/white/e-theme-white-shape.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +4 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark-en-us.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +4 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +2 -2
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark.js +4 -1
- package/dist/wcardinal-ui-theme-dark.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-en-us.js +4 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-en-us.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +4 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +2 -2
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js.map +1 -1
- package/dist/wcardinal-ui-theme-white.js +4 -1
- package/dist/wcardinal-ui-theme-white.min.js +2 -2
- package/dist/wcardinal-ui.cjs.js +1160 -103
- package/dist/wcardinal-ui.js +1154 -103
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.469.0-beta.0
|
|
3
3
|
Copyright (C) 2019-2026 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
TRIANGLE_LEGACY: 29,
|
|
60
60
|
RECTANGLE_ROUNDED_LEGACY: 30,
|
|
61
61
|
TRIANGLE_ROUNDED_LEGACY: 31,
|
|
62
|
+
FAN: 32,
|
|
63
|
+
SEMICIRCLE_LEGACY: 33,
|
|
62
64
|
EXTENSION: 1000
|
|
63
65
|
};
|
|
64
66
|
|
|
@@ -1786,6 +1788,13 @@
|
|
|
1786
1788
|
enumerable: false,
|
|
1787
1789
|
configurable: true
|
|
1788
1790
|
});
|
|
1791
|
+
Object.defineProperty(EShapeDefaults, "ANGLE", {
|
|
1792
|
+
get: function () {
|
|
1793
|
+
return this.THEME.getAngle();
|
|
1794
|
+
},
|
|
1795
|
+
enumerable: false,
|
|
1796
|
+
configurable: true
|
|
1797
|
+
});
|
|
1789
1798
|
Object.defineProperty(EShapeDefaults, "SIZE_X", {
|
|
1790
1799
|
get: function () {
|
|
1791
1800
|
return this.THEME.getSizeX();
|
|
@@ -4703,6 +4712,7 @@
|
|
|
4703
4712
|
var LINE = 0x800000;
|
|
4704
4713
|
var LINE_TAIL = 0x1000000;
|
|
4705
4714
|
var LINE_HEAD = 0x2000000;
|
|
4715
|
+
var ANGLE = 0x4000000;
|
|
4706
4716
|
var COORDINATE = POSITION | WIDTH$1 | HEIGHT$1 | ROTATION$1 | SKEW;
|
|
4707
4717
|
var SHAPE = REPLACING | GROUPING | FILL$1 | STROKE$1 | STROKE_STYLE | LINE | LINE_TAIL | LINE_HEAD;
|
|
4708
4718
|
var LAYER = ORDER_IN_LAYER;
|
|
@@ -4711,7 +4721,7 @@
|
|
|
4711
4721
|
var EMBEDDED = ID | COORDINATE | REPLACING | GROUPING | TEXT$2 | DATA | ACTION | LAYER | DATA_MAPPING;
|
|
4712
4722
|
var EMBEDDED_ACCEPTOR_EDGE = ID | COORDINATE | REPLACING | FILL$1 | STROKE$1 | STROKE_STYLE_SCALING | TEXT$2 | TEXTURE | DATA | ACTION | CURSOR$1 | LAYER;
|
|
4713
4723
|
var CONNECTOR = ID | SHAPE | TEXT$2 | TEXTURE | DATA | ACTION | CURSOR$1 | LAYER | CHILDREN$1;
|
|
4714
|
-
var ALL = PRIMITIVE | STROKE_SIDE | BORDER_RADIUS | DATA_MAPPING | UNGROUPING;
|
|
4724
|
+
var ALL = PRIMITIVE | STROKE_SIDE | BORDER_RADIUS | ANGLE | DATA_MAPPING | UNGROUPING;
|
|
4715
4725
|
var EShapeCapability = {
|
|
4716
4726
|
NONE: NONE,
|
|
4717
4727
|
/**
|
|
@@ -4780,6 +4790,10 @@
|
|
|
4780
4790
|
* Allows shape border radiuses to be modified.
|
|
4781
4791
|
*/
|
|
4782
4792
|
BORDER_RADIUS: BORDER_RADIUS,
|
|
4793
|
+
/**
|
|
4794
|
+
* Allows shape angles to be modified.
|
|
4795
|
+
*/
|
|
4796
|
+
ANGLE: ANGLE,
|
|
4783
4797
|
/**
|
|
4784
4798
|
* Allows shape texts to be modified.
|
|
4785
4799
|
*/
|
|
@@ -8433,6 +8447,16 @@
|
|
|
8433
8447
|
enumerable: false,
|
|
8434
8448
|
configurable: true
|
|
8435
8449
|
});
|
|
8450
|
+
Object.defineProperty(EShapePrimitive.prototype, "angle", {
|
|
8451
|
+
get: function () {
|
|
8452
|
+
return 0;
|
|
8453
|
+
},
|
|
8454
|
+
set: function (angle) {
|
|
8455
|
+
// DO NOTHING
|
|
8456
|
+
},
|
|
8457
|
+
enumerable: false,
|
|
8458
|
+
configurable: true
|
|
8459
|
+
});
|
|
8436
8460
|
Object.defineProperty(EShapePrimitive.prototype, "image", {
|
|
8437
8461
|
get: function () {
|
|
8438
8462
|
return this._image;
|
|
@@ -11678,7 +11702,6 @@
|
|
|
11678
11702
|
return new EShapeEmbeddedAcceptorEdge(this.type).copy(this);
|
|
11679
11703
|
};
|
|
11680
11704
|
EShapeEmbeddedAcceptorEdge.prototype.copy = function (source, part) {
|
|
11681
|
-
if (part === void 0) { part = EShapeCopyPart.ALL; }
|
|
11682
11705
|
_super.prototype.copy.call(this, source, part);
|
|
11683
11706
|
if (source instanceof EShapeEmbeddedAcceptorEdge) {
|
|
11684
11707
|
this._subtype = source.subtype;
|
|
@@ -12481,6 +12504,16 @@
|
|
|
12481
12504
|
enumerable: false,
|
|
12482
12505
|
configurable: true
|
|
12483
12506
|
});
|
|
12507
|
+
Object.defineProperty(EShapeGroupViewer.prototype, "angle", {
|
|
12508
|
+
get: function () {
|
|
12509
|
+
return 0;
|
|
12510
|
+
},
|
|
12511
|
+
set: function (angle) {
|
|
12512
|
+
// DO NOTHING
|
|
12513
|
+
},
|
|
12514
|
+
enumerable: false,
|
|
12515
|
+
configurable: true
|
|
12516
|
+
});
|
|
12484
12517
|
Object.defineProperty(EShapeGroupViewer.prototype, "image", {
|
|
12485
12518
|
get: function () {
|
|
12486
12519
|
return undefined;
|
|
@@ -15308,7 +15341,6 @@
|
|
|
15308
15341
|
values.length = bodyValuesLength + 4;
|
|
15309
15342
|
};
|
|
15310
15343
|
EShapeConnectorLine.prototype.copy = function (source, part) {
|
|
15311
|
-
if (part === void 0) { part = EShapeCopyPart.ALL; }
|
|
15312
15344
|
this.lock(EShapeLockPart.ALL);
|
|
15313
15345
|
_super.prototype.copy.call(this, source, part);
|
|
15314
15346
|
if (source instanceof EShapeConnectorLine) {
|
|
@@ -47930,6 +47962,918 @@
|
|
|
47930
47962
|
EShapeCapabilities.set(EShapeType.EMBEDDED_ACCEPTOR_EDGE, EShapeCapability.EMBEDDED_ACCEPTOR_EDGE);
|
|
47931
47963
|
};
|
|
47932
47964
|
|
|
47965
|
+
/*
|
|
47966
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
47967
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
47968
|
+
*/
|
|
47969
|
+
/**
|
|
47970
|
+
* Converts an angle ratio to the half central angle of a fan in [0, PI / 2].
|
|
47971
|
+
*/
|
|
47972
|
+
var toFanAngleCentric = function (angle) {
|
|
47973
|
+
return Math.PI * Math.max(0, Math.min(0.5, angle));
|
|
47974
|
+
};
|
|
47975
|
+
|
|
47976
|
+
/*
|
|
47977
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
47978
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
47979
|
+
*/
|
|
47980
|
+
/**
|
|
47981
|
+
* Converts the half central angle of fans to the eccentric angle of the arc end points
|
|
47982
|
+
* of the fan whose arc is on the ellipse with the semi-axes (w, h).
|
|
47983
|
+
*/
|
|
47984
|
+
var toFanAngleEccentric = function (w, h, theta) {
|
|
47985
|
+
return Math.atan((h / w) * Math.tan(theta));
|
|
47986
|
+
};
|
|
47987
|
+
|
|
47988
|
+
/*
|
|
47989
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
47990
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
47991
|
+
*/
|
|
47992
|
+
/**
|
|
47993
|
+
* Triangulates a fan whose arc is on the ellipse with the semi-axes (w, h) centered at the origin O.
|
|
47994
|
+
* The vertices are computed in the frame where w and h are positive and flipped at the end.
|
|
47995
|
+
*
|
|
47996
|
+
* ## Points
|
|
47997
|
+
*
|
|
47998
|
+
* - O: the apex of the fan, the origin
|
|
47999
|
+
* - A, B: the end points of the arc, (-w sin(ea), -h cos(ea)) and (+w sin(ea), -h cos(ea))
|
|
48000
|
+
* - C: the point where the area of the fan becomes zero when the fan shrinks, (0, -h / (1 + sin(ca)))
|
|
48001
|
+
* - P[k]: the points on the arc, k in [0, 2N] (P[0] = A, P[N] is the top, P[2N] = B)
|
|
48002
|
+
* - Q[k]: the points on the medial axis of the fan, which are on the normal of the arc at P[k]
|
|
48003
|
+
* and equidistant from the arc and the straight sides (Q[0] = A, Q[N] = C, Q[2N] = B)
|
|
48004
|
+
* - R[k]: the points P[k] shifted outward for the anti-aliasing
|
|
48005
|
+
* - O': the point O shifted outward for the anti-aliasing
|
|
48006
|
+
*
|
|
48007
|
+
* ## Stroke sides
|
|
48008
|
+
*
|
|
48009
|
+
* The clipping of a vertex is 1 on the outline and decreases toward the inside by (the distance from the outline) * fd,
|
|
48010
|
+
* where the outline is the arc and/or the straight sides depending on the stroke side.
|
|
48011
|
+
*
|
|
48012
|
+
* - ALL (and NONE): the stroke is at the arc and the straight sides.
|
|
48013
|
+
* The fan is triangulated into the strip P[k], P[k + 1], Q[k + 1], Q[k] and
|
|
48014
|
+
* the two polygons O', A', Q[0], ..., Q[N] and O', B', Q[2N], ..., Q[N] at the bottom.
|
|
48015
|
+
* - TOP: the stroke is only at the arc.
|
|
48016
|
+
* For a circle and a semi-ellipse, Q[k] are the points on the axis, which gives the exact fan with the strip only.
|
|
48017
|
+
* For the other ellipses, Q[k] are on the medial axis as ALL, and the two polygons
|
|
48018
|
+
* O, Q[0], ..., Q[N] and O, Q[2N], ..., Q[N] are added at the bottom without the stroke and the anti-aliasing.
|
|
48019
|
+
* - BOTTOM: the stroke is only at the straight sides.
|
|
48020
|
+
* It is the same as a polygon. Two triangle fans from C cover the area between the arc and the segments CA and CB,
|
|
48021
|
+
* and two quads O', A', A, C and O', B', B, C cover the rest.
|
|
48022
|
+
*/
|
|
48023
|
+
var EShapeFanTriangulatedImpl = /** @class */ (function () {
|
|
48024
|
+
function EShapeFanTriangulatedImpl(parent) {
|
|
48025
|
+
this._id = 0;
|
|
48026
|
+
this._parent = parent;
|
|
48027
|
+
this._width = 0;
|
|
48028
|
+
this._height = 0;
|
|
48029
|
+
this._strokeAlign = 0;
|
|
48030
|
+
this._strokeWidth = 0;
|
|
48031
|
+
this._strokeSideTop = true;
|
|
48032
|
+
this._strokeSideBottom = true;
|
|
48033
|
+
this._angle = 0;
|
|
48034
|
+
this._sizeX = 0;
|
|
48035
|
+
this._sizeY = 0;
|
|
48036
|
+
this._vertices = [];
|
|
48037
|
+
this._nvertices = 0;
|
|
48038
|
+
this._distances = [];
|
|
48039
|
+
this._lengths = [];
|
|
48040
|
+
this._clippings = [];
|
|
48041
|
+
this._uvs = [];
|
|
48042
|
+
this._indices = [];
|
|
48043
|
+
this._nindices = 0;
|
|
48044
|
+
this._boundary = [0, 0, 0, 0];
|
|
48045
|
+
}
|
|
48046
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "id", {
|
|
48047
|
+
get: function () {
|
|
48048
|
+
this.triangulate();
|
|
48049
|
+
return this._id;
|
|
48050
|
+
},
|
|
48051
|
+
enumerable: false,
|
|
48052
|
+
configurable: true
|
|
48053
|
+
});
|
|
48054
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "vertices", {
|
|
48055
|
+
get: function () {
|
|
48056
|
+
this.triangulate();
|
|
48057
|
+
return this._vertices;
|
|
48058
|
+
},
|
|
48059
|
+
enumerable: false,
|
|
48060
|
+
configurable: true
|
|
48061
|
+
});
|
|
48062
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "nvertices", {
|
|
48063
|
+
get: function () {
|
|
48064
|
+
this.triangulate();
|
|
48065
|
+
return this._nvertices;
|
|
48066
|
+
},
|
|
48067
|
+
enumerable: false,
|
|
48068
|
+
configurable: true
|
|
48069
|
+
});
|
|
48070
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "distances", {
|
|
48071
|
+
get: function () {
|
|
48072
|
+
this.triangulate();
|
|
48073
|
+
return this._distances;
|
|
48074
|
+
},
|
|
48075
|
+
enumerable: false,
|
|
48076
|
+
configurable: true
|
|
48077
|
+
});
|
|
48078
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "lengths", {
|
|
48079
|
+
get: function () {
|
|
48080
|
+
this.triangulate();
|
|
48081
|
+
return this._lengths;
|
|
48082
|
+
},
|
|
48083
|
+
enumerable: false,
|
|
48084
|
+
configurable: true
|
|
48085
|
+
});
|
|
48086
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "clippings", {
|
|
48087
|
+
get: function () {
|
|
48088
|
+
this.triangulate();
|
|
48089
|
+
return this._clippings;
|
|
48090
|
+
},
|
|
48091
|
+
enumerable: false,
|
|
48092
|
+
configurable: true
|
|
48093
|
+
});
|
|
48094
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "uvs", {
|
|
48095
|
+
get: function () {
|
|
48096
|
+
this.triangulate();
|
|
48097
|
+
return this._uvs;
|
|
48098
|
+
},
|
|
48099
|
+
enumerable: false,
|
|
48100
|
+
configurable: true
|
|
48101
|
+
});
|
|
48102
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "indices", {
|
|
48103
|
+
get: function () {
|
|
48104
|
+
this.triangulate();
|
|
48105
|
+
return this._indices;
|
|
48106
|
+
},
|
|
48107
|
+
enumerable: false,
|
|
48108
|
+
configurable: true
|
|
48109
|
+
});
|
|
48110
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "nindices", {
|
|
48111
|
+
get: function () {
|
|
48112
|
+
this.triangulate();
|
|
48113
|
+
return this._nindices;
|
|
48114
|
+
},
|
|
48115
|
+
enumerable: false,
|
|
48116
|
+
configurable: true
|
|
48117
|
+
});
|
|
48118
|
+
Object.defineProperty(EShapeFanTriangulatedImpl.prototype, "boundary", {
|
|
48119
|
+
get: function () {
|
|
48120
|
+
this.triangulate();
|
|
48121
|
+
return this._boundary;
|
|
48122
|
+
},
|
|
48123
|
+
enumerable: false,
|
|
48124
|
+
configurable: true
|
|
48125
|
+
});
|
|
48126
|
+
EShapeFanTriangulatedImpl.prototype.triangulate = function () {
|
|
48127
|
+
var isNotInitialized = this._id === 0;
|
|
48128
|
+
var parent = this._parent;
|
|
48129
|
+
var size = parent.size;
|
|
48130
|
+
var width = size.x;
|
|
48131
|
+
var height = size.y;
|
|
48132
|
+
var isRectChanged = this._width !== width || this._height !== height;
|
|
48133
|
+
var stroke = parent.stroke;
|
|
48134
|
+
var strokeAlign = stroke.align;
|
|
48135
|
+
var strokeSideTop = (stroke.side & EShapeStrokeSide.TOP) !== 0;
|
|
48136
|
+
var strokeSideBottom = (stroke.side & EShapeStrokeSide.BOTTOM) !== 0;
|
|
48137
|
+
var strokeWidth = stroke.enable && (strokeSideTop || strokeSideBottom) ? stroke.width : 0;
|
|
48138
|
+
var isStrokeChanged = this._strokeAlign !== strokeAlign || this._strokeWidth !== strokeWidth;
|
|
48139
|
+
var isStrokeSideChanged = this._strokeSideTop !== strokeSideTop || this._strokeSideBottom !== strokeSideBottom;
|
|
48140
|
+
var angle = parent.angle;
|
|
48141
|
+
var isAngleChanged = this._angle !== angle;
|
|
48142
|
+
var isSizeChanged = false;
|
|
48143
|
+
var sizeX = this._sizeX;
|
|
48144
|
+
var sizeY = this._sizeY;
|
|
48145
|
+
if (isRectChanged || isStrokeChanged) {
|
|
48146
|
+
this._width = width;
|
|
48147
|
+
this._height = height;
|
|
48148
|
+
this._strokeAlign = strokeAlign;
|
|
48149
|
+
this._strokeWidth = strokeWidth;
|
|
48150
|
+
var s = strokeAlign * strokeWidth;
|
|
48151
|
+
sizeX = width * 0.5 + (0 <= width ? +s : -s);
|
|
48152
|
+
sizeY = height * 0.5 + (0 <= height ? +s : -s);
|
|
48153
|
+
isSizeChanged = this._sizeX !== sizeX || this._sizeY !== sizeY;
|
|
48154
|
+
}
|
|
48155
|
+
if (isNotInitialized || isSizeChanged || isStrokeSideChanged || isAngleChanged) {
|
|
48156
|
+
this._sizeX = sizeX;
|
|
48157
|
+
this._sizeY = sizeY;
|
|
48158
|
+
this._strokeSideTop = strokeSideTop;
|
|
48159
|
+
this._strokeSideBottom = strokeSideBottom;
|
|
48160
|
+
this._angle = angle;
|
|
48161
|
+
this.update(sizeX, sizeY, angle, strokeSideTop, strokeSideBottom);
|
|
48162
|
+
}
|
|
48163
|
+
};
|
|
48164
|
+
EShapeFanTriangulatedImpl.prototype.update = function (sx, sy, angle, sst, ssb) {
|
|
48165
|
+
// The number of the arc segments is 2n and the number of the points on the arc is m.
|
|
48166
|
+
var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
|
|
48167
|
+
var m = 2 * n + 1;
|
|
48168
|
+
var nv = 2 * m + 2 * (n + 3);
|
|
48169
|
+
var ni = 4 * n + 2 * (n + 1);
|
|
48170
|
+
this._nvertices = nv;
|
|
48171
|
+
this._nindices = ni;
|
|
48172
|
+
this._id += 1;
|
|
48173
|
+
// The eccentric angle ea of A and B, and the sine and cosine of it
|
|
48174
|
+
var ax = Math.abs(sx);
|
|
48175
|
+
var ay = Math.abs(sy);
|
|
48176
|
+
if (ax <= 0 || ay <= 0) {
|
|
48177
|
+
this.updateEmpty(ax, ay, nv, ni);
|
|
48178
|
+
return;
|
|
48179
|
+
}
|
|
48180
|
+
var ca = toFanAngleCentric(angle);
|
|
48181
|
+
var ea = toFanAngleEccentric(ax, ay, ca);
|
|
48182
|
+
var sea = Math.sin(ea);
|
|
48183
|
+
var cea = Math.cos(ea);
|
|
48184
|
+
var bx = ax * sea;
|
|
48185
|
+
var by = ay * cea;
|
|
48186
|
+
var bz = bx * bx + by * by;
|
|
48187
|
+
if (bx <= 0 || bz <= 0) {
|
|
48188
|
+
this.updateEmpty(ax, ay, nv, ni);
|
|
48189
|
+
return;
|
|
48190
|
+
}
|
|
48191
|
+
// The sine and cosine of the geometric half central angle
|
|
48192
|
+
var oa = Math.sqrt(bz);
|
|
48193
|
+
var st = bx / oa;
|
|
48194
|
+
var ct = by / oa;
|
|
48195
|
+
// The factors of the UVs and the signs of the flipping
|
|
48196
|
+
var fx = 1 / bx;
|
|
48197
|
+
var fy = 1 / ay;
|
|
48198
|
+
var gx = Math.sign(sx);
|
|
48199
|
+
var gy = Math.sign(sy);
|
|
48200
|
+
if (!sst && ssb) {
|
|
48201
|
+
this.updateBottom(ax, ay, n, ea, sea, cea, bx, by, st, ct, fx, fy, gx, gy, nv, ni);
|
|
48202
|
+
}
|
|
48203
|
+
else {
|
|
48204
|
+
this.updateArc(ax, ay, n, ea, sea, cea, bx, oa, st, ct, fx, fy, gx, gy, sst, ssb, nv, ni);
|
|
48205
|
+
}
|
|
48206
|
+
};
|
|
48207
|
+
/**
|
|
48208
|
+
* Fills the empty fan, which has no vertices to draw.
|
|
48209
|
+
*/
|
|
48210
|
+
EShapeFanTriangulatedImpl.prototype.updateEmpty = function (w, h, nv, ni) {
|
|
48211
|
+
var boundary = this._boundary;
|
|
48212
|
+
boundary[0] = -w;
|
|
48213
|
+
boundary[1] = -h;
|
|
48214
|
+
boundary[2] = +w;
|
|
48215
|
+
boundary[3] = +h;
|
|
48216
|
+
this.pad(0, 0, nv, ni, 0);
|
|
48217
|
+
};
|
|
48218
|
+
EShapeFanTriangulatedImpl.prototype.updateArc = function (w, h, n, ea, sea, cea, bx, oa, st, ct, fx, fy, gx, gy, sst, ssb, nv, ni) {
|
|
48219
|
+
var m = 2 * n + 1;
|
|
48220
|
+
// sided: the straight sides are the outline, which has the stroke and the anti-aliasing
|
|
48221
|
+
// capped: the polygons are added at the bottom to cover the sector with the hard straight sides
|
|
48222
|
+
// chained: Q is on the medial axis. Otherwise, Q is on the axis x = 0 (w <= h) or y = 0 (h < w)
|
|
48223
|
+
// For a circle and a semi-ellipse, Q on the axis gives the exact fan.
|
|
48224
|
+
var sided = !sst || ssb;
|
|
48225
|
+
var isExact = Math.abs(w - h) <= 1e-9 * w || Math.PI * 0.5 <= ea;
|
|
48226
|
+
var capped = !sided && !isExact;
|
|
48227
|
+
var chained = sided || capped;
|
|
48228
|
+
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
48229
|
+
this.computeArcNormals(w, h, n, ea);
|
|
48230
|
+
var dmax = this.computeMedialPoints(w, h, n, st, ct, chained);
|
|
48231
|
+
if (capped) {
|
|
48232
|
+
// The distance field of the arc must cover O, which is the farthest point from the arc,
|
|
48233
|
+
// because the clipping in the polygons at the bottom is interpolated from the arc to O.
|
|
48234
|
+
dmax = Math.max(dmax, h <= w ? h : oa);
|
|
48235
|
+
}
|
|
48236
|
+
if (dmax <= 0) {
|
|
48237
|
+
this.updateEmpty(w, h, nv, ni);
|
|
48238
|
+
return;
|
|
48239
|
+
}
|
|
48240
|
+
var boundary = this._boundary;
|
|
48241
|
+
boundary[0] = -bx;
|
|
48242
|
+
boundary[1] = -h;
|
|
48243
|
+
boundary[2] = +bx;
|
|
48244
|
+
boundary[3] = 0;
|
|
48245
|
+
var fd = 1 / dmax;
|
|
48246
|
+
var fs = (EShapeFanTriangulatedImpl.SCALE - 1) * dmax;
|
|
48247
|
+
this.computeRimPoints(w, h, n, fs, st, ct, sea, cea, sided);
|
|
48248
|
+
// Strip: 2m vertices and 2 * 3 * (m - 1) indices
|
|
48249
|
+
this.writeStrip(m, fd, fx, fy, gx, gy);
|
|
48250
|
+
var iv = 2 * m;
|
|
48251
|
+
var ii = 6 * (m - 1);
|
|
48252
|
+
// Polygons at the bottom: left (sign = -1) and right (sign = +1)
|
|
48253
|
+
if (sided) {
|
|
48254
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48255
|
+
var count = this.writeSidePolygon(iv, ii, sign, n, w, oa, st, ct, fs, fd, fx, fy, gx, gy);
|
|
48256
|
+
iv += count;
|
|
48257
|
+
ii += 3 * (count - 2);
|
|
48258
|
+
}
|
|
48259
|
+
}
|
|
48260
|
+
else if (capped) {
|
|
48261
|
+
var co = Math.max(0, 1 - (w >= h ? h : oa) * fd);
|
|
48262
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48263
|
+
var count = this.writeCapPolygon(iv, ii, sign, n, w, co, fd, fx, fy, gx, gy);
|
|
48264
|
+
iv += count;
|
|
48265
|
+
ii += 3 * (count - 2);
|
|
48266
|
+
}
|
|
48267
|
+
}
|
|
48268
|
+
this.pad(iv, ii, nv, ni, fd);
|
|
48269
|
+
};
|
|
48270
|
+
/**
|
|
48271
|
+
* Computes P[k], the points on the arc, in the work arrays.
|
|
48272
|
+
*
|
|
48273
|
+
* The sine and cosine of the angle are updated by the rotation to avoid calling Math.sin and Math.cos in the loop.
|
|
48274
|
+
* The points are symmetric with respect to the axis x = 0, so only the left half is computed
|
|
48275
|
+
* and the right half is mirrored from it.
|
|
48276
|
+
*/
|
|
48277
|
+
EShapeFanTriangulatedImpl.prototype.computeArcPoints = function (w, h, n, ea, sea, cea) {
|
|
48278
|
+
var m = 2 * n + 1;
|
|
48279
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48280
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48281
|
+
var da = ea / n;
|
|
48282
|
+
var cda = Math.cos(da);
|
|
48283
|
+
var sda = Math.sin(da);
|
|
48284
|
+
var s = -sea;
|
|
48285
|
+
var c = cea;
|
|
48286
|
+
for (var k = 0; k <= n; ++k) {
|
|
48287
|
+
// Use the exact values at the center to prevent the accumulation of the errors.
|
|
48288
|
+
if (k === n) {
|
|
48289
|
+
s = 0;
|
|
48290
|
+
c = 1;
|
|
48291
|
+
}
|
|
48292
|
+
px[k] = w * s;
|
|
48293
|
+
py[k] = -h * c;
|
|
48294
|
+
// Rotate by da
|
|
48295
|
+
var ns = s * cda + c * sda;
|
|
48296
|
+
c = c * cda - s * sda;
|
|
48297
|
+
s = ns;
|
|
48298
|
+
}
|
|
48299
|
+
for (var k = 0; k < n; ++k) {
|
|
48300
|
+
px[m - 1 - k] = -px[k];
|
|
48301
|
+
py[m - 1 - k] = py[k];
|
|
48302
|
+
}
|
|
48303
|
+
};
|
|
48304
|
+
/**
|
|
48305
|
+
* Computes the unit inward normals of the arc, the speeds of the arc, and the arc lengths at P[k].
|
|
48306
|
+
*
|
|
48307
|
+
* The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
|
|
48308
|
+
* The speed is used to approximate the arc length without extra square roots.
|
|
48309
|
+
*/
|
|
48310
|
+
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n, ea) {
|
|
48311
|
+
var m = 2 * n + 1;
|
|
48312
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48313
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48314
|
+
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48315
|
+
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48316
|
+
var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
|
|
48317
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48318
|
+
var da = ea / n;
|
|
48319
|
+
var hw = h / w;
|
|
48320
|
+
var wh = w / h;
|
|
48321
|
+
var l = 0;
|
|
48322
|
+
var previous = 0;
|
|
48323
|
+
for (var k = 0; k <= n; ++k) {
|
|
48324
|
+
var dx = -hw * px[k];
|
|
48325
|
+
var dy = -wh * py[k];
|
|
48326
|
+
var speed = Math.sqrt(dx * dx + dy * dy);
|
|
48327
|
+
nx[k] = dx / speed;
|
|
48328
|
+
ny[k] = dy / speed;
|
|
48329
|
+
speeds[k] = speed;
|
|
48330
|
+
if (0 < k) {
|
|
48331
|
+
l += 0.5 * da * (previous + speed);
|
|
48332
|
+
}
|
|
48333
|
+
previous = speed;
|
|
48334
|
+
ls[k] = l;
|
|
48335
|
+
}
|
|
48336
|
+
for (var k = 0; k < n; ++k) {
|
|
48337
|
+
var j = m - 1 - k;
|
|
48338
|
+
nx[j] = -nx[k];
|
|
48339
|
+
ny[j] = ny[k];
|
|
48340
|
+
speeds[j] = speeds[k];
|
|
48341
|
+
ls[j] = 2 * ls[n] - ls[k];
|
|
48342
|
+
}
|
|
48343
|
+
};
|
|
48344
|
+
/**
|
|
48345
|
+
* Computes Q[k], the points on the normals, and their distances from P[k], and returns the maximum distance.
|
|
48346
|
+
*
|
|
48347
|
+
* If chained is true, Q is the point on the medial axis, that is, the point on the normal
|
|
48348
|
+
* whose distance to the arc is equal to the distance to the straight sides.
|
|
48349
|
+
* The distance delta is obtained from delta = -(n . P) - delta (n . normal) for the outward unit normals n of the sides.
|
|
48350
|
+
* The clamps keep Q on the same side of the axis x = 0 as P and before the center of curvature,
|
|
48351
|
+
* otherwise adjacent normals cross each other, which happens for tall ellipses.
|
|
48352
|
+
*
|
|
48353
|
+
* Otherwise, the normal is extended until it reaches x = 0 if w <= h, otherwise y = 0.
|
|
48354
|
+
*/
|
|
48355
|
+
EShapeFanTriangulatedImpl.prototype.computeMedialPoints = function (w, h, n, st, ct, chained) {
|
|
48356
|
+
var m = 2 * n + 1;
|
|
48357
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48358
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48359
|
+
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48360
|
+
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48361
|
+
var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
|
|
48362
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48363
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48364
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48365
|
+
var u = w <= h ? w / h : h / w;
|
|
48366
|
+
var dmax = 0;
|
|
48367
|
+
for (var k = 0; k <= n; ++k) {
|
|
48368
|
+
var x = px[k];
|
|
48369
|
+
var y = py[k];
|
|
48370
|
+
var nnx = nx[k];
|
|
48371
|
+
var nny = ny[k];
|
|
48372
|
+
var speed = speeds[k];
|
|
48373
|
+
var delta = Infinity;
|
|
48374
|
+
if (chained) {
|
|
48375
|
+
var da = 1 + -ct * nnx + st * nny;
|
|
48376
|
+
if (1e-9 < da) {
|
|
48377
|
+
delta = Math.min(delta, (ct * x - st * y) / da);
|
|
48378
|
+
}
|
|
48379
|
+
var db = 1 + ct * nnx + st * nny;
|
|
48380
|
+
if (1e-9 < db) {
|
|
48381
|
+
delta = Math.min(delta, (-ct * x - st * y) / db);
|
|
48382
|
+
}
|
|
48383
|
+
if (k !== n && 1e-12 < Math.abs(nnx)) {
|
|
48384
|
+
delta = Math.min(delta, -x / nnx);
|
|
48385
|
+
}
|
|
48386
|
+
delta = Math.max(0, Math.min(delta, (speed * speed * speed) / (w * h)));
|
|
48387
|
+
}
|
|
48388
|
+
// The distance between P and Q
|
|
48389
|
+
var d = void 0;
|
|
48390
|
+
if (Number.isFinite(delta)) {
|
|
48391
|
+
d = delta;
|
|
48392
|
+
}
|
|
48393
|
+
else {
|
|
48394
|
+
d = u * speed;
|
|
48395
|
+
}
|
|
48396
|
+
qx[k] = x + d * nnx;
|
|
48397
|
+
qy[k] = y + d * nny;
|
|
48398
|
+
qd[k] = d;
|
|
48399
|
+
dmax = Math.max(dmax, d);
|
|
48400
|
+
}
|
|
48401
|
+
for (var k = 0; k < n; ++k) {
|
|
48402
|
+
var j = m - 1 - k;
|
|
48403
|
+
qx[j] = -qx[k];
|
|
48404
|
+
qy[j] = qy[k];
|
|
48405
|
+
qd[j] = qd[k];
|
|
48406
|
+
}
|
|
48407
|
+
return dmax;
|
|
48408
|
+
};
|
|
48409
|
+
/**
|
|
48410
|
+
* Computes R[k], the points on the arc shifted outward by fs, and their lengths.
|
|
48411
|
+
* If the straight sides are the outline, the end points are shifted
|
|
48412
|
+
* to the intersections of the shifted arc and the shifted straight sides.
|
|
48413
|
+
*/
|
|
48414
|
+
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (w, h, n, fs, st, ct, sea, cea, sided) {
|
|
48415
|
+
var m = 2 * n + 1;
|
|
48416
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48417
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48418
|
+
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48419
|
+
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48420
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48421
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48422
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48423
|
+
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
48424
|
+
for (var k = 0; k < m; ++k) {
|
|
48425
|
+
var x = px[k] - fs * nx[k];
|
|
48426
|
+
var y = py[k] - fs * ny[k];
|
|
48427
|
+
var l = ls[k];
|
|
48428
|
+
if (sided && (k === 0 || k === m - 1)) {
|
|
48429
|
+
var sign = k === 0 ? -1 : +1;
|
|
48430
|
+
// The miter of the outward normal of the arc (n1) and that of the straight side (n2)
|
|
48431
|
+
var n1x = -nx[k];
|
|
48432
|
+
var n1y = -ny[k];
|
|
48433
|
+
var n2x = sign * ct;
|
|
48434
|
+
var n2y = st;
|
|
48435
|
+
var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
|
|
48436
|
+
x = px[k] + miter * (n1x + n2x);
|
|
48437
|
+
y = py[k] + miter * (n1y + n2y);
|
|
48438
|
+
// The length is shifted along the tangent (tx, ty) / speed
|
|
48439
|
+
var tx = w * cea;
|
|
48440
|
+
var ty = sign * h * sea;
|
|
48441
|
+
l +=
|
|
48442
|
+
((x - px[k]) * tx + (y - py[k]) * ty) / EShapeFanTriangulatedImpl.WORK_SPEED[0];
|
|
48443
|
+
}
|
|
48444
|
+
rx[k] = x;
|
|
48445
|
+
ry[k] = y;
|
|
48446
|
+
rl[k] = l;
|
|
48447
|
+
}
|
|
48448
|
+
};
|
|
48449
|
+
/**
|
|
48450
|
+
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k] and Q[k].
|
|
48451
|
+
*/
|
|
48452
|
+
EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
|
|
48453
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48454
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48455
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48456
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48457
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48458
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48459
|
+
var rl = EShapeFanTriangulatedImpl.WORK_RIM_L;
|
|
48460
|
+
var scale = EShapeFanTriangulatedImpl.SCALE;
|
|
48461
|
+
var indices = this._indices;
|
|
48462
|
+
var iv = 0;
|
|
48463
|
+
var ii = 0;
|
|
48464
|
+
for (var k = 0; k < m; ++k) {
|
|
48465
|
+
this.writeVertex(iv++, rx[k], ry[k], rl[k], scale, fd, fx, fy, gx, gy);
|
|
48466
|
+
this.writeVertex(iv++, qx[k], qy[k], ls[k], 1 - qd[k] * fd, fd, fx, fy, gx, gy);
|
|
48467
|
+
if (k < m - 1) {
|
|
48468
|
+
var a = 2 * k;
|
|
48469
|
+
indices[ii++] = a;
|
|
48470
|
+
indices[ii++] = a + 2;
|
|
48471
|
+
indices[ii++] = a + 3;
|
|
48472
|
+
indices[ii++] = a;
|
|
48473
|
+
indices[ii++] = a + 3;
|
|
48474
|
+
indices[ii++] = a + 1;
|
|
48475
|
+
}
|
|
48476
|
+
}
|
|
48477
|
+
};
|
|
48478
|
+
/**
|
|
48479
|
+
* Writes the polygon O', R[end], Q[end], ..., Q[N] where the end is 0 for the left (sign = -1)
|
|
48480
|
+
* and 2N for the right (sign = +1). The straight side OA (or OB) is the outline of the polygon.
|
|
48481
|
+
* Returns the number of the written vertices.
|
|
48482
|
+
*
|
|
48483
|
+
* The chain of Q ends at the first point on the axis because the following points go back along the axis.
|
|
48484
|
+
* Q is not always on the medial axis where it is clamped,
|
|
48485
|
+
* so the clipping must not be less than the one of the arc.
|
|
48486
|
+
*
|
|
48487
|
+
* The clipping and the length are computed from the straight side:
|
|
48488
|
+
* the outward unit normal is (sign * ct, st) and the length is oa + arc + (-st, sign * ct) . p.
|
|
48489
|
+
*/
|
|
48490
|
+
EShapeFanTriangulatedImpl.prototype.writeSidePolygon = function (iv, ii, sign, n, w, oa, st, ct, fs, fd, fx, fy, gx, gy) {
|
|
48491
|
+
var m = 2 * n + 1;
|
|
48492
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48493
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48494
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48495
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48496
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48497
|
+
var l0 = oa + EShapeFanTriangulatedImpl.WORK_ARC_L[m - 1];
|
|
48498
|
+
var nx = sign * ct;
|
|
48499
|
+
var ly = sign * ct;
|
|
48500
|
+
var eps = 1e-9 * w;
|
|
48501
|
+
var end = sign < 0 ? 0 : m - 1;
|
|
48502
|
+
var count = 0;
|
|
48503
|
+
this.writeSideVertex(iv + count++, 0, fs / st, -Infinity, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48504
|
+
this.writeSideVertex(iv + count++, rx[end], ry[end], -Infinity, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48505
|
+
for (var j = 0; j <= n; ++j) {
|
|
48506
|
+
var k = sign < 0 ? j : m - 1 - j;
|
|
48507
|
+
var floor = 1 - qd[k] * fd;
|
|
48508
|
+
this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48509
|
+
if (Math.abs(qx[k]) <= eps) {
|
|
48510
|
+
break;
|
|
48511
|
+
}
|
|
48512
|
+
}
|
|
48513
|
+
this.writeFan(ii, iv, count);
|
|
48514
|
+
return count;
|
|
48515
|
+
};
|
|
48516
|
+
/**
|
|
48517
|
+
* Writes the polygon O, Q[end], ..., Q[N] where the end is 0 for the left (sign = -1)
|
|
48518
|
+
* and 2N for the right (sign = +1). The straight sides are hard edges without the stroke.
|
|
48519
|
+
* Returns the number of the written vertices.
|
|
48520
|
+
*
|
|
48521
|
+
* The clipping of O is given by co, and the length of O is the one of the end point.
|
|
48522
|
+
*/
|
|
48523
|
+
EShapeFanTriangulatedImpl.prototype.writeCapPolygon = function (iv, ii, sign, n, w, co, fd, fx, fy, gx, gy) {
|
|
48524
|
+
var m = 2 * n + 1;
|
|
48525
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48526
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48527
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48528
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48529
|
+
var eps = 1e-9 * w;
|
|
48530
|
+
var end = sign < 0 ? 0 : m - 1;
|
|
48531
|
+
this.writeVertex(iv, 0, 0, ls[end], co, fd, fx, fy, gx, gy);
|
|
48532
|
+
var count = 1;
|
|
48533
|
+
for (var j = 0; j <= n; ++j) {
|
|
48534
|
+
var k = sign < 0 ? j : m - 1 - j;
|
|
48535
|
+
var clipping = 1 - qd[k] * fd;
|
|
48536
|
+
this.writeVertex(iv + count++, qx[k], qy[k], ls[k], clipping, fd, fx, fy, gx, gy);
|
|
48537
|
+
if (Math.abs(qx[k]) <= eps) {
|
|
48538
|
+
break;
|
|
48539
|
+
}
|
|
48540
|
+
}
|
|
48541
|
+
this.writeFan(ii, iv, count);
|
|
48542
|
+
return count;
|
|
48543
|
+
};
|
|
48544
|
+
/**
|
|
48545
|
+
* The clipping is 1 - (the distance from the straight side) / d where d is the distance from C to OA (or OB).
|
|
48546
|
+
*/
|
|
48547
|
+
EShapeFanTriangulatedImpl.prototype.updateBottom = function (w, h, n, ea, sea, cea, bx, by, st, ct, fx, fy, gx, gy, nv, ni) {
|
|
48548
|
+
var boundary = this._boundary;
|
|
48549
|
+
boundary[0] = -bx;
|
|
48550
|
+
boundary[1] = -h;
|
|
48551
|
+
boundary[2] = +bx;
|
|
48552
|
+
boundary[3] = 0;
|
|
48553
|
+
var yc = h / (1 + st);
|
|
48554
|
+
var fd = (1 + st) / (h * st);
|
|
48555
|
+
var fs = (EShapeFanTriangulatedImpl.SCALE - 1) / fd;
|
|
48556
|
+
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
48557
|
+
// Triangle fans from C to the arc: left (sign = -1) and right (sign = +1)
|
|
48558
|
+
var iv = 0;
|
|
48559
|
+
var ii = 0;
|
|
48560
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48561
|
+
var count = this.writeBottomFan(iv, ii, sign, n, yc, st, ct, fd, fx, fy, gx, gy);
|
|
48562
|
+
iv += count;
|
|
48563
|
+
ii += 3 * (count - 2);
|
|
48564
|
+
}
|
|
48565
|
+
// Quads at the bottom: O', A', A, C and O', B', B, C
|
|
48566
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48567
|
+
var count = this.writeBottomQuad(iv, ii, sign, bx, by, yc, fs, st, ct, fd, fx, fy, gx, gy);
|
|
48568
|
+
iv += count;
|
|
48569
|
+
ii += 3 * (count - 2);
|
|
48570
|
+
}
|
|
48571
|
+
this.pad(iv, ii, nv, ni, fd);
|
|
48572
|
+
};
|
|
48573
|
+
/**
|
|
48574
|
+
* Writes the triangle fan from C to the arc of the left half (sign = -1) or the right half (sign = +1).
|
|
48575
|
+
* Returns the number of the written vertices.
|
|
48576
|
+
*
|
|
48577
|
+
* The clipping is 1 + fd * (n . p) where n is the outward unit normal of the straight side,
|
|
48578
|
+
* and the length is the distance along the straight side measured from O.
|
|
48579
|
+
* The side OA has n = (-ct, st) and l = (-st, -ct), and the side OB has n = (ct, st) and l = (st, -ct).
|
|
48580
|
+
*/
|
|
48581
|
+
EShapeFanTriangulatedImpl.prototype.writeBottomFan = function (iv, ii, sign, n, yc, st, ct, fd, fx, fy, gx, gy) {
|
|
48582
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48583
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48584
|
+
var nx = sign * ct;
|
|
48585
|
+
var lx = sign * st;
|
|
48586
|
+
var count = 0;
|
|
48587
|
+
this.writeSideVertex(iv + count++, 0, -yc, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48588
|
+
for (var j = 0; j <= n; ++j) {
|
|
48589
|
+
var k = sign < 0 ? j : n + j;
|
|
48590
|
+
this.writeSideVertex(iv + count++, px[k], py[k], 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48591
|
+
}
|
|
48592
|
+
this.writeFan(ii, iv, count);
|
|
48593
|
+
return count;
|
|
48594
|
+
};
|
|
48595
|
+
/**
|
|
48596
|
+
* Writes the quad O', A', A, C (sign = -1) or O', B', B, C (sign = +1) at the bottom.
|
|
48597
|
+
* O' is shifted outward by fs / st, and A' (B') is shifted outward by fs perpendicular to the straight side.
|
|
48598
|
+
* Returns the number of the written vertices.
|
|
48599
|
+
*/
|
|
48600
|
+
EShapeFanTriangulatedImpl.prototype.writeBottomQuad = function (iv, ii, sign, bx, by, yc, fs, st, ct, fd, fx, fy, gx, gy) {
|
|
48601
|
+
var nx = sign * ct;
|
|
48602
|
+
var lx = sign * st;
|
|
48603
|
+
this.writeSideVertex(iv, 0, fs / st, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48604
|
+
this.writeSideVertex(iv + 1, sign * (bx + fs * ct), -by + fs * st, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48605
|
+
this.writeSideVertex(iv + 2, sign * bx, -by, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48606
|
+
this.writeSideVertex(iv + 3, 0, -yc, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48607
|
+
this.writeFan(ii, iv, 4);
|
|
48608
|
+
return 4;
|
|
48609
|
+
};
|
|
48610
|
+
// ----------------------------------------------------------------------------------------
|
|
48611
|
+
// Writers
|
|
48612
|
+
// ----------------------------------------------------------------------------------------
|
|
48613
|
+
/**
|
|
48614
|
+
* Writes a vertex whose clipping and length are computed from the parameters of a straight side.
|
|
48615
|
+
* The clipping is 1 + fd * (nx * x + ny * y), which is not less than the given floor,
|
|
48616
|
+
* and the length is l0 + lx * x + ly * y.
|
|
48617
|
+
*/
|
|
48618
|
+
EShapeFanTriangulatedImpl.prototype.writeSideVertex = function (vertex, x, y, floor, nx, ny, l0, lx, ly, fd, fx, fy, gx, gy) {
|
|
48619
|
+
var clipping = Math.max(floor, 1 + fd * (nx * x + ny * y));
|
|
48620
|
+
var length = l0 + lx * x + ly * y;
|
|
48621
|
+
this.writeVertex(vertex, x, y, length, clipping, fd, fx, fy, gx, gy);
|
|
48622
|
+
};
|
|
48623
|
+
/**
|
|
48624
|
+
* Writes the indices of a triangle fan from the first vertex.
|
|
48625
|
+
* The number of the written indices is 3 * (count - 2).
|
|
48626
|
+
*/
|
|
48627
|
+
EShapeFanTriangulatedImpl.prototype.writeFan = function (ii, iv, count) {
|
|
48628
|
+
var indices = this._indices;
|
|
48629
|
+
for (var i = 1; i < count - 1; ++i) {
|
|
48630
|
+
indices[ii++] = iv;
|
|
48631
|
+
indices[ii++] = iv + i;
|
|
48632
|
+
indices[ii++] = iv + i + 1;
|
|
48633
|
+
}
|
|
48634
|
+
};
|
|
48635
|
+
/**
|
|
48636
|
+
* Writes a vertex.
|
|
48637
|
+
*
|
|
48638
|
+
* @param x - The X coordinate in the frame where the sizes are positive
|
|
48639
|
+
* @param y - The Y coordinate in the frame where the sizes are positive
|
|
48640
|
+
* @param fd - The inverse of the distance where the clipping decreases from 1 to 0
|
|
48641
|
+
* @param fx - The factor to convert x to the UV
|
|
48642
|
+
* @param fy - The factor to convert y to the UV
|
|
48643
|
+
* @param gx - The sign of the X size, which flips the vertex
|
|
48644
|
+
* @param gy - The sign of the Y size, which flips the vertex
|
|
48645
|
+
*/
|
|
48646
|
+
EShapeFanTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, length, clipping, fd, fx, fy, gx, gy) {
|
|
48647
|
+
var vertex2 = vertex << 1;
|
|
48648
|
+
this._vertices[vertex2] = gx * x;
|
|
48649
|
+
this._vertices[vertex2 + 1] = gy * y;
|
|
48650
|
+
this._distances[vertex] = fd;
|
|
48651
|
+
this._lengths[vertex] = length;
|
|
48652
|
+
this._clippings[vertex] = clipping;
|
|
48653
|
+
this._uvs[vertex2] = 0.5 * (x * fx + 1);
|
|
48654
|
+
this._uvs[vertex2 + 1] = 1 + y * fy;
|
|
48655
|
+
};
|
|
48656
|
+
/**
|
|
48657
|
+
* Fills the unused tail with degenerated triangles and trims the arrays
|
|
48658
|
+
* so that the buffers always hold exactly `nv` vertices and `ni` triangles.
|
|
48659
|
+
*/
|
|
48660
|
+
EShapeFanTriangulatedImpl.prototype.pad = function (iv, ii, nv, ni, distance) {
|
|
48661
|
+
for (var i = iv; i < nv; ++i) {
|
|
48662
|
+
var vertex2 = i << 1;
|
|
48663
|
+
this._vertices[vertex2] = 0;
|
|
48664
|
+
this._vertices[vertex2 + 1] = 0;
|
|
48665
|
+
this._distances[i] = distance;
|
|
48666
|
+
this._lengths[i] = 0;
|
|
48667
|
+
this._clippings[i] = 0;
|
|
48668
|
+
this._uvs[vertex2] = 0.5;
|
|
48669
|
+
this._uvs[vertex2 + 1] = 0.5;
|
|
48670
|
+
}
|
|
48671
|
+
for (var i = ii; i < ni * 3; ++i) {
|
|
48672
|
+
this._indices[i] = 0;
|
|
48673
|
+
}
|
|
48674
|
+
this._vertices.length = nv * 2;
|
|
48675
|
+
this._distances.length = nv;
|
|
48676
|
+
this._lengths.length = nv;
|
|
48677
|
+
this._clippings.length = nv;
|
|
48678
|
+
this._uvs.length = nv * 2;
|
|
48679
|
+
this._indices.length = ni * 3;
|
|
48680
|
+
};
|
|
48681
|
+
/** The ratio of the outer edge, where the clipping is 1, to the edge of the anti-aliasing */
|
|
48682
|
+
EShapeFanTriangulatedImpl.SCALE = 1.1;
|
|
48683
|
+
// Work arrays shared by all the instances because they are used only in a single synchronous triangulation.
|
|
48684
|
+
// All of them are indexed by k, which is in [0, 2N].
|
|
48685
|
+
/** P: the points on the arc */
|
|
48686
|
+
EShapeFanTriangulatedImpl.WORK_ARC_X = [];
|
|
48687
|
+
EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
|
|
48688
|
+
/** The arc lengths measured from P[0] */
|
|
48689
|
+
EShapeFanTriangulatedImpl.WORK_ARC_L = [];
|
|
48690
|
+
/** The unit inward normals of the arc */
|
|
48691
|
+
EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
|
|
48692
|
+
EShapeFanTriangulatedImpl.WORK_NORMAL_Y = [];
|
|
48693
|
+
/** The magnitudes of the tangents, that is, the speeds of the arc */
|
|
48694
|
+
EShapeFanTriangulatedImpl.WORK_SPEED = [];
|
|
48695
|
+
/** Q: the points on the normals */
|
|
48696
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_X = [];
|
|
48697
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
|
|
48698
|
+
/** The distances from P to Q */
|
|
48699
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
|
|
48700
|
+
/** R: the points on the arc shifted outward, and their lengths */
|
|
48701
|
+
EShapeFanTriangulatedImpl.WORK_RIM_X = [];
|
|
48702
|
+
EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
|
|
48703
|
+
EShapeFanTriangulatedImpl.WORK_RIM_L = [];
|
|
48704
|
+
return EShapeFanTriangulatedImpl;
|
|
48705
|
+
}());
|
|
48706
|
+
|
|
48707
|
+
/*
|
|
48708
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48709
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48710
|
+
*/
|
|
48711
|
+
/**
|
|
48712
|
+
* Tests whether the point is in the fan shrunk by `sa` at the arc and by `ss` at the straight sides.
|
|
48713
|
+
*
|
|
48714
|
+
* @param st - The sine of the half central angle
|
|
48715
|
+
* @param ct - The cosine of the half central angle
|
|
48716
|
+
*/
|
|
48717
|
+
var isInFan = function (x, y, ax, ay, st, ct, sa, ss) {
|
|
48718
|
+
var wx = ax - sa;
|
|
48719
|
+
var wy = ay - sa;
|
|
48720
|
+
if (wx <= 0 || wy <= 0) {
|
|
48721
|
+
return false;
|
|
48722
|
+
}
|
|
48723
|
+
var ex = x * wy;
|
|
48724
|
+
var ey = y * wx;
|
|
48725
|
+
if (wx * wy * wx * wy < ex * ex + ey * ey) {
|
|
48726
|
+
return false;
|
|
48727
|
+
}
|
|
48728
|
+
var ay1 = st * y;
|
|
48729
|
+
return -ct * x + ay1 <= -ss && ct * x + ay1 <= -ss;
|
|
48730
|
+
};
|
|
48731
|
+
var hitTestFanFill = function (shape, x, y, bx, by) {
|
|
48732
|
+
var fill = shape.fill;
|
|
48733
|
+
if (fill.enable) {
|
|
48734
|
+
var percent = Math.max(0, Math.min(1, fill.percent));
|
|
48735
|
+
if (1 <= percent) {
|
|
48736
|
+
return true;
|
|
48737
|
+
}
|
|
48738
|
+
// The fill is relative to the bounding box [-bx, +bx] x [-by, 0] of the fan.
|
|
48739
|
+
switch (fill.direction) {
|
|
48740
|
+
case EShapeFillDirection.TOP:
|
|
48741
|
+
return y + by <= percent * by;
|
|
48742
|
+
case EShapeFillDirection.RIGHT:
|
|
48743
|
+
return (1 - percent) * (2 * bx) <= x + bx;
|
|
48744
|
+
case EShapeFillDirection.BOTTOM:
|
|
48745
|
+
return (1 - percent) * by <= y + by;
|
|
48746
|
+
case EShapeFillDirection.LEFT:
|
|
48747
|
+
return x + bx <= percent * (2 * bx);
|
|
48748
|
+
}
|
|
48749
|
+
}
|
|
48750
|
+
return false;
|
|
48751
|
+
};
|
|
48752
|
+
var hitTestFan = function (shape, x, y, ax, ay, sw, ss) {
|
|
48753
|
+
var ca = toFanAngleCentric(shape.angle);
|
|
48754
|
+
if (ca <= 0 || ax <= 0 || ay <= 0) {
|
|
48755
|
+
return false;
|
|
48756
|
+
}
|
|
48757
|
+
var ea = toFanAngleEccentric(ax, ay, ca);
|
|
48758
|
+
var bx = ax * Math.sin(ea);
|
|
48759
|
+
var st = Math.sin(ca);
|
|
48760
|
+
var ct = Math.cos(ca);
|
|
48761
|
+
var fill = shape.fill;
|
|
48762
|
+
var strokeSide = shape.stroke.side;
|
|
48763
|
+
var strokeSideTop = (strokeSide & EShapeStrokeSide.TOP) !== 0;
|
|
48764
|
+
var strokeSideBottom = (strokeSide & EShapeStrokeSide.BOTTOM) !== 0;
|
|
48765
|
+
var strokeWidth = strokeSideTop || strokeSideBottom ? sw : 0;
|
|
48766
|
+
if ((fill.enable || 0 < strokeWidth) && isInFan(x, y, ax, ay, st, ct, 0, 0)) {
|
|
48767
|
+
if (fill.enable && hitTestFanFill(shape, x, y, bx, ay)) {
|
|
48768
|
+
return true;
|
|
48769
|
+
}
|
|
48770
|
+
if (0 < strokeWidth) {
|
|
48771
|
+
var s = strokeWidth * ss;
|
|
48772
|
+
var arc = strokeSideTop ? s : 0;
|
|
48773
|
+
var sides = strokeSideBottom ? s : 0;
|
|
48774
|
+
if (!isInFan(x, y, ax, ay, st, ct, arc, sides)) {
|
|
48775
|
+
return true;
|
|
48776
|
+
}
|
|
48777
|
+
}
|
|
48778
|
+
}
|
|
48779
|
+
return false;
|
|
48780
|
+
};
|
|
48781
|
+
|
|
48782
|
+
/*
|
|
48783
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48784
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48785
|
+
*/
|
|
48786
|
+
var EShapeFan = /** @class */ (function (_super) {
|
|
48787
|
+
__extends(EShapeFan, _super);
|
|
48788
|
+
function EShapeFan(type) {
|
|
48789
|
+
if (type === void 0) { type = EShapeType.FAN; }
|
|
48790
|
+
var _this = _super.call(this, type) || this;
|
|
48791
|
+
_this._angle = _this.newAngle();
|
|
48792
|
+
_this._triangulated = _this.newTriangulated();
|
|
48793
|
+
return _this;
|
|
48794
|
+
}
|
|
48795
|
+
EShapeFan.prototype.newAngle = function () {
|
|
48796
|
+
return EShapeDefaults.ANGLE;
|
|
48797
|
+
};
|
|
48798
|
+
EShapeFan.prototype.newTriangulated = function () {
|
|
48799
|
+
return new EShapeFanTriangulatedImpl(this);
|
|
48800
|
+
};
|
|
48801
|
+
Object.defineProperty(EShapeFan.prototype, "triangulated", {
|
|
48802
|
+
get: function () {
|
|
48803
|
+
return this._triangulated;
|
|
48804
|
+
},
|
|
48805
|
+
enumerable: false,
|
|
48806
|
+
configurable: true
|
|
48807
|
+
});
|
|
48808
|
+
Object.defineProperty(EShapeFan.prototype, "angle", {
|
|
48809
|
+
/**
|
|
48810
|
+
* The ratio of the half central angle of the fan to PI. Must be in [0, 0.5].
|
|
48811
|
+
* 0.5 results in a semicircle.
|
|
48812
|
+
*/
|
|
48813
|
+
get: function () {
|
|
48814
|
+
return this._angle;
|
|
48815
|
+
},
|
|
48816
|
+
set: function (angle) {
|
|
48817
|
+
if (this._angle !== angle) {
|
|
48818
|
+
this._angle = angle;
|
|
48819
|
+
this.updateUploaded();
|
|
48820
|
+
}
|
|
48821
|
+
},
|
|
48822
|
+
enumerable: false,
|
|
48823
|
+
configurable: true
|
|
48824
|
+
});
|
|
48825
|
+
EShapeFan.prototype.toHitTestStrokeShift = function (strokeWidth, strokeScale, strokeAlign) {
|
|
48826
|
+
if ((this.stroke.side & EShapeStrokeSide.TOP_OR_BOTTOM) !== 0) {
|
|
48827
|
+
return _super.prototype.toHitTestStrokeShift.call(this, strokeWidth, strokeScale, strokeAlign);
|
|
48828
|
+
}
|
|
48829
|
+
return 0;
|
|
48830
|
+
};
|
|
48831
|
+
EShapeFan.prototype.copy = function (source, part) {
|
|
48832
|
+
this.lock(EShapeLockPart.ALL);
|
|
48833
|
+
_super.prototype.copy.call(this, source, part);
|
|
48834
|
+
if ((part == null || part & EShapeCopyPart.STYLE) && source instanceof EShapeFan) {
|
|
48835
|
+
this._angle = source._angle;
|
|
48836
|
+
}
|
|
48837
|
+
this.unlock(EShapeLockPart.ALL, true);
|
|
48838
|
+
return this;
|
|
48839
|
+
};
|
|
48840
|
+
EShapeFan.prototype.clone = function () {
|
|
48841
|
+
return new EShapeFan(this.type).copy(this);
|
|
48842
|
+
};
|
|
48843
|
+
EShapeFan.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
48844
|
+
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
48845
|
+
return hitTestFan(this, x, y, ax, ay, sw, ss);
|
|
48846
|
+
}
|
|
48847
|
+
return false;
|
|
48848
|
+
};
|
|
48849
|
+
EShapeFan.prototype.serialize = function (manager) {
|
|
48850
|
+
var result = _super.prototype.serialize.call(this, manager);
|
|
48851
|
+
result[15] = this._angle;
|
|
48852
|
+
return result;
|
|
48853
|
+
};
|
|
48854
|
+
return EShapeFan;
|
|
48855
|
+
}(EShapePrimitive));
|
|
48856
|
+
|
|
48857
|
+
/*
|
|
48858
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48859
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48860
|
+
*/
|
|
48861
|
+
var deserializeFan = function (item, manager, shape) {
|
|
48862
|
+
shape = shape || new EShapeFan();
|
|
48863
|
+
shape.angle = item[15];
|
|
48864
|
+
return deserializeBase(item, manager, shape);
|
|
48865
|
+
};
|
|
48866
|
+
|
|
48867
|
+
/*
|
|
48868
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48869
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48870
|
+
*/
|
|
48871
|
+
var loadShapeFan = function () {
|
|
48872
|
+
EShapeUploadeds[EShapeType.FAN] = createPolygonUploaded;
|
|
48873
|
+
EShapeDeserializers[EShapeType.FAN] = deserializeFan;
|
|
48874
|
+
EShapeCapabilities.set(EShapeType.FAN, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE | EShapeCapability.ANGLE);
|
|
48875
|
+
};
|
|
48876
|
+
|
|
47933
48877
|
/*
|
|
47934
48878
|
* Copyright (C) 2019 Toshiba Corporation
|
|
47935
48879
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -48566,7 +49510,7 @@
|
|
|
48566
49510
|
if (0 < children.length) {
|
|
48567
49511
|
return children[children.length - 1].radius;
|
|
48568
49512
|
}
|
|
48569
|
-
return
|
|
49513
|
+
return EShapeDefaults.RADIUS;
|
|
48570
49514
|
},
|
|
48571
49515
|
set: function (radius) {
|
|
48572
49516
|
var children = this.children;
|
|
@@ -48577,6 +49521,23 @@
|
|
|
48577
49521
|
enumerable: false,
|
|
48578
49522
|
configurable: true
|
|
48579
49523
|
});
|
|
49524
|
+
Object.defineProperty(EShapeGroup.prototype, "angle", {
|
|
49525
|
+
get: function () {
|
|
49526
|
+
var children = this.children;
|
|
49527
|
+
if (0 < children.length) {
|
|
49528
|
+
return children[children.length - 1].angle;
|
|
49529
|
+
}
|
|
49530
|
+
return EShapeDefaults.ANGLE;
|
|
49531
|
+
},
|
|
49532
|
+
set: function (angle) {
|
|
49533
|
+
var children = this.children;
|
|
49534
|
+
for (var i = 0, imax = children.length; i < imax; ++i) {
|
|
49535
|
+
children[i].angle = angle;
|
|
49536
|
+
}
|
|
49537
|
+
},
|
|
49538
|
+
enumerable: false,
|
|
49539
|
+
configurable: true
|
|
49540
|
+
});
|
|
48580
49541
|
Object.defineProperty(EShapeGroup.prototype, "image", {
|
|
48581
49542
|
get: function () {
|
|
48582
49543
|
var children = this.children;
|
|
@@ -53314,7 +54275,7 @@
|
|
|
53314
54275
|
boundary[2] = +ax;
|
|
53315
54276
|
boundary[3] = +ay;
|
|
53316
54277
|
// # of vertices and # of indices
|
|
53317
|
-
var nv =
|
|
54278
|
+
var nv = 9;
|
|
53318
54279
|
var ni = 3;
|
|
53319
54280
|
this._nvertices = nv;
|
|
53320
54281
|
this._nindices = ni;
|
|
@@ -53369,11 +54330,7 @@
|
|
|
53369
54330
|
// vertices (-sx, sy) and (sx, sy). The signs of sx and
|
|
53370
54331
|
// sy intentionally preserve horizontal and vertical reflections.
|
|
53371
54332
|
// The sloped edge spans ax horizontally and 2 * ay vertically.
|
|
53372
|
-
var
|
|
53373
|
-
// The base is horizontal, so its length is twice the half-width.
|
|
53374
|
-
var base = 2 * ax;
|
|
53375
|
-
// Length values are measured along the triangle perimeter.
|
|
53376
|
-
var perimeter = 2 * side + base;
|
|
54333
|
+
var b = Math.sqrt(ax * ax + 4 * ay * ay);
|
|
53377
54334
|
// The incenter lies on the vertical center line. This is its y-coordinate.
|
|
53378
54335
|
// Along the median, the distances from the top vertex to the incenter and
|
|
53379
54336
|
// from the incenter to the base are in the ratio 2 * side : base.
|
|
@@ -53385,42 +54342,47 @@
|
|
|
53385
54342
|
// cy = ay (2 side - 2 ax) / (2 side + 2 ax)
|
|
53386
54343
|
// cy = ay (side - ax) / (side + ax)
|
|
53387
54344
|
var cx = 0;
|
|
53388
|
-
var cy = (sy * (
|
|
54345
|
+
var cy = (sy * (b - ax)) / (b + ax);
|
|
53389
54346
|
// The distance from the incenter to every edge is the inradius.
|
|
53390
54347
|
// Since 0 <= (side - ax) / (side + ax) <= 1, the incenter remains
|
|
53391
54348
|
// between the apex and the base even when sy is negative.
|
|
53392
|
-
var
|
|
53393
|
-
var
|
|
54349
|
+
var d = Math.abs(sy - cy);
|
|
54350
|
+
var fd = 1 / d;
|
|
53394
54351
|
// Expand the triangle around its incenter for anti-aliasing and strokes.
|
|
53395
|
-
// The outer vertices are shared where their interpolated attributes match.
|
|
53396
54352
|
var x0 = 0;
|
|
53397
54353
|
var y0 = cy + scale * (-sy - cy);
|
|
53398
54354
|
var x1 = scale * sx;
|
|
53399
54355
|
var y1 = cy + scale * (sy - cy);
|
|
53400
54356
|
var x2 = -x1;
|
|
53401
54357
|
var y2 = y1;
|
|
53402
|
-
//
|
|
53403
|
-
|
|
53404
|
-
|
|
53405
|
-
this.updateVertex(2, cx, cy, fdistance, side - ax, 0, fx, fy);
|
|
54358
|
+
// Each cell has its own vertices because `length` is the arc length projected onto
|
|
54359
|
+
// the cell's edge. It is `lc` at the incenter (the tangent point) and
|
|
54360
|
+
// `lc + scale * (l - lc)` at the outer vertices so that it equals `l` at clipping = 1.
|
|
53406
54361
|
var indices = this._indices;
|
|
53407
|
-
|
|
53408
|
-
|
|
53409
|
-
|
|
53410
|
-
|
|
53411
|
-
this.
|
|
53412
|
-
this.
|
|
53413
|
-
|
|
53414
|
-
|
|
53415
|
-
|
|
53416
|
-
|
|
53417
|
-
this.
|
|
53418
|
-
this.
|
|
53419
|
-
|
|
53420
|
-
|
|
53421
|
-
|
|
53422
|
-
|
|
53423
|
-
|
|
54362
|
+
// Top-to-right edge cell
|
|
54363
|
+
var l0 = 0;
|
|
54364
|
+
var l1 = l0 + b;
|
|
54365
|
+
var lc0 = b - ax;
|
|
54366
|
+
this.writeVertex(0, x0, y0, fd, lc0 + scale * (l0 - lc0), scale, fx, fy);
|
|
54367
|
+
this.writeVertex(1, x1, y1, fd, lc0 + scale * (l1 - lc0), scale, fx, fy);
|
|
54368
|
+
this.writeVertex(2, cx, cy, fd, lc0, 0, fx, fy);
|
|
54369
|
+
// Right-to-left base edge cell
|
|
54370
|
+
var l2 = l1 + 2 * ax;
|
|
54371
|
+
var lc1 = b + ax;
|
|
54372
|
+
this.writeVertex(3, x1, y1, fd, lc1 + scale * (l1 - lc1), scale, fx, fy);
|
|
54373
|
+
this.writeVertex(4, x2, y2, fd, lc1 + scale * (l2 - lc1), scale, fx, fy);
|
|
54374
|
+
this.writeVertex(5, cx, cy, fd, lc1, 0, fx, fy);
|
|
54375
|
+
// Left-to-top edge cell
|
|
54376
|
+
var l3 = l2 + b;
|
|
54377
|
+
var lc2 = b + 3 * ax;
|
|
54378
|
+
this.writeVertex(6, x2, y2, fd, lc2 + scale * (l2 - lc2), scale, fx, fy);
|
|
54379
|
+
this.writeVertex(7, x0, y0, fd, lc2 + scale * (l3 - lc2), scale, fx, fy);
|
|
54380
|
+
this.writeVertex(8, cx, cy, fd, lc2, 0, fx, fy);
|
|
54381
|
+
for (var i = 0; i < 9; ++i) {
|
|
54382
|
+
indices[i] = i;
|
|
54383
|
+
}
|
|
54384
|
+
};
|
|
54385
|
+
EShapeTriangleTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, distance, length, clipping, fx, fy) {
|
|
53424
54386
|
var vertex2 = vertex << 1;
|
|
53425
54387
|
this._vertices[vertex2] = x;
|
|
53426
54388
|
this._vertices[vertex2 + 1] = y;
|
|
@@ -55431,14 +56393,13 @@
|
|
|
55431
56393
|
return new EShapePolygon(this.type).copy(this);
|
|
55432
56394
|
};
|
|
55433
56395
|
EShapePolygon.prototype.copy = function (source, part) {
|
|
55434
|
-
if (part === void 0) { part = EShapeCopyPart.ALL; }
|
|
55435
56396
|
this.lock(EShapeLockPart.ALL);
|
|
55436
|
-
|
|
55437
|
-
if (part & EShapeCopyPart.POINTS && source instanceof EShapePolygon) {
|
|
56397
|
+
_super.prototype.copy.call(this, source, part);
|
|
56398
|
+
if ((part == null || part & EShapeCopyPart.POINTS) && source instanceof EShapePolygon) {
|
|
55438
56399
|
this._triangulated.copy(source._triangulated);
|
|
55439
56400
|
}
|
|
55440
56401
|
this.unlock(EShapeLockPart.ALL, true);
|
|
55441
|
-
return
|
|
56402
|
+
return this;
|
|
55442
56403
|
};
|
|
55443
56404
|
EShapePolygon.prototype.serialize = function (manager) {
|
|
55444
56405
|
var result = _super.prototype.serialize.call(this, manager);
|
|
@@ -55775,11 +56736,84 @@
|
|
|
55775
56736
|
EShapeCapabilities.set(EShapeType.RECTANGLE_ROUNDED_LEGACY, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE | EShapeCapability.BORDER_RADIUS);
|
|
55776
56737
|
};
|
|
55777
56738
|
|
|
55778
|
-
|
|
55779
|
-
|
|
55780
|
-
|
|
55781
|
-
|
|
55782
|
-
|
|
56739
|
+
/*
|
|
56740
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
56741
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56742
|
+
*/
|
|
56743
|
+
/**
|
|
56744
|
+
* A semicircle shape.
|
|
56745
|
+
*/
|
|
56746
|
+
var EShapeSemicircle = /** @class */ (function (_super) {
|
|
56747
|
+
__extends(EShapeSemicircle, _super);
|
|
56748
|
+
function EShapeSemicircle(type) {
|
|
56749
|
+
if (type === void 0) { type = EShapeType.SEMICIRCLE; }
|
|
56750
|
+
var _this = _super.call(this, type) || this;
|
|
56751
|
+
_this._triangulated = _this.newTriangulated();
|
|
56752
|
+
return _this;
|
|
56753
|
+
}
|
|
56754
|
+
EShapeSemicircle.prototype.newStroke = function () {
|
|
56755
|
+
return new EShapeStrokeImpl(this, true, EShapeDefaults.STROKE_COLOR, EShapeDefaults.STROKE_ALPHA, EShapeDefaults.STROKE_WIDTH, EShapeDefaults.STROKE_ALIGN, EShapeDefaults.STROKE_SIDE & ~EShapeStrokeSide.BOTTOM, EShapeDefaults.STROKE_STYLE);
|
|
56756
|
+
};
|
|
56757
|
+
EShapeSemicircle.prototype.newTriangulated = function () {
|
|
56758
|
+
return new EShapeFanTriangulatedImpl(this);
|
|
56759
|
+
};
|
|
56760
|
+
Object.defineProperty(EShapeSemicircle.prototype, "triangulated", {
|
|
56761
|
+
get: function () {
|
|
56762
|
+
return this._triangulated;
|
|
56763
|
+
},
|
|
56764
|
+
enumerable: false,
|
|
56765
|
+
configurable: true
|
|
56766
|
+
});
|
|
56767
|
+
Object.defineProperty(EShapeSemicircle.prototype, "angle", {
|
|
56768
|
+
get: function () {
|
|
56769
|
+
return 0.5;
|
|
56770
|
+
},
|
|
56771
|
+
set: function (angle) {
|
|
56772
|
+
// DO NOTHING
|
|
56773
|
+
},
|
|
56774
|
+
enumerable: false,
|
|
56775
|
+
configurable: true
|
|
56776
|
+
});
|
|
56777
|
+
EShapeSemicircle.prototype.toHitTestStrokeShift = function (strokeWidth, strokeScale, strokeAlign) {
|
|
56778
|
+
if ((this.stroke.side & EShapeStrokeSide.TOP_OR_BOTTOM) !== 0) {
|
|
56779
|
+
return _super.prototype.toHitTestStrokeShift.call(this, strokeWidth, strokeScale, strokeAlign);
|
|
56780
|
+
}
|
|
56781
|
+
return 0;
|
|
56782
|
+
};
|
|
56783
|
+
EShapeSemicircle.prototype.clone = function () {
|
|
56784
|
+
return new EShapeSemicircle(this.type).copy(this);
|
|
56785
|
+
};
|
|
56786
|
+
EShapeSemicircle.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
56787
|
+
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
56788
|
+
return hitTestFan(this, x, y, ax, ay, sw, ss);
|
|
56789
|
+
}
|
|
56790
|
+
return false;
|
|
56791
|
+
};
|
|
56792
|
+
return EShapeSemicircle;
|
|
56793
|
+
}(EShapePrimitive));
|
|
56794
|
+
|
|
56795
|
+
/*
|
|
56796
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
56797
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56798
|
+
*/
|
|
56799
|
+
var deserializeSemicircle = function (item, manager, shape) {
|
|
56800
|
+
return deserializeBase(item, manager, shape || new EShapeSemicircle());
|
|
56801
|
+
};
|
|
56802
|
+
|
|
56803
|
+
/*
|
|
56804
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
56805
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56806
|
+
*/
|
|
56807
|
+
var loadShapeSemicircle = function () {
|
|
56808
|
+
EShapeUploadeds[EShapeType.SEMICIRCLE] = createPolygonUploaded;
|
|
56809
|
+
EShapeDeserializers[EShapeType.SEMICIRCLE] = deserializeSemicircle;
|
|
56810
|
+
EShapeCapabilities.set(EShapeType.SEMICIRCLE, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE);
|
|
56811
|
+
};
|
|
56812
|
+
|
|
56813
|
+
var SEMICIRCLE_LEGACY_VERTEX_COUNT = 6;
|
|
56814
|
+
var SEMICIRCLE_LEGACY_INDEX_COUNT = 4;
|
|
56815
|
+
var SEMICIRCLE_LEGACY_WORLD_SIZE = [0, 0];
|
|
56816
|
+
var buildSemicircleLegacyIndex = function (indices, voffset, ioffset) {
|
|
55783
56817
|
var ii = ioffset * 3 - 1;
|
|
55784
56818
|
indices[++ii] = voffset;
|
|
55785
56819
|
indices[++ii] = voffset + 1;
|
|
@@ -55794,7 +56828,7 @@
|
|
|
55794
56828
|
indices[++ii] = voffset + 5;
|
|
55795
56829
|
indices[++ii] = voffset + 4;
|
|
55796
56830
|
};
|
|
55797
|
-
var
|
|
56831
|
+
var buildSemicircleLegacyVertex = function (vertices, voffset, originX, originY, sizeX, sizeY, strokeAlign, strokeWidth, internalTransform, worldSize) {
|
|
55798
56832
|
// Calculate the transformed positions
|
|
55799
56833
|
//
|
|
55800
56834
|
// 0 1 2
|
|
@@ -55802,24 +56836,23 @@
|
|
|
55802
56836
|
// |3 |4 |5
|
|
55803
56837
|
// |-------|-------|
|
|
55804
56838
|
//
|
|
55805
|
-
var work = SEMICIRCLE_WORK_POINT;
|
|
55806
56839
|
var s = strokeAlign * strokeWidth;
|
|
55807
56840
|
var sx = sizeX * 0.5 + (0 <= sizeX ? +s : -s);
|
|
55808
56841
|
var sy = sizeY * 0.5 + (0 <= sizeY ? +s : -s);
|
|
55809
|
-
|
|
55810
|
-
internalTransform.
|
|
55811
|
-
var
|
|
55812
|
-
var
|
|
55813
|
-
|
|
55814
|
-
internalTransform.
|
|
55815
|
-
var
|
|
55816
|
-
var
|
|
56842
|
+
var a = internalTransform.a;
|
|
56843
|
+
var b = internalTransform.b;
|
|
56844
|
+
var c = internalTransform.c;
|
|
56845
|
+
var d = internalTransform.d;
|
|
56846
|
+
var tx = internalTransform.tx;
|
|
56847
|
+
var ty = internalTransform.ty;
|
|
56848
|
+
var x0 = a * (-sx + originX) + c * (-sy + originY) + tx;
|
|
56849
|
+
var y0 = b * (-sx + originX) + d * (-sy + originY) + ty;
|
|
56850
|
+
var x1 = a * originX + c * (-sy + originY) + tx;
|
|
56851
|
+
var y1 = b * originX + d * (-sy + originY) + ty;
|
|
55817
56852
|
var dx = x1 - x0;
|
|
55818
56853
|
var dy = y1 - y0;
|
|
55819
|
-
|
|
55820
|
-
|
|
55821
|
-
var x4 = work.x;
|
|
55822
|
-
var y4 = work.y;
|
|
56854
|
+
var x4 = a * originX + c * originY + tx;
|
|
56855
|
+
var y4 = b * originX + d * originY + ty;
|
|
55823
56856
|
var x3 = x4 - dx;
|
|
55824
56857
|
var y3 = y4 - dy;
|
|
55825
56858
|
// Vertices
|
|
@@ -55839,7 +56872,7 @@
|
|
|
55839
56872
|
worldSize[0] = toLength(x0, y0, x1, y1);
|
|
55840
56873
|
worldSize[1] = toLength(x0, y0, x3, y3);
|
|
55841
56874
|
};
|
|
55842
|
-
var
|
|
56875
|
+
var buildSemicircleLegacyStep = function (steps, voffset, strokeWidth, strokeStyle, worldSize) {
|
|
55843
56876
|
var scaleInvariant = toScaleInvariant(strokeStyle);
|
|
55844
56877
|
var ws0 = worldSize[0];
|
|
55845
56878
|
var ws1 = worldSize[1];
|
|
@@ -55886,7 +56919,7 @@
|
|
|
55886
56919
|
steps[++is] = c10;
|
|
55887
56920
|
steps[++is] = 0;
|
|
55888
56921
|
};
|
|
55889
|
-
var
|
|
56922
|
+
var buildSemicircleLegacyUv = function (uvs, voffset, textureUvs) {
|
|
55890
56923
|
var x0 = textureUvs.x0;
|
|
55891
56924
|
var x1 = textureUvs.x1;
|
|
55892
56925
|
var x2 = textureUvs.x2;
|
|
@@ -55915,25 +56948,25 @@
|
|
|
55915
56948
|
* Copyright (C) 2019 Toshiba Corporation
|
|
55916
56949
|
* SPDX-License-Identifier: Apache-2.0
|
|
55917
56950
|
*/
|
|
55918
|
-
var
|
|
55919
|
-
__extends(
|
|
55920
|
-
function
|
|
55921
|
-
return _super.call(this, buffer, vertexOffset, indexOffset,
|
|
56951
|
+
var BuilderSemicircleLegacy = /** @class */ (function (_super) {
|
|
56952
|
+
__extends(BuilderSemicircleLegacy, _super);
|
|
56953
|
+
function BuilderSemicircleLegacy(buffer, vertexOffset, indexOffset) {
|
|
56954
|
+
return _super.call(this, buffer, vertexOffset, indexOffset, SEMICIRCLE_LEGACY_VERTEX_COUNT, SEMICIRCLE_LEGACY_INDEX_COUNT) || this;
|
|
55922
56955
|
}
|
|
55923
|
-
|
|
56956
|
+
BuilderSemicircleLegacy.prototype.init = function () {
|
|
55924
56957
|
var buffer = this.buffer;
|
|
55925
56958
|
buffer.updateIndices();
|
|
55926
56959
|
var voffset = this.vertexOffset;
|
|
55927
|
-
|
|
56960
|
+
buildSemicircleLegacyIndex(buffer.indices, voffset, this.indexOffset);
|
|
55928
56961
|
this.inited |= BuilderFlag.INDEX;
|
|
55929
56962
|
};
|
|
55930
|
-
|
|
56963
|
+
BuilderSemicircleLegacy.prototype.update = function (shape) {
|
|
55931
56964
|
var buffer = this.buffer;
|
|
55932
56965
|
this.updateVertexAndStep(buffer, shape);
|
|
55933
56966
|
this.updateColor(buffer, shape);
|
|
55934
56967
|
this.updateUv(buffer, shape);
|
|
55935
56968
|
};
|
|
55936
|
-
|
|
56969
|
+
BuilderSemicircleLegacy.prototype.updateVertexAndStep = function (buffer, shape) {
|
|
55937
56970
|
var size = shape.size;
|
|
55938
56971
|
var sizeX = size.x;
|
|
55939
56972
|
var sizeY = size.y;
|
|
@@ -55959,11 +56992,11 @@
|
|
|
55959
56992
|
// Buffer
|
|
55960
56993
|
buffer.updateVertices();
|
|
55961
56994
|
buffer.updateSteps();
|
|
55962
|
-
|
|
55963
|
-
|
|
56995
|
+
buildSemicircleLegacyVertex(buffer.vertices, this.vertexOffset, 0, 0, sizeX, sizeY, strokeAlign, strokeWidth, shape.transform.internalTransform, SEMICIRCLE_LEGACY_WORLD_SIZE);
|
|
56996
|
+
buildSemicircleLegacyStep(buffer.steps, this.vertexOffset, strokeWidth, strokeStyle, SEMICIRCLE_LEGACY_WORLD_SIZE);
|
|
55964
56997
|
}
|
|
55965
56998
|
};
|
|
55966
|
-
|
|
56999
|
+
BuilderSemicircleLegacy.prototype.updateUv = function (buffer, shape) {
|
|
55967
57000
|
var texture = toTexture(shape);
|
|
55968
57001
|
var textureTransformId = toTextureTransformId(texture);
|
|
55969
57002
|
var isNotInited = !(this.inited & BuilderFlag.UV);
|
|
@@ -55975,26 +57008,26 @@
|
|
|
55975
57008
|
this.textureTransformId = textureTransformId;
|
|
55976
57009
|
buffer.updateUvs();
|
|
55977
57010
|
var textureUvs = toTextureUvs(texture);
|
|
55978
|
-
|
|
57011
|
+
buildSemicircleLegacyUv(buffer.uvs, this.vertexOffset, textureUvs);
|
|
55979
57012
|
}
|
|
55980
57013
|
};
|
|
55981
|
-
return
|
|
57014
|
+
return BuilderSemicircleLegacy;
|
|
55982
57015
|
}(BuilderBase));
|
|
55983
57016
|
|
|
55984
57017
|
/*
|
|
55985
57018
|
* Copyright (C) 2019 Toshiba Corporation
|
|
55986
57019
|
* SPDX-License-Identifier: Apache-2.0
|
|
55987
57020
|
*/
|
|
55988
|
-
var
|
|
57021
|
+
var createSemicircleLegacyUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
|
|
55989
57022
|
var tcount = toTextBufferCount(shape);
|
|
55990
57023
|
var tvcount = tcount << TEXT_VERTEX_COUNT_SHIFT;
|
|
55991
57024
|
var ticount = tcount << TEXT_INDEX_COUNT_SHIFT;
|
|
55992
|
-
var vcount =
|
|
55993
|
-
var icount =
|
|
57025
|
+
var vcount = SEMICIRCLE_LEGACY_VERTEX_COUNT + tvcount;
|
|
57026
|
+
var icount = SEMICIRCLE_LEGACY_INDEX_COUNT + ticount;
|
|
55994
57027
|
if (buffer.check(voffset, ioffset, vcount, icount)) {
|
|
55995
57028
|
return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
|
|
55996
|
-
new
|
|
55997
|
-
new BuilderText(buffer, voffset +
|
|
57029
|
+
new BuilderSemicircleLegacy(buffer, voffset, ioffset),
|
|
57030
|
+
new BuilderText(buffer, voffset + SEMICIRCLE_LEGACY_VERTEX_COUNT, ioffset + SEMICIRCLE_LEGACY_INDEX_COUNT, tvcount, ticount)
|
|
55998
57031
|
]).init(shape);
|
|
55999
57032
|
}
|
|
56000
57033
|
return null;
|
|
@@ -56017,44 +57050,42 @@
|
|
|
56017
57050
|
*/
|
|
56018
57051
|
/**
|
|
56019
57052
|
* A semicircle shape.
|
|
56020
|
-
*
|
|
56021
|
-
* @beta
|
|
56022
57053
|
*/
|
|
56023
|
-
var
|
|
56024
|
-
__extends(
|
|
56025
|
-
function
|
|
56026
|
-
if (type === void 0) { type = EShapeType.
|
|
57054
|
+
var EShapeSemicircleLegacy = /** @class */ (function (_super) {
|
|
57055
|
+
__extends(EShapeSemicircleLegacy, _super);
|
|
57056
|
+
function EShapeSemicircleLegacy(type) {
|
|
57057
|
+
if (type === void 0) { type = EShapeType.SEMICIRCLE_LEGACY; }
|
|
56027
57058
|
var _this = _super.call(this, type) || this;
|
|
56028
57059
|
_this.stroke.side = EShapeStrokeSide.ALL & ~EShapeStrokeSide.BOTTOM;
|
|
56029
57060
|
return _this;
|
|
56030
57061
|
}
|
|
56031
|
-
|
|
56032
|
-
return new
|
|
57062
|
+
EShapeSemicircleLegacy.prototype.clone = function () {
|
|
57063
|
+
return new EShapeSemicircleLegacy(this.type).copy(this);
|
|
56033
57064
|
};
|
|
56034
|
-
|
|
57065
|
+
EShapeSemicircleLegacy.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
56035
57066
|
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
56036
57067
|
return hitTestSemicircle(this, x, y, ax, ay, sw, ss);
|
|
56037
57068
|
}
|
|
56038
57069
|
return false;
|
|
56039
57070
|
};
|
|
56040
|
-
return
|
|
57071
|
+
return EShapeSemicircleLegacy;
|
|
56041
57072
|
}(EShapePrimitive));
|
|
56042
57073
|
|
|
56043
57074
|
/*
|
|
56044
57075
|
* Copyright (C) 2019 Toshiba Corporation
|
|
56045
57076
|
* SPDX-License-Identifier: Apache-2.0
|
|
56046
57077
|
*/
|
|
56047
|
-
var
|
|
56048
|
-
return deserializeBase(item, manager, shape || new
|
|
57078
|
+
var deserializeSemicircleLegacy = function (item, manager, shape) {
|
|
57079
|
+
return deserializeBase(item, manager, shape || new EShapeSemicircleLegacy());
|
|
56049
57080
|
};
|
|
56050
57081
|
|
|
56051
57082
|
/*
|
|
56052
57083
|
* Copyright (C) 2019 Toshiba Corporation
|
|
56053
57084
|
* SPDX-License-Identifier: Apache-2.0
|
|
56054
57085
|
*/
|
|
56055
|
-
var
|
|
56056
|
-
EShapeUploadeds[EShapeType.
|
|
56057
|
-
EShapeDeserializers[EShapeType.
|
|
57086
|
+
var loadShapeSemicircleLegacy = function () {
|
|
57087
|
+
EShapeUploadeds[EShapeType.SEMICIRCLE_LEGACY] = createSemicircleLegacyUploaded;
|
|
57088
|
+
EShapeDeserializers[EShapeType.SEMICIRCLE_LEGACY] = deserializeSemicircleLegacy;
|
|
56058
57089
|
};
|
|
56059
57090
|
|
|
56060
57091
|
/*
|
|
@@ -56810,6 +57841,7 @@
|
|
|
56810
57841
|
loadShapeConnectorElbow();
|
|
56811
57842
|
loadShapeConnectorLine();
|
|
56812
57843
|
loadShapeEmbedded();
|
|
57844
|
+
loadShapeFan();
|
|
56813
57845
|
loadShapeGroupShadowed();
|
|
56814
57846
|
loadShapeGroup();
|
|
56815
57847
|
loadShapeImage();
|
|
@@ -56823,6 +57855,7 @@
|
|
|
56823
57855
|
loadShapeRectangleRoundedLegacy();
|
|
56824
57856
|
loadShapeRectangleRounded();
|
|
56825
57857
|
loadShapeRectangle();
|
|
57858
|
+
loadShapeSemicircleLegacy();
|
|
56826
57859
|
loadShapeSemicircle();
|
|
56827
57860
|
loadShapeTriangleLegacy();
|
|
56828
57861
|
loadShapeTriangleRoundedLegacy();
|
|
@@ -88883,6 +89916,7 @@
|
|
|
88883
89916
|
loadShapeConnectorElbow: loadShapeConnectorElbow,
|
|
88884
89917
|
loadShapeConnectorLine: loadShapeConnectorLine,
|
|
88885
89918
|
loadShapeEmbedded: loadShapeEmbedded,
|
|
89919
|
+
loadShapeFan: loadShapeFan,
|
|
88886
89920
|
loadShapeGroupShadowed: loadShapeGroupShadowed,
|
|
88887
89921
|
loadShapeGroup: loadShapeGroup,
|
|
88888
89922
|
loadShapeImage: loadShapeImage,
|
|
@@ -88900,6 +89934,7 @@
|
|
|
88900
89934
|
loadShapeRectangleRoundedLegacy: loadShapeRectangleRoundedLegacy,
|
|
88901
89935
|
loadShapeRectangleRounded: loadShapeRectangleRounded,
|
|
88902
89936
|
loadShapeRectangle: loadShapeRectangle,
|
|
89937
|
+
loadShapeSemicircleLegacy: loadShapeSemicircleLegacy,
|
|
88903
89938
|
loadShapeSemicircle: loadShapeSemicircle,
|
|
88904
89939
|
loadShapeTriangleLegacy: loadShapeTriangleLegacy,
|
|
88905
89940
|
loadShapeTriangleRoundedLegacy: loadShapeTriangleRoundedLegacy,
|
|
@@ -88979,13 +90014,20 @@
|
|
|
88979
90014
|
RECTANGLE_INDEX_COUNT: RECTANGLE_LEGACY_INDEX_COUNT,
|
|
88980
90015
|
RECTANGLE_VERTEX_COUNT: RECTANGLE_LEGACY_VERTEX_COUNT,
|
|
88981
90016
|
RECTANGLE_WORLD_SIZE: RECTANGLE_LEGACY_WORLD_SIZE,
|
|
88982
|
-
|
|
88983
|
-
|
|
88984
|
-
|
|
88985
|
-
|
|
88986
|
-
|
|
88987
|
-
|
|
88988
|
-
|
|
90017
|
+
SEMICIRCLE_LEGACY_VERTEX_COUNT: SEMICIRCLE_LEGACY_VERTEX_COUNT,
|
|
90018
|
+
SEMICIRCLE_LEGACY_INDEX_COUNT: SEMICIRCLE_LEGACY_INDEX_COUNT,
|
|
90019
|
+
SEMICIRCLE_LEGACY_WORLD_SIZE: SEMICIRCLE_LEGACY_WORLD_SIZE,
|
|
90020
|
+
buildSemicircleLegacyIndex: buildSemicircleLegacyIndex,
|
|
90021
|
+
buildSemicircleLegacyVertex: buildSemicircleLegacyVertex,
|
|
90022
|
+
buildSemicircleLegacyStep: buildSemicircleLegacyStep,
|
|
90023
|
+
buildSemicircleLegacyUv: buildSemicircleLegacyUv,
|
|
90024
|
+
SEMICIRCLE_VERTEX_COUNT: SEMICIRCLE_LEGACY_VERTEX_COUNT,
|
|
90025
|
+
SEMICIRCLE_INDEX_COUNT: SEMICIRCLE_LEGACY_INDEX_COUNT,
|
|
90026
|
+
SEMICIRCLE_WORLD_SIZE: SEMICIRCLE_LEGACY_WORLD_SIZE,
|
|
90027
|
+
buildSemicircleIndex: buildSemicircleLegacyIndex,
|
|
90028
|
+
buildSemicircleVertex: buildSemicircleLegacyVertex,
|
|
90029
|
+
buildSemicircleStep: buildSemicircleLegacyStep,
|
|
90030
|
+
buildSemicircleUv: buildSemicircleLegacyUv,
|
|
88989
90031
|
TEXT_VERTEX_COUNT: TEXT_VERTEX_COUNT,
|
|
88990
90032
|
TEXT_VERTEX_COUNT_SHIFT: TEXT_VERTEX_COUNT_SHIFT,
|
|
88991
90033
|
TEXT_INDEX_COUNT: TEXT_INDEX_COUNT,
|
|
@@ -89052,7 +90094,7 @@
|
|
|
89052
90094
|
BuilderRectangleRoundedLegacy: BuilderRectangleRoundedLegacy,
|
|
89053
90095
|
BuilderRectangleRounded: BuilderRectangleRoundedLegacy,
|
|
89054
90096
|
BuilderRectangle: BuilderRectangleLegacy,
|
|
89055
|
-
BuilderSemicircle:
|
|
90097
|
+
BuilderSemicircle: BuilderSemicircleLegacy,
|
|
89056
90098
|
BuilderText: BuilderText,
|
|
89057
90099
|
BuilderTriangleLegacy: BuilderTriangleLegacy,
|
|
89058
90100
|
BuilderTriangleRounded: BuilderTriangleRoundedLegacy,
|
|
@@ -89092,7 +90134,8 @@
|
|
|
89092
90134
|
createRectangleRoundedLegacyUploaded: createRectangleRoundedLegacyUploaded,
|
|
89093
90135
|
createRectangleRoundedUploaded: createRectangleRoundedLegacyUploaded,
|
|
89094
90136
|
createRectangleUploaded: createRectangleLegacyUploaded,
|
|
89095
|
-
|
|
90137
|
+
createSemicircleLegacyUploaded: createSemicircleLegacyUploaded,
|
|
90138
|
+
createSemicircleUploaded: createSemicircleLegacyUploaded,
|
|
89096
90139
|
createTriangleLegacyUploaded: createTriangleLegacyUploaded,
|
|
89097
90140
|
createTriangleRoundedUploaded: createTriangleRoundedLegacyUploaded,
|
|
89098
90141
|
createTriangleRoundedLegacyUploaded: createTriangleRoundedLegacyUploaded,
|
|
@@ -89109,6 +90152,7 @@
|
|
|
89109
90152
|
deserializeEmbeddedAcceptorEdge: deserializeEmbeddedAcceptorEdge,
|
|
89110
90153
|
deserializeEmbeddedLayer: deserializeEmbeddedLayer,
|
|
89111
90154
|
deserializeEmbedded: deserializeEmbedded,
|
|
90155
|
+
deserializeFan: deserializeFan,
|
|
89112
90156
|
deserializeGradient: deserializeGradient,
|
|
89113
90157
|
deserializeGroupShadowed: deserializeGroupShadowed,
|
|
89114
90158
|
deserializeGroup: deserializeGroup,
|
|
@@ -89128,6 +90172,7 @@
|
|
|
89128
90172
|
deserializeRectangleRoundedLegacy: deserializeRectangleRoundedLegacy,
|
|
89129
90173
|
deserializeRectangleRounded: deserializeRectangleRounded,
|
|
89130
90174
|
deserializeRectangle: deserializeRectangle,
|
|
90175
|
+
deserializeSemicircleLegacy: deserializeSemicircleLegacy,
|
|
89131
90176
|
deserializeSemicircle: deserializeSemicircle,
|
|
89132
90177
|
deserializeTriangleLegacy: deserializeTriangleLegacy,
|
|
89133
90178
|
deserializeTriangleRounded: deserializeTriangleRounded,
|
|
@@ -89156,6 +90201,8 @@
|
|
|
89156
90201
|
EShapeEmbeddedLayer: EShapeEmbeddedLayer,
|
|
89157
90202
|
EShapeEmbedded: EShapeEmbedded,
|
|
89158
90203
|
EShapeEmbeddeds: EShapeEmbeddeds,
|
|
90204
|
+
EShapeFanTriangulatedImpl: EShapeFanTriangulatedImpl,
|
|
90205
|
+
EShapeFan: EShapeFan,
|
|
89159
90206
|
EShapeFillImpl: EShapeFillImpl,
|
|
89160
90207
|
EShapeGroupFillEditor: EShapeGroupFillEditor,
|
|
89161
90208
|
EShapeGroupFillViewer: EShapeGroupFillViewer,
|
|
@@ -89199,6 +90246,7 @@
|
|
|
89199
90246
|
EShapeRectangleRounded: EShapeRectangleRounded,
|
|
89200
90247
|
EShapeRectangleTriangulatedImpl: EShapeRectangleTriangulatedImpl,
|
|
89201
90248
|
EShapeRectangle: EShapeRectangle,
|
|
90249
|
+
EShapeSemicircleLegacy: EShapeSemicircleLegacy,
|
|
89202
90250
|
EShapeSemicircle: EShapeSemicircle,
|
|
89203
90251
|
EShapeStrokeImpl: EShapeStrokeImpl,
|
|
89204
90252
|
EShapeTextAlignImpl: EShapeTextAlignImpl,
|
|
@@ -89214,6 +90262,7 @@
|
|
|
89214
90262
|
hitTestBBox: hitTestBBox,
|
|
89215
90263
|
hitTestCircleLegacy: hitTestCircleLegacy,
|
|
89216
90264
|
hitTestCircle: hitTestCircle,
|
|
90265
|
+
hitTestFan: hitTestFan,
|
|
89217
90266
|
hitTestSemicircle: hitTestSemicircle,
|
|
89218
90267
|
hitTestRectangleRoundedLegacy: hitTestRectangleRoundedLegacy,
|
|
89219
90268
|
hitTestRectangleRounded: hitTestRectangleRounded,
|
|
@@ -89228,6 +90277,8 @@
|
|
|
89228
90277
|
isStatic: isStatic,
|
|
89229
90278
|
toComputed: toComputed,
|
|
89230
90279
|
toDash: toDash,
|
|
90280
|
+
toFanAngleCentric: toFanAngleCentric,
|
|
90281
|
+
toFanAngleEccentric: toFanAngleEccentric,
|
|
89231
90282
|
toGradientImageUrl: toGradientImageUrl,
|
|
89232
90283
|
toGradientSerialized: toGradientSerialized,
|
|
89233
90284
|
toImageElement: toImageElement,
|