@@ -5,11 +5,18 @@ import { computeHandlesScale } from '../utils.js'
5
5
import { FreeScaleHandle } from './free.js'
6
6
import { AxisScaleHandle } from './axis.js'
7
7
import { PlaneScaleHandle } from './plane.js'
8
+ import { UniformAxisScaleHandle } from './uniform.js'
8
9
9
10
const vectorHelper = new Vector3 ( )
10
11
11
12
export class ScaleHandles extends Group {
12
- private readonly free : FreeScaleHandle
13
+ private readonly scaleX : UniformAxisScaleHandle
14
+ private readonly scaleY : UniformAxisScaleHandle
15
+ private readonly scaleZ : UniformAxisScaleHandle
16
+ private readonly scaleNegX : UniformAxisScaleHandle
17
+ private readonly scaleNegY : UniformAxisScaleHandle
18
+ private readonly scaleNegZ : UniformAxisScaleHandle
19
+
13
20
private readonly translationX : AxisScaleHandle
14
21
private readonly translationY : AxisScaleHandle
15
22
private readonly translationZ : AxisScaleHandle
@@ -26,8 +33,22 @@ export class ScaleHandles extends Group {
26
33
public fixed ?: boolean ,
27
34
) {
28
35
super ( )
29
- this . free = new FreeScaleHandle ( this . context )
30
- this . add ( this . free )
36
+ this . scaleX = new UniformAxisScaleHandle ( this . context , undefined , 'x' )
37
+ this . add ( this . scaleX )
38
+ this . scaleY = new UniformAxisScaleHandle ( this . context , undefined , 'y' )
39
+ this . scaleY . rotation . z = Math . PI / 2
40
+ this . add ( this . scaleY )
41
+ this . scaleZ = new UniformAxisScaleHandle ( this . context , undefined , 'z' )
42
+ this . scaleZ . rotation . y = - Math . PI / 2
43
+ this . add ( this . scaleZ )
44
+ this . scaleNegX = new UniformAxisScaleHandle ( this . context , undefined , 'x' , true )
45
+ this . add ( this . scaleNegX )
46
+ this . scaleNegY = new UniformAxisScaleHandle ( this . context , undefined , 'y' , true )
47
+ this . scaleNegY . rotation . z = Math . PI / 2
48
+ this . add ( this . scaleNegY )
49
+ this . scaleNegZ = new UniformAxisScaleHandle ( this . context , undefined , 'z' , true )
50
+ this . scaleNegZ . rotation . y = - Math . PI / 2
51
+ this . add ( this . scaleNegZ )
31
52
this . translationX = new AxisScaleHandle ( this . context , 'x' )
32
53
this . add ( this . translationX )
33
54
this . translationY = new AxisScaleHandle ( this . context , 'y' )
@@ -66,6 +87,13 @@ export class ScaleHandles extends Group {
66
87
}
67
88
68
89
bind ( options ?: HandlesProperties ) {
90
+ const unbindScaleX = this . scaleX . bind ( 0xffffff , 0xffff00 , options )
91
+ const unbindScaleY = this . scaleY . bind ( 0xffffff , 0xffff00 , options )
92
+ const unbindScaleZ = this . scaleZ . bind ( 0xffffff , 0xffff00 , options )
93
+ const unbindScaleNegX = this . scaleNegX . bind ( 0xffffff , 0xffff00 , options )
94
+ const unbindScaleNegY = this . scaleNegY . bind ( 0xffffff , 0xffff00 , options )
95
+ const unbindScaleNegZ = this . scaleNegZ . bind ( 0xffffff , 0xffff00 , options )
96
+
69
97
const unbindTranslationX = this . translationX . bind ( 0xff0000 , 0xffff00 , options )
70
98
const unbindTranslationY = this . translationY . bind ( 0x00ff00 , 0xffff00 , options )
71
99
const unbindTranslationZ = this . translationZ . bind ( 0x0000ff , 0xffff00 , options )
@@ -75,7 +103,6 @@ export class ScaleHandles extends Group {
75
103
const unbindTranslationXY = this . translationXY . bind ( 0x0000ff , 0xffff00 , options )
76
104
const unbindTranslationYZ = this . translationYZ . bind ( 0xff0000 , 0xffff00 , options )
77
105
const unbindTranslationXZ = this . translationXZ . bind ( 0x00ff00 , 0xffff00 , options )
78
- const unbindFree = this . free . bind ( options )
79
106
80
107
return ( ) => {
81
108
unbindTranslationX ?.( )
@@ -87,7 +114,12 @@ export class ScaleHandles extends Group {
87
114
unbindTranslationXY ?.( )
88
115
unbindTranslationYZ ?.( )
89
116
unbindTranslationXZ ?.( )
90
- unbindFree ?.( )
117
+ unbindScaleX ?.( )
118
+ unbindScaleY ?.( )
119
+ unbindScaleZ ?.( )
120
+ unbindScaleNegX ?.( )
121
+ unbindScaleNegY ?.( )
122
+ unbindScaleNegZ ?.( )
91
123
}
92
124
}
93
125
}
0 commit comments