pixi-reels 1.0.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # pixi-reels
2
2
 
3
+ ## 1.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#150](https://github.com/schmooky/pixi-reels/pull/150) [`6a96d60`](https://github.com/schmooky/pixi-reels/commit/6a96d603cbc8b9f1b80176268850ad9157177c26) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Fix: buffer-anchored big symbols no longer render empty, and big-symbol blocks no longer jitter, when falling through a tumble cascade. `CascadePlacePhase` now preserves `bufferAbove` target cells, so a "tail-visible" block (anchor above the viewport) keeps its anchor through the animated place path instead of being overwritten with a random symbol and leaving its visible cell empty. The place and drop-in phases now animate each block anchor exactly once instead of once per occupied visible row — previously the duplicate drop tweens fought over the anchor's position (the jitter) and could land it a row off target.
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  ### Major Changes
@@ -2411,18 +2411,26 @@ var te = class extends g {
2411
2411
  let n = (t.delay ?? 0) / 1e3;
2412
2412
  n > 0 ? this._delayedCall = e().delayedCall(n, () => this._doPlace()) : this._doPlace();
2413
2413
  }
2414
+ _placement(e) {
2415
+ let t = this._reel.bufferAbove, n = e.slice(t, t + this._reel.visibleRows);
2416
+ for (let r = 1; r <= t; r++) n[-r] = e[t - r];
2417
+ return n;
2418
+ }
2414
2419
  _doPlace() {
2415
2420
  if (this._delayedCall = null, !this._config) return;
2416
- let e = this._reel, { targetFrame: t, events: n } = this._config, r = t.slice(e.bufferAbove, e.bufferAbove + e.visibleRows);
2417
- e.placeSymbols(r), e.snapToGrid(), e.notifySpinEnd();
2418
- let i = W(e.visibleRows, this._config.winnerRows, { initial: this._config.initial }), a = [];
2419
- for (let t of i) {
2420
- let n = e.getSymbolAt(t.row);
2421
- n.view.visible = !0, n.view.alpha = +(t.offsetRows === 0), a.push(n);
2421
+ let e = this._reel, { targetFrame: t, events: n } = this._config;
2422
+ e.placeSymbols(this._placement(t)), e.snapToGrid(), e.notifySpinEnd();
2423
+ let r = W(e.visibleRows, this._config.winnerRows, { initial: this._config.initial }), i = [], a = /* @__PURE__ */ new Set();
2424
+ for (let t of r) {
2425
+ let n = e.getAnchorRow(t.row);
2426
+ if (n !== t.row && a.has(n)) continue;
2427
+ a.add(n);
2428
+ let r = e.getSymbolAt(t.row);
2429
+ r.view.visible = !0, r.view.alpha = +(t.offsetRows === 0), i.push(r);
2422
2430
  }
2423
2431
  n.emit("cascade:place:end", {
2424
2432
  reelIndex: e.reelIndex,
2425
- placedSymbols: a,
2433
+ placedSymbols: i,
2426
2434
  isInitial: this._config.initial,
2427
2435
  winnerRows: this._config.winnerRows
2428
2436
  }), this._complete();
@@ -2430,8 +2438,8 @@ var te = class extends g {
2430
2438
  update(e) {}
2431
2439
  onSkip() {
2432
2440
  if (this._delayedCall &&= (this._delayedCall.kill(), null), this._config) {
2433
- let e = this._reel, t = this._config.targetFrame.slice(e.bufferAbove, e.bufferAbove + e.visibleRows);
2434
- e.placeSymbols(t);
2441
+ let e = this._reel;
2442
+ e.placeSymbols(this._placement(this._config.targetFrame));
2435
2443
  for (let t = 0; t < e.visibleRows; t++) {
2436
2444
  let n = e.getSymbolAt(t).view;
2437
2445
  n.alpha = 1, n.visible = !0;
@@ -2456,52 +2464,55 @@ var te = class extends g {
2456
2464
  this._drop = U(this._baseDrop, this._speed.tumble?.dropIn), this._skipAbort = new AbortController();
2457
2465
  let c = s === "gravity" ? "cascade:gravity:start" : "cascade:dropIn:start", l = s === "gravity" ? "cascade:gravity:symbol" : "cascade:dropIn:symbol", u = s === "gravity" ? "cascade:gravity:end" : "cascade:dropIn:end";
2458
2466
  this._events = a, this._endEvent = u, a.emit(c, { reelIndex: o });
2459
- let d = W(r, t.winnerRows, { initial: t.initial }), f = [];
2467
+ let d = W(r, t.winnerRows, { initial: t.initial }), f = [], p = /* @__PURE__ */ new Set();
2460
2468
  for (let e of d) {
2461
- let a = n.getSymbolAt(e.row);
2469
+ let a = n.getAnchorRow(e.row);
2470
+ if (a !== e.row && p.has(a)) continue;
2471
+ p.add(a);
2472
+ let o = n.getSymbolAt(e.row);
2462
2473
  if (e.offsetRows === 0) {
2463
- a.view.visible = !0, a.view.alpha = 1;
2474
+ o.view.visible = !0, o.view.alpha = 1;
2464
2475
  continue;
2465
2476
  }
2466
- let o = a.view.y, c;
2477
+ let c = o.view.y, l;
2467
2478
  switch (this._drop.distance) {
2468
2479
  case "auto":
2469
- c = !t.initial && e.originalRow >= 0 ? e.originalRow * i : o - r * i;
2480
+ l = !t.initial && e.originalRow >= 0 ? e.originalRow * i : c - r * i;
2470
2481
  break;
2471
2482
  case "perHole":
2472
- c = e.originalRow * i;
2483
+ l = e.originalRow * i;
2473
2484
  break;
2474
- default: c = o - this._drop.distance;
2485
+ default: l = c - this._drop.distance;
2475
2486
  }
2476
- let l = e.originalRow < 0;
2477
- if (s === "gravity" && l || s === "new" && !l) {
2478
- s === "gravity" && l ? (a.view.alpha = 0, a.view.visible = !0) : s === "new" && !l && (a.view.y = o, a.view.alpha = 1, a.view.visible = !0);
2487
+ let u = e.originalRow < 0;
2488
+ if (s === "gravity" && u || s === "new" && !u) {
2489
+ s === "gravity" && u ? (o.view.alpha = 0, o.view.visible = !0) : s === "new" && !u && (o.view.y = c, o.view.alpha = 1, o.view.visible = !0);
2479
2490
  continue;
2480
2491
  }
2481
- a.view.y = c, a.view.alpha = 1, a.view.visible = !0, f.push({
2492
+ o.view.y = l, o.view.alpha = 1, o.view.visible = !0, f.push({
2482
2493
  row: e.row,
2483
- symbol: a,
2484
- view: a.view,
2485
- startY: c,
2486
- finalY: o,
2494
+ symbol: o,
2495
+ view: o.view,
2496
+ startY: l,
2497
+ finalY: c,
2487
2498
  offsetRows: e.offsetRows
2488
2499
  });
2489
2500
  }
2490
2501
  this._jobs = f;
2491
- let p = () => {
2502
+ let m = () => {
2492
2503
  this._timeline = null, this._jobs = [], a.emit(u, { reelIndex: o }), this._events = null, this._skipAbort = null, s !== "gravity" && n.notifyLanded(), this._complete();
2493
- }, m = this._drop.duration / 1e3, h = this._drop.rowStagger / 1e3;
2494
- if (f.length === 0 || m <= 0) {
2504
+ }, h = this._drop.duration / 1e3, g = this._drop.rowStagger / 1e3;
2505
+ if (f.length === 0 || h <= 0) {
2495
2506
  for (let e of f) e.view.y = e.finalY;
2496
- p();
2507
+ m();
2497
2508
  return;
2498
2509
  }
2499
- let g = e().timeline({ onComplete: p });
2500
- this._timeline = g;
2501
- let _ = this._drop.rowOrder === "bottomToTop";
2510
+ let _ = e().timeline({ onComplete: m });
2511
+ this._timeline = _;
2512
+ let v = this._drop.rowOrder === "bottomToTop";
2502
2513
  for (let e = 0; e < f.length; e++) {
2503
- let t = f[e], n = (_ ? f.length - 1 - e : e) * h;
2504
- g.call(() => {
2514
+ let t = f[e], n = (v ? f.length - 1 - e : e) * g;
2515
+ _.call(() => {
2505
2516
  let e = this._skipAbort?.signal;
2506
2517
  e && a.emit(l, {
2507
2518
  symbol: t.symbol,
@@ -2513,9 +2524,9 @@ var te = class extends g {
2513
2524
  offsetRows: t.offsetRows,
2514
2525
  signal: e
2515
2526
  });
2516
- }, void 0, n), g.to(t.view, {
2527
+ }, void 0, n), _.to(t.view, {
2517
2528
  y: t.finalY,
2518
- duration: m,
2529
+ duration: h,
2519
2530
  ease: this._drop.ease
2520
2531
  }, n);
2521
2532
  }
@@ -2959,4 +2970,4 @@ function oe(e, t) {
2959
2970
  //#endregion
2960
2971
  export { h as C, a as D, c as E, p as S, f as T, O as _, Q as a, x as b, ie as c, P as d, N as f, k as g, A as h, oe as i, W as l, j as m, K as n, X as o, M as p, G as r, Z as s, $ as t, L as u, D as v, m as w, g as x, S as y };
2961
2972
 
2962
- //# sourceMappingURL=debug-BeY8_ibp.js.map
2973
+ //# sourceMappingURL=debug-BxFw0a7S.js.map