File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed
docs/examples/en/controls Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,36 @@ <h3>[property:Number translationSnap]</h3>
132
132
steps the 3D object should be translated. Default is `null`.
133
133
</ p >
134
134
135
+ < h3 > [property:Number minX]</ h3 >
136
+ < p >
137
+ The minimum allowed X position during translation. Default is `-Infinity`.
138
+ </ p >
139
+
140
+ < h3 > [property:Number maxX]</ h3 >
141
+ < p >
142
+ The maximum allowed X position during translation. Default is `Infinity`.
143
+ </ p >
144
+
145
+ < h3 > [property:Number minY]</ h3 >
146
+ < p >
147
+ The minimum allowed Y position during translation. Default is `-Infinity`.
148
+ </ p >
149
+
150
+ < h3 > [property:Number maxY]</ h3 >
151
+ < p >
152
+ The maximum allowed Y position during translation. Default is `Infinity`.
153
+ </ p >
154
+
155
+ < h3 > [property:Number minZ]</ h3 >
156
+ < p >
157
+ The minimum allowed Z position during translation. Default is `-Infinity`.
158
+ </ p >
159
+
160
+ < h3 > [property:Number maxZ]</ h3 >
161
+ < p >
162
+ The maximum allowed Z position during translation. Default is `Infinity`.
163
+ </ p >
164
+
135
165
< h2 > Methods</ h2 >
136
166
137
167
< p > See the base [page:Controls] class for common methods.</ p >
Original file line number Diff line number Diff line change @@ -110,6 +110,12 @@ class TransformControls extends Controls {
110
110
defineProperty ( 'showX' , true ) ;
111
111
defineProperty ( 'showY' , true ) ;
112
112
defineProperty ( 'showZ' , true ) ;
113
+ defineProperty ( 'minX' , - Infinity ) ;
114
+ defineProperty ( 'maxX' , Infinity ) ;
115
+ defineProperty ( 'minY' , - Infinity ) ;
116
+ defineProperty ( 'maxY' , Infinity ) ;
117
+ defineProperty ( 'minZ' , - Infinity ) ;
118
+ defineProperty ( 'maxZ' , Infinity ) ;
113
119
114
120
// Reusable utility variables
115
121
@@ -372,6 +378,10 @@ class TransformControls extends Controls {
372
378
373
379
}
374
380
381
+ object . position . x = Math . max ( this . minX , Math . min ( this . maxX , object . position . x ) ) ;
382
+ object . position . y = Math . max ( this . minY , Math . min ( this . maxY , object . position . y ) ) ;
383
+ object . position . z = Math . max ( this . minZ , Math . min ( this . maxZ , object . position . z ) ) ;
384
+
375
385
} else if ( mode === 'scale' ) {
376
386
377
387
if ( axis . search ( 'XYZ' ) !== - 1 ) {
You can’t perform that action at this time.
0 commit comments