@open-slot-ui/pixi 0.7.0 → 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/art.js CHANGED
@@ -1,4 +1,4 @@
1
- import { svgSpinSkin } from './chunk-PYXZIGXG.js';
1
+ import { svgSpinSkin } from './chunk-BDITXPQ7.js';
2
2
  import { CanvasSource, Texture, Rectangle } from 'pixi.js';
3
3
 
4
4
  async function svgToTexture(svg, resolution = 3) {
@@ -1329,6 +1329,7 @@ var ValueDisplayView = class extends ControlView {
1329
1329
  super.dispose();
1330
1330
  }
1331
1331
  };
1332
+ var TAP_SLOP = 24;
1332
1333
  var GLYPH_SVG = {
1333
1334
  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>',
1334
1335
  "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>',
@@ -1426,17 +1427,26 @@ var ButtonView = class extends ControlView {
1426
1427
  this.sprite.scale.set(1);
1427
1428
  this.sprite.scale.set(this.iconTarget / this.sprite.height);
1428
1429
  }
1429
- onDown = () => {
1430
- if (this.btn.interactable) this.btn.setState("pressed");
1430
+ /** Screen position of the current press, for the tap-slop check on release. */
1431
+ downPt = null;
1432
+ onDown = (e) => {
1433
+ if (!this.btn.interactable) return;
1434
+ this.btn.setState("pressed");
1435
+ this.downPt = { x: e.global.x, y: e.global.y };
1431
1436
  };
1432
1437
  onUp = () => {
1433
1438
  if (this.btn.current === "pressed") {
1434
1439
  this.btn.setState("idle");
1435
1440
  this.btn.activate();
1436
1441
  }
1442
+ this.downPt = null;
1437
1443
  };
1438
- onUpOutside = () => {
1439
- if (this.btn.current === "pressed") this.btn.setState("idle");
1444
+ onUpOutside = (e) => {
1445
+ const p = this.downPt;
1446
+ this.downPt = null;
1447
+ if (this.btn.current !== "pressed") return;
1448
+ this.btn.setState("idle");
1449
+ if (p && Math.hypot(e.global.x - p.x, e.global.y - p.y) <= TAP_SLOP) this.btn.activate();
1440
1450
  };
1441
1451
  updateHit() {
1442
1452
  if (this.sprite) {
@@ -3729,5 +3739,5 @@ function svgSpinSkin(textures) {
3729
3739
  }
3730
3740
 
3731
3741
  export { AutoplayDrawerView, AutoplayView, ButtonView, ControlView, DialogView, MenuView, OpenUIPixi, ReadoutView, SelectView, SliderView, SpinView, StepperView, TextCellRenderer, ToggleView, TurboView, Tweener, ValueDisplayView, buildBlockColumn, defaultSpinSkin, drawSpin, isDesktop, svgSpinSkin };
3732
- //# sourceMappingURL=chunk-PYXZIGXG.js.map
3733
- //# sourceMappingURL=chunk-PYXZIGXG.js.map
3742
+ //# sourceMappingURL=chunk-BDITXPQ7.js.map
3743
+ //# sourceMappingURL=chunk-BDITXPQ7.js.map