@@ -10,16 +10,15 @@ import {
1010 Circle ,
1111 Sphere ,
1212 Registry ,
13- Parameter ,
1413 ZeaPointerEvent ,
1514 ZeaMouseEvent ,
1615 ZeaTouchEvent ,
17- XRControllerEvent ,
1816} from '@zeainc/zea-engine'
19- import { BaseAxialRotationHandle } from './BaseAxialRotationHandle '
17+ import { Handle } from './Handle '
2018import ParameterValueChange from '../UndoRedo/Changes/ParameterValueChange'
2119import './Shaders/HandleShader'
2220import UndoRedoManager from '../UndoRedo/UndoRedoManager'
21+ import { Change } from '../UndoRedo/Change'
2322
2423/**
2524 * Class representing a slider scene widget with an arc shape. There are two parts in this widget, the slider and the handle.<br>
@@ -35,17 +34,22 @@ import UndoRedoManager from '../UndoRedo/UndoRedoManager'
3534 * * **dragStart:** Triggered when the pointer is down.
3635 * * **dragEnd:** Triggered when the pointer is released.
3736 *
38- * @extends BaseAxialRotationHandle
37+ * @extends Handle
3938 */
40- class ArcSlider extends BaseAxialRotationHandle {
39+ class ArcSlider extends Handle {
40+ param : XfoParameter | NumberParameter
4141 arcRadiusParam : NumberParameter
4242 arcAngleParam : NumberParameter
4343 handleRadiusParam : NumberParameter
44- handleMat : Material
45- handle : GeomItem
46- arc : GeomItem
47- handleXfo = new Xfo ( )
48- handleGeomOffsetXfo = new Xfo ( )
44+ range : Array < number >
45+ private handleMat : Material
46+ private handle : GeomItem
47+ private arc : GeomItem
48+ private baseXfo : Xfo
49+ private handleXfo = new Xfo ( )
50+ private vec0 : Vec3
51+ private change : Change
52+ private handleGeomOffsetXfo = new Xfo ( )
4953
5054 /**
5155 * Creates an instance of ArcSlider.
@@ -81,27 +85,27 @@ class ArcSlider extends BaseAxialRotationHandle {
8185 this . handle . geomOffsetXfoParam . value = this . handleGeomOffsetXfo
8286
8387 // this.barRadiusParam.on('valueChanged', () => {
84- // arcGeom.radiusParam.value = this.barRadiusParam.getValue() ;
88+ // arcGeom.radiusParam.value = this.barRadiusParam.value ;
8589 // });
8690
8791 this . range = [ 0 , arcAngle ]
8892 this . arcAngleParam . on ( 'valueChanged' , ( ) => {
89- const arcAngle = this . arcAngleParam . getValue ( )
93+ const arcAngle = this . arcAngleParam . value
9094 arcGeom . angleParam . value = arcAngle
9195 this . range = [ 0 , arcAngle ]
9296 } )
9397 this . arcRadiusParam . on ( 'valueChanged' , ( ) => {
94- const arcRadius = this . arcRadiusParam . getValue ( )
98+ const arcRadius = this . arcRadiusParam . value
9599 arcGeom . radiusParam . value = arcRadius
96100 this . handleGeomOffsetXfo . tr . x = arcRadius
97101 this . handle . geomOffsetXfoParam . value = this . handleGeomOffsetXfo
98102 } )
99103 this . handleRadiusParam . on ( 'valueChanged' , ( ) => {
100- handleGeom . radiusParam . value = this . handleRadiusParam . getValue ( )
104+ handleGeom . radiusParam . value = this . handleRadiusParam . value
101105 } )
102106
103107 this . colorParam . on ( 'valueChanged' , ( ) => {
104- this . handleMat . getParameter ( 'BaseColor' ) . value = this . colorParam . getValue ( )
108+ this . handleMat . getParameter ( 'BaseColor' ) . value = this . colorParam . value
105109 } )
106110
107111 this . addChild ( this . handle )
@@ -149,34 +153,21 @@ class ArcSlider extends BaseAxialRotationHandle {
149153 */
150154 highlight ( ) : void {
151155 super . highlight ( )
152- this . handleMat . getParameter ( 'BaseColor' ) . value = this . highlightColorParam . getValue ( )
156+ this . handleMat . getParameter ( 'BaseColor' ) . value = this . highlightColorParam . value
153157 }
154158
155159 /**
156160 * Removes the shining shader from the handle.
157161 */
158162 unhighlight ( ) : void {
159163 super . unhighlight ( )
160- this . handleMat . getParameter ( 'BaseColor' ) . value = this . colorParam . getValue ( )
164+ this . handleMat . getParameter ( 'BaseColor' ) . value = this . colorParam . value
161165 }
162166
163- // /**
164- // * The setTargetParam method.
165- // * @param param - The param param.
166- // */
167- // setTargetParam(param) {
168- // this.param = param;
169- // const __updateSlider = () => {
170- // this.__updateSlider(param.getValue());
171- // };
172- // __updateSlider();
173- // param.on('valueChanged', __updateSlider);
174- // }
175-
176167 /**
177168 * Sets global xfo target parameter
178169 *
179- * @param param - The param param.
170+ * @param param - The parameter that will be modified during manipulation
180171 * @param track - The track param.
181172 */
182173 setTargetParam ( param : XfoParameter | NumberParameter , track = true ) : void {
@@ -190,7 +181,7 @@ class ArcSlider extends BaseAxialRotationHandle {
190181 param . on ( 'valueChanged' , __updateGizmo )
191182 } else if ( this . param instanceof NumberParameter ) {
192183 const __updateGizmo = ( ) => {
193- this . handleXfo . ori . setFromAxisAndAngle ( new Vec3 ( 0 , 0 , 1 ) , < number > param . getValue ( ) )
184+ this . handleXfo . ori . setFromAxisAndAngle ( new Vec3 ( 0 , 0 , 1 ) , < number > param . value )
194185 this . handle . globalXfoParam . value = this . handleXfo
195186 }
196187 __updateGizmo ( )
@@ -205,7 +196,7 @@ class ArcSlider extends BaseAxialRotationHandle {
205196 // const range =
206197 // this.param && this.param.getRange() ? this.param.getRange() : [0, 1];
207198 // const v = Math.remap(value, range[0], range[1], 0, 1);
208- // const length = this.arcAngleParam.getValue() ;
199+ // const length = this.arcAngleParam.value ;
209200 // this.handleXfo.ori.setFromAxisAndAngle(this.axis, ) = v * length;
210201 // this.handle.localXfoParam.value = this.handleXfo;
211202 // }
@@ -230,10 +221,10 @@ class ArcSlider extends BaseAxialRotationHandle {
230221 onDragStart ( event : ZeaPointerEvent ) : void {
231222 this . baseXfo = this . globalXfoParam . value . clone ( )
232223 this . baseXfo . sc . set ( 1 , 1 , 1 )
233- // this.offsetXfo = this.baseXfo.inverse().multiply(this.param.getValue() );
224+ // this.offsetXfo = this.baseXfo.inverse().multiply(this.param.value );
234225
235226 this . vec0 = this . globalXfoParam . value . ori . getXaxis ( )
236- // this.grabCircleRadius = this.arcRadiusParam.getValue() ;
227+ // this.grabCircleRadius = this.arcRadiusParam.value ;
237228 this . vec0 . normalizeInPlace ( )
238229
239230 this . change = new ParameterValueChange ( this . param )
0 commit comments