mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 18:23:22 +02:00
Fix xz guides not showing when translating with Shift
This commit is contained in:
parent
566c837bba
commit
25b558e6b4
1 changed files with 106 additions and 5 deletions
|
@ -616,6 +616,40 @@ SelectionDisplay = (function() {
|
|||
dashed: false
|
||||
});
|
||||
|
||||
var xRailOverlay = Overlays.addOverlay("line3d", {
|
||||
visible: false,
|
||||
start: Vec3.ZERO,
|
||||
end: Vec3.ZERO,
|
||||
color: {
|
||||
red: 255,
|
||||
green: 0,
|
||||
blue: 0
|
||||
},
|
||||
ignoreRayIntersection: true // always ignore this
|
||||
});
|
||||
var yRailOverlay = Overlays.addOverlay("line3d", {
|
||||
visible: false,
|
||||
start: Vec3.ZERO,
|
||||
end: Vec3.ZERO,
|
||||
color: {
|
||||
red: 0,
|
||||
green: 255,
|
||||
blue: 0
|
||||
},
|
||||
ignoreRayIntersection: true // always ignore this
|
||||
});
|
||||
var zRailOverlay = Overlays.addOverlay("line3d", {
|
||||
visible: false,
|
||||
start: Vec3.ZERO,
|
||||
end: Vec3.ZERO,
|
||||
color: {
|
||||
red: 0,
|
||||
green: 0,
|
||||
blue: 255
|
||||
},
|
||||
ignoreRayIntersection: true // always ignore this
|
||||
});
|
||||
|
||||
var allOverlays = [
|
||||
handleTranslateXCone,
|
||||
handleTranslateXCylinder,
|
||||
|
@ -656,7 +690,11 @@ SelectionDisplay = (function() {
|
|||
handleScaleFLEdge,
|
||||
handleCloner,
|
||||
selectionBox,
|
||||
iconSelectionBox
|
||||
iconSelectionBox,
|
||||
xRailOverlay,
|
||||
yRailOverlay,
|
||||
zRailOverlay
|
||||
|
||||
];
|
||||
var maximumHandleInAllOverlays = handleCloner;
|
||||
|
||||
|
@ -873,11 +911,14 @@ SelectionDisplay = (function() {
|
|||
};
|
||||
|
||||
// FUNCTION: MOUSE MOVE EVENT
|
||||
var lastMouseEvent = null;
|
||||
that.mouseMoveEvent = function(event) {
|
||||
print("Got mouse move event", JSON.stringify(event));
|
||||
var wantDebug = false;
|
||||
if (wantDebug) {
|
||||
print("=============== eST::MouseMoveEvent BEG =======================");
|
||||
}
|
||||
lastMouseEvent = event;
|
||||
if (activeTool) {
|
||||
if (wantDebug) {
|
||||
print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove");
|
||||
|
@ -999,19 +1040,35 @@ SelectionDisplay = (function() {
|
|||
};
|
||||
|
||||
// Control key remains active only while key is held down
|
||||
that.keyReleaseEvent = function(key) {
|
||||
if (key.key === CTRL_KEY_CODE) {
|
||||
that.keyReleaseEvent = function(event) {
|
||||
if (event.key === CTRL_KEY_CODE) {
|
||||
ctrlPressed = false;
|
||||
that.updateActiveRotateRing();
|
||||
}
|
||||
if (activeTool && lastMouseEvent !== null) {
|
||||
lastMouseEvent.isShifted = event.isShifted;
|
||||
lastMouseEvent.isMeta = event.isMeta;
|
||||
lastMouseEvent.isControl = event.isControl;
|
||||
lastMouseEvent.isAlt = event.isAlt;
|
||||
activeTool.onMove(lastMouseEvent);
|
||||
SelectionManager._update();
|
||||
}
|
||||
};
|
||||
|
||||
// Triggers notification on specific key driven events
|
||||
that.keyPressEvent = function(key) {
|
||||
if (key.key === CTRL_KEY_CODE) {
|
||||
that.keyPressEvent = function(event) {
|
||||
if (event.key === CTRL_KEY_CODE) {
|
||||
ctrlPressed = true;
|
||||
that.updateActiveRotateRing();
|
||||
}
|
||||
if (activeTool && lastMouseEvent !== null) {
|
||||
lastMouseEvent.isShifted = event.isShifted;
|
||||
lastMouseEvent.isMeta = event.isMeta;
|
||||
lastMouseEvent.isControl = event.isControl;
|
||||
lastMouseEvent.isAlt = event.isAlt;
|
||||
activeTool.onMove(lastMouseEvent);
|
||||
SelectionManager._update();
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these:
|
||||
|
@ -1705,6 +1762,14 @@ SelectionDisplay = (function() {
|
|||
},
|
||||
onEnd: function(event, reason) {
|
||||
pushCommandForSelections(duplicatedEntityIDs);
|
||||
if (isConstrained) {
|
||||
Overlays.editOverlay(xRailOverlay, {
|
||||
visible: false
|
||||
});
|
||||
Overlays.editOverlay(zRailOverlay, {
|
||||
visible: false
|
||||
});
|
||||
}
|
||||
},
|
||||
elevation: function(origin, intersection) {
|
||||
return (origin.y - intersection.y) / Vec3.distance(origin, intersection);
|
||||
|
@ -1768,10 +1833,46 @@ SelectionDisplay = (function() {
|
|||
vector.x = 0;
|
||||
}
|
||||
if (!isConstrained) {
|
||||
var xStart = Vec3.sum(startPosition, {
|
||||
x: -10000,
|
||||
y: 0,
|
||||
z: 0
|
||||
});
|
||||
var xEnd = Vec3.sum(startPosition, {
|
||||
x: 10000,
|
||||
y: 0,
|
||||
z: 0
|
||||
});
|
||||
var zStart = Vec3.sum(startPosition, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: -10000
|
||||
});
|
||||
var zEnd = Vec3.sum(startPosition, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 10000
|
||||
});
|
||||
Overlays.editOverlay(xRailOverlay, {
|
||||
start: xStart,
|
||||
end: xEnd,
|
||||
visible: true
|
||||
});
|
||||
Overlays.editOverlay(zRailOverlay, {
|
||||
start: zStart,
|
||||
end: zEnd,
|
||||
visible: true
|
||||
});
|
||||
isConstrained = true;
|
||||
}
|
||||
} else {
|
||||
if (isConstrained) {
|
||||
Overlays.editOverlay(xRailOverlay, {
|
||||
visible: false
|
||||
});
|
||||
Overlays.editOverlay(zRailOverlay, {
|
||||
visible: false
|
||||
});
|
||||
isConstrained = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue