mirror of
https://github.com/tsoding/boomer
synced 2024-11-16 12:12:47 +00:00
(#54) make scale friction depend on the delta scale
This commit is contained in:
parent
984b0ea629
commit
eea38a2247
@ -10,8 +10,8 @@ type Config* = object
|
||||
const defaultConfig* = Config(
|
||||
scrollSpeed: 1.0,
|
||||
dragVelocityFactor: 10.0,
|
||||
dragFriction: 3.0,
|
||||
scaleFriction: 10.0,
|
||||
dragFriction: 2.0,
|
||||
scaleFriction: 4.0,
|
||||
fps: 60
|
||||
)
|
||||
|
||||
|
@ -27,7 +27,7 @@ proc update*(camera: var Camera, config: Config, dt: float, mouse: Mouse, image:
|
||||
let p1 = (mouse.curr - (windowSize * 0.5)) / camera.scale
|
||||
camera.position += p0 - p1
|
||||
|
||||
camera.delta_scale -= sgn(camera.delta_scale).float * config.scale_friction * dt
|
||||
camera.delta_scale -= camera.delta_scale * dt * config.scale_friction
|
||||
|
||||
if not mouse.drag and (camera.velocity.length > VELOCITY_THRESHOLD):
|
||||
camera.position += camera.velocity * dt
|
||||
|
Loading…
Reference in New Issue
Block a user