mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #13648 from huffman/fix/create-xz-lines
Fix xz guides not showing when translating with Shift
This commit is contained in:
commit
d1da7675f6
1 changed files with 107 additions and 5 deletions
|
@ -381,6 +381,8 @@ SelectionDisplay = (function() {
|
||||||
|
|
||||||
var CTRL_KEY_CODE = 16777249;
|
var CTRL_KEY_CODE = 16777249;
|
||||||
|
|
||||||
|
var RAIL_AXIS_LENGTH = 10000;
|
||||||
|
|
||||||
var TRANSLATE_DIRECTION = {
|
var TRANSLATE_DIRECTION = {
|
||||||
X: 0,
|
X: 0,
|
||||||
Y: 1,
|
Y: 1,
|
||||||
|
@ -616,6 +618,40 @@ SelectionDisplay = (function() {
|
||||||
dashed: false
|
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 = [
|
var allOverlays = [
|
||||||
handleTranslateXCone,
|
handleTranslateXCone,
|
||||||
handleTranslateXCylinder,
|
handleTranslateXCylinder,
|
||||||
|
@ -656,7 +692,11 @@ SelectionDisplay = (function() {
|
||||||
handleScaleFLEdge,
|
handleScaleFLEdge,
|
||||||
handleCloner,
|
handleCloner,
|
||||||
selectionBox,
|
selectionBox,
|
||||||
iconSelectionBox
|
iconSelectionBox,
|
||||||
|
xRailOverlay,
|
||||||
|
yRailOverlay,
|
||||||
|
zRailOverlay
|
||||||
|
|
||||||
];
|
];
|
||||||
var maximumHandleInAllOverlays = handleCloner;
|
var maximumHandleInAllOverlays = handleCloner;
|
||||||
|
|
||||||
|
@ -873,11 +913,13 @@ SelectionDisplay = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// FUNCTION: MOUSE MOVE EVENT
|
// FUNCTION: MOUSE MOVE EVENT
|
||||||
|
var lastMouseEvent = null;
|
||||||
that.mouseMoveEvent = function(event) {
|
that.mouseMoveEvent = function(event) {
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("=============== eST::MouseMoveEvent BEG =======================");
|
print("=============== eST::MouseMoveEvent BEG =======================");
|
||||||
}
|
}
|
||||||
|
lastMouseEvent = event;
|
||||||
if (activeTool) {
|
if (activeTool) {
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove");
|
print(" Trigger ActiveTool(" + activeTool.mode + ")'s onMove");
|
||||||
|
@ -999,19 +1041,35 @@ SelectionDisplay = (function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Control key remains active only while key is held down
|
// Control key remains active only while key is held down
|
||||||
that.keyReleaseEvent = function(key) {
|
that.keyReleaseEvent = function(event) {
|
||||||
if (key.key === CTRL_KEY_CODE) {
|
if (event.key === CTRL_KEY_CODE) {
|
||||||
ctrlPressed = false;
|
ctrlPressed = false;
|
||||||
that.updateActiveRotateRing();
|
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
|
// Triggers notification on specific key driven events
|
||||||
that.keyPressEvent = function(key) {
|
that.keyPressEvent = function(event) {
|
||||||
if (key.key === CTRL_KEY_CODE) {
|
if (event.key === CTRL_KEY_CODE) {
|
||||||
ctrlPressed = true;
|
ctrlPressed = true;
|
||||||
that.updateActiveRotateRing();
|
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:
|
// NOTE: mousePressEvent and mouseMoveEvent from the main script should call us., so we don't hook these:
|
||||||
|
@ -1705,6 +1763,14 @@ SelectionDisplay = (function() {
|
||||||
},
|
},
|
||||||
onEnd: function(event, reason) {
|
onEnd: function(event, reason) {
|
||||||
pushCommandForSelections(duplicatedEntityIDs);
|
pushCommandForSelections(duplicatedEntityIDs);
|
||||||
|
if (isConstrained) {
|
||||||
|
Overlays.editOverlay(xRailOverlay, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(zRailOverlay, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
elevation: function(origin, intersection) {
|
elevation: function(origin, intersection) {
|
||||||
return (origin.y - intersection.y) / Vec3.distance(origin, intersection);
|
return (origin.y - intersection.y) / Vec3.distance(origin, intersection);
|
||||||
|
@ -1768,10 +1834,46 @@ SelectionDisplay = (function() {
|
||||||
vector.x = 0;
|
vector.x = 0;
|
||||||
}
|
}
|
||||||
if (!isConstrained) {
|
if (!isConstrained) {
|
||||||
|
var xStart = Vec3.sum(startPosition, {
|
||||||
|
x: -RAIL_AXIS_LENGTH,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var xEnd = Vec3.sum(startPosition, {
|
||||||
|
x: RAIL_AXIS_LENGTH,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
});
|
||||||
|
var zStart = Vec3.sum(startPosition, {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: -RAIL_AXIS_LENGTH
|
||||||
|
});
|
||||||
|
var zEnd = Vec3.sum(startPosition, {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: RAIL_AXIS_LENGTH
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(xRailOverlay, {
|
||||||
|
start: xStart,
|
||||||
|
end: xEnd,
|
||||||
|
visible: true
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(zRailOverlay, {
|
||||||
|
start: zStart,
|
||||||
|
end: zEnd,
|
||||||
|
visible: true
|
||||||
|
});
|
||||||
isConstrained = true;
|
isConstrained = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isConstrained) {
|
if (isConstrained) {
|
||||||
|
Overlays.editOverlay(xRailOverlay, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
|
Overlays.editOverlay(zRailOverlay, {
|
||||||
|
visible: false
|
||||||
|
});
|
||||||
isConstrained = false;
|
isConstrained = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue