orb icon indicating copy to clipboard operation
orb copied to clipboard

Can't set map view max zoom

Open you-randomly opened this issue 2 years ago • 2 comments

changing the maxZoom view setting on a map view orb container has no effect

        const container = document.getElementById('graph');
        const orb = new Orb.Orb(container);
        orb.setView((context) => new Orb.MapView(context, {
            getGeoPosition: (node) => ({ lat: node.data.lat, lng: node.data.lng, }),
        }));
        orb.view.setSettings({
            map: {
                zoomLevel: 9,
            },
            render: {
                maxzoom: 20,
            },
        });

I'd expect the above would allow the user to zoom all the way to zoom level 20 on the map

however this doesn't seem to the be the case as this has no affect on the test sie i have setup

I'm guessing these settings maybe only affect the default view?

you-randomly avatar Feb 20 '23 00:02 you-randomly

Good guess, the maxZoom property is currently part of the renderer settings, but in a map view environment, map becomes the primary renderer in a sense of settings and the environment.

As we haven't yet added a better sync between renderer zoom levels and map zoom levels (e.g. when you zoom in, the node size stays the same which should not be the case), the orb exposes the leaflet instance so you can do any customization on it.

Get the leaflet instance with orb.view.leaflet (Docs reference) and with it you can do any customization that Leaflet has, including maxZoom for the map: https://leafletjs.com/reference.html#map-maxzoom

tonilastre avatar Feb 20 '23 10:02 tonilastre

Hi @you-randomly, did @tonilastre's suggestion help you resolve the issue you were experiencing?

katarinasupe avatar Dec 19 '23 12:12 katarinasupe