Special orbit opposite behavior when looking from the top
This commit is contained in:
@@ -277,7 +277,7 @@ class UIMenu {
|
||||
if (ui.button(" " + tr("Orbit Right"), Left, Config.keymap.view_orbit_right)) { ViewportUtil.orbit(Math.PI / 12, 0); }
|
||||
if (ui.button(" " + tr("Orbit Up"), Left, Config.keymap.view_orbit_up)) { ViewportUtil.orbit(0, -Math.PI / 12); }
|
||||
if (ui.button(" " + tr("Orbit Down"), Left, Config.keymap.view_orbit_down)) { ViewportUtil.orbit(0, Math.PI / 12); }
|
||||
if (ui.button(" " + tr("Orbit Opposite"), Left, Config.keymap.view_orbit_opposite)) { ViewportUtil.orbit(Math.PI, 0); }
|
||||
if (ui.button(" " + tr("Orbit Opposite"), Left, Config.keymap.view_orbit_opposite)) { ViewportUtil.orbitOpposite(); }
|
||||
if (ui.button(" " + tr("Zoom In"), Left, Config.keymap.view_zoom_in)) { ViewportUtil.zoom(0.2); }
|
||||
if (ui.button(" " + tr("Zoom Out"), Left, Config.keymap.view_zoom_out)) { ViewportUtil.zoom(-0.2); }
|
||||
// ui.fill(0, 0, sepw, 1, ui.t.ACCENT_SELECT_COL);
|
||||
|
||||
@@ -340,7 +340,7 @@ class UISidebar {
|
||||
else if (Operator.shortcut(Config.keymap.view_orbit_right, ShortcutRepeat)) ViewportUtil.orbit(Math.PI / 12, 0);
|
||||
else if (Operator.shortcut(Config.keymap.view_orbit_up, ShortcutRepeat)) ViewportUtil.orbit(0, -Math.PI / 12);
|
||||
else if (Operator.shortcut(Config.keymap.view_orbit_down, ShortcutRepeat)) ViewportUtil.orbit(0, Math.PI / 12);
|
||||
else if (Operator.shortcut(Config.keymap.view_orbit_opposite)) ViewportUtil.orbit(Math.PI, 0);
|
||||
else if (Operator.shortcut(Config.keymap.view_orbit_opposite)) ViewportUtil.orbitOpposite();
|
||||
else if (Operator.shortcut(Config.keymap.view_zoom_in, ShortcutRepeat)) ViewportUtil.zoom(0.2);
|
||||
else if (Operator.shortcut(Config.keymap.view_zoom_out, ShortcutRepeat)) ViewportUtil.zoom(-0.2);
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@ class ViewportUtil {
|
||||
Context.ddirty = 2;
|
||||
}
|
||||
|
||||
public static function orbitOpposite() {
|
||||
var cam = Scene.active.camera;
|
||||
var z = Math.abs(cam.look().z) - 1.0;
|
||||
(z < 0.0001 && z > -0.0001) ? ViewportUtil.orbit(0, Math.PI) : ViewportUtil.orbit(Math.PI, 0);
|
||||
}
|
||||
|
||||
public static function zoom(f: Float) {
|
||||
var cam = Scene.active.camera;
|
||||
cam.transform.move(cam.look(), f);
|
||||
|
||||
Reference in New Issue
Block a user