mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 00:59:56 +02:00
Add undo/redo for move
This commit is contained in:
parent
922b712b35
commit
d718ea6928
1 changed files with 20 additions and 0 deletions
|
@ -29,6 +29,8 @@ Selection = function (side) {
|
|||
scaleOrientation,
|
||||
scaleRootOffset,
|
||||
scaleRootOrientation,
|
||||
startPosition,
|
||||
startOrientation,
|
||||
ENTITY_TYPE = "entity",
|
||||
ENTITY_TYPES_WITH_COLOR = ["Box", "Sphere", "Shape", "PolyLine", "PolyVox"],
|
||||
ENTITY_TYPES_2D = ["Text", "Web"];
|
||||
|
@ -227,6 +229,10 @@ Selection = function (side) {
|
|||
function startEditing() {
|
||||
var i;
|
||||
|
||||
// Remember start properties for history entry.
|
||||
startPosition = selection[0].position;
|
||||
startOrientation = selection[0].rotation;
|
||||
|
||||
// Disable entity set's physics.
|
||||
//for (i = 0, count = selection.length; i < count; i += 1) {
|
||||
for (i = selection.length - 1; i >= 0; i -= 1) {
|
||||
|
@ -254,6 +260,20 @@ Selection = function (side) {
|
|||
});
|
||||
}
|
||||
|
||||
// Add history entry.
|
||||
History.push(
|
||||
{
|
||||
setProperties: [
|
||||
{ entityID: rootEntityID, properties: { position: startPosition, rotation: startOrientation } }
|
||||
]
|
||||
},
|
||||
{
|
||||
setProperties: [
|
||||
{ entityID: rootEntityID, properties: { position: rootPosition, rotation: rootOrientation } }
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
// Kick off physics if necessary.
|
||||
if (selection.length > 0 && selection[0].dynamic) {
|
||||
kickPhysics(selection[0].id);
|
||||
|
|
Loading…
Reference in a new issue