So. Ive been trying to achieve this for two days, but i just can't get it right.
Ok, so i have a script right here that draws a triangle:

Code:

Code:
 TheImage.canvas.MoveTo(round((100*zoom-moved.x)), round((100*zoom-moved.y)));
 TheImage.canvas.LineTo(round((200*zoom-moved.x)), round((200*zoom-moved.y)));
 TheImage.canvas.LineTo(round(100*zoom-moved.x)), round((200*zoom-moved.y)));
 TheImage.canvas.LineTo(round((100*zoom-moved.x)), round((100*zoom-moved.y)));

Zoom is the distance. When i roll my mouse wheel, it gets multyplied by 1.1 or 0.9 to increase or decrease the size.

moved.x and moved.y is the distance the view is shifted. Like, if i take a hand tool, i can shift the view.

Now, how should i do the math so the view could zoom to the mouse instead of the 0 0 position? Embarrassed