Skip to content

integer inaccuracy when zooming #2

Description

@Arttale

I can see what you did with the zoom being limited to a max of 2.
the issue with the decreased inaccuracy at higher zoom is that point(0,0) is limited to integers and will automatically cast to integers even if you pass a float into it.

here's my fix
variables:

local image_pos = { x = 0.0, y = 0.0 }
local image_origin = { x = 0.0, y = 0.0 }

mouse move adjustment so that the fix doesn't cause issues:

onmousemove=function(ev)
			if mouse_drag then
				local mouse = Point(ev.x, ev.y)
				local dpos = {
					x = (mouse.x - mouse_origin.x) * inv_scale_factor,
					y = (mouse.y - mouse_origin.y) * inv_scale_factor
				}
				image_pos = {
					x = image_origin.x - dpos.x,
					y = image_origin.y - dpos.y
				}
				--dlg:repaint()
			end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions