Added undo button (only one level)
This commit is contained in:
@@ -247,6 +247,16 @@ PointerCamera.prototype.log = function() {
|
||||
console.log("(" + this.target.x + "," + this.target.y + ',' + this.target.z + ')');
|
||||
}
|
||||
|
||||
PointerCamera.prototype.save = function() {
|
||||
this.backup = {};
|
||||
this.backup.position = this.position.clone();
|
||||
this.backup.target = this.target.clone();
|
||||
}
|
||||
|
||||
PointerCamera.prototype.load = function() {
|
||||
this.move(this.backup);
|
||||
}
|
||||
|
||||
// Static members
|
||||
PointerCamera.DISTANCE_X = 1000;
|
||||
PointerCamera.DISTANCE_Z = 300;
|
||||
|
||||
8
static/js/prototype/main.js
vendored
8
static/js/prototype/main.js
vendored
@@ -65,6 +65,10 @@ function init() {
|
||||
showArrows = showarrows.checked;
|
||||
}
|
||||
|
||||
document.getElementById('undo').onclick = function() {
|
||||
cameras.mainCamera().load();
|
||||
}
|
||||
|
||||
// on initialise le moteur de rendu
|
||||
container = document.getElementById('container');
|
||||
container.style.height = container_size.height() + 'px';
|
||||
@@ -474,8 +478,10 @@ function updateMouse(event) {
|
||||
|
||||
function click(event) {
|
||||
var newCamera = pointedCamera(event);
|
||||
if (newCamera !== undefined)
|
||||
if (newCamera !== undefined) {
|
||||
cameras.mainCamera().save();
|
||||
cameras.mainCamera().move(newCamera);
|
||||
}
|
||||
}
|
||||
|
||||
function pointedCamera(event) {
|
||||
|
||||
Reference in New Issue
Block a user