-
Notifications
You must be signed in to change notification settings - Fork 123
/
manipulate.js
31 lines (29 loc) · 961 Bytes
/
manipulate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { viewModes } = require('./viewMode');
const manipulateModes = {
translate: 'translate',
scale: 'scale',
rotate: 'rotate',
};
module.exports = {
refreshManipulateGUI(K3D, GUI) {
GUI.controls.controllers.forEach((controller) => {
if (controller.property === 'manipulateMode') {
controller.domElement.hidden = K3D.parameters.viewMode !== viewModes.manipulate;
controller.updateDisplay();
}
});
},
manipulateGUI(gui, K3D, changeParameters) {
gui.add(K3D.parameters, 'manipulateMode', {
Translate: manipulateModes.translate,
Rotate: manipulateModes.rotate,
Scale: manipulateModes.scale,
}).name('Manipulate mode').onChange(
(mode) => {
K3D.setManipulateMode(mode);
changeParameters('manipulate_mode', mode);
},
);
},
manipulateModes,
};