diff --git a/Sources/arm/Config.hx b/Sources/arm/Config.hx index 3e99348e..63691940 100644 --- a/Sources/arm/Config.hx +++ b/Sources/arm/Config.hx @@ -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; diff --git a/Sources/arm/ConfigFormat.hx b/Sources/arm/ConfigFormat.hx index 7a143a72..2976675b 100644 --- a/Sources/arm/ConfigFormat.hx +++ b/Sources/arm/ConfigFormat.hx @@ -44,6 +44,7 @@ typedef TConfig = { @:optional var brush_3d: Null; @:optional var node_preview: Null; @:optional var camera_speed: Null; + @:optional var invert_zoom_direction: Null; @:optional var displace_strength: Null; @:optional var native_file_browser: Null; @:optional var show_asset_names: Null; diff --git a/Sources/arm/plugin/Camera.hx b/Sources/arm/plugin/Camera.hx index ca475e92..427ecedb 100644 --- a/Sources/arm/plugin/Camera.hx +++ b/Sources/arm/plugin/Camera.hx @@ -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(); diff --git a/Sources/arm/ui/BoxPreferences.hx b/Sources/arm/ui/BoxPreferences.hx index 1e7343e7..51a7213c 100644 --- a/Sources/arm/ui/BoxPreferences.hx +++ b/Sources/arm/ui/BoxPreferences.hx @@ -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