After a pinch gesture to zoom in on HereMaps using JavaScript, the getZoom() function unexpectedly returns a value

We are in the process of creating an Android app (targeting API 19 and above) using C# and the Xamarin framework. One of the key features is a map embedded within a WebViewClient - specifically, we are utilizing Here Maps rendered through the Here Maps JS API v3 (not the Here Maps mobile Android SDK).

The current issue at hand is that map.getZoom() returns 0 after a user performs a pinch-to-zoom action on the map.

In an attempt to troubleshoot this problem, we set up event listeners for 'mapviewchangestart', 'mapviewchange', 'mapviewchangeend', and 'sync'. Within these handlers, we called map.getZoom(), with the exception of 'sync' where we referenced e.newValue.zoom. We also tested calling getZoom() directly without any associated map events. However, in all cases, after a pinch-to-zoom action, the result was consistently 0.

To rule out any asynchronous issues, we tried waiting for approximately 30 seconds for all events and handlers to finish before calling map.getZoom(), yet it still returned 0.

Interestingly, when zooming in by tapping the map controls (+/-) or programmatically setting the zoom level, getZoom() functions correctly and provides the accurate zoom level. A potential clue emerged when we observed that when reaching the maximum zoom level (i.e., 20) through pinching-to-zoom, map.getZoom() did reflect the correct value of 20.

Has anyone encountered a similar issue before? Any insights or suggestions, no matter how small, would be greatly appreciated. Thank you.

Answer №1

After collaborating with our mapping partner and examining some sample code they provided, we discovered that the root of the problem was actually due to an erroneous assumption on our part:

The getZoom() method does not return an integer, but rather a float

In our C# wrapper, we mistakenly assumed it would give us an integer value. Therefore, whenever the value was not directly convertible to an integer (e.g. when it wasn't 3.0, 4.0, 5.0 etc) and contained a decimal portion (like 3.462), C# converted it to zero(0).

Interestingly, when using the zoom control buttons on the map (+ -), the value always seems to round up or down to the nearest whole number (e.g. 3.462 becomes 3.0 or 4.0). However, during pinch-to-zoom events, the values often include decimal points.

We also incorrectly assumed that there were exactly 21 zoom levels (ranging from 0 to 20), which now appears to be another mistaken belief. It would be beneficial if anyone could point us to documentation that clarifies this issue.

In hindsight, it's clear that we should have paid closer attention to the manuals and reevaluated our assumptions.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

There is a delay in updating ng-if/ng-hide in real time on the HTML page

Assistance needed for implementing a slight adjustment in AngularJS with TypeScript. The requirement is to change the text of a button for 3 seconds upon clicking, then revert back to its original text. Two HTML elements are created for this purpose, each ...

What is the process for incorporating an Onclick function to a Wheel Menu?

