Просмотр исходного кода

TransformControls: Allow visibility control of plane gizmos. (#33170)

Michael Herzog 1 месяц назад
Родитель
Сommit
75ec9d4f56
1 измененных файлов с 32 добавлено и 0 удалено
  1. 32 0
      examples/jsm/controls/TransformControls.js

+ 32 - 0
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();

粤ICP备19079148号