pixi-watchface-engine 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3,25 +3,43 @@ var __getProtoOf = Object.getPrototypeOf;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
6
11
  var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
7
19
  target = mod != null ? __create(__getProtoOf(mod)) : {};
8
20
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
21
  for (let key of __getOwnPropNames(mod))
10
22
  if (!__hasOwnProp.call(to, key))
11
23
  __defProp(to, key, {
12
- get: () => mod[key],
24
+ get: __accessProp.bind(mod, key),
13
25
  enumerable: true
14
26
  });
27
+ if (canCache)
28
+ cache.set(mod, to);
15
29
  return to;
16
30
  };
17
31
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
+ var __returnValue = (v) => v;
33
+ function __exportSetter(name, newValue) {
34
+ this[name] = __returnValue.bind(null, newValue);
35
+ }
18
36
  var __export = (target, all) => {
19
37
  for (var name in all)
20
38
  __defProp(target, name, {
21
39
  get: all[name],
22
40
  enumerable: true,
23
41
  configurable: true,
24
- set: (newValue) => all[name] = () => newValue
42
+ set: __exportSetter.bind(all, name)
25
43
  });
26
44
  };
27
45
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -10289,400 +10307,6 @@ var init_Geometry = __esm(() => {
10289
10307
  };
10290
10308
  });
10291
10309
 
