@@ -33,6 +33,8 @@ const yDir = /* @__PURE__ */ new THREE.Vector3(0, 1, 0)
33
33
const zDir = /* @__PURE__ */ new THREE . Vector3 ( 0 , 0 , 1 )
34
34
35
35
type PivotControlsProps = {
36
+ /** Enables/disables the control, true */
37
+ enabled ?: boolean
36
38
/** Scale of the gizmo, 1 */
37
39
scale ?: number
38
40
/** Width of the gizmo lines, this is a THREE.Line2 prop, 2.5 */
@@ -92,6 +94,7 @@ export const PivotControls: ForwardRefComponent<PivotControlsProps, THREE.Group>
92
94
> (
93
95
(
94
96
{
97
+ enabled = true ,
95
98
matrix,
96
99
onDragStart,
97
100
onDrag,
@@ -256,20 +259,28 @@ export const PivotControls: ForwardRefComponent<PivotControlsProps, THREE.Group>
256
259
< context . Provider value = { config } >
257
260
< group ref = { parentRef } >
258
261
< group ref = { ref } matrix = { matrix } matrixAutoUpdate = { false } { ...props } >
259
- < group visible = { visible } ref = { gizmoRef } position = { offset } rotation = { rotation } >
260
- { ! disableAxes && activeAxes [ 0 ] && < AxisArrow axis = { 0 } direction = { xDir } /> }
261
- { ! disableAxes && activeAxes [ 1 ] && < AxisArrow axis = { 1 } direction = { yDir } /> }
262
- { ! disableAxes && activeAxes [ 2 ] && < AxisArrow axis = { 2 } direction = { zDir } /> }
263
- { ! disableSliders && activeAxes [ 0 ] && activeAxes [ 1 ] && < PlaneSlider axis = { 2 } dir1 = { xDir } dir2 = { yDir } /> }
264
- { ! disableSliders && activeAxes [ 0 ] && activeAxes [ 2 ] && < PlaneSlider axis = { 1 } dir1 = { zDir } dir2 = { xDir } /> }
265
- { ! disableSliders && activeAxes [ 2 ] && activeAxes [ 1 ] && < PlaneSlider axis = { 0 } dir1 = { yDir } dir2 = { zDir } /> }
266
- { ! disableRotations && activeAxes [ 0 ] && activeAxes [ 1 ] && < AxisRotator axis = { 2 } dir1 = { xDir } dir2 = { yDir } /> }
267
- { ! disableRotations && activeAxes [ 0 ] && activeAxes [ 2 ] && < AxisRotator axis = { 1 } dir1 = { zDir } dir2 = { xDir } /> }
268
- { ! disableRotations && activeAxes [ 2 ] && activeAxes [ 1 ] && < AxisRotator axis = { 0 } dir1 = { yDir } dir2 = { zDir } /> }
269
- { ! disableScaling && activeAxes [ 0 ] && < ScalingSphere axis = { 0 } direction = { xDir } /> }
270
- { ! disableScaling && activeAxes [ 1 ] && < ScalingSphere axis = { 1 } direction = { yDir } /> }
271
- { ! disableScaling && activeAxes [ 2 ] && < ScalingSphere axis = { 2 } direction = { zDir } /> }
272
- </ group >
262
+ { enabled && (
263
+ < group visible = { visible } ref = { gizmoRef } position = { offset } rotation = { rotation } >
264
+ { ! disableAxes && activeAxes [ 0 ] && < AxisArrow axis = { 0 } direction = { xDir } /> }
265
+ { ! disableAxes && activeAxes [ 1 ] && < AxisArrow axis = { 1 } direction = { yDir } /> }
266
+ { ! disableAxes && activeAxes [ 2 ] && < AxisArrow axis = { 2 } direction = { zDir } /> }
267
+ { ! disableSliders && activeAxes [ 0 ] && activeAxes [ 1 ] && < PlaneSlider axis = { 2 } dir1 = { xDir } dir2 = { yDir } /> }
268
+ { ! disableSliders && activeAxes [ 0 ] && activeAxes [ 2 ] && < PlaneSlider axis = { 1 } dir1 = { zDir } dir2 = { xDir } /> }
269
+ { ! disableSliders && activeAxes [ 2 ] && activeAxes [ 1 ] && < PlaneSlider axis = { 0 } dir1 = { yDir } dir2 = { zDir } /> }
270
+ { ! disableRotations && activeAxes [ 0 ] && activeAxes [ 1 ] && (
271
+ < AxisRotator axis = { 2 } dir1 = { xDir } dir2 = { yDir } />
272
+ ) }
273
+ { ! disableRotations && activeAxes [ 0 ] && activeAxes [ 2 ] && (
274
+ < AxisRotator axis = { 1 } dir1 = { zDir } dir2 = { xDir } />
275
+ ) }
276
+ { ! disableRotations && activeAxes [ 2 ] && activeAxes [ 1 ] && (
277
+ < AxisRotator axis = { 0 } dir1 = { yDir } dir2 = { zDir } />
278
+ ) }
279
+ { ! disableScaling && activeAxes [ 0 ] && < ScalingSphere axis = { 0 } direction = { xDir } /> }
280
+ { ! disableScaling && activeAxes [ 1 ] && < ScalingSphere axis = { 1 } direction = { yDir } /> }
281
+ { ! disableScaling && activeAxes [ 2 ] && < ScalingSphere axis = { 2 } direction = { zDir } /> }
282
+ </ group >
283
+ ) }
273
284
< group ref = { childrenRef } > { children } </ group >
274
285
</ group >
275
286
</ group >
0 commit comments