Add invert zoom direction option

This commit is contained in:
luboslenco
2020-10-06 14:59:34 +02:00
parent 67538a9f03
commit da660dd616
4 changed files with 12 additions and 4 deletions
+1
View File
@@ -102,6 +102,7 @@ class Config {
raw.brush_3d = true;
raw.brush_live = false;
raw.camera_speed = 1.0;
raw.invert_zoom_direction = false;
raw.displace_strength = 1.0;
#if krom_android
raw.native_file_browser = false;
+1
View File
@@ -44,6 +44,7 @@ typedef TConfig = {
@:optional var brush_3d: Null<Bool>;
@:optional var node_preview: Null<Bool>;
@:optional var camera_speed: Null<Float>;
@:optional var invert_zoom_direction: Null<Bool>;
@:optional var displace_strength: Null<Float>;
@:optional var native_file_browser: Null<Bool>;
@:optional var show_asset_names: Null<Bool>;
+8 -4
View File
@@ -62,7 +62,7 @@ class Camera {
if (Operator.shortcut(Config.keymap.action_zoom, ShortcutDown)) {
redraws = 2;
var f = -mouse.movementY / 150;
f *= Config.raw.camera_speed;
f *= getCameraSpeed();
camera.transform.move(camera.look(), f);
dist -= f;
}
@@ -70,7 +70,7 @@ class Camera {
if (mouse.wheelDelta != 0 && !modif) {
redraws = 2;
var f = mouse.wheelDelta * (-0.1);
f *= Config.raw.camera_speed;
f *= getCameraSpeed();
camera.transform.move(camera.look(), f);
dist -= f;
}
@@ -108,14 +108,14 @@ class Camera {
if (Operator.shortcut(Config.keymap.action_zoom, ShortcutDown)) {
redraws = 2;
var f = -mouse.movementY / 150;
f *= Config.raw.camera_speed;
f *= getCameraSpeed();
camera.transform.move(camera.look(), f);
}
if (mouse.wheelDelta != 0) {
redraws = 2;
var f = mouse.wheelDelta * (-0.1);
f *= Config.raw.camera_speed;
f *= getCameraSpeed();
camera.transform.move(camera.look(), f);
}
}
@@ -171,6 +171,10 @@ class Camera {
});
}
function getCameraSpeed(): Float {
return Config.raw.camera_speed * (Config.raw.invert_zoom_direction ? -1 : 1);
}
public function reset() {
var camera = iron.Scene.active.camera;
dist = camera.transform.loc.length();
+2
View File
@@ -58,6 +58,8 @@ class BoxPreferences {
var hspeed = Id.handle({value: Config.raw.camera_speed});
Config.raw.camera_speed = ui.slider(hspeed, tr("Camera Speed"), 0.1, 4.0, true);
Config.raw.invert_zoom_direction = ui.check(Id.handle({selected: Config.raw.invert_zoom_direction}), tr("Invert Zoom Direction"));
#if (!krom_android && !krom_ios)
Config.raw.native_file_browser = ui.check(Id.handle({selected: Config.raw.native_file_browser}), tr("Native File Browser"));
#end