touch scroll/zoom map

Get help using Construct 2

Post » Tue Oct 15, 2013 11:52 pm

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
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Wed Oct 16, 2013 2:08 am

Give this a try

https://dl.dropboxusercontent.com/u/108799982/Capx%20Demos/ZoomInOut.capx
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Wed Oct 16, 2013 9:10 am

thanks, @emoaeden.
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 ?
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Wed Oct 16, 2013 9:56 am

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 16, 2013 11:14 am

@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 ?
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Wed Oct 16, 2013 11:21 am

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 told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Oct 16, 2013 11:48 am

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.
Using R243 for all examples
B
69
S
20
G
6
Posts: 379
Reputation: 9,699

Post » Wed Oct 16, 2013 12:56 pm

@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.
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Wed Oct 16, 2013 1:40 pm

@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.
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Fri Feb 13, 2015 4:15 pm

Laurent wrote:@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
B
6
S
1
Posts: 24
Reputation: 450

Next

Return to How do I....?

Who is online

Users browsing this forum: alextro, ivanski1983, Ryan Kocourek and 9 guests