mage-engine 3.24.6 → 3.24.8

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.
Files changed (2) hide show
  1. package/dist/mage.js +24 -2
  2. package/package.json +1 -1
package/dist/mage.js CHANGED
@@ -58179,7 +58179,7 @@ function applyMiddleware() {
58179
58179
 
58180
58180
  var thunk = createThunkMiddleware();
58181
58181
  thunk.withExtraArgument = createThunkMiddleware;var name = "mage-engine";
58182
- var version$1 = "3.24.6";
58182
+ var version$1 = "3.24.8";
58183
58183
  var description = "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.";
58184
58184
  var main = "dist/mage.js";
58185
58185
  var author$1 = {
@@ -63384,6 +63384,19 @@ let Sprite = /*#__PURE__*/function (_Element) {
63384
63384
  key: "toJSON",
63385
63385
  value: function toJSON(parseJSON = false) {
63386
63386
  if (this.isSerializable()) {
63387
+ // Sync position from holder before serializing to ensure the
63388
+ // serialized position matches the holder (which the user drags).
63389
+ // Without this, the camera body can lag the holder by one frame.
63390
+ if (this.hasHolder()) {
63391
+ const holderBody = this.holder.getBody();
63392
+ this.setPosition({
63393
+ x: holderBody.position.x,
63394
+ y: holderBody.position.y,
63395
+ z: holderBody.position.z
63396
+ }, {
63397
+ updateHolder: false
63398
+ });
63399
+ }
63387
63400
  return {
63388
63401
  ..._superPropGet(Camera, "toJSON", this, 3)([parseJSON]),
63389
63402
  fov: this.getFov(),
@@ -92560,7 +92573,8 @@ const AVAILABLE_CONTROLS = Object.keys(CONTROLS);var controls_contants=/*#__PURE
92560
92573
  const CONTROL_EVENTS = {
92561
92574
  TRANSFORM: {
92562
92575
  CHANGE: `${CONTROLS.TRANSFORM}:CHANGE`,
92563
- DRAGGING_CHANGE: `${CONTROLS.TRANSFORM}:DRAGGING_CHANGE`
92576
+ DRAGGING_CHANGE: `${CONTROLS.TRANSFORM}:DRAGGING_CHANGE`,
92577
+ DRAG_END: `${CONTROLS.TRANSFORM}:DRAG_END`
92564
92578
  }
92565
92579
  };
92566
92580
  let Controls = /*#__PURE__*/function (_EventDispatcher) {
@@ -92665,6 +92679,14 @@ let Controls = /*#__PURE__*/function (_EventDispatcher) {
92665
92679
  this.controls[CONTROLS.ORBIT].enabled = !event.value;
92666
92680
  }
92667
92681
  });
92682
+
92683
+ // Dispatch a dedicated drag-end event when the transform interaction finishes
92684
+ control.addEventListener("mouseUp", () => {
92685
+ this.dispatchEvent({
92686
+ type: CONTROL_EVENTS.TRANSFORM.DRAG_END,
92687
+ element: Universe$1.find(control.object)
92688
+ });
92689
+ });
92668
92690
  this.controls[CONTROLS.TRANSFORM] = control;
92669
92691
  return this.controls[CONTROLS.TRANSFORM];
92670
92692
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mage-engine",
3
- "version": "3.24.6",
3
+ "version": "3.24.8",
4
4
  "description": "A WebGL Javascript Game Engine, built on top of THREE.js and many other libraries.",
5
5
  "main": "dist/mage.js",
6
6
  "author": {