From 1e2a3a13da223f8f97d8e9abf9ad2f0f13b499c7 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 14 Sep 2017 09:31:32 +1200 Subject: [PATCH] Fix grip-delete entity history --- scripts/vr-edit/modules/selection.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/vr-edit/modules/selection.js b/scripts/vr-edit/modules/selection.js index 2b6155a032..f4033dda4a 100644 --- a/scripts/vr-edit/modules/selection.js +++ b/scripts/vr-edit/modules/selection.js @@ -262,18 +262,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 } } - ] - } - ); + if (selection.length > 0) { + 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) {