I followed a tutorial to create a rotating wheel menu that can be found here: The wheel menu is working fine, but I am unsure of how to add an Onclick method to it. **Activity ** public class SampleWheelActivity extends Activity { @Override pub ...

Anticipated the start of an array but instead encountered the start of an object at line 1, column 2

I am currently utilizing retrofit 2 on my Android application to fetch data in JSON format from the server and use it as an object. The server-side is developed using NetBeans. However, I'm encountering the exception mentioned above when executing the ...

Can React-Select be utilized in the browser directly from the CDN?

Is it possible to utilize react-select directly in the browser without using bundlers nowadays? The most recent version that I could find which supports this is 2.1.2: How to import from React-Select CDN with React and Babel? In the past, they provided r ...

Guide on building Browser source code for Android version 4.0.3

After downloading the Browser source code from https://github.com/android/platform_packages_apps_browser, I was able to access hidden and internal packages following a tutorial on . However, I encountered an issue while trying to build the source code for ...

Wait for Protractor until the page has completely finished loading

After navigating to https://docs.angularjs.org/tutorial, I attempted to click on '0 - Bootstrapping' under Tutorial but Protractor did not wait for the page to fully load, resulting in an Error. Error: Failed to execute 'click' on &a ...

Stop the window from scrolling up smoothly when opening a custom modal to avoid any flickering

I encountered a problem with a custom modal window that would open on click and move to the top of the viewport. The issue was that when scrolling up, the page beneath would be visible, so I needed to restrict scrolling once the modal was open. Below is th ...

What is the best method for streaming files from Java to the browser while preventing the user from downloading and saving the file?

I'm new to this and feeling a bit lost. Here's the situation: I have a web app (built with JavaScript/Reactjs) and a backend (Java using Liferay API) The server contains files (File A, B, C, etc.) of various types: pdf, excel, audio, txt, etc. ...

What could be causing the information from the ajax call to not appear in this popover?

Hovering over a link will trigger a popover with a 1 second delay containing user profile information, loaded using AJAX. $(function() { var timer = null; var xhr = null; $('.user_popup').hover( function(event) { ...

Is it better to use AngularJS' ngMock inject before each test or for each individual test case?

Current Situation As I work on writing tests for an Angular project, I have come across a common practice of creating "global" variables in a describe block to store dependencies needed for the tests. This approach involves defining variables like $contro ...

Redirect to login not working in Angular auth guard

Seeking assistance with troubleshooting an issue within my app. I am attempting to implement a feature where, if the user is not logged in and tries to access any URL of the app, they should be redirected to the login page. I have set up an auth guard, bu ...

display upcoming schedule and time

How can I display the future date and time in the respective field components? See below for a sample code snippet: require([ "dojo/_base/lang", "dijit/registry", "dojo/ready", "dijit/form/TimeTextBox", "dojo/parser" ], function(lang, registry, ready ...

Error: No matching column detected while using multiple Loaders in LoaderManager with MediaStore

Trying to match the corresponding Artist, Album's name, and Album's Cover from a music title using LoaderManager and CursorLoader in Android. The loader is initialized when the Activity is created with getLoaderManager().initLoader(1, null, this) ...

Error in TypeScript occurs when trying to destructure a block-scoped variable before it has been declared

Hello everyone, I have the below code written in TypeScript const { data: { pageCollection } } = await apolloClient.query<PageSlugsQuery>({ query: GET_PAGE_SLUGS }) ( [...(pageCollection?.items ?? [])].forEach((page) => { c ...

When trying to access an array directly within an object, it all too often returns as undefined

There is a React Component that has been provided with an array of objects (main_object), one of which contains another array of objects (secondary_object). Strangely, when trying to print the main object in console.log, the array is visible, but attemptin ...

Having trouble accessing news feed with jQuery due to an unexpected token error when attempting to cross domains

I am attempting to access the Yahoo News feed from a SharePoint site, but it is causing a cross-domain access issue. Despite trying various solutions found on numerous websites and blogs, I still cannot resolve the problem. (I am executing this code in the ...

What is the reason behind the shifting behavior of e.currentTarget when using event delegation in jQuery?

Click here for the code snippet <div id="container"> <button id="foo">Foo button</button> <button id="bar">Bar button</button> </div> $('#container').on('click', function(e) { var targ ...

Exploring Date Comparisons in AngularJS

Currently, I am in the process of developing a web application using AngularJS and Rails. One of the features involves creating bookings through a bookings function. In the dashboard section of the app, I aim to have two tabs - one for Current Bookings and ...

Is it possible to both retrieve and create data within the same route?

My route setup is like this: app.all("/checkoutupdateprods", async (res,req, next) =>{ const url = GRAPHQL_CUSTOM_URL; console.log("in b_server.js", res.body); let data = res; await fetch(url, checkOut_ProductsInStock ...

Implementing CORS for a custom route in Sails.js - a complete guide

I am experiencing an issue with my Angular 1.x app that calls APIs in my Sails.js app. Every time I attempt to make API calls from the Angular app, I encounter the following error - XMLHttpRequest cannot load <a href="http://localhost:1337/portal/login ...