Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HexBinLayer that Extends SVG #76

Closed
ssontag55 opened this issue Sep 13, 2019 · 5 comments
Closed

HexBinLayer that Extends SVG #76

ssontag55 opened this issue Sep 13, 2019 · 5 comments

Comments

@ssontag55
Copy link

ssontag55 commented Sep 13, 2019

Any suggestion on this one?

@Igor-Vladyka happy to submit a PR or separate request if needed. Thanks for the proj.

https://github.com/Asymmetrik/leaflet-d3/blob/master/src/js/hexbin/HexbinLayer.js#L20

L.Control.BrowserPrint.Utils.registerRenderer(L.HexbinLayer,"L.HexbinLayer",function(layer, options) {
      var hexLayer = L.hexbinLayer(layer.options);
      this.hexLayer.data(layer._data);
      return hexLayer;
    });

L.Control.BrowserPrint.Utils.registerLayer(L.HexbinLayer, "L.HexbinLayer",function(layer) {
      var hexLayer = L.hexbinLayer(layer.options);
      this.hexLayer.data(layer._data);
      return hexLayer;
    });
@Igor-Vladyka
Copy link
Owner

Hi, here 'HexBinLayer that Extends SVG' is basically a new renderer, so you have to only register renderer.
All layers will be rendered with hexbin renderer. Also, for renderer there is only one param inside builder function, that is options.
L.Control.BrowserPrint.Utils.registerRenderer(L.HexbinLayer,"L.HexbinLayer")

@ssontag55
Copy link
Author

Thanks, works for downloading to image, but the print option doesn't register the layer since the data isn't sent to the Hexbin layer class.

@Igor-Vladyka
Copy link
Owner

Can you provide an full code example to see what's up with that?
One of the options for now is to catch "L.Control.BrowserPrint.Event.PrintStart" event
map.on(L.Control.BrowserPrint.Event.PrintStart, function(e){ ... }); and add data to renderer there.

@ssontag55
Copy link
Author

There is data in the layer on PrePrint but it's removed on Print. See data array:

Screen Shot 2019-09-30 at 1 09 12 PM

@Igor-Vladyka
Copy link
Owner

I'm not sure how it works internally, but you should use it only as a renderer, and not as both(renderer and layer). Therefore: try to remove registerLayer for HexbinLayer, and pass all needed data to it on PrintStart.

And any working example to debug it would be helpfull :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants