|
|
@@ -115,11 +115,26 @@ editor.prepare = function() { |
|
|
|
}; |
|
|
|
|
|
|
|
editor.onKey = function(evt) { |
|
|
|
console.log(evt.keyCode); |
|
|
|
if (evt.keyCode === 32) { |
|
|
|
editor.setOrientation((editor.orientation + 1) % 3); |
|
|
|
editor.gridTimeOut = 0; |
|
|
|
} |
|
|
|
if (evt.keyCode === 46 || evt.keyCode === 68) { |
|
|
|
if (evt.keyCode === 38) { |
|
|
|
editor.moveGridNormal(1); |
|
|
|
editor.gridTimeOut = 0; |
|
|
|
} |
|
|
|
if (evt.keyCode === 40) { |
|
|
|
editor.moveGridNormal(-1); |
|
|
|
editor.gridTimeOut = 0; |
|
|
|
} |
|
|
|
if (evt.keyCode === 46) { |
|
|
|
editor.deleteNode(); |
|
|
|
editor.gridTimeOut = 0; |
|
|
|
} |
|
|
|
if (evt.keyCode === 67) { |
|
|
|
materials.curveProperties.splineDensity = materials.curveProperties.splineDensity == 10 ? 0 : 10; |
|
|
|
gui.render(); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@@ -134,6 +149,17 @@ editor.setOrientation = function(orientation) { |
|
|
|
gui.render(); |
|
|
|
}; |
|
|
|
|
|
|
|
editor.moveGridNormal = function(delta) { |
|
|
|
var orientation = editor.orientation; |
|
|
|
var rotation = editor.orientations[orientation]; |
|
|
|
var normal = new THREE.Vector3(0, 1, 0); |
|
|
|
normal.applyEuler(rotation); |
|
|
|
editor.grid.position.addScaledVector(normal, delta); |
|
|
|
editor.plane = new THREE.Plane(); |
|
|
|
editor.plane.setFromNormalAndCoplanarPoint(normal, editor.grid.position); |
|
|
|
gui.render(); |
|
|
|
}; |
|
|
|
|
|
|
|
editor.makeGrid = function() { |
|
|
|
editor.grid = new THREE.GridHelper(10, 1); |
|
|
|
editor.grid.setColors(0xbbbbbb, 0xeeeeee); |
|
|
|