mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 14:47:01 +02:00
Add selection boxes in multi-selection mode
This commit is contained in:
parent
77365ec282
commit
2b5a4e4563
1 changed files with 36 additions and 0 deletions
|
@ -347,6 +347,8 @@ SelectionDisplay = (function () {
|
|||
lineWidth: 1.0,
|
||||
});
|
||||
|
||||
var selectionBoxes = [];
|
||||
|
||||
var rotationDegreesDisplay = Overlays.addOverlay("text3d", {
|
||||
position: { x:0, y: 0, z: 0},
|
||||
text: "",
|
||||
|
@ -692,6 +694,9 @@ SelectionDisplay = (function () {
|
|||
for (var i = 0; i < allOverlays.length; i++) {
|
||||
Overlays.deleteOverlay(allOverlays[i]);
|
||||
}
|
||||
for (var i = 0; i < selectionBoxes.length; i++) {
|
||||
Overlays.deleteOverlay(selectionBoxes[i]);
|
||||
}
|
||||
};
|
||||
|
||||
that.highlightSelectable = function(entityID) {
|
||||
|
@ -1134,6 +1139,33 @@ SelectionDisplay = (function () {
|
|||
visible: !(mode == "ROTATE_YAW" || mode == "ROTATE_PITCH" || mode == "ROTATE_ROLL"),
|
||||
});
|
||||
|
||||
// Create more selection box overlays if we don't have enough
|
||||
var overlaysNeeded = selectionManager.selections.length - selectionBoxes.length;
|
||||
for (var i = 0; i < overlaysNeeded; i++) {
|
||||
selectionBoxes.push(
|
||||
Overlays.addOverlay("cube", {
|
||||
position: { x: 0, y: 0, z: 0 },
|
||||
size: 1,
|
||||
color: { red: 255, green: 153, blue: 0 },
|
||||
alpha: 1,
|
||||
solid: false,
|
||||
visible: false,
|
||||
dashed: false,
|
||||
lineWidth: 1.0,
|
||||
ignoreRayIntersection: true,
|
||||
}));
|
||||
}
|
||||
|
||||
for (var i = 0; i < selectionManager.selections.length; i++) {
|
||||
var properties = Entities.getEntityProperties(selectionManager.selections[i]);
|
||||
Overlays.editOverlay(selectionBoxes[i], {
|
||||
position: properties.position,
|
||||
rotation: properties.rotation,
|
||||
dimensions: properties.dimensions,
|
||||
visible: true,
|
||||
});
|
||||
}
|
||||
|
||||
Overlays.editOverlay(grabberEdgeTR, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTR });
|
||||
Overlays.editOverlay(grabberEdgeTL, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTL });
|
||||
Overlays.editOverlay(grabberEdgeTF, { visible: extendedStretchHandlesVisible, rotation: rotation, position: EdgeTF });
|
||||
|
@ -1157,6 +1189,10 @@ SelectionDisplay = (function () {
|
|||
for (var i = 0; i < length; i++) {
|
||||
Overlays.editOverlay(allOverlays[i], { visible: isVisible });
|
||||
}
|
||||
length = selectionBoxes.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
Overlays.editOverlay(selectionBoxes[i], { visible: isVisible });
|
||||
}
|
||||
};
|
||||
|
||||
that.unselect = function (entityID) {
|
||||
|
|
Loading…
Reference in a new issue