Posted: 11th Nov 2021 22:28
This turned out to be trickier than I anticipated. Zooming and scrolling a 2D map. Zoom in/out will focus from mouse position. Scrolling is done by dragging the screen with left mouse button. It also has a smooth, inertia-based scrolling depending on how hard you flick the mouse before releasing the button. Mouse wheel controls zoom. Map has fixed boundaries so you should never be able to scroll or zoom beyond the background image.

Zip file attached at bottom
Posted: 11th Nov 2021 23:23
Nice, I like the auto centre thing, only thing is the lockout when zooming it breaks the fluidity, maybe zoom a little faster or allow some slight movement while zooming, variable end point maybe that allows slight panning, or a distraction might work, some concentric circles or a reticule
Posted: 14th Nov 2021 16:39
only thing is the lockout when zooming it breaks the fluidity,

I did that because when you zoom it's focused on a fixed point. Panning around changes that and it gets confused when offsetting the map. Once you start panning, there is no longer a point of focus. Basically, two different functions are trying to control the offset at once and you'll get some choppy even less fluid movement.

I've tripled the zoom speed. So while you still get some gradual change, it happens quick enough now that I don't think you'd notice the temporary lock out of control.
Posted: 14th Nov 2021 17:11
That was pretty much when it felt like it needed, it was just a second or so maybe to slow, it gives the user enough time to notice the lockout but once you got some gameplay going on it will add to the distraction, don't change it too much its a nice mechanic.