@blorkfield/overlay-core 0.8.2 → 0.8.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/dist/index.cjs CHANGED
@@ -2376,11 +2376,18 @@ var OverlayScene = class {
2376
2376
  for (const body of bodies) {
2377
2377
  const entry = this.findObjectByBody(body);
2378
2378
  if (entry && entry.tags.includes("grabable")) {
2379
+ this.mouse.button = 0;
2380
+ this.mouseConstraint.constraint.pointA = { x: position.x, y: position.y };
2379
2381
  this.mouseConstraint.constraint.bodyB = entry.body;
2380
- this.mouseConstraint.constraint.pointB = {
2381
- x: position.x - entry.body.position.x,
2382
- y: position.y - entry.body.position.y
2383
- };
2382
+ this.mouseConstraint.constraint.pointB = { x: 0, y: 0 };
2383
+ console.log("[overlay-core] startGrab success", {
2384
+ entityId: entry.id,
2385
+ mousePosition: position,
2386
+ bodyPosition: { x: entry.body.position.x, y: entry.body.position.y },
2387
+ constraintPointA: this.mouseConstraint.constraint.pointA,
2388
+ constraintPointB: this.mouseConstraint.constraint.pointB,
2389
+ mouseButton: this.mouse.button
2390
+ });
2384
2391
  return entry.id;
2385
2392
  }
2386
2393
  }
@@ -2393,6 +2400,9 @@ var OverlayScene = class {
2393
2400
  if (this.mouseConstraint) {
2394
2401
  this.mouseConstraint.constraint.bodyB = null;
2395
2402
  }
2403
+ if (this.mouse) {
2404
+ this.mouse.button = -1;
2405
+ }
2396
2406
  }
2397
2407
  /**
2398
2408
  * Get the ID of the currently grabbed object.