touch scroll/zoom map

0 favourites
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi to all,

    I guess this is a classic question but I found nothing really conclusive on the forum.

    Construct 2 comes with two exemple of touch scroll/zoom but I was not able to mix them for my needs.

    I have a big map and need to be able to pinch to zoom in and touch/drag to scroll.

    Any idea ?

    Zooming should have min/max values and layer scrolling must be bound to layout.

    Thanks for any help you could provide with that

  • thanks,

    Your solution works perfectly on a computer but is non effective for a mobile device (mouse position/mouse wheel).

    Do you have any idea how it could be adapted for touch screen ?

  • What is wrong with the touch-zoom example shipped with Construct2? As far as I can see it has touch-pan integrated in it..

    What is it not doing correctly for your needs?

  • LittleStain

    Thanks for the suggestion.

    This exemple is nice ! But How do I prevent the layer to move out of the layer and how do I implement max/min zoom range ?

  • I don't understand what it means for the layer to move out of the layer..

    maximum and minimum shouldn't be that hard to set by adding conditions

    to the touchzoom>=0 event.

    -system compare two values : InitialScale * (TouchCurrentDistance / TouchStartDistance) <= MaximumScale (you have to set this number yourself)

    -system compare two values : InitialScale * (TouchCurrentDistance / TouchStartDistance) <= MinimumScale (you have to set this number yourself as well)

  • I think LittleStain is right, that's why I gave you that mouse example, so all you needed to do was change the Mouse related parts to Touch related code.

  • emoaeden & LittleStain

    Oh, about scale, I mean that the layer should be enlarge above a certain size and be pinched under another one.

    And about "layout constraint", I mean that I would like to avoid empty spaces around layer when it is downsized.

  • emoaeden & LittleStain

    Let me be more precise.

    At start of layout, layer fits exactly in layout. Is this then impossible to pan or to downsize, because if so, layer would leave blanks spaces all around.

    Layer enlargement is possible until a certain point.

  • emoaeden & LittleStain

    Let me be more precise.

    At start of layout, layer fits exactly in layout. Is this then impossible to pan or to downsize, because if so, layer would leave blanks spaces all around.

    Layer enlargement is possible until a certain point.

    Do you have a sample capx sir? that is also my problem right now how to set min/max zoom

  • seraphin , Laurent

    I don't know if it fits on your project but here it goes the zooming part of my dead project

    [attachment=0:463bq7u9][/attachment:463bq7u9]

    This allow you to zoom in and zoom out with a maximum and minimum by just shortening the distance between the two fingers, or increasing it. I don't know if there are another easier way to do it but that's how I managed to do it

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • seraphin , Laurent

    I don't know if it fits on your project but here it goes the zooming part of my dead project

    [attachment=1:2h6ev7rg][/attachment:2h6ev7rg]

    This allow you to zoom in and zoom out with a maximum and minimum by just shortening the distance between the two fingers, or increasing it. I don't know if there are another easier way to do it but that's how I managed to do it

    Thanks can you give the global variable you made? i can't do it right

  • > seraphin , Laurent

    >

    > I don't know if it fits on your project but here it goes the zooming part of my dead project

    > [attachment=1:2t9be3jp][/attachment:2t9be3jp]

    > This allow you to zoom in and zoom out with a maximum and minimum by just shortening the distance between the two fingers, or increasing it. I don't know if there are another easier way to do it but that's how I managed to do it

    >

    Thanks can you give the global variable you made? i can't do it right

    firstTOUCH, secondTOUCH, Initial_Touch_Distance, Actual_Touch_Distance and Zoom. Sorry, I forgot to mention ZOOM.

    About the variable Zoom you only need to set it's value to the layout Scale and then it will work. Like this.

    Every tick > Set Zoom to LayoutScale

  • can you upload ur sample capx ? if you don't mind

  • can you upload ur sample capx ? if you don't mind

    [attachment=0:1he8desv][/attachment:1he8desv]

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