mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #13618 from dback2/clickHandleSwitchEntityFix
Fix quickly clicking an edit handle causing selected entity change
This commit is contained in:
commit
b29044fd7e
2 changed files with 20 additions and 9 deletions
|
@ -1086,15 +1086,19 @@ function mouseReleaseEvent(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function wasTabletClicked(event) {
|
||||
function wasTabletOrEditHandleClicked(event) {
|
||||
var rayPick = Camera.computePickRay(event.x, event.y);
|
||||
var tabletIDs = getMainTabletIDs();
|
||||
if (tabletIDs.length === 0) {
|
||||
return false;
|
||||
} else {
|
||||
var result = Overlays.findRayIntersection(rayPick, true, getMainTabletIDs());
|
||||
return result.intersects;
|
||||
var result = Overlays.findRayIntersection(rayPick, true);
|
||||
if (result.intersects) {
|
||||
var overlayID = result.overlayID;
|
||||
var tabletIDs = getMainTabletIDs();
|
||||
if (tabletIDs.indexOf(overlayID) >= 0) {
|
||||
return true;
|
||||
} else if (selectionDisplay.isEditHandle(overlayID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function mouseClickEvent(event) {
|
||||
|
@ -1102,8 +1106,8 @@ function mouseClickEvent(event) {
|
|||
var result, properties, tabletClicked;
|
||||
if (isActive && event.isLeftButton) {
|
||||
result = findClickedEntity(event);
|
||||
tabletClicked = wasTabletClicked(event);
|
||||
if (tabletClicked) {
|
||||
tabletOrEditHandleClicked = wasTabletOrEditHandleClicked(event);
|
||||
if (tabletOrEditHandleClicked) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -658,6 +658,7 @@ SelectionDisplay = (function() {
|
|||
selectionBox,
|
||||
iconSelectionBox
|
||||
];
|
||||
var maximumHandleInAllOverlays = handleCloner;
|
||||
|
||||
overlayNames[handleTranslateXCone] = "handleTranslateXCone";
|
||||
overlayNames[handleTranslateXCylinder] = "handleTranslateXCylinder";
|
||||
|
@ -781,6 +782,12 @@ SelectionDisplay = (function() {
|
|||
return Math.abs(position.x) <= box.dimensions.x / 2 && Math.abs(position.y) <= box.dimensions.y / 2
|
||||
&& Math.abs(position.z) <= box.dimensions.z / 2;
|
||||
}
|
||||
|
||||
that.isEditHandle = function(overlayID) {
|
||||
var overlayIndex = allOverlays.indexOf(overlayID);
|
||||
var maxHandleIndex = allOverlays.indexOf(maximumHandleInAllOverlays);
|
||||
return overlayIndex >= 0 && overlayIndex <= maxHandleIndex;
|
||||
};
|
||||
|
||||
// FUNCTION: MOUSE PRESS EVENT
|
||||
that.mousePressEvent = function (event) {
|
||||
|
|
Loading…
Reference in a new issue