add right click to set camera focus

This commit is contained in:
Stewart Allen 2021-04-21 22:30:42 -04:00
commit cd81d6052f
6 changed files with 18 additions and 2 deletions

View file

@ -470,6 +470,13 @@
}
}
function setFocus() {
let int = contextInt[0];
if (int && int.object && int.object.widget) {
API.space.set_focus(undefined, int.point);
}
}
function duplicateSelection() {
API.selection.for_widgets(function(widget) {
let mesh = widget.mesh;
@ -2530,6 +2537,7 @@
$('context-duplicate').onclick = duplicateSelection;
$('context-mirror').onclick = mirrorSelection;
$('context-layflat').onclick = layFlat;
$('context-setfocus').onclick = setFocus;
UI.modal.onclick = API.modal.hide;
UI.modalBox.onclick = (ev) => { ev.stopPropagation() };

View file

@ -389,7 +389,12 @@
work: KIRI.work
};
function setFocus(widgets) {
function setFocus(widgets, point) {
if (point) {
SPACE.platform.setCenter(point.x, point.z, point.y);
SPACE.view.setFocus(new THREE.Vector3(point.x, point.y, point.z));
return;
}
if (widgets === undefined) {
widgets = WIDGETS;
} else if (!Array.isArray) {