Updated edit.js and selection tool

Last selected entity will now be yellow instead of orange
This commit is contained in:
Menithal 2017-02-16 10:05:59 +02:00
parent ff2c344eaa
commit d96f95a7e9
2 changed files with 14 additions and 16 deletions

View file

@ -1115,7 +1115,6 @@ function recursiveDelete(entities, childrenList) {
}
}
function unparentSelectedEntities() {
print("unparenting2 Selected Entities");
if (SelectionManager.hasSelection()) {
var selectedEntities = selectionManager.selections;
selectedEntities.forEach(function (id, index) {
@ -1128,7 +1127,6 @@ function unparentSelectedEntities() {
}
function parentSelectedEntities() {
print("parenting selected Entities");
if (SelectionManager.hasSelection()) {
var selectedEntities = selectionManager.selections;
if (selectedEntities.length <= 1) {
@ -1137,16 +1135,12 @@ function parentSelectedEntities() {
}
var lastEntityId = selectedEntities[selectedEntities.length-1];
print("last " + lastEntityId);
selectedEntities.forEach(function (id, index) {
if (lastEntityId !== id) {
print("iterating2 " + id);
// OK time to check why this breaks!
Entities.editEntity(id, {parentID: lastEntityId})
}
});
Window.notify("Entities Parented");
} else {
Window.notifyEditError("You have nothing selected")
@ -1384,7 +1378,7 @@ Controller.keyReleaseEvent.connect(function (event) {
grid.setPosition(newPosition);
}
} else if (event.text === 'p' && event.isControl ) {
if (event.isShifted) {
if (event.isAlt) {
unparentSelectedEntities();
} else {
parentSelectedEntities();

View file

@ -2189,8 +2189,12 @@ SelectionDisplay = (function() {
offset = Vec3.multiplyQbyV(properties.rotation, offset);
var boxPosition = Vec3.sum(properties.position, offset);
var color = {red: 255, green: 153, blue: 0};
if (i >= selectionManager.selections.length - 1) color = {red: 255, green: 255, blue: 0};
Overlays.editOverlay(selectionBoxes[i], {
position: boxPosition,
color: color,
rotation: properties.rotation,
dimensions: properties.dimensions,
visible: true,