Skip to content

Commit

Permalink
fine tune pinch to zoom sensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
foxnne committed Dec 12, 2024
1 parent bd2587d commit 58ce65f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/Pixi.zig
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ pub fn tick(app: *App, core: *Core) !void {
},
.magnify => |magnify| {
state.mouse.magnify = magnify.magnification;
std.log.debug("magnify!", .{});
},
.mouse_motion => |mouse_motion| {
state.mouse.position = .{ @floatCast(mouse_motion.pos.x * content_scale[0]), @floatCast(mouse_motion.pos.y * content_scale[1]) };
Expand Down
2 changes: 1 addition & 1 deletion src/gfx/camera.zig
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ pub const Camera = struct {

const nearest_zoom_index = camera.nearestZoomIndex();
const t = @as(f32, @floatFromInt(nearest_zoom_index)) / @as(f32, @floatFromInt(pixi.state.settings.zoom_steps.len - 1));
const sensitivity = pixi.math.lerp(pixi.state.settings.zoom_min_sensitivity * 10, pixi.state.settings.zoom_max_sensitivity * 10, t) * (pixi.state.settings.zoom_sensitivity / 100.0);
const sensitivity = pixi.math.lerp(pixi.state.settings.zoom_min_sensitivity, pixi.state.settings.zoom_max_sensitivity * 80, t) * (pixi.state.settings.zoom_sensitivity / 100.0);
const zoom_delta = magnification * sensitivity;

camera.zoom += zoom_delta;
Expand Down

0 comments on commit 58ce65f

Please sign in to comment.