Hi, I just purchased this library. Is it possible to scroll around the map on touch and to do pinch zoom? I want to zoom in slighty on my map and be able to scroll around with my finger and zoom in / out.
I’ve modified the main.lua of CastleDemo to demonstrate one way to accomplish these behaviors. To try it out, rename or delete main.lua from the CastleDemo 0v821 project folder and replace it with this new file: https://docs.google.com/file/d/0B8zoywKO40aibnpuVDQ0RjRsbDA/edit?usp=sharing
Touch scrolling will work in the simulator, but you’ll have to test pinch zoom on an actual device; the Corona simulator does not support multitouch.
Brilliant, thank you i’ll give it a go
Works great thank you! Ive added a zoom in and out limit too. Just 1 issue I need to sort out is when I zoom in I can’t scroll very far on the map. It maybe because of the camera bound limits I’ve set
Something to keep in mind is that MTE is not currently aware of the change in scale when you zoom in and out. The engine always assumes that the map object has a scale of 1. The result is that the camera will appear to hit its bounds sooner when you’re zoomed in. The position of the camera always stops at the same place- it will stop over the same tile no matter the zoom- but your window on the world is smaller, and so the constraint appears greater.
Hmm so do you think it’s not possible.
No, it should be possible.
I haven’t looked into it yet, but you could wait until the pinch-zoom event ends and then recompute blockScale, restore scale to 1, call goto, and call the constrainCamera command again.
Eventually- probably after isometric map support is finished- I’ll go through and update MTE’s functions to be aware of the scale. My todo list is just pretty full at the moment. Lots of features to implement in the coming weeks.
I’ve modified the main.lua of CastleDemo to demonstrate one way to accomplish these behaviors. To try it out, rename or delete main.lua from the CastleDemo 0v821 project folder and replace it with this new file: https://docs.google.com/file/d/0B8zoywKO40aibnpuVDQ0RjRsbDA/edit?usp=sharing
Touch scrolling will work in the simulator, but you’ll have to test pinch zoom on an actual device; the Corona simulator does not support multitouch.
Brilliant, thank you i’ll give it a go
Works great thank you! Ive added a zoom in and out limit too. Just 1 issue I need to sort out is when I zoom in I can’t scroll very far on the map. It maybe because of the camera bound limits I’ve set
Something to keep in mind is that MTE is not currently aware of the change in scale when you zoom in and out. The engine always assumes that the map object has a scale of 1. The result is that the camera will appear to hit its bounds sooner when you’re zoomed in. The position of the camera always stops at the same place- it will stop over the same tile no matter the zoom- but your window on the world is smaller, and so the constraint appears greater.
Hmm so do you think it’s not possible.
No, it should be possible.
I haven’t looked into it yet, but you could wait until the pinch-zoom event ends and then recompute blockScale, restore scale to 1, call goto, and call the constrainCamera command again.
Eventually- probably after isometric map support is finished- I’ll go through and update MTE’s functions to be aware of the scale. My todo list is just pretty full at the moment. Lots of features to implement in the coming weeks.
Anyone want a zoom in/out, you can check from here. It’s really helpful.
http://coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/
Anyone want a zoom in/out, you can check from here. It’s really helpful.
http://coronalabs.com/blog/2013/01/22/implementing-pinch-zoom-rotate/