@wcardinal/wcardinal-ui 0.470.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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Winter Cardinal UI v0.470.0
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
 
@@ -76039,10 +76039,41 @@ var hitTestTriangleRoundedInset = function (shape, x, y, ax, ay, s) {
76039
76039
  }
76040
76040
  return true;
76041
76041
  };
76042
+ /**
76043
+ * Tests whether the point is in the filled part. The fill percent is measured
76044
+ * against the bounding box of the rounded triangle, which is shrunk by rounded corners.
76045
+ */
76046
+ var hitTestTriangleRoundedFill = function (shape, x, y, ax, ay) {
76047
+ var fill = shape.fill;
76048
+ var percent = Math.max(0, Math.min(1, fill.percent));
76049
+ if (1 <= percent) {
76050
+ return true;
76051
+ }
76052
+ var radius = shape.radius;
76053
+ var corner = shape.corner;
76054
+ var aw = (2 * ax * ay) / (ax + Math.sqrt(ax * ax + 4 * ay * ay));
76055
+ var r = radius * aw;
76056
+ var rounded = 0 < r;
76057
+ var x0 = rounded && corner & EShapeCorner.BOTTOM_LEFT ? -ax * (1 - radius) - r : -ax;
76058
+ var x1 = rounded && corner & EShapeCorner.BOTTOM_RIGHT ? +ax * (1 - radius) + r : +ax;
76059
+ var y0 = rounded && corner & EShapeCorner.TOP ? -ay + radius * (2 * ay - aw) - r : -ay;
76060
+ var y1 = +ay;
76061
+ switch (fill.direction) {
76062
+ case EShapeFillDirection.TOP:
76063
+ return y - y0 <= percent * (y1 - y0);
76064
+ case EShapeFillDirection.RIGHT:
76065
+ return (1 - percent) * (x1 - x0) <= x - x0;
76066
+ case EShapeFillDirection.BOTTOM:
76067
+ return (1 - percent) * (y1 - y0) <= y - y0;
76068
+ case EShapeFillDirection.LEFT:
76069
+ return x - x0 <= percent * (x1 - x0);
76070
+ }
76071
+ return false;
76072
+ };
76042
76073
  var hitTestTriangleRounded = function (shape, x, y, ax, ay, sw, ss) {
76043
76074
  var fill = shape.fill;
76044
76075
  if ((fill.enable || 0 < sw) && hitTestTriangleRoundedInset(shape, x, y, ax, ay, 0)) {
76045
- if (fill.enable && hitTestFill(x, y, ax, ay, fill)) {
76076
+ if (fill.enable && hitTestTriangleRoundedFill(shape, x, y, ax, ay)) {
76046
76077
  return true;
76047
76078
  }
76048
76079
  if (0 < sw && !hitTestTriangleRoundedInset(shape, x, y, ax, ay, sw * ss)) {
@@ -79398,6 +79429,7 @@ var EShapeTriangleRoundedTriangulatedImpl = /** @class */ (function () {
79398
79429
  this._indices = [];
79399
79430
  this._nindices = 0;
79400
79431
  this._boundary = [0, 0, 0, 0];
79432
+ this._uvo = [0, 0];
79401
79433
  }
79402
79434
  Object.defineProperty(EShapeTriangleRoundedTriangulatedImpl.prototype, "id", {
79403
79435
  get: function () {
@@ -79592,11 +79624,43 @@ var EShapeTriangleRoundedTriangulatedImpl = /** @class */ (function () {
79592
79624
  var sy4 = y4 + nly * fs;
79593
79625
  var sy6 = y6 + gy * fs;
79594
79626
  var fd = r0i;
79595
- var fx = 1 / sx;
79596
- var fy = 1 / sy;
79597
79627
  var ct = 0 < r && !!(corner & EShapeCorner.TOP);
79598
79628
  var cr = 0 < r && !!(corner & EShapeCorner.BOTTOM_RIGHT);
79599
79629
  var cl = 0 < r && !!(corner & EShapeCorner.BOTTOM_LEFT);
79630
+ // Shrinks the boundary to the outermost points of the rounded corners.
79631
+ // When the shape is flipped, the extremes are swapped accordingly.
79632
+ if (0 < gy) {
79633
+ if (ct) {
79634
+ boundary[1] = y2 - r;
79635
+ }
79636
+ }
79637
+ else {
79638
+ if (ct) {
79639
+ boundary[3] = y2 + r;
79640
+ }
79641
+ }
79642
+ if (0 < gx) {
79643
+ if (cl) {
79644
+ boundary[0] = x2 - r;
79645
+ }
79646
+ if (cr) {
79647
+ boundary[2] = x6 + r;
79648
+ }
79649
+ }
79650
+ else {
79651
+ if (cl) {
79652
+ boundary[2] = x2 + r;
79653
+ }
79654
+ if (cr) {
79655
+ boundary[0] = x6 - r;
79656
+ }
79657
+ }
79658
+ // UVs are normalized by the boundary so that fills fit the rounded shape.
79659
+ // When the shape is flipped, the UV axes are flipped as well.
79660
+ var fx = gx / (boundary[2] - boundary[0]);
79661
+ var fy = gy / (boundary[3] - boundary[1]);
79662
+ this._uvo[0] = boundary[0 < gx ? 0 : 2];
79663
+ this._uvo[1] = boundary[0 < gy ? 1 : 3];
79600
79664
  var aapex = ct || cr || cl ? Math.atan2(ax, az) : 0;
79601
79665
  var gz = gx * gy;
79602
79666
  var atop = gz * (Math.PI - 2 * aapex);
@@ -79773,15 +79837,15 @@ var EShapeTriangleRoundedTriangulatedImpl = /** @class */ (function () {
79773
79837
  }
79774
79838
  return l;
79775
79839
  };
79776
- EShapeTriangleRoundedTriangulatedImpl.prototype.writeVertex = function (vertex, x, y, distance, length, clipping, fx, fy) {
79777
- var vertex2 = vertex << 1;
79778
- this._vertices[vertex2] = x;
79779
- this._vertices[vertex2 + 1] = y;
79780
- this._distances[vertex] = distance;
79781
- this._lengths[vertex] = length;
79782
- this._clippings[vertex] = clipping;
79783
- this._uvs[vertex2] = 0.5 * (x * fx + 1);
79784
- this._uvs[vertex2 + 1] = 0.5 * (y * fy + 1);
79840
+ EShapeTriangleRoundedTriangulatedImpl.prototype.writeVertex = function (iv, x, y, distance, length, clipping, fx, fy) {
79841
+ var iv2 = iv << 1;
79842
+ this._vertices[iv2 + 0] = x;
79843
+ this._vertices[iv2 + 1] = y;
79844
+ this._distances[iv] = distance;
79845
+ this._lengths[iv] = length;
79846
+ this._clippings[iv] = clipping;
79847
+ this._uvs[iv2 + 0] = (x - this._uvo[0]) * fx;
79848
+ this._uvs[iv2 + 1] = (y - this._uvo[1]) * fy;
79785
79849
  };
79786
79850
  EShapeTriangleRoundedTriangulatedImpl.prototype.pad = function (iv, ii, nv, ni, distance) {
79787
79851
  for (var i = iv; i < nv; ++i) {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Winter Cardinal UI v0.470.0
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
 
@@ -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 && hitTestFill(x, y, ax, ay, fill)) {
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)) {
@@ -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 (vertex, x, y, distance, length, clipping, fx, fy) {
57668
- var vertex2 = vertex << 1;
57669
- this._vertices[vertex2] = x;
57670
- this._vertices[vertex2 + 1] = y;
57671
- this._distances[vertex] = distance;
57672
- this._lengths[vertex] = length;
57673
- this._clippings[vertex] = clipping;
57674
- this._uvs[vertex2] = 0.5 * (x * fx + 1);
57675
- this._uvs[vertex2 + 1] = 0.5 * (y * fy + 1);
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) {