@energy8platform/shell 0.11.2 → 0.11.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@energy8platform/shell",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Energy8 branded game shell — one logic core, pluggable html/pixi renderers behind a stable contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
@@ -884,7 +884,7 @@ const D = {
884
884
  * supported, the disclaimer is translated and displayed in each language").
885
885
  *
886
886
  * Brand-free by construction. Stake's own template ends with a seventh line — "TM and © {year}
887
- * Stake Engine." — and that one belongs to a Stake launch alone: it arrives with the Stake bridge's
887
+ * Engine." — and that one belongs to a Stake launch alone: it arrives with the Stake bridge's
888
888
  * `INIT.config.disclaimerLines`, which outrank this default, and renders verbatim (see the host's
889
889
  * `isBrandLine`). Every other platform gets the same mandated wording without someone else's mark.
890
890
  */
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
2
2
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
3
- export const PACKAGE_VERSION = '0.11.2';
3
+ export const PACKAGE_VERSION = '0.11.4';
@@ -81,6 +81,9 @@ class BuyBonusOverlay extends Container implements ShellLayer {
81
81
  private dragFrom = 0;
82
82
  private dragBase = 0;
83
83
  private dragged = false; // a tap that actually moved → suppress the card select
84
+ // The wheel is a canvas listener, not a Pixi event: Pixi's federated events don't carry `wheel`.
85
+ private canvas?: HTMLCanvasElement;
86
+ private wheelHandler?: (e: WheelEvent) => void;
84
87
 
85
88
  constructor(host: PixiComponentContext, bonuses: BonusOption[]) {
86
89
  super();
@@ -97,6 +100,43 @@ class BuyBonusOverlay extends Container implements ShellLayer {
97
100
  this.on('pointerup', this.onDragUp);
98
101
  this.on('pointerupoutside', this.onDragUp);
99
102
  this.resize(host.screenW, host.screenH);
103
+ // Stake asked for this band to be "scrollable, not only draggable": on a Popout S frame the
104
+ // cards stack past the bottom, and a drag was the only way to reach the last one. Every other
105
+ // scroll region in this shell (ScrollBox) already takes the wheel; this strip rolls its own
106
+ // scroll, so it needs its own listener.
107
+ if (host.canvas) {
108
+ this.canvas = host.canvas;
109
+ this.wheelHandler = (e: WheelEvent) => {
110
+ // Swallowed whether or not we scroll: on Stake the game is an iframe, and a wheel this
111
+ // overlay ignores scrolls the casino page behind it (same rule as ScrollBox).
112
+ e.preventDefault();
113
+ if (this.confirm) return; // the confirm card is on top — don't move the strip beneath it
114
+ // A mouse reports deltaY on either layout; a trackpad swipe across the horizontal row
115
+ // reports deltaX. Take whichever axis the gesture actually favoured.
116
+ this.scrollBy(Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY);
117
+ };
118
+ this.canvas.addEventListener('wheel', this.wheelHandler, { passive: false });
119
+ }
120
+ }
121
+
122
+ /** Move the card band `delta` px along its scroll axis, clamped to the drag's own range. The
123
+ * wheel's entry point; the drag writes `dragX` straight from the pointer delta. */
124
+ private scrollBy(delta: number): void {
125
+ if (this.destroyed || this.dragMax <= 0) return;
126
+ const next = clamp(-this.dragMax, this.dragX - delta, 0);
127
+ if (next === this.dragX) return;
128
+ this.dragX = next;
129
+ if (this.dragAxis === 'x') this.strip.position.x = this.dragBaseX + this.dragX;
130
+ else this.strip.position.y = this.dragBaseY + this.dragX;
131
+ this.syncScrollCue();
132
+ }
133
+
134
+ /** Drop the canvas listener. Called from both onRemove (the normal close) and destroy, so a
135
+ * layer torn down without onRemove can't leave a handler swallowing every wheel on the page. */
136
+ private detachWheel(): void {
137
+ if (this.canvas && this.wheelHandler) this.canvas.removeEventListener('wheel', this.wheelHandler);
138
+ this.wheelHandler = undefined;
139
+ this.canvas = undefined;
100
140
  }
101
141
 
102
142
  private onDragDown = (e: FederatedPointerEvent): void => {
@@ -593,7 +633,12 @@ class BuyBonusOverlay extends Container implements ShellLayer {
593
633
  /* cards already sized to the area */
594
634
  }
595
635
  onRemove(): void {
596
- /* nothing extra */
636
+ this.detachWheel();
637
+ }
638
+
639
+ destroy(options?: Parameters<Container['destroy']>[0]): void {
640
+ this.detachWheel();
641
+ super.destroy(options);
597
642
  }
598
643
  }
599
644