minimojs 1.0.0-alpha.26 → 1.0.0-alpha.27
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/minimo-cards.d.ts +4 -0
- package/dist/minimo-cards.js +12 -5
- package/package.json +1 -1
package/dist/minimo-cards.d.ts
CHANGED
|
@@ -242,6 +242,10 @@ export declare class CardPile {
|
|
|
242
242
|
*
|
|
243
243
|
* Call {@link update} once per frame.
|
|
244
244
|
*
|
|
245
|
+
* Piles and cards live in world space and scroll with the game. The table
|
|
246
|
+
* reads the pointer itself and adds `game.scrollX` and `game.scrollY`, so a
|
|
247
|
+
* scrolled board needs no conversion from the game.
|
|
248
|
+
*
|
|
245
249
|
* @example
|
|
246
250
|
* ```ts
|
|
247
251
|
* const table = new CardTable(game, {
|
package/dist/minimo-cards.js
CHANGED
|
@@ -187,6 +187,10 @@ let nextTableId = 1;
|
|
|
187
187
|
*
|
|
188
188
|
* Call {@link update} once per frame.
|
|
189
189
|
*
|
|
190
|
+
* Piles and cards live in world space and scroll with the game. The table
|
|
191
|
+
* reads the pointer itself and adds `game.scrollX` and `game.scrollY`, so a
|
|
192
|
+
* scrolled board needs no conversion from the game.
|
|
193
|
+
*
|
|
190
194
|
* @example
|
|
191
195
|
* ```ts
|
|
192
196
|
* const table = new CardTable(game, {
|
|
@@ -638,12 +642,15 @@ export class CardTable {
|
|
|
638
642
|
this.cancelDrag();
|
|
639
643
|
return;
|
|
640
644
|
}
|
|
645
|
+
// The pointer is in screen space and the piles and cards are in world space.
|
|
641
646
|
const x = game.pointerX;
|
|
642
647
|
const y = game.pointerY;
|
|
648
|
+
const worldX = x + game.scrollX;
|
|
649
|
+
const worldY = y + game.scrollY;
|
|
643
650
|
if (game.isPointerPressed()) {
|
|
644
651
|
this.cancelDrag();
|
|
645
|
-
const hit = this.hitTest(
|
|
646
|
-
this._press = hit ? { x, y, card: hit.card, pile: hit.pile, dragTried: false } : null;
|
|
652
|
+
const hit = this.hitTest(worldX, worldY);
|
|
653
|
+
this._press = hit ? { x, y, worldX, worldY, card: hit.card, pile: hit.pile, dragTried: false } : null;
|
|
647
654
|
return;
|
|
648
655
|
}
|
|
649
656
|
const press = this._press;
|
|
@@ -654,7 +661,7 @@ export class CardTable {
|
|
|
654
661
|
this.startDrag(press);
|
|
655
662
|
}
|
|
656
663
|
if (this._drag)
|
|
657
|
-
this.followPointer(
|
|
664
|
+
this.followPointer(worldX, worldY);
|
|
658
665
|
return;
|
|
659
666
|
}
|
|
660
667
|
this._press = null;
|
|
@@ -718,8 +725,8 @@ export class CardTable {
|
|
|
718
725
|
view.moving = false;
|
|
719
726
|
view.waitMs = 0;
|
|
720
727
|
view.dragging = true;
|
|
721
|
-
view.grabX = press.
|
|
722
|
-
view.grabY = press.
|
|
728
|
+
view.grabX = press.worldX - view.sprite.x;
|
|
729
|
+
view.grabY = press.worldY - view.sprite.y;
|
|
723
730
|
view.sprite.layer = this.layer + 1000 + i * 0.01;
|
|
724
731
|
this.applyScale(view);
|
|
725
732
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minimojs",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.27",
|
|
4
4
|
"description": "MinimoJS v1 — ultra-minimal, flat, deterministic 2D web game engine. Image-first sprites with emoji as a zero-asset alternative, rAF loop, TypeScript-first, LLM-friendly.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/minimo.js",
|