From e4539cfde5f005bb44fabf44a1d47b58eaaf4c38 Mon Sep 17 00:00:00 2001 From: "h.hajji" Date: Fri, 16 Aug 2024 18:08:45 +0100 Subject: [PATCH] [#1631] fire events when position/scale/rotation are set --- src/viewer/scene/mesh/Mesh.js | 3 +++ src/viewer/scene/model/SceneModel.js | 2 ++ src/viewer/scene/nodes/Node.js | 3 +++ 3 files changed, 8 insertions(+) diff --git a/src/viewer/scene/mesh/Mesh.js b/src/viewer/scene/mesh/Mesh.js index 92a16b0a8d..46a8a53319 100644 --- a/src/viewer/scene/mesh/Mesh.js +++ b/src/viewer/scene/mesh/Mesh.js @@ -439,6 +439,7 @@ class Mesh extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("position", this._position); } /** @@ -465,6 +466,7 @@ class Mesh extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("rotation", this._rotation); } /** @@ -516,6 +518,7 @@ class Mesh extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("scale", this._scale); } /** diff --git a/src/viewer/scene/model/SceneModel.js b/src/viewer/scene/model/SceneModel.js index d64d8c0c9b..de294e3b9a 100644 --- a/src/viewer/scene/model/SceneModel.js +++ b/src/viewer/scene/model/SceneModel.js @@ -1464,6 +1464,7 @@ export class SceneModel extends Component { this._setWorldMatrixDirty(); this._sceneModelDirty(); this.glRedraw(); + this.fire("position", this._position); } /** @@ -1490,6 +1491,7 @@ export class SceneModel extends Component { this._setWorldMatrixDirty(); this._sceneModelDirty(); this.glRedraw(); + this.fire("rotation", this._rotation); } /** diff --git a/src/viewer/scene/nodes/Node.js b/src/viewer/scene/nodes/Node.js index 846fa939ae..ae023e163c 100644 --- a/src/viewer/scene/nodes/Node.js +++ b/src/viewer/scene/nodes/Node.js @@ -1076,6 +1076,7 @@ class Node extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("position", this._position); } /** @@ -1102,6 +1103,7 @@ class Node extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("rotation", this._rotation); } /** @@ -1153,6 +1155,7 @@ class Node extends Component { this._setLocalMatrixDirty(); this._setAABBDirty(); this.glRedraw(); + this.fire("scale", this._scale); } /**