From 75ec9d4f5682822af75c74729744caee41915c19 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Fri, 13 Mar 2026 19:50:19 +0100 Subject: [PATCH] TransformControls: Allow visibility control of plane gizmos. (#33170) --- examples/jsm/controls/TransformControls.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/examples/jsm/controls/TransformControls.js b/examples/jsm/controls/TransformControls.js index 5105c80641c558..98a348452f1086 100644 --- a/examples/jsm/controls/TransformControls.js +++ b/examples/jsm/controls/TransformControls.js @@ -251,6 +251,33 @@ class TransformControls extends Controls { */ defineProperty( 'showZ', true ); + /** + * Whether the xy-plane helper should be visible or not. + * + * @name TransformControls#showXY + * @type {boolean} + * @default true + */ + defineProperty( 'showXY', true ); + + /** + * Whether the yz-plane helper should be visible or not. + * + * @name TransformControls#showYZ + * @type {boolean} + * @default true + */ + defineProperty( 'showYZ', true ); + + /** + * Whether the xz-axis helper should be visible or not. + * + * @name TransformControls#showXZ + * @type {boolean} + * @default true + */ + defineProperty( 'showXZ', true ); + /** * The minimum allowed X position during translation. * @@ -1784,6 +1811,11 @@ class TransformControlsGizmo extends Object3D { handle.visible = handle.visible && ( handle.name.indexOf( 'Z' ) === - 1 || this.showZ ); handle.visible = handle.visible && ( handle.name.indexOf( 'E' ) === - 1 || ( this.showX && this.showY && this.showZ ) ); + // Hide disabled plane helpers + handle.visible = handle.visible && ( handle.name.indexOf( 'XY' ) === - 1 || this.showXY ); + handle.visible = handle.visible && ( handle.name.indexOf( 'YZ' ) === - 1 || this.showYZ ); + handle.visible = handle.visible && ( handle.name.indexOf( 'XZ' ) === - 1 || this.showXZ ); + // highlight selected axis handle.material._color = handle.material._color || handle.material.color.clone();