Closed dkilfoyle closed 4 years ago
Hello,
it makes sense.
Now user can move renderes in specified list freely, but user does not know why his/hers renderer "does not work" after registerCustomRenderer.
But we need to add new rendered before GenericNodeRenderer
and not on pre-last index.
I mean something like this:
registerCustomRenderer(renderer) {
var rs = this.renderers;
for (var i = 0; i < rs.length; i++) {
var r = rs[i];
if (r instanceof GenericNodeRenderer) {
// pushing before GenericNodeRenderer before GenericNodeRenderer renders all remaining nodes
// so we need to query a new renderer first
rs.splice(i, 0, renderer);
return;
}
}
rs.push(renderer);
}
Can you send a pull request?
@dkilfoyle Also, remove "org.eclipse.elk.randomSeed": 0,
from your project if you want to have a deterministic layout.
Also, let's rename registerCustomRenderer
to registerRenderer
so we have smaller api.
Hi. Registering a custom node renderer via HwSchematic.nodeRenderers.registerRenderer() pushes the new renderer to the end of the renderers array which already has GenericNodeRenderer as the last item. NodeRendererContainer.prepare will match GenericNodeRenderer (selector always returns true) and the custom renderer doesn't have a chance to get selected. Perhaps need NodeRendererContainer.registerCustomRenderer to insert the custom renderer before the GenericNodeRenderer?
Thanks.
PS: Awesome project!