Fix to avoid objects to move when the gizmo dragging point is clicked (#8334)

This commit is contained in:
D8H
2026-02-27 10:33:11 +01:00
committed by GitHub
parent 1d1c11bfa6
commit 7371537737
4 changed files with 23 additions and 15 deletions
+4 -6
View File
@@ -148,8 +148,8 @@ namespace gdjs {
const topOrMiddleOrBottom = position.toLowerCase().includes('top')
? 'top'
: position.toLowerCase().includes('middle')
? 'middle'
: 'bottom';
? 'middle'
: 'bottom';
const containerPositionStyle: AbsolutePositionStyle = {};
const messageContainerPositionStyle: AbsolutePositionStyle = {};
@@ -200,10 +200,8 @@ namespace gdjs {
const messageContent = document.createElement('div');
messageContent.innerHTML = nmd(message);
const {
containerPositionStyle,
messageContainerPositionStyle,
} = _getPositioningStyle(position);
const { containerPositionStyle, messageContainerPositionStyle } =
_getPositioningStyle(position);
_loadFonts();
_loadStyleSheet();
+13 -4
View File
@@ -624,8 +624,9 @@ namespace gdjs {
}
class ObjectMover {
editor: InGameEditor;
_changeHappened = false;
private editor: InGameEditor;
private _changeHappened = false;
private startTime = 0;
constructor(editor: InGameEditor) {
this.editor = editor;
@@ -649,6 +650,7 @@ namespace gdjs {
startMove() {
this._changeHappened = false;
this._objectInitialPositions.clear();
this.startTime = Date.now();
}
endMove(): boolean {
@@ -672,6 +674,10 @@ namespace gdjs {
scaleZ: float;
}
) {
if (Date.now() - this.startTime < 200) {
// Avoid miss-clicks gizmo dragging point to change object positions.
return;
}
selectedObjects.forEach((object) => {
if (this.editor.isInstanceLocked(object)) {
return;
@@ -2419,8 +2425,11 @@ namespace gdjs {
// Update the rotation snap.
const inputManager = this._runtimeGame.getInputManager();
const shouldSnap =
this._transformControlsMode === 'rotate' && isAltPressed(inputManager);
const rotationSnap = shouldSnap ? gdjs.toRad(ROTATION_SNAP_DEGREES) : null;
this._transformControlsMode === 'rotate' &&
isAltPressed(inputManager);
const rotationSnap = shouldSnap
? gdjs.toRad(ROTATION_SNAP_DEGREES)
: null;
threeTransformControls.setRotationSnap(rotationSnap);
@@ -115,9 +115,10 @@ namespace gdjs {
}
if (this._uncaughtException) {
const errorIsInJs = gdjs.AbstractDebuggerClient.isErrorComingFromJavaScriptCode(
this._uncaughtException
);
const errorIsInJs =
gdjs.AbstractDebuggerClient.isErrorComingFromJavaScriptCode(
this._uncaughtException
);
this._uncaughtExceptionElement = (
<div style={styles.errorContainer}>
<button
+2 -2
View File
@@ -29,8 +29,8 @@
"check-types": "tsc",
"build": "node scripts/build.js",
"test": "cd tests && npm run test-benchmark",
"format": "prettier --write \"Runtime/**/*.ts\" \"../Extensions/**/*.ts\" \"../Extensions/**/JsExtension.js\" \"../Extensions/**/*.spec.js\"",
"check-format": "prettier --list-different \"Runtime/**/*.ts\" \"../Extensions/**/*.ts\" \"../Extensions/**/JsExtension.js\" \"../Extensions/**/*.spec.js\"",
"format": "prettier --write \"Runtime/**/*.ts\" \"Runtime/**/*.tsx\" \"../Extensions/**/*.ts\" \"../Extensions/**/JsExtension.js\" \"../Extensions/**/*.spec.js\"",
"check-format": "prettier --list-different \"Runtime/**/*.ts\" \"Runtime/**/*.tsx\" \"../Extensions/**/*.ts\" \"../Extensions/**/JsExtension.js\" \"../Extensions/**/*.spec.js\"",
"generate-doc": "typedoc --options docs/typedoc.json --plugin typedoc-plugin-reference-excluder"
}
}