@open-slot-ui/pixi 0.7.1 → 0.7.2

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.cjs CHANGED
@@ -1333,6 +1333,7 @@ var ValueDisplayView = class extends ControlView {
1333
1333
  super.dispose();
1334
1334
  }
1335
1335
  };
1336
+ var TAP_SLOP = 24;
1336
1337
  var GLYPH_SVG = {
1337
1338
  speaker: '<svg viewBox="0 0 22.5 22.5" xmlns="http://www.w3.org/2000/svg"><path d="M13.6745 5.01252C13.9316 4.84399 14.2647 4.8292 14.5397 4.97456C14.8146 5.1199 14.9868 5.40142 14.9872 5.706L15.0007 16.8107C15.0011 17.1153 14.8296 17.3934 14.555 17.5333C14.2804 17.6731 13.9472 17.6517 13.6897 17.4781L10.4454 15.2905L8.61605 15.2722C6.76074 15.2537 5.25495 13.7655 5.25266 11.9484L5.25073 10.3739C5.2486 8.55679 6.75081 7.09863 8.6061 7.11714L10.4355 7.13539L13.6745 5.01252Z" fill="none" stroke="black" stroke-width="1.5" stroke-linejoin="round"/><path d="M16.1933 9.375C16.6252 10.4652 16.6015 11.654 16.1257 12.75" fill="none" stroke="black" stroke-width="3" stroke-linecap="round"/></svg>',
1338
1339
  "speaker-mute": '<svg viewBox="0 0 22.5 22.5" xmlns="http://www.w3.org/2000/svg"><path d="M13.6745 5.01252C13.9316 4.84399 14.2647 4.8292 14.5397 4.97456C14.8146 5.1199 14.9868 5.40142 14.9872 5.706L15.0007 16.8107C15.0011 17.1153 14.8296 17.3934 14.555 17.5333C14.2804 17.6731 13.9472 17.6517 13.6897 17.4781L10.4454 15.2905L8.61605 15.2722C6.76074 15.2537 5.25495 13.7655 5.25266 11.9484L5.25073 10.3739C5.2486 8.55679 6.75081 7.09863 8.6061 7.11714L10.4355 7.13539L13.6745 5.01252Z" fill="none" stroke="black" stroke-width="1.5" stroke-linejoin="round"/><path d="M15.5 8.5L19.5 13.5M19.5 8.5L15.5 13.5" fill="none" stroke="black" stroke-width="1.8" stroke-linecap="round"/></svg>',
@@ -1430,17 +1431,26 @@ var ButtonView = class extends ControlView {
1430
1431
  this.sprite.scale.set(1);
1431
1432
  this.sprite.scale.set(this.iconTarget / this.sprite.height);
1432
1433
  }
1433
- onDown = () => {
1434
- if (this.btn.interactable) this.btn.setState("pressed");
1434
+ /** Screen position of the current press, for the tap-slop check on release. */
1435
+ downPt = null;
1436
+ onDown = (e) => {
1437
+ if (!this.btn.interactable) return;
1438
+ this.btn.setState("pressed");
1439
+ this.downPt = { x: e.global.x, y: e.global.y };
1435
1440
  };
1436
1441
  onUp = () => {
1437
1442
  if (this.btn.current === "pressed") {
1438
1443
  this.btn.setState("idle");
1439
1444
  this.btn.activate();
1440
1445
  }
1446
+ this.downPt = null;
1441
1447
  };
1442
- onUpOutside = () => {
1443
- if (this.btn.current === "pressed") this.btn.setState("idle");
1448
+ onUpOutside = (e) => {
1449
+ const p = this.downPt;
1450
+ this.downPt = null;
1451
+ if (this.btn.current !== "pressed") return;
1452
+ this.btn.setState("idle");
1453
+ if (p && Math.hypot(e.global.x - p.x, e.global.y - p.y) <= TAP_SLOP) this.btn.activate();
1444
1454
  };
1445
1455
  updateHit() {
1446
1456
  if (this.sprite) {