@wcardinal/wcardinal-ui 0.468.0 → 0.469.0-beta.1
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 +202 -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 +753 -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 +1189 -103
- package/dist/wcardinal-ui.js +1183 -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.1
|
|
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,947 @@
|
|
|
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 = 4 * (m - 1) + 2 * (n + 4);
|
|
48169
|
+
var ni = 4 * n + 2 * (n + 2);
|
|
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);
|
|
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(n, fs, st, ct, sided);
|
|
48248
|
+
// Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
|
|
48249
|
+
this.writeStrip(m, fd, fx, fy, gx, gy);
|
|
48250
|
+
var iv = 4 * (m - 1);
|
|
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 lengths of the polyline 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 lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
|
|
48309
|
+
*/
|
|
48310
|
+
EShapeFanTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
|
|
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 hw = h / w;
|
|
48319
|
+
var wh = w / h;
|
|
48320
|
+
var l = 0;
|
|
48321
|
+
for (var k = 0; k <= n; ++k) {
|
|
48322
|
+
var dx = -hw * px[k];
|
|
48323
|
+
var dy = -wh * py[k];
|
|
48324
|
+
var speed = Math.sqrt(dx * dx + dy * dy);
|
|
48325
|
+
nx[k] = dx / speed;
|
|
48326
|
+
ny[k] = dy / speed;
|
|
48327
|
+
speeds[k] = speed;
|
|
48328
|
+
if (0 < k) {
|
|
48329
|
+
var ex = px[k] - px[k - 1];
|
|
48330
|
+
var ey = py[k] - py[k - 1];
|
|
48331
|
+
l += Math.sqrt(ex * ex + ey * ey);
|
|
48332
|
+
}
|
|
48333
|
+
ls[k] = l;
|
|
48334
|
+
}
|
|
48335
|
+
for (var k = 0; k < n; ++k) {
|
|
48336
|
+
var j = m - 1 - k;
|
|
48337
|
+
nx[j] = -nx[k];
|
|
48338
|
+
ny[j] = ny[k];
|
|
48339
|
+
speeds[j] = speeds[k];
|
|
48340
|
+
ls[j] = 2 * ls[n] - ls[k];
|
|
48341
|
+
}
|
|
48342
|
+
};
|
|
48343
|
+
/**
|
|
48344
|
+
* Computes Q[k], the points on the normals, and their distances from P[k], and returns the maximum distance.
|
|
48345
|
+
*
|
|
48346
|
+
* If chained is true, Q is the point on the medial axis, that is, the point on the normal
|
|
48347
|
+
* whose distance to the arc is equal to the distance to the straight sides.
|
|
48348
|
+
* The distance delta is obtained from delta = -(n . P) - delta (n . normal) for the outward unit normals n of the sides.
|
|
48349
|
+
* The clamps keep Q on the same side of the axis x = 0 as P and before the center of curvature,
|
|
48350
|
+
* otherwise adjacent normals cross each other, which happens for tall ellipses.
|
|
48351
|
+
*
|
|
48352
|
+
* Otherwise, the normal is extended until it reaches x = 0 if w <= h, otherwise y = 0.
|
|
48353
|
+
*/
|
|
48354
|
+
EShapeFanTriangulatedImpl.prototype.computeMedialPoints = function (w, h, n, st, ct, chained) {
|
|
48355
|
+
var m = 2 * n + 1;
|
|
48356
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48357
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48358
|
+
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48359
|
+
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48360
|
+
var speeds = EShapeFanTriangulatedImpl.WORK_SPEED;
|
|
48361
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48362
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48363
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48364
|
+
var u = w <= h ? w / h : h / w;
|
|
48365
|
+
var dmax = 0;
|
|
48366
|
+
for (var k = 0; k <= n; ++k) {
|
|
48367
|
+
var x = px[k];
|
|
48368
|
+
var y = py[k];
|
|
48369
|
+
var nnx = nx[k];
|
|
48370
|
+
var nny = ny[k];
|
|
48371
|
+
var speed = speeds[k];
|
|
48372
|
+
var delta = Infinity;
|
|
48373
|
+
if (chained) {
|
|
48374
|
+
var da = 1 + -ct * nnx + st * nny;
|
|
48375
|
+
if (1e-9 < da) {
|
|
48376
|
+
delta = Math.min(delta, (ct * x - st * y) / da);
|
|
48377
|
+
}
|
|
48378
|
+
var db = 1 + ct * nnx + st * nny;
|
|
48379
|
+
if (1e-9 < db) {
|
|
48380
|
+
delta = Math.min(delta, (-ct * x - st * y) / db);
|
|
48381
|
+
}
|
|
48382
|
+
if (k !== n && 1e-12 < Math.abs(nnx)) {
|
|
48383
|
+
delta = Math.min(delta, -x / nnx);
|
|
48384
|
+
}
|
|
48385
|
+
delta = Math.max(0, Math.min(delta, (speed * speed * speed) / (w * h)));
|
|
48386
|
+
}
|
|
48387
|
+
// The distance between P and Q
|
|
48388
|
+
var d = void 0;
|
|
48389
|
+
if (Number.isFinite(delta)) {
|
|
48390
|
+
d = delta;
|
|
48391
|
+
}
|
|
48392
|
+
else {
|
|
48393
|
+
d = u * speed;
|
|
48394
|
+
}
|
|
48395
|
+
qx[k] = x + d * nnx;
|
|
48396
|
+
qy[k] = y + d * nny;
|
|
48397
|
+
qd[k] = d;
|
|
48398
|
+
dmax = Math.max(dmax, d);
|
|
48399
|
+
}
|
|
48400
|
+
for (var k = 0; k < n; ++k) {
|
|
48401
|
+
var j = m - 1 - k;
|
|
48402
|
+
qx[j] = -qx[k];
|
|
48403
|
+
qy[j] = qy[k];
|
|
48404
|
+
qd[j] = qd[k];
|
|
48405
|
+
}
|
|
48406
|
+
return dmax;
|
|
48407
|
+
};
|
|
48408
|
+
/**
|
|
48409
|
+
* Computes R[k], the points on the arc shifted outward by fs.
|
|
48410
|
+
* If the straight sides are the outline, the end points are shifted
|
|
48411
|
+
* to the intersections of the shifted arc and the shifted straight sides.
|
|
48412
|
+
*/
|
|
48413
|
+
EShapeFanTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
|
|
48414
|
+
var m = 2 * n + 1;
|
|
48415
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48416
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48417
|
+
var nx = EShapeFanTriangulatedImpl.WORK_NORMAL_X;
|
|
48418
|
+
var ny = EShapeFanTriangulatedImpl.WORK_NORMAL_Y;
|
|
48419
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48420
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48421
|
+
for (var k = 0; k < m; ++k) {
|
|
48422
|
+
var x = px[k] - fs * nx[k];
|
|
48423
|
+
var y = py[k] - fs * ny[k];
|
|
48424
|
+
if (sided && (k === 0 || k === m - 1)) {
|
|
48425
|
+
var sign = k === 0 ? -1 : +1;
|
|
48426
|
+
// The miter of the outward normal of the arc (n1) and that of the straight side (n2)
|
|
48427
|
+
var n1x = -nx[k];
|
|
48428
|
+
var n1y = -ny[k];
|
|
48429
|
+
var n2x = sign * ct;
|
|
48430
|
+
var n2y = st;
|
|
48431
|
+
var miter = fs / Math.max(1 + n1x * n2x + n1y * n2y, 0.05);
|
|
48432
|
+
x = px[k] + miter * (n1x + n2x);
|
|
48433
|
+
y = py[k] + miter * (n1y + n2y);
|
|
48434
|
+
}
|
|
48435
|
+
rx[k] = x;
|
|
48436
|
+
ry[k] = y;
|
|
48437
|
+
}
|
|
48438
|
+
};
|
|
48439
|
+
/**
|
|
48440
|
+
* Writes the strip P[k], P[k + 1], Q[k + 1], Q[k] with the vertices R[k], Q[k], R[k + 1] and Q[k + 1].
|
|
48441
|
+
*
|
|
48442
|
+
* Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
|
|
48443
|
+
* to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
|
|
48444
|
+
*/
|
|
48445
|
+
EShapeFanTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
|
|
48446
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48447
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48448
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48449
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48450
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48451
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48452
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48453
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48454
|
+
var scale = EShapeFanTriangulatedImpl.SCALE;
|
|
48455
|
+
var indices = this._indices;
|
|
48456
|
+
var iv = 0;
|
|
48457
|
+
var ii = 0;
|
|
48458
|
+
for (var k = 0; k < m - 1; ++k) {
|
|
48459
|
+
var x0 = px[k];
|
|
48460
|
+
var y0 = py[k];
|
|
48461
|
+
var l0 = ls[k];
|
|
48462
|
+
var dl = ls[k + 1] - l0;
|
|
48463
|
+
var fl = 0 < dl ? 1 / dl : 0;
|
|
48464
|
+
var ex = (px[k + 1] - x0) * fl;
|
|
48465
|
+
var ey = (py[k + 1] - y0) * fl;
|
|
48466
|
+
var r0x = rx[k];
|
|
48467
|
+
var r0y = ry[k];
|
|
48468
|
+
var q0x = qx[k];
|
|
48469
|
+
var q0y = qy[k];
|
|
48470
|
+
var r1x = rx[k + 1];
|
|
48471
|
+
var r1y = ry[k + 1];
|
|
48472
|
+
var q1x = qx[k + 1];
|
|
48473
|
+
var q1y = qy[k + 1];
|
|
48474
|
+
var lr0 = l0 + (r0x - x0) * ex + (r0y - y0) * ey;
|
|
48475
|
+
var lq0 = l0 + (q0x - x0) * ex + (q0y - y0) * ey;
|
|
48476
|
+
var lr1 = l0 + (r1x - x0) * ex + (r1y - y0) * ey;
|
|
48477
|
+
var lq1 = l0 + (q1x - x0) * ex + (q1y - y0) * ey;
|
|
48478
|
+
var cq0 = 1 - qd[k] * fd;
|
|
48479
|
+
var cq1 = 1 - qd[k + 1] * fd;
|
|
48480
|
+
this.writeVertex(iv, r0x, r0y, lr0, scale, fd, fx, fy, gx, gy);
|
|
48481
|
+
this.writeVertex(iv + 1, q0x, q0y, lq0, cq0, fd, fx, fy, gx, gy);
|
|
48482
|
+
this.writeVertex(iv + 2, r1x, r1y, lr1, scale, fd, fx, fy, gx, gy);
|
|
48483
|
+
this.writeVertex(iv + 3, q1x, q1y, lq1, cq1, fd, fx, fy, gx, gy);
|
|
48484
|
+
indices[ii++] = iv;
|
|
48485
|
+
indices[ii++] = iv + 2;
|
|
48486
|
+
indices[ii++] = iv + 3;
|
|
48487
|
+
indices[ii++] = iv;
|
|
48488
|
+
indices[ii++] = iv + 3;
|
|
48489
|
+
indices[ii++] = iv + 1;
|
|
48490
|
+
iv += 4;
|
|
48491
|
+
}
|
|
48492
|
+
};
|
|
48493
|
+
/**
|
|
48494
|
+
* Writes the polygon O', R[end], Q[end], ..., Q[N] where the end is 0 for the left (sign = -1)
|
|
48495
|
+
* and 2N for the right (sign = +1). The straight side OA (or OB) is the outline of the polygon.
|
|
48496
|
+
* Returns the number of the written vertices.
|
|
48497
|
+
*
|
|
48498
|
+
* The chain of Q ends at the first point on the axis because the following points go back along the axis.
|
|
48499
|
+
* Q is not always on the medial axis where it is clamped,
|
|
48500
|
+
* so the clipping must not be less than the one of the arc.
|
|
48501
|
+
*
|
|
48502
|
+
* The clipping and the length are computed from the straight side:
|
|
48503
|
+
* the outward unit normal is (sign * ct, st) and the length is oa + arc + (-st, sign * ct) . p.
|
|
48504
|
+
*/
|
|
48505
|
+
EShapeFanTriangulatedImpl.prototype.writeSidePolygon = function (iv, ii, sign, n, w, oa, st, ct, fs, fd, fx, fy, gx, gy) {
|
|
48506
|
+
var m = 2 * n + 1;
|
|
48507
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48508
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48509
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48510
|
+
var rx = EShapeFanTriangulatedImpl.WORK_RIM_X;
|
|
48511
|
+
var ry = EShapeFanTriangulatedImpl.WORK_RIM_Y;
|
|
48512
|
+
var l0 = oa + EShapeFanTriangulatedImpl.WORK_ARC_L[m - 1];
|
|
48513
|
+
var nx = sign * ct;
|
|
48514
|
+
var ly = sign * ct;
|
|
48515
|
+
var eps = 1e-9 * w;
|
|
48516
|
+
var end = sign < 0 ? 0 : m - 1;
|
|
48517
|
+
var count = 0;
|
|
48518
|
+
this.writeSideVertex(iv + count++, 0, fs / st, -Infinity, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48519
|
+
this.writeSideVertex(iv + count++, rx[end], ry[end], -Infinity, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48520
|
+
for (var j = 0; j <= n; ++j) {
|
|
48521
|
+
var k = sign < 0 ? j : m - 1 - j;
|
|
48522
|
+
var floor = 1 - qd[k] * fd;
|
|
48523
|
+
var isOnAxis = Math.abs(qx[k]) <= eps;
|
|
48524
|
+
// Where Q is clamped, the clipping of the side reaches the floor at T on the axis before Q.
|
|
48525
|
+
// Without T, the clipping on the axis is not linear and a dent appears at O.
|
|
48526
|
+
var ty = -qd[k] / st;
|
|
48527
|
+
if (isOnAxis && qy[k] < ty - eps) {
|
|
48528
|
+
this.writeSideVertex(iv + count++, 0, ty, floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48529
|
+
this.writeFan(ii, iv, count);
|
|
48530
|
+
this.writeSideVertex(iv + count, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48531
|
+
var indices = this._indices;
|
|
48532
|
+
var i = ii + 3 * (count - 2);
|
|
48533
|
+
indices[i] = iv + count - 2;
|
|
48534
|
+
indices[i + 1] = iv + count;
|
|
48535
|
+
indices[i + 2] = iv + count - 1;
|
|
48536
|
+
return count + 1;
|
|
48537
|
+
}
|
|
48538
|
+
this.writeSideVertex(iv + count++, qx[k], qy[k], floor, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
48539
|
+
if (isOnAxis) {
|
|
48540
|
+
break;
|
|
48541
|
+
}
|
|
48542
|
+
}
|
|
48543
|
+
this.writeFan(ii, iv, count);
|
|
48544
|
+
return count;
|
|
48545
|
+
};
|
|
48546
|
+
/**
|
|
48547
|
+
* Writes the polygon O, Q[end], ..., Q[N] where the end is 0 for the left (sign = -1)
|
|
48548
|
+
* and 2N for the right (sign = +1). The straight sides are hard edges without the stroke.
|
|
48549
|
+
* Returns the number of the written vertices.
|
|
48550
|
+
*
|
|
48551
|
+
* The clipping of O is given by co, and the length of O is the one of the end point.
|
|
48552
|
+
*/
|
|
48553
|
+
EShapeFanTriangulatedImpl.prototype.writeCapPolygon = function (iv, ii, sign, n, w, co, fd, fx, fy, gx, gy) {
|
|
48554
|
+
var m = 2 * n + 1;
|
|
48555
|
+
var qx = EShapeFanTriangulatedImpl.WORK_MEDIAL_X;
|
|
48556
|
+
var qy = EShapeFanTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48557
|
+
var qd = EShapeFanTriangulatedImpl.WORK_MEDIAL_D;
|
|
48558
|
+
var ls = EShapeFanTriangulatedImpl.WORK_ARC_L;
|
|
48559
|
+
var eps = 1e-9 * w;
|
|
48560
|
+
var end = sign < 0 ? 0 : m - 1;
|
|
48561
|
+
this.writeVertex(iv, 0, 0, ls[end], co, fd, fx, fy, gx, gy);
|
|
48562
|
+
var count = 1;
|
|
48563
|
+
for (var j = 0; j <= n; ++j) {
|
|
48564
|
+
var k = sign < 0 ? j : m - 1 - j;
|
|
48565
|
+
var clipping = 1 - qd[k] * fd;
|
|
48566
|
+
this.writeVertex(iv + count++, qx[k], qy[k], ls[k], clipping, fd, fx, fy, gx, gy);
|
|
48567
|
+
if (Math.abs(qx[k]) <= eps) {
|
|
48568
|
+
break;
|
|
48569
|
+
}
|
|
48570
|
+
}
|
|
48571
|
+
this.writeFan(ii, iv, count);
|
|
48572
|
+
return count;
|
|
48573
|
+
};
|
|
48574
|
+
/**
|
|
48575
|
+
* The clipping is 1 - (the distance from the straight side) / d where d is the distance from C to OA (or OB).
|
|
48576
|
+
*/
|
|
48577
|
+
EShapeFanTriangulatedImpl.prototype.updateBottom = function (w, h, n, ea, sea, cea, bx, by, st, ct, fx, fy, gx, gy, nv, ni) {
|
|
48578
|
+
var boundary = this._boundary;
|
|
48579
|
+
boundary[0] = -bx;
|
|
48580
|
+
boundary[1] = -h;
|
|
48581
|
+
boundary[2] = +bx;
|
|
48582
|
+
boundary[3] = 0;
|
|
48583
|
+
var yc = h / (1 + st);
|
|
48584
|
+
var fd = (1 + st) / (h * st);
|
|
48585
|
+
var fs = (EShapeFanTriangulatedImpl.SCALE - 1) / fd;
|
|
48586
|
+
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
48587
|
+
// Triangle fans from C to the arc: left (sign = -1) and right (sign = +1)
|
|
48588
|
+
var iv = 0;
|
|
48589
|
+
var ii = 0;
|
|
48590
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48591
|
+
var count = this.writeBottomFan(iv, ii, sign, n, yc, st, ct, fd, fx, fy, gx, gy);
|
|
48592
|
+
iv += count;
|
|
48593
|
+
ii += 3 * (count - 2);
|
|
48594
|
+
}
|
|
48595
|
+
// Quads at the bottom: O', A', A, C and O', B', B, C
|
|
48596
|
+
for (var sign = -1; sign <= 1; sign += 2) {
|
|
48597
|
+
var count = this.writeBottomQuad(iv, ii, sign, bx, by, yc, fs, st, ct, fd, fx, fy, gx, gy);
|
|
48598
|
+
iv += count;
|
|
48599
|
+
ii += 3 * (count - 2);
|
|
48600
|
+
}
|
|
48601
|
+
this.pad(iv, ii, nv, ni, fd);
|
|
48602
|
+
};
|
|
48603
|
+
/**
|
|
48604
|
+
* Writes the triangle fan from C to the arc of the left half (sign = -1) or the right half (sign = +1).
|
|
48605
|
+
* Returns the number of the written vertices.
|
|
48606
|
+
*
|
|
48607
|
+
* The clipping is 1 + fd * (n . p) where n is the outward unit normal of the straight side,
|
|
48608
|
+
* and the length is the distance along the straight side measured from O.
|
|
48609
|
+
* The side OA has n = (-ct, st) and l = (-st, -ct), and the side OB has n = (ct, st) and l = (st, -ct).
|
|
48610
|
+
*/
|
|
48611
|
+
EShapeFanTriangulatedImpl.prototype.writeBottomFan = function (iv, ii, sign, n, yc, st, ct, fd, fx, fy, gx, gy) {
|
|
48612
|
+
var px = EShapeFanTriangulatedImpl.WORK_ARC_X;
|
|
48613
|
+
var py = EShapeFanTriangulatedImpl.WORK_ARC_Y;
|
|
48614
|
+
var nx = sign * ct;
|
|
48615
|
+
var lx = sign * st;
|
|
48616
|
+
var count = 0;
|
|
48617
|
+
this.writeSideVertex(iv + count++, 0, -yc, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48618
|
+
for (var j = 0; j <= n; ++j) {
|
|
48619
|
+
var k = sign < 0 ? j : n + j;
|
|
48620
|
+
this.writeSideVertex(iv + count++, px[k], py[k], 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48621
|
+
}
|
|
48622
|
+
this.writeFan(ii, iv, count);
|
|
48623
|
+
return count;
|
|
48624
|
+
};
|
|
48625
|
+
/**
|
|
48626
|
+
* Writes the quad O', A', A, C (sign = -1) or O', B', B, C (sign = +1) at the bottom.
|
|
48627
|
+
* O' is shifted outward by fs / st, and A' (B') is shifted outward by fs perpendicular to the straight side.
|
|
48628
|
+
* Returns the number of the written vertices.
|
|
48629
|
+
*/
|
|
48630
|
+
EShapeFanTriangulatedImpl.prototype.writeBottomQuad = function (iv, ii, sign, bx, by, yc, fs, st, ct, fd, fx, fy, gx, gy) {
|
|
48631
|
+
var nx = sign * ct;
|
|
48632
|
+
var lx = sign * st;
|
|
48633
|
+
this.writeSideVertex(iv, 0, fs / st, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48634
|
+
this.writeSideVertex(iv + 1, sign * (bx + fs * ct), -by + fs * st, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48635
|
+
this.writeSideVertex(iv + 2, sign * bx, -by, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48636
|
+
this.writeSideVertex(iv + 3, 0, -yc, 0, nx, st, 0, lx, -ct, fd, fx, fy, gx, gy);
|
|
48637
|
+
this.writeFan(ii, iv, 4);
|
|
48638
|
+
return 4;
|
|
48639
|
+
};
|
|
48640
|
+
// ----------------------------------------------------------------------------------------
|
|
48641
|
+
// Writers
|
|
48642
|
+
// ----------------------------------------------------------------------------------------
|
|
48643
|
+
/**
|
|
48644
|
+
* Writes a vertex whose clipping and length are computed from the parameters of a straight side.
|
|
48645
|
+
* The clipping is 1 + fd * (nx * x + ny * y), which is not less than the given floor,
|
|
48646
|
+
* and the length is l0 + lx * x + ly * y.
|
|
48647
|
+
*/
|
|
48648
|
+
EShapeFanTriangulatedImpl.prototype.writeSideVertex = function (vertex, x, y, floor, nx, ny, l0, lx, ly, fd, fx, fy, gx, gy) {
|
|
48649
|
+
var clipping = Math.max(floor, 1 + fd * (nx * x + ny * y));
|
|
48650
|
+
var length = l0 + lx * x + ly * y;
|
|
48651
|
+
this.writeVertex(vertex, x, y, length, clipping, fd, fx, fy, gx, gy);
|
|
48652
|
+
};
|
|
48653
|
+
/**
|
|
48654
|
+
* Writes the indices of a triangle fan from the first vertex.
|
|
48655
|
+
* The number of the written indices is 3 * (count - 2).
|
|
48656
|
+
*/
|
|
48657
|
+
EShapeFanTriangulatedImpl.prototype.writeFan = function (ii, iv, count) {
|
|
48658
|
+
var indices = this._indices;
|
|
48659
|
+
for (var i = 1; i < count - 1; ++i) {
|
|
48660
|
+
indices[ii++] = iv;
|
|
48661
|
+
indices[ii++] = iv + i;
|
|
48662
|
+
indices[ii++] = iv + i + 1;
|
|
48663
|
+
}
|
|
48664
|
+
};
|
|
48665
|
+
/**
|
|
48666
|
+
* Writes a vertex.
|
|
48667
|
+
*
|
|
48668
|
+
* @param x - The X coordinate in the frame where the sizes are positive
|
|
48669
|
+
* @param y - The Y coordinate in the frame where the sizes are positive
|
|
48670
|
+
* @param fd - The inverse of the distance where the clipping decreases from 1 to 0
|
|
48671
|
+
* @param fx - The factor to convert x to the UV
|
|
48672
|
+
* @param fy - The factor to convert y to the UV
|
|
48673
|
+
* @param gx - The sign of the X size, which flips the vertex
|
|
48674
|
+
* @param gy - The sign of the Y size, which flips the vertex
|
|
48675
|
+
*/
|
|
48676
|
+
EShapeFanTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, length, clipping, fd, fx, fy, gx, gy) {
|
|
48677
|
+
var vertex2 = vertex << 1;
|
|
48678
|
+
this._vertices[vertex2] = gx * x;
|
|
48679
|
+
this._vertices[vertex2 + 1] = gy * y;
|
|
48680
|
+
this._distances[vertex] = fd;
|
|
48681
|
+
this._lengths[vertex] = length;
|
|
48682
|
+
this._clippings[vertex] = clipping;
|
|
48683
|
+
this._uvs[vertex2] = 0.5 * (x * fx + 1);
|
|
48684
|
+
this._uvs[vertex2 + 1] = 1 + y * fy;
|
|
48685
|
+
};
|
|
48686
|
+
/**
|
|
48687
|
+
* Fills the unused tail with degenerated triangles and trims the arrays
|
|
48688
|
+
* so that the buffers always hold exactly `nv` vertices and `ni` triangles.
|
|
48689
|
+
*/
|
|
48690
|
+
EShapeFanTriangulatedImpl.prototype.pad = function (iv, ii, nv, ni, distance) {
|
|
48691
|
+
for (var i = iv; i < nv; ++i) {
|
|
48692
|
+
var vertex2 = i << 1;
|
|
48693
|
+
this._vertices[vertex2] = 0;
|
|
48694
|
+
this._vertices[vertex2 + 1] = 0;
|
|
48695
|
+
this._distances[i] = distance;
|
|
48696
|
+
this._lengths[i] = 0;
|
|
48697
|
+
this._clippings[i] = 0;
|
|
48698
|
+
this._uvs[vertex2] = 0.5;
|
|
48699
|
+
this._uvs[vertex2 + 1] = 0.5;
|
|
48700
|
+
}
|
|
48701
|
+
for (var i = ii; i < ni * 3; ++i) {
|
|
48702
|
+
this._indices[i] = 0;
|
|
48703
|
+
}
|
|
48704
|
+
this._vertices.length = nv * 2;
|
|
48705
|
+
this._distances.length = nv;
|
|
48706
|
+
this._lengths.length = nv;
|
|
48707
|
+
this._clippings.length = nv;
|
|
48708
|
+
this._uvs.length = nv * 2;
|
|
48709
|
+
this._indices.length = ni * 3;
|
|
48710
|
+
};
|
|
48711
|
+
/** The ratio of the outer edge, where the clipping is 1, to the edge of the anti-aliasing */
|
|
48712
|
+
EShapeFanTriangulatedImpl.SCALE = 1.1;
|
|
48713
|
+
// Work arrays shared by all the instances because they are used only in a single synchronous triangulation.
|
|
48714
|
+
// All of them are indexed by k, which is in [0, 2N].
|
|
48715
|
+
/** P: the points on the arc */
|
|
48716
|
+
EShapeFanTriangulatedImpl.WORK_ARC_X = [];
|
|
48717
|
+
EShapeFanTriangulatedImpl.WORK_ARC_Y = [];
|
|
48718
|
+
/** The lengths of the polyline P[0], ..., P[k] */
|
|
48719
|
+
EShapeFanTriangulatedImpl.WORK_ARC_L = [];
|
|
48720
|
+
/** The unit inward normals of the arc */
|
|
48721
|
+
EShapeFanTriangulatedImpl.WORK_NORMAL_X = [];
|
|
48722
|
+
EShapeFanTriangulatedImpl.WORK_NORMAL_Y = [];
|
|
48723
|
+
/** The magnitudes of the tangents, that is, the speeds of the arc */
|
|
48724
|
+
EShapeFanTriangulatedImpl.WORK_SPEED = [];
|
|
48725
|
+
/** Q: the points on the normals */
|
|
48726
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_X = [];
|
|
48727
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_Y = [];
|
|
48728
|
+
/** The distances from P to Q */
|
|
48729
|
+
EShapeFanTriangulatedImpl.WORK_MEDIAL_D = [];
|
|
48730
|
+
/** R: the points on the arc shifted outward */
|
|
48731
|
+
EShapeFanTriangulatedImpl.WORK_RIM_X = [];
|
|
48732
|
+
EShapeFanTriangulatedImpl.WORK_RIM_Y = [];
|
|
48733
|
+
return EShapeFanTriangulatedImpl;
|
|
48734
|
+
}());
|
|
48735
|
+
|
|
48736
|
+
/*
|
|
48737
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48738
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48739
|
+
*/
|
|
48740
|
+
/**
|
|
48741
|
+
* Tests whether the point is in the fan shrunk by `sa` at the arc and by `ss` at the straight sides.
|
|
48742
|
+
*
|
|
48743
|
+
* @param st - The sine of the half central angle
|
|
48744
|
+
* @param ct - The cosine of the half central angle
|
|
48745
|
+
*/
|
|
48746
|
+
var isInFan = function (x, y, ax, ay, st, ct, sa, ss) {
|
|
48747
|
+
var wx = ax - sa;
|
|
48748
|
+
var wy = ay - sa;
|
|
48749
|
+
if (wx <= 0 || wy <= 0) {
|
|
48750
|
+
return false;
|
|
48751
|
+
}
|
|
48752
|
+
var ex = x * wy;
|
|
48753
|
+
var ey = y * wx;
|
|
48754
|
+
if (wx * wy * wx * wy < ex * ex + ey * ey) {
|
|
48755
|
+
return false;
|
|
48756
|
+
}
|
|
48757
|
+
var ay1 = st * y;
|
|
48758
|
+
return -ct * x + ay1 <= -ss && ct * x + ay1 <= -ss;
|
|
48759
|
+
};
|
|
48760
|
+
var hitTestFanFill = function (shape, x, y, bx, by) {
|
|
48761
|
+
var fill = shape.fill;
|
|
48762
|
+
if (fill.enable) {
|
|
48763
|
+
var percent = Math.max(0, Math.min(1, fill.percent));
|
|
48764
|
+
if (1 <= percent) {
|
|
48765
|
+
return true;
|
|
48766
|
+
}
|
|
48767
|
+
// The fill is relative to the bounding box [-bx, +bx] x [-by, 0] of the fan.
|
|
48768
|
+
switch (fill.direction) {
|
|
48769
|
+
case EShapeFillDirection.TOP:
|
|
48770
|
+
return y + by <= percent * by;
|
|
48771
|
+
case EShapeFillDirection.RIGHT:
|
|
48772
|
+
return (1 - percent) * (2 * bx) <= x + bx;
|
|
48773
|
+
case EShapeFillDirection.BOTTOM:
|
|
48774
|
+
return (1 - percent) * by <= y + by;
|
|
48775
|
+
case EShapeFillDirection.LEFT:
|
|
48776
|
+
return x + bx <= percent * (2 * bx);
|
|
48777
|
+
}
|
|
48778
|
+
}
|
|
48779
|
+
return false;
|
|
48780
|
+
};
|
|
48781
|
+
var hitTestFan = function (shape, x, y, ax, ay, sw, ss) {
|
|
48782
|
+
var ca = toFanAngleCentric(shape.angle);
|
|
48783
|
+
if (ca <= 0 || ax <= 0 || ay <= 0) {
|
|
48784
|
+
return false;
|
|
48785
|
+
}
|
|
48786
|
+
var ea = toFanAngleEccentric(ax, ay, ca);
|
|
48787
|
+
var bx = ax * Math.sin(ea);
|
|
48788
|
+
var st = Math.sin(ca);
|
|
48789
|
+
var ct = Math.cos(ca);
|
|
48790
|
+
var fill = shape.fill;
|
|
48791
|
+
var strokeSide = shape.stroke.side;
|
|
48792
|
+
var strokeSideTop = (strokeSide & EShapeStrokeSide.TOP) !== 0;
|
|
48793
|
+
var strokeSideBottom = (strokeSide & EShapeStrokeSide.BOTTOM) !== 0;
|
|
48794
|
+
var strokeWidth = strokeSideTop || strokeSideBottom ? sw : 0;
|
|
48795
|
+
if ((fill.enable || 0 < strokeWidth) && isInFan(x, y, ax, ay, st, ct, 0, 0)) {
|
|
48796
|
+
if (fill.enable && hitTestFanFill(shape, x, y, bx, ay)) {
|
|
48797
|
+
return true;
|
|
48798
|
+
}
|
|
48799
|
+
if (0 < strokeWidth) {
|
|
48800
|
+
var s = strokeWidth * ss;
|
|
48801
|
+
var arc = strokeSideTop ? s : 0;
|
|
48802
|
+
var sides = strokeSideBottom ? s : 0;
|
|
48803
|
+
if (!isInFan(x, y, ax, ay, st, ct, arc, sides)) {
|
|
48804
|
+
return true;
|
|
48805
|
+
}
|
|
48806
|
+
}
|
|
48807
|
+
}
|
|
48808
|
+
return false;
|
|
48809
|
+
};
|
|
48810
|
+
|
|
48811
|
+
/*
|
|
48812
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48813
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48814
|
+
*/
|
|
48815
|
+
var EShapeFan = /** @class */ (function (_super) {
|
|
48816
|
+
__extends(EShapeFan, _super);
|
|
48817
|
+
function EShapeFan(type) {
|
|
48818
|
+
if (type === void 0) { type = EShapeType.FAN; }
|
|
48819
|
+
var _this = _super.call(this, type) || this;
|
|
48820
|
+
_this._angle = _this.newAngle();
|
|
48821
|
+
_this._triangulated = _this.newTriangulated();
|
|
48822
|
+
return _this;
|
|
48823
|
+
}
|
|
48824
|
+
EShapeFan.prototype.newAngle = function () {
|
|
48825
|
+
return EShapeDefaults.ANGLE;
|
|
48826
|
+
};
|
|
48827
|
+
EShapeFan.prototype.newTriangulated = function () {
|
|
48828
|
+
return new EShapeFanTriangulatedImpl(this);
|
|
48829
|
+
};
|
|
48830
|
+
Object.defineProperty(EShapeFan.prototype, "triangulated", {
|
|
48831
|
+
get: function () {
|
|
48832
|
+
return this._triangulated;
|
|
48833
|
+
},
|
|
48834
|
+
enumerable: false,
|
|
48835
|
+
configurable: true
|
|
48836
|
+
});
|
|
48837
|
+
Object.defineProperty(EShapeFan.prototype, "angle", {
|
|
48838
|
+
/**
|
|
48839
|
+
* The ratio of the half central angle of the fan to PI. Must be in [0, 0.5].
|
|
48840
|
+
* 0.5 results in a semicircle.
|
|
48841
|
+
*/
|
|
48842
|
+
get: function () {
|
|
48843
|
+
return this._angle;
|
|
48844
|
+
},
|
|
48845
|
+
set: function (angle) {
|
|
48846
|
+
if (this._angle !== angle) {
|
|
48847
|
+
this._angle = angle;
|
|
48848
|
+
this.updateUploaded();
|
|
48849
|
+
}
|
|
48850
|
+
},
|
|
48851
|
+
enumerable: false,
|
|
48852
|
+
configurable: true
|
|
48853
|
+
});
|
|
48854
|
+
EShapeFan.prototype.toHitTestStrokeShift = function (strokeWidth, strokeScale, strokeAlign) {
|
|
48855
|
+
if ((this.stroke.side & EShapeStrokeSide.TOP_OR_BOTTOM) !== 0) {
|
|
48856
|
+
return _super.prototype.toHitTestStrokeShift.call(this, strokeWidth, strokeScale, strokeAlign);
|
|
48857
|
+
}
|
|
48858
|
+
return 0;
|
|
48859
|
+
};
|
|
48860
|
+
EShapeFan.prototype.copy = function (source, part) {
|
|
48861
|
+
this.lock(EShapeLockPart.ALL);
|
|
48862
|
+
_super.prototype.copy.call(this, source, part);
|
|
48863
|
+
if ((part == null || part & EShapeCopyPart.STYLE) && source instanceof EShapeFan) {
|
|
48864
|
+
this._angle = source._angle;
|
|
48865
|
+
}
|
|
48866
|
+
this.unlock(EShapeLockPart.ALL, true);
|
|
48867
|
+
return this;
|
|
48868
|
+
};
|
|
48869
|
+
EShapeFan.prototype.clone = function () {
|
|
48870
|
+
return new EShapeFan(this.type).copy(this);
|
|
48871
|
+
};
|
|
48872
|
+
EShapeFan.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
48873
|
+
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
48874
|
+
return hitTestFan(this, x, y, ax, ay, sw, ss);
|
|
48875
|
+
}
|
|
48876
|
+
return false;
|
|
48877
|
+
};
|
|
48878
|
+
EShapeFan.prototype.serialize = function (manager) {
|
|
48879
|
+
var result = _super.prototype.serialize.call(this, manager);
|
|
48880
|
+
result[15] = this._angle;
|
|
48881
|
+
return result;
|
|
48882
|
+
};
|
|
48883
|
+
return EShapeFan;
|
|
48884
|
+
}(EShapePrimitive));
|
|
48885
|
+
|
|
48886
|
+
/*
|
|
48887
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48888
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48889
|
+
*/
|
|
48890
|
+
var deserializeFan = function (item, manager, shape) {
|
|
48891
|
+
shape = shape || new EShapeFan();
|
|
48892
|
+
shape.angle = item[15];
|
|
48893
|
+
return deserializeBase(item, manager, shape);
|
|
48894
|
+
};
|
|
48895
|
+
|
|
48896
|
+
/*
|
|
48897
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48898
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
48899
|
+
*/
|
|
48900
|
+
var loadShapeFan = function () {
|
|
48901
|
+
EShapeUploadeds[EShapeType.FAN] = createPolygonUploaded;
|
|
48902
|
+
EShapeDeserializers[EShapeType.FAN] = deserializeFan;
|
|
48903
|
+
EShapeCapabilities.set(EShapeType.FAN, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE | EShapeCapability.ANGLE);
|
|
48904
|
+
};
|
|
48905
|
+
|
|
47933
48906
|
/*
|
|
47934
48907
|
* Copyright (C) 2019 Toshiba Corporation
|
|
47935
48908
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -48566,7 +49539,7 @@
|
|
|
48566
49539
|
if (0 < children.length) {
|
|
48567
49540
|
return children[children.length - 1].radius;
|
|
48568
49541
|
}
|
|
48569
|
-
return
|
|
49542
|
+
return EShapeDefaults.RADIUS;
|
|
48570
49543
|
},
|
|
48571
49544
|
set: function (radius) {
|
|
48572
49545
|
var children = this.children;
|
|
@@ -48577,6 +49550,23 @@
|
|
|
48577
49550
|
enumerable: false,
|
|
48578
49551
|
configurable: true
|
|
48579
49552
|
});
|
|
49553
|
+
Object.defineProperty(EShapeGroup.prototype, "angle", {
|
|
49554
|
+
get: function () {
|
|
49555
|
+
var children = this.children;
|
|
49556
|
+
if (0 < children.length) {
|
|
49557
|
+
return children[children.length - 1].angle;
|
|
49558
|
+
}
|
|
49559
|
+
return EShapeDefaults.ANGLE;
|
|
49560
|
+
},
|
|
49561
|
+
set: function (angle) {
|
|
49562
|
+
var children = this.children;
|
|
49563
|
+
for (var i = 0, imax = children.length; i < imax; ++i) {
|
|
49564
|
+
children[i].angle = angle;
|
|
49565
|
+
}
|
|
49566
|
+
},
|
|
49567
|
+
enumerable: false,
|
|
49568
|
+
configurable: true
|
|
49569
|
+
});
|
|
48580
49570
|
Object.defineProperty(EShapeGroup.prototype, "image", {
|
|
48581
49571
|
get: function () {
|
|
48582
49572
|
var children = this.children;
|
|
@@ -53314,7 +54304,7 @@
|
|
|
53314
54304
|
boundary[2] = +ax;
|
|
53315
54305
|
boundary[3] = +ay;
|
|
53316
54306
|
// # of vertices and # of indices
|
|
53317
|
-
var nv =
|
|
54307
|
+
var nv = 9;
|
|
53318
54308
|
var ni = 3;
|
|
53319
54309
|
this._nvertices = nv;
|
|
53320
54310
|
this._nindices = ni;
|
|
@@ -53369,11 +54359,7 @@
|
|
|
53369
54359
|
// vertices (-sx, sy) and (sx, sy). The signs of sx and
|
|
53370
54360
|
// sy intentionally preserve horizontal and vertical reflections.
|
|
53371
54361
|
// 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;
|
|
54362
|
+
var b = Math.sqrt(ax * ax + 4 * ay * ay);
|
|
53377
54363
|
// The incenter lies on the vertical center line. This is its y-coordinate.
|
|
53378
54364
|
// Along the median, the distances from the top vertex to the incenter and
|
|
53379
54365
|
// from the incenter to the base are in the ratio 2 * side : base.
|
|
@@ -53385,42 +54371,47 @@
|
|
|
53385
54371
|
// cy = ay (2 side - 2 ax) / (2 side + 2 ax)
|
|
53386
54372
|
// cy = ay (side - ax) / (side + ax)
|
|
53387
54373
|
var cx = 0;
|
|
53388
|
-
var cy = (sy * (
|
|
54374
|
+
var cy = (sy * (b - ax)) / (b + ax);
|
|
53389
54375
|
// The distance from the incenter to every edge is the inradius.
|
|
53390
54376
|
// Since 0 <= (side - ax) / (side + ax) <= 1, the incenter remains
|
|
53391
54377
|
// between the apex and the base even when sy is negative.
|
|
53392
|
-
var
|
|
53393
|
-
var
|
|
54378
|
+
var d = Math.abs(sy - cy);
|
|
54379
|
+
var fd = 1 / d;
|
|
53394
54380
|
// Expand the triangle around its incenter for anti-aliasing and strokes.
|
|
53395
|
-
// The outer vertices are shared where their interpolated attributes match.
|
|
53396
54381
|
var x0 = 0;
|
|
53397
54382
|
var y0 = cy + scale * (-sy - cy);
|
|
53398
54383
|
var x1 = scale * sx;
|
|
53399
54384
|
var y1 = cy + scale * (sy - cy);
|
|
53400
54385
|
var x2 = -x1;
|
|
53401
54386
|
var y2 = y1;
|
|
53402
|
-
//
|
|
53403
|
-
|
|
53404
|
-
|
|
53405
|
-
this.updateVertex(2, cx, cy, fdistance, side - ax, 0, fx, fy);
|
|
54387
|
+
// Each cell has its own vertices because `length` is the arc length projected onto
|
|
54388
|
+
// the cell's edge. It is `lc` at the incenter (the tangent point) and
|
|
54389
|
+
// `lc + scale * (l - lc)` at the outer vertices so that it equals `l` at clipping = 1.
|
|
53406
54390
|
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
|
-
|
|
54391
|
+
// Top-to-right edge cell
|
|
54392
|
+
var l0 = 0;
|
|
54393
|
+
var l1 = l0 + b;
|
|
54394
|
+
var lc0 = b - ax;
|
|
54395
|
+
this.writeVertex(0, x0, y0, fd, lc0 + scale * (l0 - lc0), scale, fx, fy);
|
|
54396
|
+
this.writeVertex(1, x1, y1, fd, lc0 + scale * (l1 - lc0), scale, fx, fy);
|
|
54397
|
+
this.writeVertex(2, cx, cy, fd, lc0, 0, fx, fy);
|
|
54398
|
+
// Right-to-left base edge cell
|
|
54399
|
+
var l2 = l1 + 2 * ax;
|
|
54400
|
+
var lc1 = b + ax;
|
|
54401
|
+
this.writeVertex(3, x1, y1, fd, lc1 + scale * (l1 - lc1), scale, fx, fy);
|
|
54402
|
+
this.writeVertex(4, x2, y2, fd, lc1 + scale * (l2 - lc1), scale, fx, fy);
|
|
54403
|
+
this.writeVertex(5, cx, cy, fd, lc1, 0, fx, fy);
|
|
54404
|
+
// Left-to-top edge cell
|
|
54405
|
+
var l3 = l2 + b;
|
|
54406
|
+
var lc2 = b + 3 * ax;
|
|
54407
|
+
this.writeVertex(6, x2, y2, fd, lc2 + scale * (l2 - lc2), scale, fx, fy);
|
|
54408
|
+
this.writeVertex(7, x0, y0, fd, lc2 + scale * (l3 - lc2), scale, fx, fy);
|
|
54409
|
+
this.writeVertex(8, cx, cy, fd, lc2, 0, fx, fy);
|
|
54410
|
+
for (var i = 0; i < 9; ++i) {
|
|
54411
|
+
indices[i] = i;
|
|
54412
|
+
}
|
|
54413
|
+
};
|
|
54414
|
+
EShapeTriangleTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, distance, length, clipping, fx, fy) {
|
|
53424
54415
|
var vertex2 = vertex << 1;
|
|
53425
54416
|
this._vertices[vertex2] = x;
|
|
53426
54417
|
this._vertices[vertex2 + 1] = y;
|
|
@@ -55431,14 +56422,13 @@
|
|
|
55431
56422
|
return new EShapePolygon(this.type).copy(this);
|
|
55432
56423
|
};
|
|
55433
56424
|
EShapePolygon.prototype.copy = function (source, part) {
|
|
55434
|
-
if (part === void 0) { part = EShapeCopyPart.ALL; }
|
|
55435
56425
|
this.lock(EShapeLockPart.ALL);
|
|
55436
|
-
|
|
55437
|
-
if (part & EShapeCopyPart.POINTS && source instanceof EShapePolygon) {
|
|
56426
|
+
_super.prototype.copy.call(this, source, part);
|
|
56427
|
+
if ((part == null || part & EShapeCopyPart.POINTS) && source instanceof EShapePolygon) {
|
|
55438
56428
|
this._triangulated.copy(source._triangulated);
|
|
55439
56429
|
}
|
|
55440
56430
|
this.unlock(EShapeLockPart.ALL, true);
|
|
55441
|
-
return
|
|
56431
|
+
return this;
|
|
55442
56432
|
};
|
|
55443
56433
|
EShapePolygon.prototype.serialize = function (manager) {
|
|
55444
56434
|
var result = _super.prototype.serialize.call(this, manager);
|
|
@@ -55775,11 +56765,84 @@
|
|
|
55775
56765
|
EShapeCapabilities.set(EShapeType.RECTANGLE_ROUNDED_LEGACY, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE | EShapeCapability.BORDER_RADIUS);
|
|
55776
56766
|
};
|
|
55777
56767
|
|
|
55778
|
-
|
|
55779
|
-
|
|
55780
|
-
|
|
55781
|
-
|
|
55782
|
-
|
|
56768
|
+
/*
|
|
56769
|
+
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
56770
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56771
|
+
*/
|
|
56772
|
+
/**
|
|
56773
|
+
* A semicircle shape.
|
|
56774
|
+
*/
|
|
56775
|
+
var EShapeSemicircle = /** @class */ (function (_super) {
|
|
56776
|
+
__extends(EShapeSemicircle, _super);
|
|
56777
|
+
function EShapeSemicircle(type) {
|
|
56778
|
+
if (type === void 0) { type = EShapeType.SEMICIRCLE; }
|
|
56779
|
+
var _this = _super.call(this, type) || this;
|
|
56780
|
+
_this._triangulated = _this.newTriangulated();
|
|
56781
|
+
return _this;
|
|
56782
|
+
}
|
|
56783
|
+
EShapeSemicircle.prototype.newStroke = function () {
|
|
56784
|
+
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);
|
|
56785
|
+
};
|
|
56786
|
+
EShapeSemicircle.prototype.newTriangulated = function () {
|
|
56787
|
+
return new EShapeFanTriangulatedImpl(this);
|
|
56788
|
+
};
|
|
56789
|
+
Object.defineProperty(EShapeSemicircle.prototype, "triangulated", {
|
|
56790
|
+
get: function () {
|
|
56791
|
+
return this._triangulated;
|
|
56792
|
+
},
|
|
56793
|
+
enumerable: false,
|
|
56794
|
+
configurable: true
|
|
56795
|
+
});
|
|
56796
|
+
Object.defineProperty(EShapeSemicircle.prototype, "angle", {
|
|
56797
|
+
get: function () {
|
|
56798
|
+
return 0.5;
|
|
56799
|
+
},
|
|
56800
|
+
set: function (angle) {
|
|
56801
|
+
// DO NOTHING
|
|
56802
|
+
},
|
|
56803
|
+
enumerable: false,
|
|
56804
|
+
configurable: true
|
|
56805
|
+
});
|
|
56806
|
+
EShapeSemicircle.prototype.toHitTestStrokeShift = function (strokeWidth, strokeScale, strokeAlign) {
|
|
56807
|
+
if ((this.stroke.side & EShapeStrokeSide.TOP_OR_BOTTOM) !== 0) {
|
|
56808
|
+
return _super.prototype.toHitTestStrokeShift.call(this, strokeWidth, strokeScale, strokeAlign);
|
|
56809
|
+
}
|
|
56810
|
+
return 0;
|
|
56811
|
+
};
|
|
56812
|
+
EShapeSemicircle.prototype.clone = function () {
|
|
56813
|
+
return new EShapeSemicircle(this.type).copy(this);
|
|
56814
|
+
};
|
|
56815
|
+
EShapeSemicircle.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
56816
|
+
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
56817
|
+
return hitTestFan(this, x, y, ax, ay, sw, ss);
|
|
56818
|
+
}
|
|
56819
|
+
return false;
|
|
56820
|
+
};
|
|
56821
|
+
return EShapeSemicircle;
|
|
56822
|
+
}(EShapePrimitive));
|
|
56823
|
+
|
|
56824
|
+
/*
|
|
56825
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
56826
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56827
|
+
*/
|
|
56828
|
+
var deserializeSemicircle = function (item, manager, shape) {
|
|
56829
|
+
return deserializeBase(item, manager, shape || new EShapeSemicircle());
|
|
56830
|
+
};
|
|
56831
|
+
|
|
56832
|
+
/*
|
|
56833
|
+
* Copyright (C) 2019 Toshiba Corporation
|
|
56834
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
56835
|
+
*/
|
|
56836
|
+
var loadShapeSemicircle = function () {
|
|
56837
|
+
EShapeUploadeds[EShapeType.SEMICIRCLE] = createPolygonUploaded;
|
|
56838
|
+
EShapeDeserializers[EShapeType.SEMICIRCLE] = deserializeSemicircle;
|
|
56839
|
+
EShapeCapabilities.set(EShapeType.SEMICIRCLE, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE);
|
|
56840
|
+
};
|
|
56841
|
+
|
|
56842
|
+
var SEMICIRCLE_LEGACY_VERTEX_COUNT = 6;
|
|
56843
|
+
var SEMICIRCLE_LEGACY_INDEX_COUNT = 4;
|
|
56844
|
+
var SEMICIRCLE_LEGACY_WORLD_SIZE = [0, 0];
|
|
56845
|
+
var buildSemicircleLegacyIndex = function (indices, voffset, ioffset) {
|
|
55783
56846
|
var ii = ioffset * 3 - 1;
|
|
55784
56847
|
indices[++ii] = voffset;
|
|
55785
56848
|
indices[++ii] = voffset + 1;
|
|
@@ -55794,7 +56857,7 @@
|
|
|
55794
56857
|
indices[++ii] = voffset + 5;
|
|
55795
56858
|
indices[++ii] = voffset + 4;
|
|
55796
56859
|
};
|
|
55797
|
-
var
|
|
56860
|
+
var buildSemicircleLegacyVertex = function (vertices, voffset, originX, originY, sizeX, sizeY, strokeAlign, strokeWidth, internalTransform, worldSize) {
|
|
55798
56861
|
// Calculate the transformed positions
|
|
55799
56862
|
//
|
|
55800
56863
|
// 0 1 2
|
|
@@ -55802,24 +56865,23 @@
|
|
|
55802
56865
|
// |3 |4 |5
|
|
55803
56866
|
// |-------|-------|
|
|
55804
56867
|
//
|
|
55805
|
-
var work = SEMICIRCLE_WORK_POINT;
|
|
55806
56868
|
var s = strokeAlign * strokeWidth;
|
|
55807
56869
|
var sx = sizeX * 0.5 + (0 <= sizeX ? +s : -s);
|
|
55808
56870
|
var sy = sizeY * 0.5 + (0 <= sizeY ? +s : -s);
|
|
55809
|
-
|
|
55810
|
-
internalTransform.
|
|
55811
|
-
var
|
|
55812
|
-
var
|
|
55813
|
-
|
|
55814
|
-
internalTransform.
|
|
55815
|
-
var
|
|
55816
|
-
var
|
|
56871
|
+
var a = internalTransform.a;
|
|
56872
|
+
var b = internalTransform.b;
|
|
56873
|
+
var c = internalTransform.c;
|
|
56874
|
+
var d = internalTransform.d;
|
|
56875
|
+
var tx = internalTransform.tx;
|
|
56876
|
+
var ty = internalTransform.ty;
|
|
56877
|
+
var x0 = a * (-sx + originX) + c * (-sy + originY) + tx;
|
|
56878
|
+
var y0 = b * (-sx + originX) + d * (-sy + originY) + ty;
|
|
56879
|
+
var x1 = a * originX + c * (-sy + originY) + tx;
|
|
56880
|
+
var y1 = b * originX + d * (-sy + originY) + ty;
|
|
55817
56881
|
var dx = x1 - x0;
|
|
55818
56882
|
var dy = y1 - y0;
|
|
55819
|
-
|
|
55820
|
-
|
|
55821
|
-
var x4 = work.x;
|
|
55822
|
-
var y4 = work.y;
|
|
56883
|
+
var x4 = a * originX + c * originY + tx;
|
|
56884
|
+
var y4 = b * originX + d * originY + ty;
|
|
55823
56885
|
var x3 = x4 - dx;
|
|
55824
56886
|
var y3 = y4 - dy;
|
|
55825
56887
|
// Vertices
|
|
@@ -55839,7 +56901,7 @@
|
|
|
55839
56901
|
worldSize[0] = toLength(x0, y0, x1, y1);
|
|
55840
56902
|
worldSize[1] = toLength(x0, y0, x3, y3);
|
|
55841
56903
|
};
|
|
55842
|
-
var
|
|
56904
|
+
var buildSemicircleLegacyStep = function (steps, voffset, strokeWidth, strokeStyle, worldSize) {
|
|
55843
56905
|
var scaleInvariant = toScaleInvariant(strokeStyle);
|
|
55844
56906
|
var ws0 = worldSize[0];
|
|
55845
56907
|
var ws1 = worldSize[1];
|
|
@@ -55886,7 +56948,7 @@
|
|
|
55886
56948
|
steps[++is] = c10;
|
|
55887
56949
|
steps[++is] = 0;
|
|
55888
56950
|
};
|
|
55889
|
-
var
|
|
56951
|
+
var buildSemicircleLegacyUv = function (uvs, voffset, textureUvs) {
|
|
55890
56952
|
var x0 = textureUvs.x0;
|
|
55891
56953
|
var x1 = textureUvs.x1;
|
|
55892
56954
|
var x2 = textureUvs.x2;
|
|
@@ -55915,25 +56977,25 @@
|
|
|
55915
56977
|
* Copyright (C) 2019 Toshiba Corporation
|
|
55916
56978
|
* SPDX-License-Identifier: Apache-2.0
|
|
55917
56979
|
*/
|
|
55918
|
-
var
|
|
55919
|
-
__extends(
|
|
55920
|
-
function
|
|
55921
|
-
return _super.call(this, buffer, vertexOffset, indexOffset,
|
|
56980
|
+
var BuilderSemicircleLegacy = /** @class */ (function (_super) {
|
|
56981
|
+
__extends(BuilderSemicircleLegacy, _super);
|
|
56982
|
+
function BuilderSemicircleLegacy(buffer, vertexOffset, indexOffset) {
|
|
56983
|
+
return _super.call(this, buffer, vertexOffset, indexOffset, SEMICIRCLE_LEGACY_VERTEX_COUNT, SEMICIRCLE_LEGACY_INDEX_COUNT) || this;
|
|
55922
56984
|
}
|
|
55923
|
-
|
|
56985
|
+
BuilderSemicircleLegacy.prototype.init = function () {
|
|
55924
56986
|
var buffer = this.buffer;
|
|
55925
56987
|
buffer.updateIndices();
|
|
55926
56988
|
var voffset = this.vertexOffset;
|
|
55927
|
-
|
|
56989
|
+
buildSemicircleLegacyIndex(buffer.indices, voffset, this.indexOffset);
|
|
55928
56990
|
this.inited |= BuilderFlag.INDEX;
|
|
55929
56991
|
};
|
|
55930
|
-
|
|
56992
|
+
BuilderSemicircleLegacy.prototype.update = function (shape) {
|
|
55931
56993
|
var buffer = this.buffer;
|
|
55932
56994
|
this.updateVertexAndStep(buffer, shape);
|
|
55933
56995
|
this.updateColor(buffer, shape);
|
|
55934
56996
|
this.updateUv(buffer, shape);
|
|
55935
56997
|
};
|
|
55936
|
-
|
|
56998
|
+
BuilderSemicircleLegacy.prototype.updateVertexAndStep = function (buffer, shape) {
|
|
55937
56999
|
var size = shape.size;
|
|
55938
57000
|
var sizeX = size.x;
|
|
55939
57001
|
var sizeY = size.y;
|
|
@@ -55959,11 +57021,11 @@
|
|
|
55959
57021
|
// Buffer
|
|
55960
57022
|
buffer.updateVertices();
|
|
55961
57023
|
buffer.updateSteps();
|
|
55962
|
-
|
|
55963
|
-
|
|
57024
|
+
buildSemicircleLegacyVertex(buffer.vertices, this.vertexOffset, 0, 0, sizeX, sizeY, strokeAlign, strokeWidth, shape.transform.internalTransform, SEMICIRCLE_LEGACY_WORLD_SIZE);
|
|
57025
|
+
buildSemicircleLegacyStep(buffer.steps, this.vertexOffset, strokeWidth, strokeStyle, SEMICIRCLE_LEGACY_WORLD_SIZE);
|
|
55964
57026
|
}
|
|
55965
57027
|
};
|
|
55966
|
-
|
|
57028
|
+
BuilderSemicircleLegacy.prototype.updateUv = function (buffer, shape) {
|
|
55967
57029
|
var texture = toTexture(shape);
|
|
55968
57030
|
var textureTransformId = toTextureTransformId(texture);
|
|
55969
57031
|
var isNotInited = !(this.inited & BuilderFlag.UV);
|
|
@@ -55975,26 +57037,26 @@
|
|
|
55975
57037
|
this.textureTransformId = textureTransformId;
|
|
55976
57038
|
buffer.updateUvs();
|
|
55977
57039
|
var textureUvs = toTextureUvs(texture);
|
|
55978
|
-
|
|
57040
|
+
buildSemicircleLegacyUv(buffer.uvs, this.vertexOffset, textureUvs);
|
|
55979
57041
|
}
|
|
55980
57042
|
};
|
|
55981
|
-
return
|
|
57043
|
+
return BuilderSemicircleLegacy;
|
|
55982
57044
|
}(BuilderBase));
|
|
55983
57045
|
|
|
55984
57046
|
/*
|
|
55985
57047
|
* Copyright (C) 2019 Toshiba Corporation
|
|
55986
57048
|
* SPDX-License-Identifier: Apache-2.0
|
|
55987
57049
|
*/
|
|
55988
|
-
var
|
|
57050
|
+
var createSemicircleLegacyUploaded = function (buffer, shape, voffset, ioffset, antialiasWeight) {
|
|
55989
57051
|
var tcount = toTextBufferCount(shape);
|
|
55990
57052
|
var tvcount = tcount << TEXT_VERTEX_COUNT_SHIFT;
|
|
55991
57053
|
var ticount = tcount << TEXT_INDEX_COUNT_SHIFT;
|
|
55992
|
-
var vcount =
|
|
55993
|
-
var icount =
|
|
57054
|
+
var vcount = SEMICIRCLE_LEGACY_VERTEX_COUNT + tvcount;
|
|
57055
|
+
var icount = SEMICIRCLE_LEGACY_INDEX_COUNT + ticount;
|
|
55994
57056
|
if (buffer.check(voffset, ioffset, vcount, icount)) {
|
|
55995
57057
|
return new EShapeUploadedImpl(buffer, voffset, ioffset, vcount, icount, [
|
|
55996
|
-
new
|
|
55997
|
-
new BuilderText(buffer, voffset +
|
|
57058
|
+
new BuilderSemicircleLegacy(buffer, voffset, ioffset),
|
|
57059
|
+
new BuilderText(buffer, voffset + SEMICIRCLE_LEGACY_VERTEX_COUNT, ioffset + SEMICIRCLE_LEGACY_INDEX_COUNT, tvcount, ticount)
|
|
55998
57060
|
]).init(shape);
|
|
55999
57061
|
}
|
|
56000
57062
|
return null;
|
|
@@ -56017,44 +57079,42 @@
|
|
|
56017
57079
|
*/
|
|
56018
57080
|
/**
|
|
56019
57081
|
* A semicircle shape.
|
|
56020
|
-
*
|
|
56021
|
-
* @beta
|
|
56022
57082
|
*/
|
|
56023
|
-
var
|
|
56024
|
-
__extends(
|
|
56025
|
-
function
|
|
56026
|
-
if (type === void 0) { type = EShapeType.
|
|
57083
|
+
var EShapeSemicircleLegacy = /** @class */ (function (_super) {
|
|
57084
|
+
__extends(EShapeSemicircleLegacy, _super);
|
|
57085
|
+
function EShapeSemicircleLegacy(type) {
|
|
57086
|
+
if (type === void 0) { type = EShapeType.SEMICIRCLE_LEGACY; }
|
|
56027
57087
|
var _this = _super.call(this, type) || this;
|
|
56028
57088
|
_this.stroke.side = EShapeStrokeSide.ALL & ~EShapeStrokeSide.BOTTOM;
|
|
56029
57089
|
return _this;
|
|
56030
57090
|
}
|
|
56031
|
-
|
|
56032
|
-
return new
|
|
57091
|
+
EShapeSemicircleLegacy.prototype.clone = function () {
|
|
57092
|
+
return new EShapeSemicircleLegacy(this.type).copy(this);
|
|
56033
57093
|
};
|
|
56034
|
-
|
|
57094
|
+
EShapeSemicircleLegacy.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
56035
57095
|
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
56036
57096
|
return hitTestSemicircle(this, x, y, ax, ay, sw, ss);
|
|
56037
57097
|
}
|
|
56038
57098
|
return false;
|
|
56039
57099
|
};
|
|
56040
|
-
return
|
|
57100
|
+
return EShapeSemicircleLegacy;
|
|
56041
57101
|
}(EShapePrimitive));
|
|
56042
57102
|
|
|
56043
57103
|
/*
|
|
56044
57104
|
* Copyright (C) 2019 Toshiba Corporation
|
|
56045
57105
|
* SPDX-License-Identifier: Apache-2.0
|
|
56046
57106
|
*/
|
|
56047
|
-
var
|
|
56048
|
-
return deserializeBase(item, manager, shape || new
|
|
57107
|
+
var deserializeSemicircleLegacy = function (item, manager, shape) {
|
|
57108
|
+
return deserializeBase(item, manager, shape || new EShapeSemicircleLegacy());
|
|
56049
57109
|
};
|
|
56050
57110
|
|
|
56051
57111
|
/*
|
|
56052
57112
|
* Copyright (C) 2019 Toshiba Corporation
|
|
56053
57113
|
* SPDX-License-Identifier: Apache-2.0
|
|
56054
57114
|
*/
|
|
56055
|
-
var
|
|
56056
|
-
EShapeUploadeds[EShapeType.
|
|
56057
|
-
EShapeDeserializers[EShapeType.
|
|
57115
|
+
var loadShapeSemicircleLegacy = function () {
|
|
57116
|
+
EShapeUploadeds[EShapeType.SEMICIRCLE_LEGACY] = createSemicircleLegacyUploaded;
|
|
57117
|
+
EShapeDeserializers[EShapeType.SEMICIRCLE_LEGACY] = deserializeSemicircleLegacy;
|
|
56058
57118
|
};
|
|
56059
57119
|
|
|
56060
57120
|
/*
|
|
@@ -56810,6 +57870,7 @@
|
|
|
56810
57870
|
loadShapeConnectorElbow();
|
|
56811
57871
|
loadShapeConnectorLine();
|
|
56812
57872
|
loadShapeEmbedded();
|
|
57873
|
+
loadShapeFan();
|
|
56813
57874
|
loadShapeGroupShadowed();
|
|
56814
57875
|
loadShapeGroup();
|
|
56815
57876
|
loadShapeImage();
|
|
@@ -56823,6 +57884,7 @@
|
|
|
56823
57884
|
loadShapeRectangleRoundedLegacy();
|
|
56824
57885
|
loadShapeRectangleRounded();
|
|
56825
57886
|
loadShapeRectangle();
|
|
57887
|
+
loadShapeSemicircleLegacy();
|
|
56826
57888
|
loadShapeSemicircle();
|
|
56827
57889
|
loadShapeTriangleLegacy();
|
|
56828
57890
|
loadShapeTriangleRoundedLegacy();
|
|
@@ -88883,6 +89945,7 @@
|
|
|
88883
89945
|
loadShapeConnectorElbow: loadShapeConnectorElbow,
|
|
88884
89946
|
loadShapeConnectorLine: loadShapeConnectorLine,
|
|
88885
89947
|
loadShapeEmbedded: loadShapeEmbedded,
|
|
89948
|
+
loadShapeFan: loadShapeFan,
|
|
88886
89949
|
loadShapeGroupShadowed: loadShapeGroupShadowed,
|
|
88887
89950
|
loadShapeGroup: loadShapeGroup,
|
|
88888
89951
|
loadShapeImage: loadShapeImage,
|
|
@@ -88900,6 +89963,7 @@
|
|
|
88900
89963
|
loadShapeRectangleRoundedLegacy: loadShapeRectangleRoundedLegacy,
|
|
88901
89964
|
loadShapeRectangleRounded: loadShapeRectangleRounded,
|
|
88902
89965
|
loadShapeRectangle: loadShapeRectangle,
|
|
89966
|
+
loadShapeSemicircleLegacy: loadShapeSemicircleLegacy,
|
|
88903
89967
|
loadShapeSemicircle: loadShapeSemicircle,
|
|
88904
89968
|
loadShapeTriangleLegacy: loadShapeTriangleLegacy,
|
|
88905
89969
|
loadShapeTriangleRoundedLegacy: loadShapeTriangleRoundedLegacy,
|
|
@@ -88979,13 +90043,20 @@
|
|
|
88979
90043
|
RECTANGLE_INDEX_COUNT: RECTANGLE_LEGACY_INDEX_COUNT,
|
|
88980
90044
|
RECTANGLE_VERTEX_COUNT: RECTANGLE_LEGACY_VERTEX_COUNT,
|
|
88981
90045
|
RECTANGLE_WORLD_SIZE: RECTANGLE_LEGACY_WORLD_SIZE,
|
|
88982
|
-
|
|
88983
|
-
|
|
88984
|
-
|
|
88985
|
-
|
|
88986
|
-
|
|
88987
|
-
|
|
88988
|
-
|
|
90046
|
+
SEMICIRCLE_LEGACY_VERTEX_COUNT: SEMICIRCLE_LEGACY_VERTEX_COUNT,
|
|
90047
|
+
SEMICIRCLE_LEGACY_INDEX_COUNT: SEMICIRCLE_LEGACY_INDEX_COUNT,
|
|
90048
|
+
SEMICIRCLE_LEGACY_WORLD_SIZE: SEMICIRCLE_LEGACY_WORLD_SIZE,
|
|
90049
|
+
buildSemicircleLegacyIndex: buildSemicircleLegacyIndex,
|
|
90050
|
+
buildSemicircleLegacyVertex: buildSemicircleLegacyVertex,
|
|
90051
|
+
buildSemicircleLegacyStep: buildSemicircleLegacyStep,
|
|
90052
|
+
buildSemicircleLegacyUv: buildSemicircleLegacyUv,
|
|
90053
|
+
SEMICIRCLE_VERTEX_COUNT: SEMICIRCLE_LEGACY_VERTEX_COUNT,
|
|
90054
|
+
SEMICIRCLE_INDEX_COUNT: SEMICIRCLE_LEGACY_INDEX_COUNT,
|
|
90055
|
+
SEMICIRCLE_WORLD_SIZE: SEMICIRCLE_LEGACY_WORLD_SIZE,
|
|
90056
|
+
buildSemicircleIndex: buildSemicircleLegacyIndex,
|
|
90057
|
+
buildSemicircleVertex: buildSemicircleLegacyVertex,
|
|
90058
|
+
buildSemicircleStep: buildSemicircleLegacyStep,
|
|
90059
|
+
buildSemicircleUv: buildSemicircleLegacyUv,
|
|
88989
90060
|
TEXT_VERTEX_COUNT: TEXT_VERTEX_COUNT,
|
|
88990
90061
|
TEXT_VERTEX_COUNT_SHIFT: TEXT_VERTEX_COUNT_SHIFT,
|
|
88991
90062
|
TEXT_INDEX_COUNT: TEXT_INDEX_COUNT,
|
|
@@ -89052,7 +90123,7 @@
|
|
|
89052
90123
|
BuilderRectangleRoundedLegacy: BuilderRectangleRoundedLegacy,
|
|
89053
90124
|
BuilderRectangleRounded: BuilderRectangleRoundedLegacy,
|
|
89054
90125
|
BuilderRectangle: BuilderRectangleLegacy,
|
|
89055
|
-
BuilderSemicircle:
|
|
90126
|
+
BuilderSemicircle: BuilderSemicircleLegacy,
|
|
89056
90127
|
BuilderText: BuilderText,
|
|
89057
90128
|
BuilderTriangleLegacy: BuilderTriangleLegacy,
|
|
89058
90129
|
BuilderTriangleRounded: BuilderTriangleRoundedLegacy,
|
|
@@ -89092,7 +90163,8 @@
|
|
|
89092
90163
|
createRectangleRoundedLegacyUploaded: createRectangleRoundedLegacyUploaded,
|
|
89093
90164
|
createRectangleRoundedUploaded: createRectangleRoundedLegacyUploaded,
|
|
89094
90165
|
createRectangleUploaded: createRectangleLegacyUploaded,
|
|
89095
|
-
|
|
90166
|
+
createSemicircleLegacyUploaded: createSemicircleLegacyUploaded,
|
|
90167
|
+
createSemicircleUploaded: createSemicircleLegacyUploaded,
|
|
89096
90168
|
createTriangleLegacyUploaded: createTriangleLegacyUploaded,
|
|
89097
90169
|
createTriangleRoundedUploaded: createTriangleRoundedLegacyUploaded,
|
|
89098
90170
|
createTriangleRoundedLegacyUploaded: createTriangleRoundedLegacyUploaded,
|
|
@@ -89109,6 +90181,7 @@
|
|
|
89109
90181
|
deserializeEmbeddedAcceptorEdge: deserializeEmbeddedAcceptorEdge,
|
|
89110
90182
|
deserializeEmbeddedLayer: deserializeEmbeddedLayer,
|
|
89111
90183
|
deserializeEmbedded: deserializeEmbedded,
|
|
90184
|
+
deserializeFan: deserializeFan,
|
|
89112
90185
|
deserializeGradient: deserializeGradient,
|
|
89113
90186
|
deserializeGroupShadowed: deserializeGroupShadowed,
|
|
89114
90187
|
deserializeGroup: deserializeGroup,
|
|
@@ -89128,6 +90201,7 @@
|
|
|
89128
90201
|
deserializeRectangleRoundedLegacy: deserializeRectangleRoundedLegacy,
|
|
89129
90202
|
deserializeRectangleRounded: deserializeRectangleRounded,
|
|
89130
90203
|
deserializeRectangle: deserializeRectangle,
|
|
90204
|
+
deserializeSemicircleLegacy: deserializeSemicircleLegacy,
|
|
89131
90205
|
deserializeSemicircle: deserializeSemicircle,
|
|
89132
90206
|
deserializeTriangleLegacy: deserializeTriangleLegacy,
|
|
89133
90207
|
deserializeTriangleRounded: deserializeTriangleRounded,
|
|
@@ -89156,6 +90230,8 @@
|
|
|
89156
90230
|
EShapeEmbeddedLayer: EShapeEmbeddedLayer,
|
|
89157
90231
|
EShapeEmbedded: EShapeEmbedded,
|
|
89158
90232
|
EShapeEmbeddeds: EShapeEmbeddeds,
|
|
90233
|
+
EShapeFanTriangulatedImpl: EShapeFanTriangulatedImpl,
|
|
90234
|
+
EShapeFan: EShapeFan,
|
|
89159
90235
|
EShapeFillImpl: EShapeFillImpl,
|
|
89160
90236
|
EShapeGroupFillEditor: EShapeGroupFillEditor,
|
|
89161
90237
|
EShapeGroupFillViewer: EShapeGroupFillViewer,
|
|
@@ -89199,6 +90275,7 @@
|
|
|
89199
90275
|
EShapeRectangleRounded: EShapeRectangleRounded,
|
|
89200
90276
|
EShapeRectangleTriangulatedImpl: EShapeRectangleTriangulatedImpl,
|
|
89201
90277
|
EShapeRectangle: EShapeRectangle,
|
|
90278
|
+
EShapeSemicircleLegacy: EShapeSemicircleLegacy,
|
|
89202
90279
|
EShapeSemicircle: EShapeSemicircle,
|
|
89203
90280
|
EShapeStrokeImpl: EShapeStrokeImpl,
|
|
89204
90281
|
EShapeTextAlignImpl: EShapeTextAlignImpl,
|
|
@@ -89214,6 +90291,7 @@
|
|
|
89214
90291
|
hitTestBBox: hitTestBBox,
|
|
89215
90292
|
hitTestCircleLegacy: hitTestCircleLegacy,
|
|
89216
90293
|
hitTestCircle: hitTestCircle,
|
|
90294
|
+
hitTestFan: hitTestFan,
|
|
89217
90295
|
hitTestSemicircle: hitTestSemicircle,
|
|
89218
90296
|
hitTestRectangleRoundedLegacy: hitTestRectangleRoundedLegacy,
|
|
89219
90297
|
hitTestRectangleRounded: hitTestRectangleRounded,
|
|
@@ -89228,6 +90306,8 @@
|
|
|
89228
90306
|
isStatic: isStatic,
|
|
89229
90307
|
toComputed: toComputed,
|
|
89230
90308
|
toDash: toDash,
|
|
90309
|
+
toFanAngleCentric: toFanAngleCentric,
|
|
90310
|
+
toFanAngleEccentric: toFanAngleEccentric,
|
|
89231
90311
|
toGradientImageUrl: toGradientImageUrl,
|
|
89232
90312
|
toGradientSerialized: toGradientSerialized,
|
|
89233
90313
|
toImageElement: toImageElement,
|