1 (edited by mcb 2021-05-12 17:33:06)

Topic: Android: Map Drag locked to left and right + Not click under UI

Sorry to hit you hit with 2 questions here, but I'm stuck, and you've always responded quickly.

First, I'm displaying the map via a Raw Image, and using the Raw Image Touch Forwarder, and it all works except I can't drag the map vertically. Pinch to zoom, Left and right drags work as expected, but up and down also trigger left and right. Any ideas what might be causing that?

Second question, I have struggled to keep from triggering OnMapClick events from UI interactions. I've tried all the usual things, ex EventSystem.current.IsPointerOverGameObject(), which I've never understood because UI elements like buttons are game objects, but I digress. Do you have any best practices for blocking the map, especially on mobile devices so I can interact with my GUI? As mentioned above, I'm displaying the map as a Raw Image on my canvas.

Thanks in advance!

Re: Android: Map Drag locked to left and right + Not click under UI

Hello.

1. Most likely your map already has a minimum zoom.
This is not some kind of constant, this is a zoom at which the entire Earth is displayed, and it depends on the width and height of the map.
If you increase the zoom, can you move vertically?
If so, then this is exactly the problem.

2. Online Maps / Troubleshooting / Not Interact Under GUI - ON.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Android: Map Drag locked to left and right + Not click under UI

Thanks for your response!

It doesn't matter what zoom level I'm at, I can only go left or right. I immediately zoom to level 14 when the app loads.

Now I do have my render texture set to the resolution of my screen (2280x1080), and my map set to 1024x1024, if that matters.


Regarding the Not Interact Under GUI, I have it set to on, but I still can add markers under the UI Panels.

4 (edited by mcb 2021-05-12 18:47:53)

Re: Android: Map Drag locked to left and right + Not click under UI

Small Update, it does appear as though I am now blocking map touches under the GUI, but OnMapClick seems to be holding onto the last touched position of the map.

What I mean, is I have a panel on the right of the screen that the user can select which model to place on the map. If I click on one of the buttons, it immediately spawns my marker at the last place I touched the map--for instance, where I touched to drag, or zoom the map.

I do notice that Not Interact Under UI gets set to false after loading--so having it set to true really did nothing.

I see that you set it to false in Start if forwarders.Count == 0. If I set it back to true, I can't interact with the map at all, regardless of what I click on.


Also, I can't even drag the map vertically in the editor.  But I do see that if I zoom up to level 10 or lower, that I can drag vertically.  How do I resolve this?

Re: Android: Map Drag locked to left and right + Not click under UI

1. I found and fixed the problem.
Send me an email (support@infinity-code.com) and I will send you a fix.

2. Unfortunately, I don't know what the problem might be.
No one has ever written to me about such a problem and on my side the map moves vertically correctly.
Here you need to debug what is happening in the map and your scripts.
You can do it yourself, or send me your project by email.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

Re: Android: Map Drag locked to left and right + Not click under UI

Thank you sending email now.

I will continue to investigate what might be happening regarding the zoom, thanks!

Re: Android: Map Drag locked to left and right + Not click under UI

Update on the map dragging.

My map game object was rotated [ -90, 0, 0 ], resetting it back to zero resolves the issue.
Maybe this will help someone down the road!