@wcardinal/wcardinal-ui 0.469.0 → 0.470.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/shape/e-shape-type.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/load/index.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/load/load-shape-sector.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/deserialize-sector.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/{e-shape-fan-triangulated-impl.d.ts → e-shape-sector-triangulated-impl.d.ts} +9 -9
- package/dist/types/wcardinal/ui/shape/variant/{e-shape-fan-triangulated.d.ts → e-shape-sector-triangulated.d.ts} +1 -1
- package/dist/types/wcardinal/ui/shape/variant/{e-shape-fan.d.ts → e-shape-sector.d.ts} +7 -7
- package/dist/types/wcardinal/ui/shape/variant/e-shape-semicircle.d.ts +4 -4
- package/dist/types/wcardinal/ui/shape/variant/e-shape-triangle-rounded-triangulated-impl.d.ts +2 -1
- package/dist/types/wcardinal/ui/shape/variant/hit-test-sector.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/variant/index.d.ts +7 -7
- package/dist/types/wcardinal/ui/shape/variant/to-sector-angle-centric.d.ts +4 -0
- package/dist/types/wcardinal/ui/shape/variant/to-sector-angle-eccentric.d.ts +5 -0
- package/dist/wcardinal/ui/shape/e-shape-type.js +1 -1
- package/dist/wcardinal/ui/shape/e-shape-type.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/index.js +1 -1
- package/dist/wcardinal/ui/shape/load/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/load-shape-all.js +2 -2
- package/dist/wcardinal/ui/shape/load/load-shape-all.js.map +1 -1
- package/dist/wcardinal/ui/shape/load/{load-shape-fan.js → load-shape-sector.js} +6 -6
- package/dist/wcardinal/ui/shape/load/load-shape-sector.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/{deserialize-fan.js → deserialize-sector.js} +4 -4
- package/dist/wcardinal/ui/shape/variant/deserialize-sector.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/{e-shape-fan-triangulated-impl.js → e-shape-sector-triangulated-impl.js} +103 -103
- package/dist/wcardinal/ui/shape/variant/e-shape-sector-triangulated-impl.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/{e-shape-fan-triangulated.js → e-shape-sector-triangulated.js} +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-sector-triangulated.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/{e-shape-fan.js → e-shape-sector.js} +23 -23
- package/dist/wcardinal/ui/shape/variant/e-shape-sector.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle.js +4 -4
- package/dist/wcardinal/ui/shape/variant/e-shape-semicircle.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-triangle-rounded-triangulated-impl.js +44 -11
- package/dist/wcardinal/ui/shape/variant/e-shape-triangle-rounded-triangulated-impl.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/{hit-test-fan.js → hit-test-sector.js} +13 -13
- package/dist/wcardinal/ui/shape/variant/hit-test-sector.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/hit-test-triangle-rounded.js +33 -2
- package/dist/wcardinal/ui/shape/variant/hit-test-triangle-rounded.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/index.js +7 -7
- package/dist/wcardinal/ui/shape/variant/index.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/to-sector-angle-centric.js +11 -0
- package/dist/wcardinal/ui/shape/variant/to-sector-angle-centric.js.map +1 -0
- package/dist/wcardinal/ui/shape/variant/to-sector-angle-eccentric.js +12 -0
- package/dist/wcardinal/ui/shape/variant/to-sector-angle-eccentric.js.map +1 -0
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +227 -163
- package/dist/wcardinal-ui.js +227 -163
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/wcardinal/ui/shape/load/load-shape-fan.d.ts +0 -1
- package/dist/types/wcardinal/ui/shape/variant/deserialize-fan.d.ts +0 -4
- package/dist/types/wcardinal/ui/shape/variant/hit-test-fan.d.ts +0 -2
- package/dist/types/wcardinal/ui/shape/variant/to-fan-angle-centric.d.ts +0 -4
- package/dist/types/wcardinal/ui/shape/variant/to-fan-angle-eccentric.d.ts +0 -5
- package/dist/wcardinal/ui/shape/load/load-shape-fan.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/deserialize-fan.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated-impl.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-fan-triangulated.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-fan.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/hit-test-fan.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-centric.js +0 -11
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-centric.js.map +0 -1
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-eccentric.js +0 -12
- package/dist/wcardinal/ui/shape/variant/to-fan-angle-eccentric.js.map +0 -1
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.470.1
|
|
3
3
|
Copyright (C) 2019-2026 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
TRIANGLE_LEGACY: 29,
|
|
60
60
|
RECTANGLE_ROUNDED_LEGACY: 30,
|
|
61
61
|
TRIANGLE_ROUNDED_LEGACY: 31,
|
|
62
|
-
|
|
62
|
+
SECTOR: 32,
|
|
63
63
|
SEMICIRCLE_LEGACY: 33,
|
|
64
64
|
EXTENSION: 1000
|
|
65
65
|
};
|
|
@@ -47969,9 +47969,9 @@
|
|
|
47969
47969
|
* SPDX-License-Identifier: Apache-2.0
|
|
47970
47970
|
*/
|
|
47971
47971
|
/**
|
|
47972
|
-
* Converts an angle ratio to the half central angle of a
|
|
47972
|
+
* Converts an angle ratio to the half central angle of a sector in [0, PI / 2].
|
|
47973
47973
|
*/
|
|
47974
|
-
var
|
|
47974
|
+
var toSectorAngleCentric = function (angle) {
|
|
47975
47975
|
return Math.PI * Math.max(0, Math.min(0.5, angle));
|
|
47976
47976
|
};
|
|
47977
47977
|
|
|
@@ -47980,10 +47980,10 @@
|
|
|
47980
47980
|
* SPDX-License-Identifier: Apache-2.0
|
|
47981
47981
|
*/
|
|
47982
47982
|
/**
|
|
47983
|
-
* Converts the half central angle of
|
|
47984
|
-
* of the
|
|
47983
|
+
* Converts the half central angle of sectors to the eccentric angle of the arc end points
|
|
47984
|
+
* of the sector whose arc is on the ellipse with the semi-axes (w, h).
|
|
47985
47985
|
*/
|
|
47986
|
-
var
|
|
47986
|
+
var toSectorAngleEccentric = function (w, h, theta) {
|
|
47987
47987
|
return Math.atan((h / w) * Math.tan(theta));
|
|
47988
47988
|
};
|
|
47989
47989
|
|
|
@@ -47992,16 +47992,16 @@
|
|
|
47992
47992
|
* SPDX-License-Identifier: Apache-2.0
|
|
47993
47993
|
*/
|
|
47994
47994
|
/**
|
|
47995
|
-
* Triangulates a
|
|
47995
|
+
* Triangulates a sector whose arc is on the ellipse with the semi-axes (w, h) centered at the origin O.
|
|
47996
47996
|
* The vertices are computed in the frame where w and h are positive and flipped at the end.
|
|
47997
47997
|
*
|
|
47998
47998
|
* ## Points
|
|
47999
47999
|
*
|
|
48000
|
-
* - O: the apex of the
|
|
48000
|
+
* - O: the apex of the sector, the origin
|
|
48001
48001
|
* - A, B: the end points of the arc, (-w sin(ea), -h cos(ea)) and (+w sin(ea), -h cos(ea))
|
|
48002
|
-
* - C: the point where the area of the
|
|
48002
|
+
* - C: the point where the area of the sector becomes zero when the sector shrinks, (0, -h / (1 + sin(ca)))
|
|
48003
48003
|
* - P[k]: the points on the arc, k in [0, 2N] (P[0] = A, P[N] is the top, P[2N] = B)
|
|
48004
|
-
* - Q[k]: the points on the medial axis of the
|
|
48004
|
+
* - Q[k]: the points on the medial axis of the sector, which are on the normal of the arc at P[k]
|
|
48005
48005
|
* and equidistant from the arc and the straight sides (Q[0] = A, Q[N] = C, Q[2N] = B)
|
|
48006
48006
|
* - R[k]: the points P[k] shifted outward for the anti-aliasing
|
|
48007
48007
|
* - O': the point O shifted outward for the anti-aliasing
|
|
@@ -48014,18 +48014,18 @@
|
|
|
48014
48014
|
* where the outline is the arc and/or the straight sides depending on the stroke side.
|
|
48015
48015
|
*
|
|
48016
48016
|
* - ARC and BOTTOM (and NONE): the stroke is at the arc and the straight sides.
|
|
48017
|
-
* The
|
|
48017
|
+
* The sector is triangulated into the strip P[k], P[k + 1], Q[k + 1], Q[k] and
|
|
48018
48018
|
* the two polygons O', A', Q[0], ..., Q[N] and O', B', Q[2N], ..., Q[N] at the bottom.
|
|
48019
48019
|
* - ARC: the stroke is only at the arc.
|
|
48020
|
-
* For a circle and a semi-ellipse, Q[k] are the points on the axis, which gives the exact
|
|
48020
|
+
* For a circle and a semi-ellipse, Q[k] are the points on the axis, which gives the exact sector with the strip only.
|
|
48021
48021
|
* For the other ellipses, Q[k] are on the medial axis as ARC and BOTTOM, and the two polygons
|
|
48022
48022
|
* O, Q[0], ..., Q[N] and O, Q[2N], ..., Q[N] are added at the bottom without the stroke and the anti-aliasing.
|
|
48023
48023
|
* - BOTTOM: the stroke is only at the straight sides.
|
|
48024
48024
|
* It is the same as a polygon. Two triangle fans from C cover the area between the arc and the segments CA and CB,
|
|
48025
48025
|
* and two quads O', A', A, C and O', B', B, C cover the rest.
|
|
48026
48026
|
*/
|
|
48027
|
-
var
|
|
48028
|
-
function
|
|
48027
|
+
var EShapeSectorTriangulatedImpl = /** @class */ (function () {
|
|
48028
|
+
function EShapeSectorTriangulatedImpl(parent) {
|
|
48029
48029
|
this._id = 0;
|
|
48030
48030
|
this._parent = parent;
|
|
48031
48031
|
this._width = 0;
|
|
@@ -48047,7 +48047,7 @@
|
|
|
48047
48047
|
this._nindices = 0;
|
|
48048
48048
|
this._boundary = [0, 0, 0, 0];
|
|
48049
48049
|
}
|
|
48050
|
-
Object.defineProperty(
|
|
48050
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "id", {
|
|
48051
48051
|
get: function () {
|
|
48052
48052
|
this.triangulate();
|
|
48053
48053
|
return this._id;
|
|
@@ -48055,7 +48055,7 @@
|
|
|
48055
48055
|
enumerable: false,
|
|
48056
48056
|
configurable: true
|
|
48057
48057
|
});
|
|
48058
|
-
Object.defineProperty(
|
|
48058
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "vertices", {
|
|
48059
48059
|
get: function () {
|
|
48060
48060
|
this.triangulate();
|
|
48061
48061
|
return this._vertices;
|
|
@@ -48063,7 +48063,7 @@
|
|
|
48063
48063
|
enumerable: false,
|
|
48064
48064
|
configurable: true
|
|
48065
48065
|
});
|
|
48066
|
-
Object.defineProperty(
|
|
48066
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "nvertices", {
|
|
48067
48067
|
get: function () {
|
|
48068
48068
|
this.triangulate();
|
|
48069
48069
|
return this._nvertices;
|
|
@@ -48071,7 +48071,7 @@
|
|
|
48071
48071
|
enumerable: false,
|
|
48072
48072
|
configurable: true
|
|
48073
48073
|
});
|
|
48074
|
-
Object.defineProperty(
|
|
48074
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "distances", {
|
|
48075
48075
|
get: function () {
|
|
48076
48076
|
this.triangulate();
|
|
48077
48077
|
return this._distances;
|
|
@@ -48079,7 +48079,7 @@
|
|
|
48079
48079
|
enumerable: false,
|
|
48080
48080
|
configurable: true
|
|
48081
48081
|
});
|
|
48082
|
-
Object.defineProperty(
|
|
48082
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "lengths", {
|
|
48083
48083
|
get: function () {
|
|
48084
48084
|
this.triangulate();
|
|
48085
48085
|
return this._lengths;
|
|
@@ -48087,7 +48087,7 @@
|
|
|
48087
48087
|
enumerable: false,
|
|
48088
48088
|
configurable: true
|
|
48089
48089
|
});
|
|
48090
|
-
Object.defineProperty(
|
|
48090
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "clippings", {
|
|
48091
48091
|
get: function () {
|
|
48092
48092
|
this.triangulate();
|
|
48093
48093
|
return this._clippings;
|
|
@@ -48095,7 +48095,7 @@
|
|
|
48095
48095
|
enumerable: false,
|
|
48096
48096
|
configurable: true
|
|
48097
48097
|
});
|
|
48098
|
-
Object.defineProperty(
|
|
48098
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "uvs", {
|
|
48099
48099
|
get: function () {
|
|
48100
48100
|
this.triangulate();
|
|
48101
48101
|
return this._uvs;
|
|
@@ -48103,7 +48103,7 @@
|
|
|
48103
48103
|
enumerable: false,
|
|
48104
48104
|
configurable: true
|
|
48105
48105
|
});
|
|
48106
|
-
Object.defineProperty(
|
|
48106
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "indices", {
|
|
48107
48107
|
get: function () {
|
|
48108
48108
|
this.triangulate();
|
|
48109
48109
|
return this._indices;
|
|
@@ -48111,7 +48111,7 @@
|
|
|
48111
48111
|
enumerable: false,
|
|
48112
48112
|
configurable: true
|
|
48113
48113
|
});
|
|
48114
|
-
Object.defineProperty(
|
|
48114
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "nindices", {
|
|
48115
48115
|
get: function () {
|
|
48116
48116
|
this.triangulate();
|
|
48117
48117
|
return this._nindices;
|
|
@@ -48119,7 +48119,7 @@
|
|
|
48119
48119
|
enumerable: false,
|
|
48120
48120
|
configurable: true
|
|
48121
48121
|
});
|
|
48122
|
-
Object.defineProperty(
|
|
48122
|
+
Object.defineProperty(EShapeSectorTriangulatedImpl.prototype, "boundary", {
|
|
48123
48123
|
get: function () {
|
|
48124
48124
|
this.triangulate();
|
|
48125
48125
|
return this._boundary;
|
|
@@ -48127,7 +48127,7 @@
|
|
|
48127
48127
|
enumerable: false,
|
|
48128
48128
|
configurable: true
|
|
48129
48129
|
});
|
|
48130
|
-
|
|
48130
|
+
EShapeSectorTriangulatedImpl.prototype.triangulate = function () {
|
|
48131
48131
|
var isNotInitialized = this._id === 0;
|
|
48132
48132
|
var parent = this._parent;
|
|
48133
48133
|
var size = parent.size;
|
|
@@ -48165,7 +48165,7 @@
|
|
|
48165
48165
|
this.update(sizeX, sizeY, angle, strokeSideArc, strokeSideBottom);
|
|
48166
48166
|
}
|
|
48167
48167
|
};
|
|
48168
|
-
|
|
48168
|
+
EShapeSectorTriangulatedImpl.prototype.update = function (sx, sy, angle, ssa, ssb) {
|
|
48169
48169
|
// The number of the arc segments is 2n and the number of the points on the arc is m.
|
|
48170
48170
|
var n = EShapeDefaults.CIRCLE_SEGMENT_COUNT >> 2;
|
|
48171
48171
|
var m = 2 * n + 1;
|
|
@@ -48181,8 +48181,8 @@
|
|
|
48181
48181
|
this.updateEmpty(ax, ay, nv, ni);
|
|
48182
48182
|
return;
|
|
48183
48183
|
}
|
|
48184
|
-
var ca =
|
|
48185
|
-
var ea =
|
|
48184
|
+
var ca = toSectorAngleCentric(angle);
|
|
48185
|
+
var ea = toSectorAngleEccentric(ax, ay, ca);
|
|
48186
48186
|
var sea = Math.sin(ea);
|
|
48187
48187
|
var cea = Math.cos(ea);
|
|
48188
48188
|
var bx = ax * sea;
|
|
@@ -48209,9 +48209,9 @@
|
|
|
48209
48209
|
}
|
|
48210
48210
|
};
|
|
48211
48211
|
/**
|
|
48212
|
-
* Fills the empty
|
|
48212
|
+
* Fills the empty sector, which has no vertices to draw.
|
|
48213
48213
|
*/
|
|
48214
|
-
|
|
48214
|
+
EShapeSectorTriangulatedImpl.prototype.updateEmpty = function (w, h, nv, ni) {
|
|
48215
48215
|
var boundary = this._boundary;
|
|
48216
48216
|
boundary[0] = -w;
|
|
48217
48217
|
boundary[1] = -h;
|
|
@@ -48219,12 +48219,12 @@
|
|
|
48219
48219
|
boundary[3] = +h;
|
|
48220
48220
|
this.pad(0, 0, nv, ni, 0);
|
|
48221
48221
|
};
|
|
48222
|
-
|
|
48222
|
+
EShapeSectorTriangulatedImpl.prototype.updateArc = function (w, h, n, ea, sea, cea, bx, oa, st, ct, fx, fy, gx, gy, ssa, ssb, nv, ni) {
|
|
48223
48223
|
var m = 2 * n + 1;
|
|
48224
48224
|
// sided: the straight sides are the outline, which has the stroke and the anti-aliasing
|
|
48225
48225
|
// capped: the polygons are added at the bottom to cover the sector with the hard straight sides
|
|
48226
48226
|
// chained: Q is on the medial axis. Otherwise, Q is on the axis x = 0 (w <= h) or y = 0 (h < w)
|
|
48227
|
-
// For a circle and a semi-ellipse, Q on the axis gives the exact
|
|
48227
|
+
// For a circle and a semi-ellipse, Q on the axis gives the exact sector.
|
|
48228
48228
|
var sided = !ssa || ssb;
|
|
48229
48229
|
var isExact = Math.abs(w - h) <= 1e-9 * w || Math.PI * 0.5 <= ea;
|
|
48230
48230
|
var capped = !sided && !isExact;
|
|
@@ -48247,7 +48247,7 @@
|
|
|
48247
48247
|
boundary[2] = +bx;
|
|
48248
48248
|
boundary[3] = 0;
|
|
48249
48249
|
var fd = 1 / dmax;
|
|
48250
|
-
var fs = (
|
|
48250
|
+
var fs = (EShapeSectorTriangulatedImpl.SCALE - 1) * dmax;
|
|
48251
48251
|
this.computeRimPoints(n, fs, st, ct, sided);
|
|
48252
48252
|
// Strip: 4 * (m - 1) vertices and 2 * 3 * (m - 1) indices
|
|
48253
48253
|
this.writeStrip(m, fd, fx, fy, gx, gy);
|
|
@@ -48278,10 +48278,10 @@
|
|
|
48278
48278
|
* The points are symmetric with respect to the axis x = 0, so only the left half is computed
|
|
48279
48279
|
* and the right half is mirrored from it.
|
|
48280
48280
|
*/
|
|
48281
|
-
|
|
48281
|
+
EShapeSectorTriangulatedImpl.prototype.computeArcPoints = function (w, h, n, ea, sea, cea) {
|
|
48282
48282
|
var m = 2 * n + 1;
|
|
48283
|
-
var px =
|
|
48284
|
-
var py =
|
|
48283
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48284
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48285
48285
|
var da = ea / n;
|
|
48286
48286
|
var cda = Math.cos(da);
|
|
48287
48287
|
var sda = Math.sin(da);
|
|
@@ -48311,14 +48311,14 @@
|
|
|
48311
48311
|
* The normal at P is Np = (-h x / w, -w y / h), whose magnitude is the speed of the arc.
|
|
48312
48312
|
* The lengths are the ones of the polyline, which is the actual outline, so that they are exact at clipping = 1.
|
|
48313
48313
|
*/
|
|
48314
|
-
|
|
48314
|
+
EShapeSectorTriangulatedImpl.prototype.computeArcNormals = function (w, h, n) {
|
|
48315
48315
|
var m = 2 * n + 1;
|
|
48316
|
-
var px =
|
|
48317
|
-
var py =
|
|
48318
|
-
var nx =
|
|
48319
|
-
var ny =
|
|
48320
|
-
var speeds =
|
|
48321
|
-
var ls =
|
|
48316
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48317
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48318
|
+
var nx = EShapeSectorTriangulatedImpl.WORK_NORMAL_X;
|
|
48319
|
+
var ny = EShapeSectorTriangulatedImpl.WORK_NORMAL_Y;
|
|
48320
|
+
var speeds = EShapeSectorTriangulatedImpl.WORK_SPEED;
|
|
48321
|
+
var ls = EShapeSectorTriangulatedImpl.WORK_ARC_L;
|
|
48322
48322
|
var hw = h / w;
|
|
48323
48323
|
var wh = w / h;
|
|
48324
48324
|
var l = 0;
|
|
@@ -48355,16 +48355,16 @@
|
|
|
48355
48355
|
*
|
|
48356
48356
|
* Otherwise, the normal is extended until it reaches x = 0 if w <= h, otherwise y = 0.
|
|
48357
48357
|
*/
|
|
48358
|
-
|
|
48358
|
+
EShapeSectorTriangulatedImpl.prototype.computeMedialPoints = function (w, h, n, st, ct, chained) {
|
|
48359
48359
|
var m = 2 * n + 1;
|
|
48360
|
-
var px =
|
|
48361
|
-
var py =
|
|
48362
|
-
var nx =
|
|
48363
|
-
var ny =
|
|
48364
|
-
var speeds =
|
|
48365
|
-
var qx =
|
|
48366
|
-
var qy =
|
|
48367
|
-
var qd =
|
|
48360
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48361
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48362
|
+
var nx = EShapeSectorTriangulatedImpl.WORK_NORMAL_X;
|
|
48363
|
+
var ny = EShapeSectorTriangulatedImpl.WORK_NORMAL_Y;
|
|
48364
|
+
var speeds = EShapeSectorTriangulatedImpl.WORK_SPEED;
|
|
48365
|
+
var qx = EShapeSectorTriangulatedImpl.WORK_MEDIAL_X;
|
|
48366
|
+
var qy = EShapeSectorTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48367
|
+
var qd = EShapeSectorTriangulatedImpl.WORK_MEDIAL_D;
|
|
48368
48368
|
var u = w <= h ? w / h : h / w;
|
|
48369
48369
|
var dmax = 0;
|
|
48370
48370
|
for (var k = 0; k <= n; ++k) {
|
|
@@ -48414,14 +48414,14 @@
|
|
|
48414
48414
|
* If the straight sides are the outline, the end points are shifted
|
|
48415
48415
|
* to the intersections of the shifted arc and the shifted straight sides.
|
|
48416
48416
|
*/
|
|
48417
|
-
|
|
48417
|
+
EShapeSectorTriangulatedImpl.prototype.computeRimPoints = function (n, fs, st, ct, sided) {
|
|
48418
48418
|
var m = 2 * n + 1;
|
|
48419
|
-
var px =
|
|
48420
|
-
var py =
|
|
48421
|
-
var nx =
|
|
48422
|
-
var ny =
|
|
48423
|
-
var rx =
|
|
48424
|
-
var ry =
|
|
48419
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48420
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48421
|
+
var nx = EShapeSectorTriangulatedImpl.WORK_NORMAL_X;
|
|
48422
|
+
var ny = EShapeSectorTriangulatedImpl.WORK_NORMAL_Y;
|
|
48423
|
+
var rx = EShapeSectorTriangulatedImpl.WORK_RIM_X;
|
|
48424
|
+
var ry = EShapeSectorTriangulatedImpl.WORK_RIM_Y;
|
|
48425
48425
|
for (var k = 0; k < m; ++k) {
|
|
48426
48426
|
var x = px[k] - fs * nx[k];
|
|
48427
48427
|
var y = py[k] - fs * ny[k];
|
|
@@ -48446,16 +48446,16 @@
|
|
|
48446
48446
|
* Each quad owns its vertices. The length in a quad is the length at P[k] plus the projection
|
|
48447
48447
|
* to the chord P[k]P[k + 1], which is exact at clipping = 1 where the chord is the outline.
|
|
48448
48448
|
*/
|
|
48449
|
-
|
|
48450
|
-
var px =
|
|
48451
|
-
var py =
|
|
48452
|
-
var qx =
|
|
48453
|
-
var qy =
|
|
48454
|
-
var qd =
|
|
48455
|
-
var ls =
|
|
48456
|
-
var rx =
|
|
48457
|
-
var ry =
|
|
48458
|
-
var scale =
|
|
48449
|
+
EShapeSectorTriangulatedImpl.prototype.writeStrip = function (m, fd, fx, fy, gx, gy) {
|
|
48450
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48451
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48452
|
+
var qx = EShapeSectorTriangulatedImpl.WORK_MEDIAL_X;
|
|
48453
|
+
var qy = EShapeSectorTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48454
|
+
var qd = EShapeSectorTriangulatedImpl.WORK_MEDIAL_D;
|
|
48455
|
+
var ls = EShapeSectorTriangulatedImpl.WORK_ARC_L;
|
|
48456
|
+
var rx = EShapeSectorTriangulatedImpl.WORK_RIM_X;
|
|
48457
|
+
var ry = EShapeSectorTriangulatedImpl.WORK_RIM_Y;
|
|
48458
|
+
var scale = EShapeSectorTriangulatedImpl.SCALE;
|
|
48459
48459
|
var indices = this._indices;
|
|
48460
48460
|
var iv = 0;
|
|
48461
48461
|
var ii = 0;
|
|
@@ -48506,14 +48506,14 @@
|
|
|
48506
48506
|
* The clipping and the length are computed from the straight side:
|
|
48507
48507
|
* the outward unit normal is (sign * ct, st) and the length is oa + arc + (-st, sign * ct) . p.
|
|
48508
48508
|
*/
|
|
48509
|
-
|
|
48509
|
+
EShapeSectorTriangulatedImpl.prototype.writeSidePolygon = function (iv, ii, sign, n, w, oa, st, ct, fs, fd, fx, fy, gx, gy) {
|
|
48510
48510
|
var m = 2 * n + 1;
|
|
48511
|
-
var qx =
|
|
48512
|
-
var qy =
|
|
48513
|
-
var qd =
|
|
48514
|
-
var rx =
|
|
48515
|
-
var ry =
|
|
48516
|
-
var l0 = oa +
|
|
48511
|
+
var qx = EShapeSectorTriangulatedImpl.WORK_MEDIAL_X;
|
|
48512
|
+
var qy = EShapeSectorTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48513
|
+
var qd = EShapeSectorTriangulatedImpl.WORK_MEDIAL_D;
|
|
48514
|
+
var rx = EShapeSectorTriangulatedImpl.WORK_RIM_X;
|
|
48515
|
+
var ry = EShapeSectorTriangulatedImpl.WORK_RIM_Y;
|
|
48516
|
+
var l0 = oa + EShapeSectorTriangulatedImpl.WORK_ARC_L[m - 1];
|
|
48517
48517
|
var nx = sign * ct;
|
|
48518
48518
|
var ly = sign * ct;
|
|
48519
48519
|
var eps = 1e-9 * w;
|
|
@@ -48554,12 +48554,12 @@
|
|
|
48554
48554
|
*
|
|
48555
48555
|
* The clipping of O is given by co, and the length of O is the one of the end point.
|
|
48556
48556
|
*/
|
|
48557
|
-
|
|
48557
|
+
EShapeSectorTriangulatedImpl.prototype.writeCapPolygon = function (iv, ii, sign, n, w, co, fd, fx, fy, gx, gy) {
|
|
48558
48558
|
var m = 2 * n + 1;
|
|
48559
|
-
var qx =
|
|
48560
|
-
var qy =
|
|
48561
|
-
var qd =
|
|
48562
|
-
var ls =
|
|
48559
|
+
var qx = EShapeSectorTriangulatedImpl.WORK_MEDIAL_X;
|
|
48560
|
+
var qy = EShapeSectorTriangulatedImpl.WORK_MEDIAL_Y;
|
|
48561
|
+
var qd = EShapeSectorTriangulatedImpl.WORK_MEDIAL_D;
|
|
48562
|
+
var ls = EShapeSectorTriangulatedImpl.WORK_ARC_L;
|
|
48563
48563
|
var eps = 1e-9 * w;
|
|
48564
48564
|
var end = sign < 0 ? 0 : m - 1;
|
|
48565
48565
|
this.writeVertex(iv, 0, 0, ls[end], co, fd, fx, fy, gx, gy);
|
|
@@ -48578,7 +48578,7 @@
|
|
|
48578
48578
|
/**
|
|
48579
48579
|
* The clipping is 1 - (the distance from the straight side) / d where d is the distance from C to OA (or OB).
|
|
48580
48580
|
*/
|
|
48581
|
-
|
|
48581
|
+
EShapeSectorTriangulatedImpl.prototype.updateBottom = function (w, h, n, ea, sea, cea, bx, by, st, ct, fx, fy, gx, gy, nv, ni) {
|
|
48582
48582
|
var boundary = this._boundary;
|
|
48583
48583
|
boundary[0] = -bx;
|
|
48584
48584
|
boundary[1] = -h;
|
|
@@ -48586,11 +48586,11 @@
|
|
|
48586
48586
|
boundary[3] = 0;
|
|
48587
48587
|
var yc = h / (1 + st);
|
|
48588
48588
|
var fd = (1 + st) / (h * st);
|
|
48589
|
-
var fs = (
|
|
48589
|
+
var fs = (EShapeSectorTriangulatedImpl.SCALE - 1) / fd;
|
|
48590
48590
|
this.computeArcPoints(w, h, n, ea, sea, cea);
|
|
48591
48591
|
this.computeArcNormals(w, h, n);
|
|
48592
48592
|
// The length of O, which is the same as the one of writeSidePolygon: |OA| + the length of the arc
|
|
48593
|
-
var l0 = Math.sqrt(bx * bx + by * by) +
|
|
48593
|
+
var l0 = Math.sqrt(bx * bx + by * by) + EShapeSectorTriangulatedImpl.WORK_ARC_L[2 * n];
|
|
48594
48594
|
// Triangle fans from C to the arc: left (sign = -1) and right (sign = +1)
|
|
48595
48595
|
var iv = 0;
|
|
48596
48596
|
var ii = 0;
|
|
@@ -48615,9 +48615,9 @@
|
|
|
48615
48615
|
* and the length is l0 + (-st, sign * ct) . p, which is the same as the one of writeSidePolygon
|
|
48616
48616
|
* so that the dashes of the straight sides do not depend on the stroke side.
|
|
48617
48617
|
*/
|
|
48618
|
-
|
|
48619
|
-
var px =
|
|
48620
|
-
var py =
|
|
48618
|
+
EShapeSectorTriangulatedImpl.prototype.writeBottomFan = function (iv, ii, sign, n, yc, l0, st, ct, fd, fx, fy, gx, gy) {
|
|
48619
|
+
var px = EShapeSectorTriangulatedImpl.WORK_ARC_X;
|
|
48620
|
+
var py = EShapeSectorTriangulatedImpl.WORK_ARC_Y;
|
|
48621
48621
|
var nx = sign * ct;
|
|
48622
48622
|
var ly = sign * ct;
|
|
48623
48623
|
var count = 0;
|
|
@@ -48634,7 +48634,7 @@
|
|
|
48634
48634
|
* O' is shifted outward by fs / st, and A' (B') is shifted outward by fs perpendicular to the straight side.
|
|
48635
48635
|
* Returns the number of the written vertices.
|
|
48636
48636
|
*/
|
|
48637
|
-
|
|
48637
|
+
EShapeSectorTriangulatedImpl.prototype.writeBottomQuad = function (iv, ii, sign, bx, by, yc, l0, fs, st, ct, fd, fx, fy, gx, gy) {
|
|
48638
48638
|
var nx = sign * ct;
|
|
48639
48639
|
var ly = sign * ct;
|
|
48640
48640
|
this.writeSideVertex(iv, 0, fs / st, 0, nx, st, l0, -st, ly, fd, fx, fy, gx, gy);
|
|
@@ -48652,7 +48652,7 @@
|
|
|
48652
48652
|
* The clipping is 1 + fd * (nx * x + ny * y), which is not less than the given floor,
|
|
48653
48653
|
* and the length is l0 + lx * x + ly * y.
|
|
48654
48654
|
*/
|
|
48655
|
-
|
|
48655
|
+
EShapeSectorTriangulatedImpl.prototype.writeSideVertex = function (vertex, x, y, floor, nx, ny, l0, lx, ly, fd, fx, fy, gx, gy) {
|
|
48656
48656
|
var clipping = Math.max(floor, 1 + fd * (nx * x + ny * y));
|
|
48657
48657
|
var length = l0 + lx * x + ly * y;
|
|
48658
48658
|
this.writeVertex(vertex, x, y, length, clipping, fd, fx, fy, gx, gy);
|
|
@@ -48661,7 +48661,7 @@
|
|
|
48661
48661
|
* Writes the indices of a triangle fan from the first vertex.
|
|
48662
48662
|
* The number of the written indices is 3 * (count - 2).
|
|
48663
48663
|
*/
|
|
48664
|
-
|
|
48664
|
+
EShapeSectorTriangulatedImpl.prototype.writeFan = function (ii, iv, count) {
|
|
48665
48665
|
var indices = this._indices;
|
|
48666
48666
|
for (var i = 1; i < count - 1; ++i) {
|
|
48667
48667
|
indices[ii++] = iv;
|
|
@@ -48680,7 +48680,7 @@
|
|
|
48680
48680
|
* @param gx - The sign of the X size, which flips the vertex
|
|
48681
48681
|
* @param gy - The sign of the Y size, which flips the vertex
|
|
48682
48682
|
*/
|
|
48683
|
-
|
|
48683
|
+
EShapeSectorTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, length, clipping, fd, fx, fy, gx, gy) {
|
|
48684
48684
|
var vertex2 = vertex << 1;
|
|
48685
48685
|
this._vertices[vertex2] = gx * x;
|
|
48686
48686
|
this._vertices[vertex2 + 1] = gy * y;
|
|
@@ -48694,7 +48694,7 @@
|
|
|
48694
48694
|
* Fills the unused tail with degenerated triangles and trims the arrays
|
|
48695
48695
|
* so that the buffers always hold exactly `nv` vertices and `ni` triangles.
|
|
48696
48696
|
*/
|
|
48697
|
-
|
|
48697
|
+
EShapeSectorTriangulatedImpl.prototype.pad = function (iv, ii, nv, ni, distance) {
|
|
48698
48698
|
for (var i = iv; i < nv; ++i) {
|
|
48699
48699
|
var vertex2 = i << 1;
|
|
48700
48700
|
this._vertices[vertex2] = 0;
|
|
@@ -48716,28 +48716,28 @@
|
|
|
48716
48716
|
this._indices.length = ni * 3;
|
|
48717
48717
|
};
|
|
48718
48718
|
/** The ratio of the outer edge, where the clipping is 1, to the edge of the anti-aliasing */
|
|
48719
|
-
|
|
48719
|
+
EShapeSectorTriangulatedImpl.SCALE = 1.1;
|
|
48720
48720
|
// Work arrays shared by all the instances because they are used only in a single synchronous triangulation.
|
|
48721
48721
|
// All of them are indexed by k, which is in [0, 2N].
|
|
48722
48722
|
/** P: the points on the arc */
|
|
48723
|
-
|
|
48724
|
-
|
|
48723
|
+
EShapeSectorTriangulatedImpl.WORK_ARC_X = [];
|
|
48724
|
+
EShapeSectorTriangulatedImpl.WORK_ARC_Y = [];
|
|
48725
48725
|
/** The lengths of the polyline P[0], ..., P[k] */
|
|
48726
|
-
|
|
48726
|
+
EShapeSectorTriangulatedImpl.WORK_ARC_L = [];
|
|
48727
48727
|
/** The unit inward normals of the arc */
|
|
48728
|
-
|
|
48729
|
-
|
|
48728
|
+
EShapeSectorTriangulatedImpl.WORK_NORMAL_X = [];
|
|
48729
|
+
EShapeSectorTriangulatedImpl.WORK_NORMAL_Y = [];
|
|
48730
48730
|
/** The magnitudes of the tangents, that is, the speeds of the arc */
|
|
48731
|
-
|
|
48731
|
+
EShapeSectorTriangulatedImpl.WORK_SPEED = [];
|
|
48732
48732
|
/** Q: the points on the normals */
|
|
48733
|
-
|
|
48734
|
-
|
|
48733
|
+
EShapeSectorTriangulatedImpl.WORK_MEDIAL_X = [];
|
|
48734
|
+
EShapeSectorTriangulatedImpl.WORK_MEDIAL_Y = [];
|
|
48735
48735
|
/** The distances from P to Q */
|
|
48736
|
-
|
|
48736
|
+
EShapeSectorTriangulatedImpl.WORK_MEDIAL_D = [];
|
|
48737
48737
|
/** R: the points on the arc shifted outward */
|
|
48738
|
-
|
|
48739
|
-
|
|
48740
|
-
return
|
|
48738
|
+
EShapeSectorTriangulatedImpl.WORK_RIM_X = [];
|
|
48739
|
+
EShapeSectorTriangulatedImpl.WORK_RIM_Y = [];
|
|
48740
|
+
return EShapeSectorTriangulatedImpl;
|
|
48741
48741
|
}());
|
|
48742
48742
|
|
|
48743
48743
|
/*
|
|
@@ -48745,12 +48745,12 @@
|
|
|
48745
48745
|
* SPDX-License-Identifier: Apache-2.0
|
|
48746
48746
|
*/
|
|
48747
48747
|
/**
|
|
48748
|
-
* Tests whether the point is in the
|
|
48748
|
+
* Tests whether the point is in the sector shrunk by `sa` at the arc and by `ss` at the straight sides.
|
|
48749
48749
|
*
|
|
48750
48750
|
* @param st - The sine of the half central angle
|
|
48751
48751
|
* @param ct - The cosine of the half central angle
|
|
48752
48752
|
*/
|
|
48753
|
-
var
|
|
48753
|
+
var isInSector = function (x, y, ax, ay, st, ct, sa, ss) {
|
|
48754
48754
|
var wx = ax - sa;
|
|
48755
48755
|
var wy = ay - sa;
|
|
48756
48756
|
if (wx <= 0 || wy <= 0) {
|
|
@@ -48764,14 +48764,14 @@
|
|
|
48764
48764
|
var ay1 = st * y;
|
|
48765
48765
|
return -ct * x + ay1 <= -ss && ct * x + ay1 <= -ss;
|
|
48766
48766
|
};
|
|
48767
|
-
var
|
|
48767
|
+
var hitTestSectorFill = function (shape, x, y, bx, by) {
|
|
48768
48768
|
var fill = shape.fill;
|
|
48769
48769
|
if (fill.enable) {
|
|
48770
48770
|
var percent = Math.max(0, Math.min(1, fill.percent));
|
|
48771
48771
|
if (1 <= percent) {
|
|
48772
48772
|
return true;
|
|
48773
48773
|
}
|
|
48774
|
-
// The fill is relative to the bounding box [-bx, +bx] x [-by, 0] of the
|
|
48774
|
+
// The fill is relative to the bounding box [-bx, +bx] x [-by, 0] of the sector.
|
|
48775
48775
|
switch (fill.direction) {
|
|
48776
48776
|
case EShapeFillDirection.TOP:
|
|
48777
48777
|
return y + by <= percent * by;
|
|
@@ -48785,12 +48785,12 @@
|
|
|
48785
48785
|
}
|
|
48786
48786
|
return false;
|
|
48787
48787
|
};
|
|
48788
|
-
var
|
|
48789
|
-
var ca =
|
|
48788
|
+
var hitTestSector = function (shape, x, y, ax, ay, sw, ss) {
|
|
48789
|
+
var ca = toSectorAngleCentric(shape.angle);
|
|
48790
48790
|
if (ca <= 0 || ax <= 0 || ay <= 0) {
|
|
48791
48791
|
return false;
|
|
48792
48792
|
}
|
|
48793
|
-
var ea =
|
|
48793
|
+
var ea = toSectorAngleEccentric(ax, ay, ca);
|
|
48794
48794
|
var bx = ax * Math.sin(ea);
|
|
48795
48795
|
var st = Math.sin(ca);
|
|
48796
48796
|
var ct = Math.cos(ca);
|
|
@@ -48799,15 +48799,15 @@
|
|
|
48799
48799
|
var strokeSideArc = (strokeSide & EShapeStrokeSide.NOT_BOTTOM) !== 0;
|
|
48800
48800
|
var strokeSideBottom = (strokeSide & EShapeStrokeSide.BOTTOM) !== 0;
|
|
48801
48801
|
var strokeWidth = strokeSideArc || strokeSideBottom ? sw : 0;
|
|
48802
|
-
if ((fill.enable || 0 < strokeWidth) &&
|
|
48803
|
-
if (fill.enable &&
|
|
48802
|
+
if ((fill.enable || 0 < strokeWidth) && isInSector(x, y, ax, ay, st, ct, 0, 0)) {
|
|
48803
|
+
if (fill.enable && hitTestSectorFill(shape, x, y, bx, ay)) {
|
|
48804
48804
|
return true;
|
|
48805
48805
|
}
|
|
48806
48806
|
if (0 < strokeWidth) {
|
|
48807
48807
|
var s = strokeWidth * ss;
|
|
48808
48808
|
var arc = strokeSideArc ? s : 0;
|
|
48809
48809
|
var sides = strokeSideBottom ? s : 0;
|
|
48810
|
-
if (!
|
|
48810
|
+
if (!isInSector(x, y, ax, ay, st, ct, arc, sides)) {
|
|
48811
48811
|
return true;
|
|
48812
48812
|
}
|
|
48813
48813
|
}
|
|
@@ -48819,31 +48819,31 @@
|
|
|
48819
48819
|
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48820
48820
|
* SPDX-License-Identifier: Apache-2.0
|
|
48821
48821
|
*/
|
|
48822
|
-
var
|
|
48823
|
-
__extends(
|
|
48824
|
-
function
|
|
48825
|
-
if (type === void 0) { type = EShapeType.
|
|
48822
|
+
var EShapeSector = /** @class */ (function (_super) {
|
|
48823
|
+
__extends(EShapeSector, _super);
|
|
48824
|
+
function EShapeSector(type) {
|
|
48825
|
+
if (type === void 0) { type = EShapeType.SECTOR; }
|
|
48826
48826
|
var _this = _super.call(this, type) || this;
|
|
48827
48827
|
_this._angle = _this.newAngle();
|
|
48828
48828
|
_this._triangulated = _this.newTriangulated();
|
|
48829
48829
|
return _this;
|
|
48830
48830
|
}
|
|
48831
|
-
|
|
48831
|
+
EShapeSector.prototype.newAngle = function () {
|
|
48832
48832
|
return EShapeDefaults.ANGLE;
|
|
48833
48833
|
};
|
|
48834
|
-
|
|
48835
|
-
return new
|
|
48834
|
+
EShapeSector.prototype.newTriangulated = function () {
|
|
48835
|
+
return new EShapeSectorTriangulatedImpl(this);
|
|
48836
48836
|
};
|
|
48837
|
-
Object.defineProperty(
|
|
48837
|
+
Object.defineProperty(EShapeSector.prototype, "triangulated", {
|
|
48838
48838
|
get: function () {
|
|
48839
48839
|
return this._triangulated;
|
|
48840
48840
|
},
|
|
48841
48841
|
enumerable: false,
|
|
48842
48842
|
configurable: true
|
|
48843
48843
|
});
|
|
48844
|
-
Object.defineProperty(
|
|
48844
|
+
Object.defineProperty(EShapeSector.prototype, "angle", {
|
|
48845
48845
|
/**
|
|
48846
|
-
* The ratio of the half central angle of the
|
|
48846
|
+
* The ratio of the half central angle of the sector to PI. Must be in [0, 0.5].
|
|
48847
48847
|
* 0.5 results in a semicircle.
|
|
48848
48848
|
*/
|
|
48849
48849
|
get: function () {
|
|
@@ -48858,44 +48858,44 @@
|
|
|
48858
48858
|
enumerable: false,
|
|
48859
48859
|
configurable: true
|
|
48860
48860
|
});
|
|
48861
|
-
|
|
48861
|
+
EShapeSector.prototype.toHitTestStrokeShift = function (strokeWidth, strokeScale, strokeAlign) {
|
|
48862
48862
|
if (this.stroke.side !== EShapeStrokeSide.NONE) {
|
|
48863
48863
|
return _super.prototype.toHitTestStrokeShift.call(this, strokeWidth, strokeScale, strokeAlign);
|
|
48864
48864
|
}
|
|
48865
48865
|
return 0;
|
|
48866
48866
|
};
|
|
48867
|
-
|
|
48867
|
+
EShapeSector.prototype.copy = function (source, part) {
|
|
48868
48868
|
this.lock(EShapeLockPart.ALL);
|
|
48869
48869
|
_super.prototype.copy.call(this, source, part);
|
|
48870
|
-
if ((part == null || part & EShapeCopyPart.STYLE) && source instanceof
|
|
48870
|
+
if ((part == null || part & EShapeCopyPart.STYLE) && source instanceof EShapeSector) {
|
|
48871
48871
|
this._angle = source._angle;
|
|
48872
48872
|
}
|
|
48873
48873
|
this.unlock(EShapeLockPart.ALL, true);
|
|
48874
48874
|
return this;
|
|
48875
48875
|
};
|
|
48876
|
-
|
|
48877
|
-
return new
|
|
48876
|
+
EShapeSector.prototype.clone = function () {
|
|
48877
|
+
return new EShapeSector(this.type).copy(this);
|
|
48878
48878
|
};
|
|
48879
|
-
|
|
48879
|
+
EShapeSector.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
48880
48880
|
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
48881
|
-
return
|
|
48881
|
+
return hitTestSector(this, x, y, ax, ay, sw, ss);
|
|
48882
48882
|
}
|
|
48883
48883
|
return false;
|
|
48884
48884
|
};
|
|
48885
|
-
|
|
48885
|
+
EShapeSector.prototype.serialize = function (manager) {
|
|
48886
48886
|
var result = _super.prototype.serialize.call(this, manager);
|
|
48887
48887
|
result[15] = this._angle;
|
|
48888
48888
|
return result;
|
|
48889
48889
|
};
|
|
48890
|
-
return
|
|
48890
|
+
return EShapeSector;
|
|
48891
48891
|
}(EShapePrimitive));
|
|
48892
48892
|
|
|
48893
48893
|
/*
|
|
48894
48894
|
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48895
48895
|
* SPDX-License-Identifier: Apache-2.0
|
|
48896
48896
|
*/
|
|
48897
|
-
var
|
|
48898
|
-
shape = shape || new
|
|
48897
|
+
var deserializeSector = function (item, manager, shape) {
|
|
48898
|
+
shape = shape || new EShapeSector();
|
|
48899
48899
|
shape.angle = item[15];
|
|
48900
48900
|
return deserializeBase(item, manager, shape);
|
|
48901
48901
|
};
|
|
@@ -48904,10 +48904,10 @@
|
|
|
48904
48904
|
* Copyright (C) 2019-2026 Toshiba Corporation
|
|
48905
48905
|
* SPDX-License-Identifier: Apache-2.0
|
|
48906
48906
|
*/
|
|
48907
|
-
var
|
|
48908
|
-
EShapeUploadeds[EShapeType.
|
|
48909
|
-
EShapeDeserializers[EShapeType.
|
|
48910
|
-
EShapeCapabilities.set(EShapeType.
|
|
48907
|
+
var loadShapeSector = function () {
|
|
48908
|
+
EShapeUploadeds[EShapeType.SECTOR] = createPolygonUploaded;
|
|
48909
|
+
EShapeDeserializers[EShapeType.SECTOR] = deserializeSector;
|
|
48910
|
+
EShapeCapabilities.set(EShapeType.SECTOR, EShapeCapability.PRIMITIVE | EShapeCapability.STROKE_SIDE | EShapeCapability.ANGLE);
|
|
48911
48911
|
};
|
|
48912
48912
|
|
|
48913
48913
|
/*
|
|
@@ -53930,10 +53930,41 @@
|
|
|
53930
53930
|
}
|
|
53931
53931
|
return true;
|
|
53932
53932
|
};
|
|
53933
|
+
/**
|
|
53934
|
+
* Tests whether the point is in the filled part. The fill percent is measured
|
|
53935
|
+
* against the bounding box of the rounded triangle, which is shrunk by rounded corners.
|
|
53936
|
+
*/
|
|
53937
|
+
var hitTestTriangleRoundedFill = function (shape, x, y, ax, ay) {
|
|
53938
|
+
var fill = shape.fill;
|
|
53939
|
+
var percent = Math.max(0, Math.min(1, fill.percent));
|
|
53940
|
+
if (1 <= percent) {
|
|
53941
|
+
return true;
|
|
53942
|
+
}
|
|
53943
|
+
var radius = shape.radius;
|
|
53944
|
+
var corner = shape.corner;
|
|
53945
|
+
var aw = (2 * ax * ay) / (ax + Math.sqrt(ax * ax + 4 * ay * ay));
|
|
53946
|
+
var r = radius * aw;
|
|
53947
|
+
var rounded = 0 < r;
|
|
53948
|
+
var x0 = rounded && corner & EShapeCorner.BOTTOM_LEFT ? -ax * (1 - radius) - r : -ax;
|
|
53949
|
+
var x1 = rounded && corner & EShapeCorner.BOTTOM_RIGHT ? +ax * (1 - radius) + r : +ax;
|
|
53950
|
+
var y0 = rounded && corner & EShapeCorner.TOP ? -ay + radius * (2 * ay - aw) - r : -ay;
|
|
53951
|
+
var y1 = +ay;
|
|
53952
|
+
switch (fill.direction) {
|
|
53953
|
+
case EShapeFillDirection.TOP:
|
|
53954
|
+
return y - y0 <= percent * (y1 - y0);
|
|
53955
|
+
case EShapeFillDirection.RIGHT:
|
|
53956
|
+
return (1 - percent) * (x1 - x0) <= x - x0;
|
|
53957
|
+
case EShapeFillDirection.BOTTOM:
|
|
53958
|
+
return (1 - percent) * (y1 - y0) <= y - y0;
|
|
53959
|
+
case EShapeFillDirection.LEFT:
|
|
53960
|
+
return x - x0 <= percent * (x1 - x0);
|
|
53961
|
+
}
|
|
53962
|
+
return false;
|
|
53963
|
+
};
|
|
53933
53964
|
var hitTestTriangleRounded = function (shape, x, y, ax, ay, sw, ss) {
|
|
53934
53965
|
var fill = shape.fill;
|
|
53935
53966
|
if ((fill.enable || 0 < sw) && hitTestTriangleRoundedInset(shape, x, y, ax, ay, 0)) {
|
|
53936
|
-
if (fill.enable &&
|
|
53967
|
+
if (fill.enable && hitTestTriangleRoundedFill(shape, x, y, ax, ay)) {
|
|
53937
53968
|
return true;
|
|
53938
53969
|
}
|
|
53939
53970
|
if (0 < sw && !hitTestTriangleRoundedInset(shape, x, y, ax, ay, sw * ss)) {
|
|
@@ -56791,7 +56822,7 @@
|
|
|
56791
56822
|
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);
|
|
56792
56823
|
};
|
|
56793
56824
|
EShapeSemicircle.prototype.newTriangulated = function () {
|
|
56794
|
-
return new
|
|
56825
|
+
return new EShapeSectorTriangulatedImpl(this);
|
|
56795
56826
|
};
|
|
56796
56827
|
Object.defineProperty(EShapeSemicircle.prototype, "triangulated", {
|
|
56797
56828
|
get: function () {
|
|
@@ -56821,7 +56852,7 @@
|
|
|
56821
56852
|
};
|
|
56822
56853
|
EShapeSemicircle.prototype.containsAbs = function (x, y, ax, ay, sw, ss, sa) {
|
|
56823
56854
|
if (_super.prototype.containsAbsBBox.call(this, x, y, ax, ay)) {
|
|
56824
|
-
return
|
|
56855
|
+
return hitTestSector(this, x, y, ax, ay, sw, ss);
|
|
56825
56856
|
}
|
|
56826
56857
|
return false;
|
|
56827
56858
|
};
|
|
@@ -57289,6 +57320,7 @@
|
|
|
57289
57320
|
this._indices = [];
|
|
57290
57321
|
this._nindices = 0;
|
|
57291
57322
|
this._boundary = [0, 0, 0, 0];
|
|
57323
|
+
this._uvo = [0, 0];
|
|
57292
57324
|
}
|
|
57293
57325
|
Object.defineProperty(EShapeTriangleRoundedTriangulatedImpl.prototype, "id", {
|
|
57294
57326
|
get: function () {
|
|
@@ -57483,11 +57515,43 @@
|
|
|
57483
57515
|
var sy4 = y4 + nly * fs;
|
|
57484
57516
|
var sy6 = y6 + gy * fs;
|
|
57485
57517
|
var fd = r0i;
|
|
57486
|
-
var fx = 1 / sx;
|
|
57487
|
-
var fy = 1 / sy;
|
|
57488
57518
|
var ct = 0 < r && !!(corner & EShapeCorner.TOP);
|
|
57489
57519
|
var cr = 0 < r && !!(corner & EShapeCorner.BOTTOM_RIGHT);
|
|
57490
57520
|
var cl = 0 < r && !!(corner & EShapeCorner.BOTTOM_LEFT);
|
|
57521
|
+
// Shrinks the boundary to the outermost points of the rounded corners.
|
|
57522
|
+
// When the shape is flipped, the extremes are swapped accordingly.
|
|
57523
|
+
if (0 < gy) {
|
|
57524
|
+
if (ct) {
|
|
57525
|
+
boundary[1] = y2 - r;
|
|
57526
|
+
}
|
|
57527
|
+
}
|
|
57528
|
+
else {
|
|
57529
|
+
if (ct) {
|
|
57530
|
+
boundary[3] = y2 + r;
|
|
57531
|
+
}
|
|
57532
|
+
}
|
|
57533
|
+
if (0 < gx) {
|
|
57534
|
+
if (cl) {
|
|
57535
|
+
boundary[0] = x2 - r;
|
|
57536
|
+
}
|
|
57537
|
+
if (cr) {
|
|
57538
|
+
boundary[2] = x6 + r;
|
|
57539
|
+
}
|
|
57540
|
+
}
|
|
57541
|
+
else {
|
|
57542
|
+
if (cl) {
|
|
57543
|
+
boundary[2] = x2 + r;
|
|
57544
|
+
}
|
|
57545
|
+
if (cr) {
|
|
57546
|
+
boundary[0] = x6 - r;
|
|
57547
|
+
}
|
|
57548
|
+
}
|
|
57549
|
+
// UVs are normalized by the boundary so that fills fit the rounded shape.
|
|
57550
|
+
// When the shape is flipped, the UV axes are flipped as well.
|
|
57551
|
+
var fx = gx / (boundary[2] - boundary[0]);
|
|
57552
|
+
var fy = gy / (boundary[3] - boundary[1]);
|
|
57553
|
+
this._uvo[0] = boundary[0 < gx ? 0 : 2];
|
|
57554
|
+
this._uvo[1] = boundary[0 < gy ? 1 : 3];
|
|
57491
57555
|
var aapex = ct || cr || cl ? Math.atan2(ax, az) : 0;
|
|
57492
57556
|
var gz = gx * gy;
|
|
57493
57557
|
var atop = gz * (Math.PI - 2 * aapex);
|
|
@@ -57664,15 +57728,15 @@
|
|
|
57664
57728
|
}
|
|
57665
57729
|
return l;
|
|
57666
57730
|
};
|
|
57667
|
-
EShapeTriangleRoundedTriangulatedImpl.prototype.writeVertex = function (
|
|
57668
|
-
var
|
|
57669
|
-
this._vertices[
|
|
57670
|
-
this._vertices[
|
|
57671
|
-
this._distances[
|
|
57672
|
-
this._lengths[
|
|
57673
|
-
this._clippings[
|
|
57674
|
-
this._uvs[
|
|
57675
|
-
this._uvs[
|
|
57731
|
+
EShapeTriangleRoundedTriangulatedImpl.prototype.writeVertex = function (iv, x, y, distance, length, clipping, fx, fy) {
|
|
57732
|
+
var iv2 = iv << 1;
|
|
57733
|
+
this._vertices[iv2 + 0] = x;
|
|
57734
|
+
this._vertices[iv2 + 1] = y;
|
|
57735
|
+
this._distances[iv] = distance;
|
|
57736
|
+
this._lengths[iv] = length;
|
|
57737
|
+
this._clippings[iv] = clipping;
|
|
57738
|
+
this._uvs[iv2 + 0] = (x - this._uvo[0]) * fx;
|
|
57739
|
+
this._uvs[iv2 + 1] = (y - this._uvo[1]) * fy;
|
|
57676
57740
|
};
|
|
57677
57741
|
EShapeTriangleRoundedTriangulatedImpl.prototype.pad = function (iv, ii, nv, ni, distance) {
|
|
57678
57742
|
for (var i = iv; i < nv; ++i) {
|
|
@@ -57877,7 +57941,7 @@
|
|
|
57877
57941
|
loadShapeConnectorElbow();
|
|
57878
57942
|
loadShapeConnectorLine();
|
|
57879
57943
|
loadShapeEmbedded();
|
|
57880
|
-
|
|
57944
|
+
loadShapeSector();
|
|
57881
57945
|
loadShapeGroupShadowed();
|
|
57882
57946
|
loadShapeGroup();
|
|
57883
57947
|
loadShapeImage();
|
|
@@ -89952,7 +90016,7 @@
|
|
|
89952
90016
|
loadShapeConnectorElbow: loadShapeConnectorElbow,
|
|
89953
90017
|
loadShapeConnectorLine: loadShapeConnectorLine,
|
|
89954
90018
|
loadShapeEmbedded: loadShapeEmbedded,
|
|
89955
|
-
|
|
90019
|
+
loadShapeSector: loadShapeSector,
|
|
89956
90020
|
loadShapeGroupShadowed: loadShapeGroupShadowed,
|
|
89957
90021
|
loadShapeGroup: loadShapeGroup,
|
|
89958
90022
|
loadShapeImage: loadShapeImage,
|
|
@@ -90188,7 +90252,6 @@
|
|
|
90188
90252
|
deserializeEmbeddedAcceptorEdge: deserializeEmbeddedAcceptorEdge,
|
|
90189
90253
|
deserializeEmbeddedLayer: deserializeEmbeddedLayer,
|
|
90190
90254
|
deserializeEmbedded: deserializeEmbedded,
|
|
90191
|
-
deserializeFan: deserializeFan,
|
|
90192
90255
|
deserializeGradient: deserializeGradient,
|
|
90193
90256
|
deserializeGroupShadowed: deserializeGroupShadowed,
|
|
90194
90257
|
deserializeGroup: deserializeGroup,
|
|
@@ -90208,6 +90271,7 @@
|
|
|
90208
90271
|
deserializeRectangleRoundedLegacy: deserializeRectangleRoundedLegacy,
|
|
90209
90272
|
deserializeRectangleRounded: deserializeRectangleRounded,
|
|
90210
90273
|
deserializeRectangle: deserializeRectangle,
|
|
90274
|
+
deserializeSector: deserializeSector,
|
|
90211
90275
|
deserializeSemicircleLegacy: deserializeSemicircleLegacy,
|
|
90212
90276
|
deserializeSemicircle: deserializeSemicircle,
|
|
90213
90277
|
deserializeTriangleLegacy: deserializeTriangleLegacy,
|
|
@@ -90237,8 +90301,6 @@
|
|
|
90237
90301
|
EShapeEmbeddedLayer: EShapeEmbeddedLayer,
|
|
90238
90302
|
EShapeEmbedded: EShapeEmbedded,
|
|
90239
90303
|
EShapeEmbeddeds: EShapeEmbeddeds,
|
|
90240
|
-
EShapeFanTriangulatedImpl: EShapeFanTriangulatedImpl,
|
|
90241
|
-
EShapeFan: EShapeFan,
|
|
90242
90304
|
EShapeFillImpl: EShapeFillImpl,
|
|
90243
90305
|
EShapeGroupFillEditor: EShapeGroupFillEditor,
|
|
90244
90306
|
EShapeGroupFillViewer: EShapeGroupFillViewer,
|
|
@@ -90282,6 +90344,8 @@
|
|
|
90282
90344
|
EShapeRectangleRounded: EShapeRectangleRounded,
|
|
90283
90345
|
EShapeRectangleTriangulatedImpl: EShapeRectangleTriangulatedImpl,
|
|
90284
90346
|
EShapeRectangle: EShapeRectangle,
|
|
90347
|
+
EShapeSectorTriangulatedImpl: EShapeSectorTriangulatedImpl,
|
|
90348
|
+
EShapeSector: EShapeSector,
|
|
90285
90349
|
EShapeSemicircleLegacy: EShapeSemicircleLegacy,
|
|
90286
90350
|
EShapeSemicircle: EShapeSemicircle,
|
|
90287
90351
|
EShapeStrokeImpl: EShapeStrokeImpl,
|
|
@@ -90298,7 +90362,6 @@
|
|
|
90298
90362
|
hitTestBBox: hitTestBBox,
|
|
90299
90363
|
hitTestCircleLegacy: hitTestCircleLegacy,
|
|
90300
90364
|
hitTestCircle: hitTestCircle,
|
|
90301
|
-
hitTestFan: hitTestFan,
|
|
90302
90365
|
hitTestSemicircle: hitTestSemicircle,
|
|
90303
90366
|
hitTestRectangleRoundedLegacy: hitTestRectangleRoundedLegacy,
|
|
90304
90367
|
hitTestRectangleRounded: hitTestRectangleRounded,
|
|
@@ -90309,18 +90372,19 @@
|
|
|
90309
90372
|
hitTestTriangleFilled: hitTestTriangleFilled,
|
|
90310
90373
|
hitTestTriangleLegacy: hitTestTriangleLegacy,
|
|
90311
90374
|
hitTestTriangle: hitTestTriangle,
|
|
90375
|
+
hitTestSector: hitTestSector,
|
|
90312
90376
|
isShapePolygonLike: isShapePolygonLike,
|
|
90313
90377
|
isStatic: isStatic,
|
|
90314
90378
|
toComputed: toComputed,
|
|
90315
90379
|
toDash: toDash,
|
|
90316
|
-
toFanAngleCentric: toFanAngleCentric,
|
|
90317
|
-
toFanAngleEccentric: toFanAngleEccentric,
|
|
90318
90380
|
toGradientImageUrl: toGradientImageUrl,
|
|
90319
90381
|
toGradientSerialized: toGradientSerialized,
|
|
90320
90382
|
toImageElement: toImageElement,
|
|
90321
90383
|
toLength: toLength,
|
|
90322
90384
|
toResized: toResized,
|
|
90323
90385
|
toScaleInvariant: toScaleInvariant,
|
|
90386
|
+
toSectorAngleCentric: toSectorAngleCentric,
|
|
90387
|
+
toSectorAngleEccentric: toSectorAngleEccentric,
|
|
90324
90388
|
toSizeNormalized: toSizeNormalized,
|
|
90325
90389
|
toSizeRounded: toSizeRounded,
|
|
90326
90390
|
toThresholdDefault: toThresholdDefault,
|