preferCanvas problem with panes #5190

Open
mrit64 opened this Issue Dec 14, 2016 · 3 comments

Projects

None yet

3 participants

@mrit64
mrit64 commented Dec 14, 2016

How to reproduce

  • Leaflet version I'm using: 1.0.2
  • Browser (with version) I'm using: Chrome and FF
  • OS/Platform (with version) I'm using: Windows 10

What behaviour I'm expecting and which behaviour I'm seeing

I have crated a map with preferCanvas option (or renderer: L.canvas()). It's working well without panes. When panes are associated with layers, SVG renderer is used despite the preferCanvas option.
Maybe because of the following instruction in L.Map._getPaneRenderer function :

	if (renderer === undefined) {
		renderer = (L.SVG && L.svg({pane: name})) || (L.Canvas && L.canvas({pane: name}));

...which favour SVG renderer in all cases ?

Best regards

@perliedman
Member

@mrit64 could you provide a running example on http://playground-leaflet.rhcloud.com/ or similar?

@Lax-Phorell
Lax-Phorell commented Dec 22, 2016 edited

I have the same problem, but i think it is connected with

getPaneRenderer: function (name) {
    if (name === 'overlayPane' || name === undefined) {
        return false;
    }
...

I think by default, Leaflet uses the overlayPane when rendering to canvas. If you use a different name for your (canvas-) pane, then

renderer = (L.SVG && L.svg({pane: name})) || (L.Canvas && L.canvas({pane: name}));

kicks in and you end up with a SVG renderer and therefore this.options.preferCanvas isn't even checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment