Pinch-zoom image in canvas

  1. 7 months ago

    Hamish S

    23 May 2019 Pre-Release Testers

    Hello,

    Long time, no post from me. Hello again, folks.

    I'm trying to put together an iOS app which has a map in it, on which people can tap for points of interest. I want to make this map zoomable and also scrollable. I think I want to be drawing the map with a canvas and stuff in the Paint event. I've got scrolling working just fine (using PointerDrag events to record what's gone on, then shifting the painted graphics). Zooming is proving harder.

    I've used PinchExample from iOSKit, which looks great, and I've got the canvas itself transforming. But I want to be transforming the *image* within the canvas. There's a little help elsewhere on this forum but I'm not good enough on iOS (or Declares!) to get it working; is this something someone else has done? Or should I be using an ImageWell or something else?

    Thanks in advance,

    Hamish

  2. Hamish S

    24 May 2019 Pre-Release Testers

    OK, I'm being a bit of a fool; I don't need affine transformations at all, but can simply set a property of the view to tell me the scale I should be painting at (which I change using Pinch.Gesture, and then invalidate the canvas and do all the scaling in the Paint event.

    Now all I need to do is work out how to get the centre point of the pinch so that I know the centre point around which I should be scaling the graphic. Anyone?

or Sign Up to reply!