Pinch to zoom

0 favourites
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Many games on mobiles use the "pinch to zoom" feature.

    I didn't see any event for pinching, how is it possible to do it myself ?

    One difficulty is that we cant get both finger coordinate I think, well I just began to use construct 2 a few days ago so I'm not sure :)

    On solution would be to let the browser do the work, but for some reason my construct app don't zoom as other web pages do.

    It may have something to do with the meta tag "viewport" attribute "user-scalable", but I don't see how to set that from construct (and it would be nicer to control the pinch event also).

    Ah and is there a mouse wheel event ? Would be nice to zoom also.

    (to the dev: great software btw, you're making my life more beautiful)

  • Things like

    <meta name="viewport"

        content="user-scalable=no, width=device-width" />

    prevent the pinch-to-zoom feature.

    One way to do that with only a single gesture that I saw in my lab is to use a specific widget, looking like a knob. When you have your finger on it, and turning the knob clockwise, you are zooming, when you turn it counter-clockwise, you are dezooming.

  • I'd prefer a pinch to zoom, people are used to it and it doesn't take any space on screen.

    Editing the index.html is fine, but it won't work with the preview I guess.

    It could be a layout option in construct: "allow user to zoom: yes/no".

  • You can edit the file "preview.html" in the folder c2\exporters\html5 to have this working in preview mode.

    But you would have to remember to edit it again if you want on to make another project not using said pinch, or targeted at desktop.

  • Ah thanks, I'll do that !

  • So is there a way to pinch to zoom? "Edit the html file" is not very clear to me, is that the way to pinch to zoom? What do you edit it to?

  • You edit preview-fs.html and comment or remove this line:

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, target-densitydpi=device-dpi" />

    After that you can zoom, but you still can't drag to pan the view <img src="smileys/smiley19.gif" border="0" align="middle" />

    Not sure why.

    Panning is probably possible with the "in touch" event, so zoom would be handled by the browser and panning by constuct.

    Multi-touch support in construct would be nice though.

  • I made a plugin to support multi touch, with an example on how to do "pinch to zoom"

    here.

    The pinch to zoom is not very good, it can probably be smoother.

  • pinch to zoom (the default one) might be a problem if you want a HUD layer.

    Perhaps, on two touches at the same time (not sure you can even do that)

    create an invisible object at each one

    set layerscale(whatever)

    clamp(factor / distance(x1,y1,x2,y2), lower zoom out limit, upper zoom out limit

    factor can be anything... not sure of the math now but play around with some numbers.

    Hmm, this resets it every time you try to zoom though...

  • Perhaps, on two touches at the same time (not sure you can even do that)

    You can with my plugin :)

  • How can disable zooming out?

  • You can edit the file "preview.html" in the folder c2\exporters\html5 to have this working in preview mode.

    But you would have to remember to edit it again if you want on to make another project not using said pinch, or targeted at desktop.

    How can i disable zoom out when when its starts but when it zoom in zoom out is enable?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi. Its old but I did not find another up to date Topic about it so I hope its ok to "revive" it.

    Does anyone have a working example of zooming in/out with a 2 finger gesture without plugins? (does the old plugin still work?)

    I think this is possible with the nth Touch Actions so Construct knows there are 2 fingers touching.

  • Hi. Its old but I did not find another up to date Topic about it so I hope its ok to "revive" it.

    Does anyone have a working example of zooming in/out with a 2 finger gesture without plugins? (does the old plugin still work?)

    I think this is possible with the nth Touch Actions so Construct knows there are 2 fingers touching.

    Doesn't the touch-zooming example from the new project dialog work as intended?

  • There's also quite few examples here, that lot of people seems to not know about

    c:\Program Files\Construct 2\examples\Touch - zooming.capx

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)