Skip to content

Commit 2e3af77

Browse files
cursoragent4ian
andcommitted
Disable transform controls on multiple touches
Co-authored-by: florian <[email protected]>
1 parent c629ba9 commit 2e3af77

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

GDJS/Runtime/InGameEditor/InGameEditor.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,15 @@ namespace gdjs {
21782178
const touchIds = getCurrentTouchIdentifiers(inputManager);
21792179
const hasMultipleTouches = touchIds.length >= 2;
21802180

2181+
// Disable the transform controls when there are multiple touches to prevent
2182+
// accidental gizmo interactions when doing pinch-to-zoom or other multi-touch gestures.
2183+
// This must be done before checking if controls should be hidden, as the TransformControls
2184+
// processes pointer events independently and could start dragging between frames.
2185+
if (this._selectionControls) {
2186+
this._selectionControls.threeTransformControls.enabled =
2187+
!hasMultipleTouches;
2188+
}
2189+
21812190
// Selection controls are shown on the last object that can be manipulated
21822191
// (and if none, selection controls are not shown).
21832192
const lastEditableSelectedObject = this._selection.getLastSelectedObject({

0 commit comments

Comments
 (0)