Translating a zoomed touch?

I need help getting this to work with zooming on an image. I handle all the touches with a variable ‘td’.

td.x = (td.x*screensize)+((origin.x-screenpos.x)/screensize)
td.y = (td.y*screensize)+((origin.y-screenpos.y)/screensize)

This works if the screensize is 1, that’s when the screen isn’t zoomed then say for instance a screensize of 0.1 is 10x zoom. The screenpos is the dynamic position of the screen image when being panned around, the origin is where the screen lies to begin with, this works for translating touches if the screensize is 1, but anything lower seems to not give me the right results, I’m guessing its something small that needs changing but I just can’t figure it out. How would I go about translating the touches to an image that has been moved and zoomed?

Which order are you doing the translate and scale of your zoomed image?

I’m not using the scale() function, I’m resizing the sprite instead which works fine, then I translate all the drawing on to the screen to the origin take away the disposition of panned screen position from the original position then in the touched function I assign the touch to a class so I can add and subtract from the touch position to draw to the appropriate part of the screen, and the expression in the OP works but it only draws to the right position of the screen when I pan around on 1x zoom, I’m not sure if that’s clear enough but there it is, any help is great thanks.

Ill record it on a video. Here:

Doesn’t matter, got it working eventually