otm / networkmap.js

A network weathermap written in Javascript and SVG with editing capabilities.
http://otm.github.io/networkmap.js/
Other
139 stars 29 forks source link

Adding support for custom SVG drawing callback. #11

Closed emil-palm closed 8 years ago

emil-palm commented 8 years ago

This pull request will add support for custom SVG drawing callbacks.

networkMap.registerDrawingCallback(name, func)

And then just add drawingcallback with the name of callback you would like to be fired, to the options of a node.

otm commented 8 years ago

Thanks for the PR. The only thing is that drawingCallback does not have a nice ring to it. The drawingCallback is what actually renders the node. I would suggest to maybe call it render or renderer in the configuration file.

Moving the registration function to the Node, that is. networkMap.Node.registerRenderer(name, fn). Then instead of having an if/else statement in the draw function always call the renderer for the node. And all nodes that does not have a specific renderer would be assigned a default rederer.

emil-palm commented 8 years ago

Hi.

Nah i agree the naming isnt that good, renderer would work.

Sure il just rewrite that part to move the renderering to the node object instead and register a default "rect" renderer.

On a side note Nils, are you on any Slack / open chat platform to discuss some minor things ?

Cheers Emil

emil-palm commented 8 years ago

Im going to close this PR and open a new one with a clean branch instead of master.

otm commented 8 years ago

@mrevilme best way to get in touch with me is through Slack or Hangouts. Hangouts is probably the best way.