10292
- // node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs
10293
- function squaredDistanceToLineSegment(x2, y2, x1, y1, x22, y22) {
10294
- const a2 = x2 - x1;
10295
- const b2 = y2 - y1;
10296
- const c2 = x22 - x1;
10297
- const d2 = y22 - y1;
10298
- const dot = a2 * c2 + b2 * d2;
10299
- const lenSq = c2 * c2 + d2 * d2;
10300
- let param = -1;
10301
- if (lenSq !== 0) {
10302
- param = dot / lenSq;
10303
- }
10304
- let xx;
10305
- let yy;
10306
- if (param < 0) {
10307
- xx = x1;
10308
- yy = y1;
10309
- } else if (param > 1) {
10310
- xx = x22;
10311
- yy = y22;
10312
- } else {
10313
- xx = x1 + param * c2;
10314
- yy = y1 + param * d2;
10315
- }
10316
- const dx = x2 - xx;
10317
- const dy = y2 - yy;
10318
- return dx * dx + dy * dy;
10319
- }
10320
- var init_squaredDistanceToLineSegment = () => {};
10321
-
10322
- // node_modules/pixi.js/lib/maths/shapes/Circle.mjs
10323
- class Circle {
10324
- constructor(x2 = 0, y2 = 0, radius = 0) {
10325
- this.type = "circle";
10326
- this.x = x2;
10327
- this.y = y2;
10328
- this.radius = radius;
10329
- }
10330
- clone() {
10331
- return new Circle(this.x, this.y, this.radius);
10332
- }
10333
- contains(x2, y2) {
10334
- if (this.radius <= 0)
10335
- return false;
10336
- const r2 = this.radius * this.radius;
10337
- let dx = this.x - x2;
10338
- let dy = this.y - y2;
10339
- dx *= dx;
10340
- dy *= dy;
10341
- return dx + dy <= r2;
10342
- }
10343
- strokeContains(x2, y2, width, alignment = 0.5) {
10344
- if (this.radius === 0)
10345
- return false;
10346
- const dx = this.x - x2;
10347
- const dy = this.y - y2;
10348
- const radius = this.radius;
10349
- const outerWidth = (1 - alignment) * width;
10350
- const distance = Math.sqrt(dx * dx + dy * dy);
10351
- return distance <= radius + outerWidth && distance > radius - (width - outerWidth);
10352
- }
10353
- getBounds(out) {
10354
- out || (out = new Rectangle);
10355
- out.x = this.x - this.radius;
10356
- out.y = this.y - this.radius;
10357
- out.width = this.radius * 2;
10358
- out.height = this.radius * 2;
10359
- return out;
10360
- }
10361
- copyFrom(circle) {
10362
- this.x = circle.x;
10363
- this.y = circle.y;
10364
- this.radius = circle.radius;
10365
- return this;
10366
- }
10367
- copyTo(circle) {
10368
- circle.copyFrom(this);
10369
- return circle;
10370
- }
10371
- toString() {
10372
- return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;
10373
- }
10374
- }
10375
- var init_Circle = __esm(() => {
10376
- init_Rectangle();
10377
- });
10378
-
10379
- // node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs
10380
- class Ellipse {
10381
- constructor(x2 = 0, y2 = 0, halfWidth = 0, halfHeight = 0) {
10382
- this.type = "ellipse";
10383
- this.x = x2;
10384
- this.y = y2;
10385
- this.halfWidth = halfWidth;
10386
- this.halfHeight = halfHeight;
10387
- }
10388
- clone() {
10389
- return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);
10390
- }
10391
- contains(x2, y2) {
10392
- if (this.halfWidth <= 0 || this.halfHeight <= 0) {
10393
- return false;
10394
- }
10395
- let normx = (x2 - this.x) / this.halfWidth;
10396
- let normy = (y2 - this.y) / this.halfHeight;
10397
- normx *= normx;
10398
- normy *= normy;
10399
- return normx + normy <= 1;
10400
- }
10401
- strokeContains(x2, y2, strokeWidth, alignment = 0.5) {
10402
- const { halfWidth, halfHeight } = this;
10403
- if (halfWidth <= 0 || halfHeight <= 0) {
10404
- return false;
10405
- }
10406
- const strokeOuterWidth = strokeWidth * (1 - alignment);
10407
- const strokeInnerWidth = strokeWidth - strokeOuterWidth;
10408
- const innerHorizontal = halfWidth - strokeInnerWidth;
10409
- const innerVertical = halfHeight - strokeInnerWidth;
10410
- const outerHorizontal = halfWidth + strokeOuterWidth;
10411
- const outerVertical = halfHeight + strokeOuterWidth;
10412
- const normalizedX = x2 - this.x;
10413
- const normalizedY = y2 - this.y;
10414
- const innerEllipse = normalizedX * normalizedX / (innerHorizontal * innerHorizontal) + normalizedY * normalizedY / (innerVertical * innerVertical);
10415
- const outerEllipse = normalizedX * normalizedX / (outerHorizontal * outerHorizontal) + normalizedY * normalizedY / (outerVertical * outerVertical);
10416
- return innerEllipse > 1 && outerEllipse <= 1;
10417
- }
10418
- getBounds(out) {
10419
- out || (out = new Rectangle);
10420
- out.x = this.x - this.halfWidth;
10421
- out.y = this.y - this.halfHeight;
10422
- out.width = this.halfWidth * 2;
10423
- out.height = this.halfHeight * 2;
10424
- return out;
10425
- }
10426
- copyFrom(ellipse) {
10427
- this.x = ellipse.x;
10428
- this.y = ellipse.y;
10429
- this.halfWidth = ellipse.halfWidth;
10430
- this.halfHeight = ellipse.halfHeight;
10431
- return this;
10432
- }
10433
- copyTo(ellipse) {
10434
- ellipse.copyFrom(this);
10435
- return ellipse;
10436
- }
10437
- toString() {
10438
- return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;
10439
- }
10440
- }
10441
- var init_Ellipse = __esm(() => {
10442
- init_Rectangle();
10443
- });
10444
-
10445
- // node_modules/pixi.js/lib/maths/shapes/Polygon.mjs
10446
- class Polygon {
10447
- constructor(...points) {
10448
- this.type = "polygon";
10449
- let flat = Array.isArray(points[0]) ? points[0] : points;
10450
- if (typeof flat[0] !== "number") {
10451
- const p2 = [];
10452
- for (let i2 = 0, il = flat.length;i2 < il; i2++) {
10453
- p2.push(flat[i2].x, flat[i2].y);
10454
- }
10455
- flat = p2;
10456
- }
10457
- this.points = flat;
10458
- this.closePath = true;
10459
- }
10460
- isClockwise() {
10461
- let area = 0;
10462
- const points = this.points;
10463
- const length = points.length;
10464
- for (let i2 = 0;i2 < length; i2 += 2) {
10465
- const x1 = points[i2];
10466
- const y1 = points[i2 + 1];
10467
- const x2 = points[(i2 + 2) % length];
10468
- const y2 = points[(i2 + 3) % length];
10469
- area += (x2 - x1) * (y2 + y1);
10470
- }
10471
- return area < 0;
10472
- }
10473
- containsPolygon(polygon) {
10474
- const thisBounds = this.getBounds(tempRect);
10475
- const otherBounds = polygon.getBounds(tempRect2);
10476
- if (!thisBounds.containsRect(otherBounds)) {
10477
- return false;
10478
- }
10479
- const points = polygon.points;
10480
- for (let i2 = 0;i2 < points.length; i2 += 2) {
10481
- const x2 = points[i2];
10482
- const y2 = points[i2 + 1];
10483
- if (!this.contains(x2, y2)) {
10484
- return false;
10485
- }
10486
- }
10487
- return true;
10488
- }
10489
- clone() {
10490
- const points = this.points.slice();
10491
- const polygon = new Polygon(points);
10492
- polygon.closePath = this.closePath;
10493
- return polygon;
10494
- }
10495
- contains(x2, y2) {
10496
- let inside = false;
10497
- const length = this.points.length / 2;
10498
- for (let i2 = 0, j2 = length - 1;i2 < length; j2 = i2++) {
10499
- const xi = this.points[i2 * 2];
10500
- const yi = this.points[i2 * 2 + 1];
10501
- const xj = this.points[j2 * 2];
10502
- const yj = this.points[j2 * 2 + 1];
10503
- const intersect = yi > y2 !== yj > y2 && x2 < (xj - xi) * ((y2 - yi) / (yj - yi)) + xi;
10504
- if (intersect) {
10505
- inside = !inside;
10506
- }
10507
- }
10508
- return inside;
10509
- }
10510
- strokeContains(x2, y2, strokeWidth, alignment = 0.5) {
10511
- const strokeWidthSquared = strokeWidth * strokeWidth;
10512
- const rightWidthSquared = strokeWidthSquared * (1 - alignment);
10513
- const leftWidthSquared = strokeWidthSquared - rightWidthSquared;
10514
- const { points } = this;
10515
- const iterationLength = points.length - (this.closePath ? 0 : 2);
10516
- for (let i2 = 0;i2 < iterationLength; i2 += 2) {
10517
- const x1 = points[i2];
10518
- const y1 = points[i2 + 1];
10519
- const x22 = points[(i2 + 2) % points.length];
10520
- const y22 = points[(i2 + 3) % points.length];
10521
- const distanceSquared = squaredDistanceToLineSegment(x2, y2, x1, y1, x22, y22);
10522
- const sign = Math.sign((x22 - x1) * (y2 - y1) - (y22 - y1) * (x2 - x1));
10523
- if (distanceSquared <= (sign < 0 ? leftWidthSquared : rightWidthSquared)) {
10524
- return true;
10525
- }
10526
- }
10527
- return false;
10528
- }
10529
- getBounds(out) {
10530
- out || (out = new Rectangle);
10531
- const points = this.points;
10532
- let minX = Infinity;
10533
- let maxX = -Infinity;
10534
- let minY = Infinity;
10535
- let maxY = -Infinity;
10536
- for (let i2 = 0, n2 = points.length;i2 < n2; i2 += 2) {
10537
- const x2 = points[i2];
10538
- const y2 = points[i2 + 1];
10539
- minX = x2 < minX ? x2 : minX;
10540
- maxX = x2 > maxX ? x2 : maxX;
10541
- minY = y2 < minY ? y2 : minY;
10542
- maxY = y2 > maxY ? y2 : maxY;
10543
- }
10544
- out.x = minX;
10545
- out.width = maxX - minX;
10546
- out.y = minY;
10547
- out.height = maxY - minY;
10548
- return out;
10549
- }
10550
- copyFrom(polygon) {
10551
- this.points = polygon.points.slice();
10552
- this.closePath = polygon.closePath;
10553
- return this;
10554
- }
10555
- copyTo(polygon) {
10556
- polygon.copyFrom(this);
10557
- return polygon;
10558
- }
10559
- toString() {
10560
- return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, "")}]`;
10561
- }
10562
- get lastX() {
10563
- return this.points[this.points.length - 2];
10564
- }
10565
- get lastY() {
10566
- return this.points[this.points.length - 1];
10567
- }
10568
- get x() {
10569
- deprecation("8.11.0", "Polygon.lastX is deprecated, please use Polygon.lastX instead.");
10570
- return this.points[this.points.length - 2];
10571
- }
10572
- get y() {
10573
- deprecation("8.11.0", "Polygon.y is deprecated, please use Polygon.lastY instead.");
10574
- return this.points[this.points.length - 1];
10575
- }
10576
- get startX() {
10577
- return this.points[0];
10578
- }
10579
- get startY() {
10580
- return this.points[1];
10581
- }
10582
- }
10583
- var tempRect, tempRect2;
10584
- var init_Polygon = __esm(() => {
10585
- init_deprecation();
10586
- init_squaredDistanceToLineSegment();
10587
- init_Rectangle();
10588
- });
10589
-
10590
- // node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs
10591
- class RoundedRectangle {
10592
- constructor(x2 = 0, y2 = 0, width = 0, height = 0, radius = 20) {
10593
- this.type = "roundedRectangle";
10594
- this.x = x2;
10595
- this.y = y2;
10596
- this.width = width;
10597
- this.height = height;
10598
- this.radius = radius;
10599
- }
10600
- getBounds(out) {
10601
- out || (out = new Rectangle);
10602
- out.x = this.x;
10603
- out.y = this.y;
10604
- out.width = this.width;
10605
- out.height = this.height;
10606
- return out;
10607
- }
10608
- clone() {
10609
- return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
10610
- }
10611
- copyFrom(rectangle) {
10612
- this.x = rectangle.x;
10613
- this.y = rectangle.y;
10614
- this.width = rectangle.width;
10615
- this.height = rectangle.height;
10616
- return this;
10617
- }
10618
- copyTo(rectangle) {
10619
- rectangle.copyFrom(this);
10620
- return rectangle;
10621
- }
10622
- contains(x2, y2) {
10623
- if (this.width <= 0 || this.height <= 0) {
10624
- return false;
10625
- }
10626
- if (x2 >= this.x && x2 <= this.x + this.width) {
10627
- if (y2 >= this.y && y2 <= this.y + this.height) {
10628
- const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));
10629
- if (y2 >= this.y + radius && y2 <= this.y + this.height - radius || x2 >= this.x + radius && x2 <= this.x + this.width - radius) {
10630
- return true;
10631
- }
10632
- let dx = x2 - (this.x + radius);
10633
- let dy = y2 - (this.y + radius);
10634
- const radius2 = radius * radius;
10635
- if (dx * dx + dy * dy <= radius2) {
10636
- return true;
10637
- }
10638
- dx = x2 - (this.x + this.width - radius);
10639
- if (dx * dx + dy * dy <= radius2) {
10640
- return true;
10641
- }
10642
- dy = y2 - (this.y + this.height - radius);
10643
- if (dx * dx + dy * dy <= radius2) {
10644
- return true;
10645
- }
10646
- dx = x2 - (this.x + radius);
10647
- if (dx * dx + dy * dy <= radius2) {
10648
- return true;
10649
- }
10650
- }
10651
- }
10652
- return false;
10653
- }
10654
- strokeContains(pX, pY, strokeWidth, alignment = 0.5) {
10655
- const { x: x2, y: y2, width, height, radius } = this;
10656
- const strokeWidthOuter = strokeWidth * (1 - alignment);
10657
- const strokeWidthInner = strokeWidth - strokeWidthOuter;
10658
- const innerX = x2 + radius;
10659
- const innerY = y2 + radius;
10660
- const innerWidth = width - radius * 2;
10661
- const innerHeight = height - radius * 2;
10662
- const rightBound = x2 + width;
10663
- const bottomBound = y2 + height;
10664
- if ((pX >= x2 - strokeWidthOuter && pX <= x2 + strokeWidthInner || pX >= rightBound - strokeWidthInner && pX <= rightBound + strokeWidthOuter) && pY >= innerY && pY <= innerY + innerHeight) {
10665
- return true;
10666
- }
10667
- if ((pY >= y2 - strokeWidthOuter && pY <= y2 + strokeWidthInner || pY >= bottomBound - strokeWidthInner && pY <= bottomBound + strokeWidthOuter) && pX >= innerX && pX <= innerX + innerWidth) {
10668
- return true;
10669
- }
10670
- return pX < innerX && pY < innerY && isCornerWithinStroke(pX, pY, innerX, innerY, radius, strokeWidthInner, strokeWidthOuter) || pX > rightBound - radius && pY < innerY && isCornerWithinStroke(pX, pY, rightBound - radius, innerY, radius, strokeWidthInner, strokeWidthOuter) || pX > rightBound - radius && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, rightBound - radius, bottomBound - radius, radius, strokeWidthInner, strokeWidthOuter) || pX < innerX && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, innerX, bottomBound - radius, radius, strokeWidthInner, strokeWidthOuter);
10671
- }
10672
- toString() {
10673
- return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`;
10674
- }
10675
- }
10676
- var isCornerWithinStroke = (pX, pY, cornerX, cornerY, radius, strokeWidthInner, strokeWidthOuter) => {
10677
- const dx = pX - cornerX;
10678
- const dy = pY - cornerY;
10679
- const distance = Math.sqrt(dx * dx + dy * dy);
10680
- return distance >= radius - strokeWidthInner && distance <= radius + strokeWidthOuter;
10681
- };
10682
- var init_RoundedRectangle = __esm(() => {
10683
- init_Rectangle();
10684
- });
10685
-
10686
10310
  // node_modules/pixi.js/lib/scene/container/bounds/getRenderableBounds.mjs
