[IGN-7955] Get web browser zoom level in perspective

Hi
I want to display very large area in single view and to viewing different part user had to zoom/pan the view. (power distribution grid of a city)
And if I manage some how the current web browser zoom level, I can simply hide and hide object depend on current zoom level and making cluttering/de-cluttering effect.
Is there any trick to do that?

Hi Nader,

This is something we’ve looked at and would like to be able to do, but unfortunately there is no simple way to reliably get the zoom level across the different browsers we support. Chrome has an api for it, and firefox implements it as well now, but Edge and Safari do not, nor do the mobile browsers.

We’d prefer not to implement functionality that is only supported on some browsers we are targeting, so we’ve been waiting/hoping that the big browser distributors would all implement the same/similar API. I’m hoping that Edge will start supporting it once it’s fully running on the Chromium/V8 engine for their production versions. Mobile and Safari are a different story.

We’ve looked at implementing something on our own, but there are a lot of challenges due to the differences across devices in how they report screen size/pixels/dpi/viewport/etc. For instance, a calculation that works well in many cases will break or report incorrect values when in an iFrame.

Of course, that doesn’t mean we can’t get it done, it’s just something that is challenging enough to require more time/testing than we’ve been able to give it this far.

I’m going to create a ticket to reinvestigate the current options in detecting the state of zoom in the browser and see what we can do.

1 Like

Hi Perry
Thanks for your explanation.
Why don’t you support the same technique you use in map component? Like a new container that have zoom option. The container has a zoom property and support zooming gestures. Every component we put in this component can access it and bind that to it’s visibility.

Please take a look that following video as example:

I really need this feature so if it only work for chrome there is no problem for me.

A ‘zoomable’ container type is already something we’re planning to implement (actually, it’s been on the list pretty much the whole time), as a separate feature to exposing the browser zoom level.

2 Likes

Can you give a rough estimation for releasing it?
I’m really need that for my next projects.

Still in the planning/design stages, so unfortunately can't offer any estimation.

That's certainly a usage pattern we hope to achieve, but unfortunately for a number of technical and user-experience related purposes, it's not as simple as "just add views/components to the map".

If you only need it for chrome, you could consider building a module (using our example as a start) that has a single invisible 'component' that reports the zoom level as a property.

Otherwise, no timeline, but it's something that's on our roadmap.

2 Likes

Do we still don't have this option ?

It looks like there is now broader support for getting and setting the zoom through JS apis. I've opened a ticket to review compatibility and see if this is something we can look to add now that there's broader support across browsers (looks like mobile firefox is an exception, but seems an uncommon use case).

So for now, still no zoom support, but looks like it may be feasible so we'll review it and see what we can do. Ticket created as IGN-7955.

4 Likes

Me! (Well, I use the app usually. Ok.)

Hah - ya, I actually removed Chrome from my android phone and run FF as well (can't live without my adblock/privacy extensions). But definitely swimming against the current there!

1 Like

We simply implement zooming and panning with CSS transform and mouse events. Even BJIC creates a new container for that as a module. So at this point having this feature is useless. Instead having the scroll position and changing its position is a very good tool for us.