I've a main view used to show a workspace (like paint for example), which can be zoomed/unzoomed and rotated.
The zoom is defined by a global multiplier: scrolling the wheel changes that multiplier, then the view size becomes equal to the window size times that multiplier. That way i can keep the zoom value when the window is resized.
My problem is, while mouse coordinates are mapped perfectly with a 1x zoom, any different value of the zoom screws the mapping (of course, mapping coordinates is a property of the window, not of the view); but i'm having quite an hard time understanding what maths should i apply to the mouse coordinates in order to have them be aware of the zoom.
if ((delta > 0 && graphics_zoom > 0.8) || (delta < 0 && graphics_zoom < 20))
{
graphics_zoom += delta * -0.2;
view_work_area.setSize(window.getSize().x * graphics_zoom, window.getSize().y * graphics_zoom);
}
where delta is the scrolling wheel value