10687
10311
  function getGlobalRenderableBounds(renderables, bounds) {
10688
10312
  bounds.clear();
@@ -15175,7 +14799,7 @@ class GenerateTextureSystem {
15175
14799
  } else {
15176
14800
  clearColor = noColor;
15177
14801
  }
15178
- const region = options.frame?.copyTo(tempRect3) || getLocalBounds(container, tempBounds3).rectangle;
14802
+ const region = options.frame?.copyTo(tempRect) || getLocalBounds(container, tempBounds3).rectangle;
15179
14803
  region.width = Math.max(region.width, 1 / resolution) | 0;
15180
14804
  region.height = Math.max(region.height, 1 / resolution) | 0;
15181
14805
  const target = RenderTexture.create({
@@ -15199,7 +14823,7 @@ class GenerateTextureSystem {
15199
14823
  this._renderer = null;
15200
14824
  }
15201
14825
  }
15202
- var tempRect3, tempBounds3, noColor;
14826
+ var tempRect, tempBounds3, noColor;
15203
14827
  var init_GenerateTextureSystem = __esm(() => {
15204
14828
  init_Color();
15205
14829
  init_Extensions();
@@ -15209,7 +14833,7 @@ var init_GenerateTextureSystem = __esm(() => {
15209
14833
  init_getLocalBounds();
15210
14834
  init_Container();
15211
14835
  init_RenderTexture();
15212
- tempRect3 = new Rectangle;
14836
+ tempRect = new Rectangle;
15213
14837
  tempBounds3 = new Bounds;
15214
14838
  noColor = [0, 0, 0, 0];
15215
14839
  GenerateTextureSystem.extension = {
@@ -23756,7 +23380,7 @@ var init_buildTriangle = __esm(() => {
23756
23380
  function generateTextureMatrix(out, style, shape, matrix) {
23757
23381
  const textureMatrix = style.matrix ? out.copyFrom(style.matrix).invert() : out.identity();
23758
23382
  if (style.textureSpace === "local") {
23759
- const bounds = shape.getBounds(tempRect5);
23383
+ const bounds = shape.getBounds(tempRect2);
23760
23384
  if (style.width) {
23761
23385
  bounds.pad(style.width);
23762
23386
  }
@@ -23789,13 +23413,13 @@ function generateTextureMatrix(out, style, shape, matrix) {
23789
23413
  }
23790
23414
  return textureMatrix;
23791
23415
  }
23792
- var tempTextureMatrix, tempRect5;
23416
+ var tempTextureMatrix, tempRect2;
23793
23417
  var init_generateTextureFillMatrix = __esm(() => {
23794
23418
  init_Matrix();
23795
23419
  init_Rectangle();
23796
23420
  init_FillGradient();
23797
23421
  tempTextureMatrix = new Matrix;
23798
- tempRect5 = new Rectangle;
23422
+ tempRect2 = new Rectangle;
23799
23423
  });
23800
23424
 
23801
23425
  // node_modules/pixi.js/lib/scene/graphics/shared/utils/buildContextBatches.mjs
@@ -23827,7 +23451,7 @@ function buildContextBatches(context2, gpuContext) {
23827
23451
  function addTextureToGeometryData(data, batches, geometryData) {
23828
23452
  const points = [];
23829
23453
  const build = shapeBuilders.rectangle;
23830
- const rect = tempRect6;
23454
+ const rect = tempRect3;
23831
23455
  rect.x = data.dx;
23832
23456
  rect.y = data.dy;
23833
23457
  rect.width = data.dw;
@@ -23927,7 +23551,7 @@ function getHoleArrays(holePrimitives) {
23927
23551
  }
23928
23552
  return holeArrays;
23929
23553
  }
23930
- var shapeBuilders, tempRect6, tempTextureMatrix2;
23554
+ var shapeBuilders, tempRect3, tempTextureMatrix2;
23931
23555
  var init_buildContextBatches = __esm(() => {
23932
23556
  init_Extensions();
23933
23557
  init_Matrix();
@@ -23948,7 +23572,7 @@ var init_buildContextBatches = __esm(() => {
23948
23572
  shapeBuilders = {};
23949
23573
  extensions.handleByMap(ExtensionType.ShapeBuilder, shapeBuilders);
23950
23574
  extensions.add(buildRectangle, buildPolygon, buildTriangle, buildCircle, buildEllipse, buildRoundedRectangle);
23951
- tempRect6 = new Rectangle;
23575
+ tempRect3 = new Rectangle;
23952
23576
  tempTextureMatrix2 = new Matrix;
23953
23577
  });
23954
23578
 
@@ -24635,6 +24259,400 @@ var init_parseSVGPath = __esm(() => {
24635
24259
  import_parse_svg_path = __toESM(require_parse_svg_path(), 1);
24636
24260
  });
24637
24261
 
24262
+ // node_modules/pixi.js/lib/maths/shapes/Circle.mjs
24263
+ class Circle {
24264
+ constructor(x2 = 0, y2 = 0, radius = 0) {
24265
+ this.type = "circle";
24266
+ this.x = x2;
24267
+ this.y = y2;
24268
+ this.radius = radius;
24269
+ }
24270
+ clone() {
24271
+ return new Circle(this.x, this.y, this.radius);
24272
+ }
24273
+ contains(x2, y2) {
24274
+ if (this.radius <= 0)
24275
+ return false;
24276
+ const r2 = this.radius * this.radius;
24277
+ let dx = this.x - x2;
24278
+ let dy = this.y - y2;
24279
+ dx *= dx;
24280
+ dy *= dy;
24281
+ return dx + dy <= r2;
24282
+ }
24283
+ strokeContains(x2, y2, width, alignment = 0.5) {
24284
+ if (this.radius === 0)
24285
+ return false;
24286
+ const dx = this.x - x2;
24287
+ const dy = this.y - y2;
24288
+ const radius = this.radius;
24289
+ const outerWidth = (1 - alignment) * width;
24290
+ const distance = Math.sqrt(dx * dx + dy * dy);
24291
+ return distance <= radius + outerWidth && distance > radius - (width - outerWidth);
24292
+ }
24293
+ getBounds(out) {
24294
+ out || (out = new Rectangle);
24295
+ out.x = this.x - this.radius;
24296
+ out.y = this.y - this.radius;
24297
+ out.width = this.radius * 2;
24298
+ out.height = this.radius * 2;
24299
+ return out;
24300
+ }
24301
+ copyFrom(circle) {
24302
+ this.x = circle.x;
24303
+ this.y = circle.y;
24304
+ this.radius = circle.radius;
24305
+ return this;
24306
+ }
24307
+ copyTo(circle) {
24308
+ circle.copyFrom(this);
24309
+ return circle;
24310
+ }
24311
+ toString() {
24312
+ return `[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;
24313
+ }
24314
+ }
24315
+ var init_Circle = __esm(() => {
24316
+ init_Rectangle();
24317
+ });
24318
+
24319
+ // node_modules/pixi.js/lib/maths/shapes/Ellipse.mjs
24320
+ class Ellipse {
24321
+ constructor(x2 = 0, y2 = 0, halfWidth = 0, halfHeight = 0) {
24322
+ this.type = "ellipse";
24323
+ this.x = x2;
24324
+ this.y = y2;
24325
+ this.halfWidth = halfWidth;
24326
+ this.halfHeight = halfHeight;
24327
+ }
24328
+ clone() {
24329
+ return new Ellipse(this.x, this.y, this.halfWidth, this.halfHeight);
24330
+ }
24331
+ contains(x2, y2) {
24332
+ if (this.halfWidth <= 0 || this.halfHeight <= 0) {
24333
+ return false;
24334
+ }
24335
+ let normx = (x2 - this.x) / this.halfWidth;
24336
+ let normy = (y2 - this.y) / this.halfHeight;
24337
+ normx *= normx;
24338
+ normy *= normy;
24339
+ return normx + normy <= 1;
24340
+ }
24341
+ strokeContains(x2, y2, strokeWidth, alignment = 0.5) {
24342
+ const { halfWidth, halfHeight } = this;
24343
+ if (halfWidth <= 0 || halfHeight <= 0) {
24344
+ return false;
24345
+ }
24346
+ const strokeOuterWidth = strokeWidth * (1 - alignment);
24347
+ const strokeInnerWidth = strokeWidth - strokeOuterWidth;
24348
+ const innerHorizontal = halfWidth - strokeInnerWidth;
24349
+ const innerVertical = halfHeight - strokeInnerWidth;
24350
+ const outerHorizontal = halfWidth + strokeOuterWidth;
24351
+ const outerVertical = halfHeight + strokeOuterWidth;
24352
+ const normalizedX = x2 - this.x;
24353
+ const normalizedY = y2 - this.y;
24354
+ const innerEllipse = normalizedX * normalizedX / (innerHorizontal * innerHorizontal) + normalizedY * normalizedY / (innerVertical * innerVertical);
24355
+ const outerEllipse = normalizedX * normalizedX / (outerHorizontal * outerHorizontal) + normalizedY * normalizedY / (outerVertical * outerVertical);
24356
+ return innerEllipse > 1 && outerEllipse <= 1;
24357
+ }
24358
+ getBounds(out) {
24359
+ out || (out = new Rectangle);
24360
+ out.x = this.x - this.halfWidth;
24361
+ out.y = this.y - this.halfHeight;
24362
+ out.width = this.halfWidth * 2;
24363
+ out.height = this.halfHeight * 2;
24364
+ return out;
24365
+ }
24366
+ copyFrom(ellipse) {
24367
+ this.x = ellipse.x;
24368
+ this.y = ellipse.y;
24369
+ this.halfWidth = ellipse.halfWidth;
24370
+ this.halfHeight = ellipse.halfHeight;
24371
+ return this;
24372
+ }
24373
+ copyTo(ellipse) {
24374
+ ellipse.copyFrom(this);
24375
+ return ellipse;
24376
+ }
24377
+ toString() {
24378
+ return `[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`;
24379
+ }
24380
+ }
24381
+ var init_Ellipse = __esm(() => {
24382
+ init_Rectangle();
24383
+ });
24384
+
24385
+ // node_modules/pixi.js/lib/maths/misc/squaredDistanceToLineSegment.mjs
24386
+ function squaredDistanceToLineSegment(x2, y2, x1, y1, x22, y22) {
24387
+ const a2 = x2 - x1;
24388
+ const b2 = y2 - y1;
24389
+ const c2 = x22 - x1;
24390
+ const d2 = y22 - y1;
24391
+ const dot = a2 * c2 + b2 * d2;
24392
+ const lenSq = c2 * c2 + d2 * d2;
24393
+ let param = -1;
24394
+ if (lenSq !== 0) {
24395
+ param = dot / lenSq;
24396
+ }
24397
+ let xx;
24398
+ let yy;
24399
+ if (param < 0) {
24400
+ xx = x1;
24401
+ yy = y1;
24402
+ } else if (param > 1) {
24403
+ xx = x22;
24404
+ yy = y22;
24405
+ } else {
24406
+ xx = x1 + param * c2;
24407
+ yy = y1 + param * d2;
24408
+ }
24409
+ const dx = x2 - xx;
24410
+ const dy = y2 - yy;
24411
+ return dx * dx + dy * dy;
24412
+ }
24413
+ var init_squaredDistanceToLineSegment = () => {};
24414
+
24415
+ // node_modules/pixi.js/lib/maths/shapes/Polygon.mjs
24416
+ class Polygon {
24417
+ constructor(...points) {
24418
+ this.type = "polygon";
24419
+ let flat = Array.isArray(points[0]) ? points[0] : points;
24420
+ if (typeof flat[0] !== "number") {
24421
+ const p2 = [];
24422
+ for (let i2 = 0, il = flat.length;i2 < il; i2++) {
24423
+ p2.push(flat[i2].x, flat[i2].y);
24424
+ }
24425
+ flat = p2;
24426
+ }
24427
+ this.points = flat;
24428
+ this.closePath = true;
24429
+ }
24430
+ isClockwise() {
24431
+ let area2 = 0;
24432
+ const points = this.points;
24433
+ const length = points.length;
24434
+ for (let i2 = 0;i2 < length; i2 += 2) {
24435
+ const x1 = points[i2];
24436
+ const y1 = points[i2 + 1];
24437
+ const x2 = points[(i2 + 2) % length];
24438
+ const y2 = points[(i2 + 3) % length];
24439
+ area2 += (x2 - x1) * (y2 + y1);
24440
+ }
24441
+ return area2 < 0;
24442
+ }
24443
+ containsPolygon(polygon) {
24444
+ const thisBounds = this.getBounds(tempRect4);
24445
+ const otherBounds = polygon.getBounds(tempRect22);
24446
+ if (!thisBounds.containsRect(otherBounds)) {
24447
+ return false;
24448
+ }
24449
+ const points = polygon.points;
24450
+ for (let i2 = 0;i2 < points.length; i2 += 2) {
24451
+ const x2 = points[i2];
24452
+ const y2 = points[i2 + 1];
24453
+ if (!this.contains(x2, y2)) {
24454
+ return false;
24455
+ }
24456
+ }
24457
+ return true;
24458
+ }
24459
+ clone() {
24460
+ const points = this.points.slice();
24461
+ const polygon = new Polygon(points);
24462
+ polygon.closePath = this.closePath;
24463
+ return polygon;
24464
+ }
24465
+ contains(x2, y2) {
24466
+ let inside = false;
24467
+ const length = this.points.length / 2;
24468
+ for (let i2 = 0, j2 = length - 1;i2 < length; j2 = i2++) {
24469
+ const xi = this.points[i2 * 2];
24470
+ const yi = this.points[i2 * 2 + 1];
24471
+ const xj = this.points[j2 * 2];
24472
+ const yj = this.points[j2 * 2 + 1];
24473
+ const intersect = yi > y2 !== yj > y2 && x2 < (xj - xi) * ((y2 - yi) / (yj - yi)) + xi;
24474
+ if (intersect) {
24475
+ inside = !inside;
24476
+ }
24477
+ }
24478
+ return inside;
24479
+ }
24480
+ strokeContains(x2, y2, strokeWidth, alignment = 0.5) {
24481
+ const strokeWidthSquared = strokeWidth * strokeWidth;
24482
+ const rightWidthSquared = strokeWidthSquared * (1 - alignment);
24483
+ const leftWidthSquared = strokeWidthSquared - rightWidthSquared;
24484
+ const { points } = this;
24485
+ const iterationLength = points.length - (this.closePath ? 0 : 2);
24486
+ for (let i2 = 0;i2 < iterationLength; i2 += 2) {
24487
+ const x1 = points[i2];
24488
+ const y1 = points[i2 + 1];
24489
+ const x22 = points[(i2 + 2) % points.length];
24490
+ const y22 = points[(i2 + 3) % points.length];
24491
+ const distanceSquared = squaredDistanceToLineSegment(x2, y2, x1, y1, x22, y22);
24492
+ const sign2 = Math.sign((x22 - x1) * (y2 - y1) - (y22 - y1) * (x2 - x1));
24493
+ if (distanceSquared <= (sign2 < 0 ? leftWidthSquared : rightWidthSquared)) {
24494
+ return true;
24495
+ }
24496
+ }
24497
+ return false;
24498
+ }
24499
+ getBounds(out) {
24500
+ out || (out = new Rectangle);
24501
+ const points = this.points;
24502
+ let minX = Infinity;
24503
+ let maxX = -Infinity;
24504
+ let minY = Infinity;
24505
+ let maxY = -Infinity;
24506
+ for (let i2 = 0, n2 = points.length;i2 < n2; i2 += 2) {
24507
+ const x2 = points[i2];
24508
+ const y2 = points[i2 + 1];
24509
+ minX = x2 < minX ? x2 : minX;
24510
+ maxX = x2 > maxX ? x2 : maxX;
24511
+ minY = y2 < minY ? y2 : minY;
24512
+ maxY = y2 > maxY ? y2 : maxY;
24513
+ }
24514
+ out.x = minX;
24515
+ out.width = maxX - minX;
24516
+ out.y = minY;
24517
+ out.height = maxY - minY;
24518
+ return out;
24519
+ }
24520
+ copyFrom(polygon) {
24521
+ this.points = polygon.points.slice();
24522
+ this.closePath = polygon.closePath;
24523
+ return this;
24524
+ }
24525
+ copyTo(polygon) {
24526
+ polygon.copyFrom(this);
24527
+ return polygon;
24528
+ }
24529
+ toString() {
24530
+ return `[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, "")}]`;
24531
+ }
24532
+ get lastX() {
24533
+ return this.points[this.points.length - 2];
24534
+ }
24535
+ get lastY() {
24536
+ return this.points[this.points.length - 1];
24537
+ }
24538
+ get x() {
24539
+ deprecation("8.11.0", "Polygon.lastX is deprecated, please use Polygon.lastX instead.");
24540
+ return this.points[this.points.length - 2];
24541
+ }
24542
+ get y() {
24543
+ deprecation("8.11.0", "Polygon.y is deprecated, please use Polygon.lastY instead.");
24544
+ return this.points[this.points.length - 1];
24545
+ }
24546
+ get startX() {
24547
+ return this.points[0];
24548
+ }
24549
+ get startY() {
24550
+ return this.points[1];
24551
+ }
24552
+ }
24553
+ var tempRect4, tempRect22;
24554
+ var init_Polygon = __esm(() => {
24555
+ init_deprecation();
24556
+ init_squaredDistanceToLineSegment();
24557
+ init_Rectangle();
24558
+ });
24559
+
24560
+ // node_modules/pixi.js/lib/maths/shapes/RoundedRectangle.mjs
24561
+ class RoundedRectangle {
24562
+ constructor(x2 = 0, y2 = 0, width = 0, height = 0, radius = 20) {
24563
+ this.type = "roundedRectangle";
24564
+ this.x = x2;
24565
+ this.y = y2;
24566
+ this.width = width;
24567
+ this.height = height;
24568
+ this.radius = radius;
24569
+ }
24570
+ getBounds(out) {
24571
+ out || (out = new Rectangle);
24572
+ out.x = this.x;
24573
+ out.y = this.y;
24574
+ out.width = this.width;
24575
+ out.height = this.height;
24576
+ return out;
24577
+ }
24578
+ clone() {
24579
+ return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);
24580
+ }
24581
+ copyFrom(rectangle) {
24582
+ this.x = rectangle.x;
24583
+ this.y = rectangle.y;
24584
+ this.width = rectangle.width;
24585
+ this.height = rectangle.height;
24586
+ return this;
24587
+ }
24588
+ copyTo(rectangle) {
24589
+ rectangle.copyFrom(this);
24590
+ return rectangle;
24591
+ }
24592
+ contains(x2, y2) {
24593
+ if (this.width <= 0 || this.height <= 0) {
24594
+ return false;
24595
+ }
24596
+ if (x2 >= this.x && x2 <= this.x + this.width) {
24597
+ if (y2 >= this.y && y2 <= this.y + this.height) {
24598
+ const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));
24599
+ if (y2 >= this.y + radius && y2 <= this.y + this.height - radius || x2 >= this.x + radius && x2 <= this.x + this.width - radius) {
24600
+ return true;
24601
+ }
24602
+ let dx = x2 - (this.x + radius);
24603
+ let dy = y2 - (this.y + radius);
24604
+ const radius2 = radius * radius;
24605
+ if (dx * dx + dy * dy <= radius2) {
24606
+ return true;
24607
+ }
24608
+ dx = x2 - (this.x + this.width - radius);
24609
+ if (dx * dx + dy * dy <= radius2) {
24610
+ return true;
24611
+ }
24612
+ dy = y2 - (this.y + this.height - radius);
24613
+ if (dx * dx + dy * dy <= radius2) {
24614
+ return true;
24615
+ }
24616
+ dx = x2 - (this.x + radius);
24617
+ if (dx * dx + dy * dy <= radius2) {
24618
+ return true;
24619
+ }
24620
+ }
24621
+ }
24622
+ return false;
24623
+ }
24624
+ strokeContains(pX, pY, strokeWidth, alignment = 0.5) {
24625
+ const { x: x2, y: y2, width, height, radius } = this;
24626
+ const strokeWidthOuter = strokeWidth * (1 - alignment);
24627
+ const strokeWidthInner = strokeWidth - strokeWidthOuter;
24628
+ const innerX = x2 + radius;
24629
+ const innerY = y2 + radius;
24630
+ const innerWidth = width - radius * 2;
24631
+ const innerHeight = height - radius * 2;
24632
+ const rightBound = x2 + width;
24633
+ const bottomBound = y2 + height;
24634
+ if ((pX >= x2 - strokeWidthOuter && pX <= x2 + strokeWidthInner || pX >= rightBound - strokeWidthInner && pX <= rightBound + strokeWidthOuter) && pY >= innerY && pY <= innerY + innerHeight) {
24635
+ return true;
24636
+ }
24637
+ if ((pY >= y2 - strokeWidthOuter && pY <= y2 + strokeWidthInner || pY >= bottomBound - strokeWidthInner && pY <= bottomBound + strokeWidthOuter) && pX >= innerX && pX <= innerX + innerWidth) {
24638
+ return true;
24639
+ }
24640
+ return pX < innerX && pY < innerY && isCornerWithinStroke(pX, pY, innerX, innerY, radius, strokeWidthInner, strokeWidthOuter) || pX > rightBound - radius && pY < innerY && isCornerWithinStroke(pX, pY, rightBound - radius, innerY, radius, strokeWidthInner, strokeWidthOuter) || pX > rightBound - radius && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, rightBound - radius, bottomBound - radius, radius, strokeWidthInner, strokeWidthOuter) || pX < innerX && pY > bottomBound - radius && isCornerWithinStroke(pX, pY, innerX, bottomBound - radius, radius, strokeWidthInner, strokeWidthOuter);
24641
+ }
24642
+ toString() {
24643
+ return `[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`;
24644
+ }
24645
+ }
24646
+ var isCornerWithinStroke = (pX, pY, cornerX, cornerY, radius, strokeWidthInner, strokeWidthOuter) => {
24647
+ const dx = pX - cornerX;
24648
+ const dy = pY - cornerY;
24649
+ const distance = Math.sqrt(dx * dx + dy * dy);
24650
+ return distance >= radius - strokeWidthInner && distance <= radius + strokeWidthOuter;
24651
+ };
24652
+ var init_RoundedRectangle = __esm(() => {
24653
+ init_Rectangle();
24654
+ });
24655
+
24638
24656
  // node_modules/pixi.js/lib/scene/graphics/shared/GraphicsContextSystem.mjs
24639
24657
  class GpuGraphicsContext {
24640
24658
  constructor() {
@@ -29858,6 +29876,9 @@ _Application._plugins = [];
29858
29876
  var Application = _Application;
29859
29877
  extensions.handleByList(ExtensionType.Application, Application._plugins);
29860
29878
  extensions.add(ApplicationInitHook);
29879
+ // node_modules/pixi.js/lib/index.mjs
29880
+ init_Point();
29881
+ init_Rectangle();
29861
29882
 
29862
29883
  // node_modules/pixi.js/lib/scene/text/Text.mjs
29863
29884
  init_TextureStyle();
@@ -30088,7 +30109,7 @@ function getCanvasBoundingBox(...args) {
30088
30109
  init_CanvasTextMetrics();
30089
30110
  init_fontStringFromTextStyle();
30090
30111
  init_getCanvasFillStyle();
30091
- var tempRect7 = new Rectangle;
30112
+ var tempRect5 = new Rectangle;
30092
30113
 
30093
30114
  class CanvasTextGeneratorClass {
30094
30115
  getCanvasAndContext(options) {
@@ -30099,7 +30120,7 @@ class CanvasTextGeneratorClass {
30099
30120
  const height = Math.ceil(Math.ceil(Math.max(1, measured.height) + padding * 2) * resolution);
30100
30121
  const canvasAndContext = CanvasPool.getOptimalCanvasAndContext(width, height);
30101
30122
  this._renderTextToCanvas(style, padding, resolution, canvasAndContext, measured);
30102
- const frame = style.trim ? getCanvasBoundingBox({ canvas: canvasAndContext.canvas, width, height, resolution: 1, output: tempRect7 }) : tempRect7.set(0, 0, width, height);
30123
+ const frame = style.trim ? getCanvasBoundingBox({ canvas: canvasAndContext.canvas, width, height, resolution: 1, output: tempRect5 }) : tempRect5.set(0, 0, width, height);
30103
30124
  return {
30104
30125
  canvasAndContext,
30105
30126
  frame
@@ -30705,9 +30726,8 @@ class Text extends AbstractText {
30705
30726
  bounds.maxY = bounds.minY + height;
30706
30727
  }
30707
30728
  }
30729
+
30708
30730
  // node_modules/pixi.js/lib/index.mjs
30709
- init_Point();
30710
- init_Rectangle();
30711
30731
  init_ImageSource();
30712
30732
  init_Texture();
30713
30733
  init_textureFrom();
@@ -31080,12 +31100,14 @@ class BaseElement {
31080
31100
  // src/elements/TextElement.ts
31081
31101
  class TextElement extends BaseElement {
31082
31102
  pixiText;
31103
+ charSprites = [];
31083
31104
  _text;
31084
31105
  _fontFamily;
31085
31106
  _fontSize;
31086
31107
  _fontWeight;
31087
31108
  _align;
31088
31109
  _color;
31110
+ _arcPath = null;
31089
31111
  constructor(text, x2, y2, style) {
31090
31112
  super("text");
31091
31113
  this._text = text;
@@ -31094,20 +31116,20 @@ class TextElement extends BaseElement {
31094
31116
  this._fontWeight = style?.fontWeight ?? "normal";
31095
31117
  this._align = style?.align ?? "left";
31096
31118
  this._color = style?.color ?? 16777215;
31097
- this.pixiText = new Text({
31098
- text: this._text,
31099
- style: new TextStyle({
31100
- fontFamily: this._fontFamily,
31101
- fontSize: this._fontSize,
31102
- fontWeight: this._fontWeight,
31103
- fill: this._color,
31104
- align: this._align
31105
- })
31106
- });
31119
+ this.pixiText = this.makeText(this._text);
31107
31120
  this.container.addChild(this.pixiText);
31108
31121
  this.x = x2;
31109
31122
  this.y = y2;
31110
31123
  }
31124
+ get arcPath() {
31125
+ return this._arcPath;
31126
+ }
31127
+ set arcPath(value) {
31128
+ const old = this._arcPath;
31129
+ this._arcPath = value;
31130
+ this.redraw();
31131
+ this.emitChange("arcPath", old, value);
31132
+ }
31111
31133
  get text() {
31112
31134
  return this._text;
31113
31135
  }
@@ -31116,7 +31138,7 @@ class TextElement extends BaseElement {
31116
31138
  if (old === value)
31117
31139
  return;
31118
31140
  this._text = value;
31119
- this.pixiText.text = value;
31141
+ this.redraw();
31120
31142
  this.emitChange("text", old, value);
31121
31143
  }
31122
31144
  get fontFamily() {
@@ -31127,7 +31149,9 @@ class TextElement extends BaseElement {
31127
31149
  if (old === value)
31128
31150
  return;
31129
31151
  this._fontFamily = value;
31130
- this.pixiText.style.fontFamily = value;
31152
+ this.applyStyleToAll((s2) => {
31153
+ s2.fontFamily = value;
31154
+ });
31131
31155
  this.emitChange("fontFamily", old, value);
31132
31156
  }
31133
31157
  get fontSize() {
@@ -31138,7 +31162,9 @@ class TextElement extends BaseElement {
31138
31162
  if (old === value)
31139
31163
  return;
31140
31164
  this._fontSize = value;
31141
- this.pixiText.style.fontSize = value;
31165
+ this.applyStyleToAll((s2) => {
31166
+ s2.fontSize = value;
31167
+ });
31142
31168
  this.emitChange("fontSize", old, value);
31143
31169
  }
31144
31170
  get fontWeight() {
@@ -31149,7 +31175,9 @@ class TextElement extends BaseElement {
31149
31175
  if (old === value)
31150
31176
  return;
31151
31177
  this._fontWeight = value;
31152
- this.pixiText.style.fontWeight = value;
31178
+ this.applyStyleToAll((s2) => {
31179
+ s2.fontWeight = value;
31180
+ });
31153
31181
  this.emitChange("fontWeight", old, value);
31154
31182
  }
31155
31183
  get align() {
@@ -31160,7 +31188,8 @@ class TextElement extends BaseElement {
31160
31188
  if (old === value)
31161
31189
  return;
31162
31190
  this._align = value;
31163
- this.pixiText.style.align = value;
31191
+ if (this.pixiText)
31192
+ this.pixiText.style.align = value;
31164
31193
  this.emitChange("align", old, value);
31165
31194
  }
31166
31195
  get color() {
@@ -31171,30 +31200,95 @@ class TextElement extends BaseElement {
31171
31200
  if (old === value)
31172
31201
  return;
31173
31202
  this._color = value;
31174
- this.pixiText.style.fill = value;
31203
+ this.applyStyleToAll((s2) => {
31204
+ s2.fill = value;
31205
+ });
31175
31206
  this.emitChange("color", old, value);
31176
31207
  }
31177
31208
  get width() {
31178
- return this.pixiText.width;
31179
- }
31180
- set width(value) {
31181
- const old = this.pixiText.width;
31182
- if (old === value)
31183
- return;
31184
- this.pixiText.width = value;
31185
- this.emitChange("width", old, value);
31209
+ if (this._arcPath)
31210
+ return this._arcPath.radius * 2;
31211
+ return this.pixiText?.width ?? 0;
31186
31212
  }
31213
+ set width(_value) {}
31187
31214
  get height() {
31188
- return this.pixiText.height;
31215
+ if (this._arcPath)
31216
+ return this._arcPath.radius * 2;
31217
+ return this.pixiText?.height ?? 0;
31189
31218
  }
31190
- set height(value) {
31191
- const old = this.pixiText.height;
31192
- if (old === value)
31219
+ set height(_value) {}
31220
+ redraw() {
31221
+ if (this._arcPath) {
31222
+ this.drawArcText();
31223
+ } else {
31224
+ this.drawNormalText();
31225
+ }
31226
+ }
31227
+ drawNormalText() {
31228
+ for (const s2 of this.charSprites) {
31229
+ this.container.removeChild(s2);
31230
+ s2.destroy();
31231
+ }
31232
+ this.charSprites = [];
31233
+ if (!this.pixiText) {
31234
+ this.pixiText = this.makeText(this._text);
31235
+ this.container.addChild(this.pixiText);
31236
+ } else {
31237
+ this.pixiText.text = this._text;
31238
+ this.pixiText.visible = true;
31239
+ }
31240
+ }
31241
+ drawArcText() {
31242
+ const arc = this._arcPath;
31243
+ if (this.pixiText) {
31244
+ this.pixiText.visible = false;
31245
+ }
31246
+ for (const s2 of this.charSprites) {
31247
+ this.container.removeChild(s2);
31248
+ s2.destroy();
31249
+ }
31250
+ this.charSprites = [];
31251
+ const chars = Array.from(this._text);
31252
+ if (chars.length === 0)
31193
31253
  return;
31194
- this.pixiText.height = value;
31195
- this.emitChange("height", old, value);
31254
+ const sprites = chars.map((ch) => this.makeText(ch));
31255
+ const span = arc.endAngle - arc.startAngle;
31256
+ const arcLength = Math.abs(arc.radius * span);
31257
+ const totalWidth = sprites.reduce((sum, s2) => sum + s2.width, 0);
31258
+ const spacingScale = arcLength > 0 ? arcLength / totalWidth : 1;
31259
+ const flip = arc.side === "inside" ? Math.PI : 0;
31260
+ const anchorY = arc.side === "outside" ? 1 : 0;
31261
+ let angle = arc.startAngle;
31262
+ for (const sprite of sprites) {
31263
+ const halfAngular = sprite.width * spacingScale / 2 / arc.radius;
31264
+ angle += halfAngular * Math.sign(span);
31265
+ sprite.x = Math.cos(angle) * arc.radius;
31266
+ sprite.y = Math.sin(angle) * arc.radius;
31267
+ sprite.rotation = angle + Math.PI / 2 + flip;
31268
+ sprite.anchor.set(0.5, anchorY);
31269
+ this.container.addChild(sprite);
31270
+ this.charSprites.push(sprite);
31271
+ angle += halfAngular * Math.sign(span);
31272
+ }
31273
+ }
31274
+ makeText(content) {
31275
+ return new Text({
31276
+ text: content,
31277
+ style: new TextStyle({
31278
+ fontFamily: this._fontFamily,
31279
+ fontSize: this._fontSize,
31280
+ fontWeight: this._fontWeight,
31281
+ fill: this._color,
31282
+ align: this._align
31283
+ })
31284
+ });
31285
+ }
31286
+ applyStyleToAll(mutate) {
31287
+ if (this.pixiText)
31288
+ mutate(this.pixiText.style);
31289
+ for (const s2 of this.charSprites)
31290
+ mutate(s2.style);
31196
31291
  }
31197
- redraw() {}
31198
31292
  toJSON() {
31199
31293
  return {
31200
31294
  ...super.toJSON(),
@@ -31203,7 +31297,8 @@ class TextElement extends BaseElement {
31203
31297
  fontSize: this._fontSize,
31204
31298
  fontWeight: this._fontWeight,
31205
31299
  align: this._align,
31206
- color: this._color
31300
+ color: this._color,
31301
+ arcPath: this._arcPath ?? undefined
31207
31302
  };
31208
31303
  }
31209
31304
  applyJSON(data) {
@@ -31219,6 +31314,8 @@ class TextElement extends BaseElement {
31219
31314
  this.align = data.align;
31220
31315
  if (data.color !== undefined)
31221
31316
  this.color = data.color;
31317
+ if ("arcPath" in data)
31318
+ this.arcPath = data.arcPath ?? null;
31222
31319
  this.x = data.x;
31223
31320
  this.y = data.y;
31224
31321
  this.rotation = data.rotation;
@@ -31235,6 +31332,8 @@ class TextElement extends BaseElement {
31235
31332
  align: data.align,
31236
31333
  color: data.color
31237
31334
  });
31335
+ if (data.arcPath)
31336
+ el.arcPath = data.arcPath;
31238
31337
  el.rotation = data.rotation;
31239
31338
  el.zIndex = data.zIndex;
31240
31339
  el.visible = data.visible;
@@ -31484,7 +31583,11 @@ class ShapeElement extends BaseElement {
31484
31583
  if (old === clamped)
31485
31584
  return;
31486
31585
  this._fillPercentage = clamped;
31487
- this.updateMask();
31586
+ if (this._shapeType === "arc") {
31587
+ this.redraw();
31588
+ } else {
31589
+ this.updateMask();
31590
+ }
31488
31591
  this.emitChange("fillPercentage", old, clamped);
31489
31592
  }
31490
31593
  get fillDirection() {
@@ -31495,7 +31598,11 @@ class ShapeElement extends BaseElement {
31495
31598
  if (old === value)
31496
31599
  return;
31497
31600
  this._fillDirection = value;
31498
- this.updateMask();
31601
+ if (this._shapeType === "arc") {
31602
+ this.redraw();
31603
+ } else {
31604
+ this.updateMask();
31605
+ }
31499
31606
  this.emitChange("fillDirection", old, value);
31500
31607
  }
31501
31608
  get strokeWidth() {
@@ -31596,9 +31703,34 @@ class ShapeElement extends BaseElement {
31596
31703
  redraw() {
31597
31704
  this.bgGraphics.clear();
31598
31705
  this.fgGraphics.clear();
31599
- this.drawShape(this.bgGraphics, this._backgroundColor);
31600
- this.drawShape(this.fgGraphics, this._foregroundColor);
31601
- this.updateMask();
31706
+ if (this._shapeType === "arc") {
31707
+ this.drawArc(this.bgGraphics, this._backgroundColor, 100);
31708
+ this.drawArc(this.fgGraphics, this._foregroundColor, this._fillPercentage);
31709
+ this.fillMask.update(this.getLocalBounds(), 100, this._fillDirection);
31710
+ } else {
31711
+ this.drawShape(this.bgGraphics, this._backgroundColor);
31712
+ this.drawShape(this.fgGraphics, this._foregroundColor);
31713
+ this.updateMask();
31714
+ }
31715
+ }
31716
+ drawArc(g2, color, fillPct) {
31717
+ const r2 = this._shapeParams["radius"];
31718
+ const start = this._shapeParams["startAngle"];
31719
+ const end = this._shapeParams["endAngle"];
31720
+ const pct = clamp(fillPct, 0, 100) / 100;
31721
+ const span = end - start;
31722
+ let arcStart;
31723
+ let arcEnd;
31724
+ if (this._fillDirection === "right-to-left" || this._fillDirection === "bottom-to-top") {
31725
+ arcStart = end - span * pct;
31726
+ arcEnd = end;
31727
+ } else {
31728
+ arcStart = start;
31729
+ arcEnd = start + span * pct;
31730
+ }
31731
+ if (pct === 0)
31732
+ return;
31733
+ g2.arc(0, 0, r2, arcStart, arcEnd).stroke({ color, width: this._strokeWidth, cap: this._lineCap });
31602
31734
  }
31603
31735
  drawShape(g2, color) {
31604
31736
  switch (this._shapeType) {
@@ -31621,13 +31753,6 @@ class ShapeElement extends BaseElement {
31621
31753
  g2.rect(0, 0, w2, h2).fill({ color });
31622
31754
  break;
31623
31755
  }
31624
- case "arc": {
31625
- const r2 = this._shapeParams["radius"];
31626
- const start = this._shapeParams["startAngle"];
31627
- const end = this._shapeParams["endAngle"];
31628
- g2.arc(0, 0, r2, start, end).stroke({ color, width: this._strokeWidth, cap: this._lineCap });
31629
- break;
31630
- }
31631
31756
  }
31632
31757
  }
31633
31758
  updateMask() {
@@ -34341,6 +34466,105 @@ class ViewportPlugin {
34341
34466
  this._viewport.destroy();
34342
34467
  }
34343
34468
  }
34469
+ // src/plugins/AlignmentGuidesPlugin.ts
34470
+ var DEFAULTS3 = {
34471
+ color: 16724838,
34472
+ opacity: 0.85,
34473
+ threshold: 0
34474
+ };
34475
+
34476
+ class AlignmentGuidesPlugin {
34477
+ name = "alignmentGuides";
34478
+ engine;
34479
+ graphics;
34480
+ options;
34481
+ unsubscribers = [];
34482
+ constructor(options) {
34483
+ this.options = { ...DEFAULTS3, ...options };
34484
+ }
34485
+ init(engine) {
34486
+ this.engine = engine;
34487
+ this.graphics = new Graphics;
34488
+ this.graphics.alpha = this.options.opacity;
34489
+ this.graphics.visible = false;
34490
+ engine.app.stage.addChild(this.graphics);
34491
+ const bus = engine.eventBus;
34492
+ this.unsubscribers.push(bus.on("interaction:dragMove", ({ elements }) => {
34493
+ this.drawGuides(elements);
34494
+ }), bus.on("interaction:dragEnd", () => {
34495
+ this.hide();
34496
+ }), bus.on("interaction:resizeEnd", () => {
34497
+ this.hide();
34498
+ }), bus.on("interaction:rotateEnd", () => {
34499
+ this.hide();
34500
+ }));
34501
+ }
34502
+ hide() {
34503
+ this.graphics.clear();
34504
+ this.graphics.visible = false;
34505
+ }
34506
+ elementCenterInWorld(elements) {
34507
+ let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
34508
+ for (const el of elements) {
34509
+ const b2 = el.getDisplayObject().getLocalBounds();
34510
+ const wx = el.x + b2.x;
34511
+ const wy = el.y + b2.y;
34512
+ minX = Math.min(minX, wx);
34513
+ minY = Math.min(minY, wy);
34514
+ maxX = Math.max(maxX, wx + b2.width);
34515
+ maxY = Math.max(maxY, wy + b2.height);
34516
+ }
34517
+ return { cx: (minX + maxX) / 2, cy: (minY + maxY) / 2 };
34518
+ }
34519
+ drawGuides(elements) {
34520
+ if (elements.length === 0) {
34521
+ this.hide();
34522
+ return;
34523
+ }
34524
+ const { width, height } = this.engine.options;
34525
+ const viewportPlugin = this.engine.plugins.get("viewport");
34526
+ const viewport = viewportPlugin?.viewport;
34527
+ const scale = viewport?.scale.x ?? 1;
34528
+ const panX = viewport?.x ?? 0;
34529
+ const panY = viewport?.y ?? 0;
34530
+ const { x: ox, y: oy } = this.engine.originOffset;
34531
+ const canvasCenterWorld = this.engine.options.coordinateOrigin === "center" ? { x: 0, y: 0 } : { x: width / 2, y: height / 2 };
34532
+ const { cx, cy } = this.elementCenterInWorld(elements);
34533
+ const diffX = Math.abs(cx - canvasCenterWorld.x);
34534
+ const diffY = Math.abs(cy - canvasCenterWorld.y);
34535
+ const showH = diffY <= this.options.threshold;
34536
+ const showV = diffX <= this.options.threshold;
34537
+ if (!showH && !showV) {
34538
+ this.hide();
34539
+ return;
34540
+ }
34541
+ this.graphics.clear();
34542
+ this.graphics.visible = true;
34543
+ const { color } = this.options;
34544
+ const worldLeft = this.engine.options.coordinateOrigin === "center" ? -width / 2 : 0;
34545
+ const worldRight = this.engine.options.coordinateOrigin === "center" ? width / 2 : width;
34546
+ const worldTop = this.engine.options.coordinateOrigin === "center" ? -height / 2 : 0;
34547
+ const worldBottom = this.engine.options.coordinateOrigin === "center" ? height / 2 : height;
34548
+ const toScreenX = (wx) => panX + (wx + ox) * scale;
34549
+ const toScreenY = (wy) => panY + (wy + oy) * scale;
34550
+ if (showH) {
34551
+ const screenY = toScreenY(canvasCenterWorld.y);
34552
+ const screenLeft = toScreenX(worldLeft);
34553
+ const screenRight = toScreenX(worldRight);
34554
+ this.graphics.moveTo(screenLeft, screenY).lineTo(screenRight, screenY).stroke({ color, width: 1 });
34555
+ }
34556
+ if (showV) {
34557
+ const screenX = toScreenX(canvasCenterWorld.x);
34558
+ const screenTop = toScreenY(worldTop);
34559
+ const screenBottom = toScreenY(worldBottom);
34560
+ this.graphics.moveTo(screenX, screenTop).lineTo(screenX, screenBottom).stroke({ color, width: 1 });
34561
+ }
34562
+ }
34563
+ destroy() {
34564
+ this.unsubscribers.forEach((unsub) => unsub());
34565
+ this.graphics.destroy();
34566
+ }
34567
+ }
34344
34568
  export {
34345
34569
  ZOrderManager,
34346
34570
  WatchfaceEngine,
@@ -34359,5 +34583,6 @@ export {
34359
34583
  ElementRegistry,
34360
34584
  ElementManager,
34361
34585
  BaseElement,
34362
- AutosavePlugin
34586
+ AutosavePlugin,
34587
+ AlignmentGuidesPlugin
34363
34588
  };