Keep Mapbox Current Location Fixed on Pinch to Zoom in Android - mapbox

Zooming with Pinch in Mapbox Keeps Changing the center , how to achieve the same result as zooming with double-tap + scrolling Finger with Pinch too ?

the answer is to detect Zooming event and then Disable Scrolling till Zomming Ends , this works well in GoogleMaps but not properly in MapBox as the Scrolling wont get disabled (even when set to false programmatically) while zooming .
Another Way is to Add a Marker at the center of the Map the moment Zooming Starts and Removing it when it ends and show your own Marker (Probably an Image centered over the map )

Related

Detecting if is zoom-in or zoom-out with leaflet

How can I know when the user is zooming in or zooming out? I want to start an animation if the user zooms after some level. Is it possible to know this when the event zoomstart is triggered?
How can I know when the user is zooming in or zooming out?
At every zoom level, calculate how much map.getZoom() has changed.
Is it possible to know this when the event zoomstart is triggered?
No.
Consider the following scenario: A user, using a touchscreen (phone/tablet).
The user puts two fingers down on the screen. Half a frame after, one of the fingers moves a couple of pixels towards the center, triggering a pinch-zoom with a tiny change in the zoom level.
Your code catches the zoomstart and zoom events that happen inmediately after. "I know!" - your code says - "The user is zooming out!".
And then the user starts moving their fingers wider and wider, zooming in. And your code gets confused.
But the user changes their mind, and then starts zooming out for whatever reason. And then in again. And then out again. And then they lift the fingers and the zoom snaps to a zoom level.
This is why you can not know what the final zoom level is going to be when you listen to a zoomstart or zoom event in Leaflet.

Google Map SDK Swift, Zooming in and out like Uber's Map

I am trying to implement the Google Map SDK, and so far I have implemented a marker. I made the marker in a way that it follows as it is located in the center when I move the camera position.
The problem is that I can't zoom in and out while the marker's location is not changing. I would like to make the zooming experience like Uber in which the location does not change.. Thank you for your help.
You can use this line allowScrollGesturesDuringRotateOrZoom to your GMSMapview. It controls whether rotate and zoom gestures can be performed off-center and scrolled around. The default value of this is YES.
mapView.settings.allowScrollGesturesDuringRotateOrZoom = false // NO for obj-c and false for swift
So by setting it by NO/false, you can now perform zooming while the marker location is not moving. For more information, check this thread.

iPhone: Properly scaling lines / circle drawn in drawRect

I am drawing custom annotations over an image (circle, arrow etc) in my iPhone app. I allow pinch zooming & drag gestures for these annotations. These annotations are custom made AnnotationView with drawRect drawing circle / line etc.
I am finding issues with zooming
Try 1: The zoom is applied by scale transformation to the AnnotationView. Result: the annotations become blurred.
Try 2: To avoid blurring, I added redrawing with co-ords multiplied by scale factor instead of directly manipulating the transformation. This works without blurring, but, soon the circle etc goes out of the views bounds & is clipped.
I could use a bigger frame (size of full image), but, I am keeping the smaller frame so that I can easily move it back to position when it is dragged out of the window by user's zoom / pan gestures.
Question:
Is there a better way to manage this? I would like to zoom without blurring, while also having the ability to move it back to position if it is dragged out of original image bounds.

How to snap to zoom with UIScrollView?

I have a UIScrollView with a content view that the user can zoom in/out. The min zoom level is less than 1, and the max zoom level is greater than 1.
It is easy for the user to zoom all the way in, or all the way out. What can I do to get the UIScrollView to snap to zoom level 1 as well? Not just when the the user lifts their fingers, but as the they are zooming in/out as well.
Write a method, that gets called every time the user stops zooming, which then checks to see if the current zoom scale is very close to 1.0 (like something between 0.8 and 1.2). If this returns true, the zoom scale is set exactly to 1.0 to snap.
The trick is to override or disable the pinch and add your own. When you start a pinch gesture, you DO NOT update the display and resize the image until the pinch is complete, then issue your zoomToRect.

Image in UIScrollView moves offscreen before while zooming

I am working on a photo gallery iPhone app.
Approach is fairly inspired from the ScrollingMadness code available on github.
I have a scroll view which holds all my image views when in paging mode. When user zooms an image using pinch out gesture, I remove all the image views but the current one - and set the content offset to 0,0 (obviously).
Everything works perfect on simulator but on device I face this crazy issue.
When a user pinch out to zoom an image, it goes off screen and when the pinch out touch event ends, it comes back to the screen.
After zooming the image once, if I zoom it further - it does not give me the buggy experience. This leads me to a conclusion that patch needs to be applied where I am removing the other image views from the scroll view and holding the one which is being zoomed.
Not able to figure out how I should make it to work like the iPhone's Photo app. The - magical - Photos app!
Anyone who can point to a direction to get this thing up and running - would be all the help I need right now!
Well, since when you zoom you are moving your picture to (0,0) effectivly the first page, you would expect when the user pinches any page thats not the first one, the image will have to move to 0,0 and therefore you are expiriencing your image moving. After you zoomed once, the image is already at 0,0 so subsequent zooms work fine. Are you finding that zooming on the very first page gives you the behavior you want and only other pages have this issue? If so a fix might be not to move the zooming picture to (0,0) but just keep it where it is and have some dummy view for all your other pages so you dont take up memory from the other pictures. Hope this helps