yWorks/yfiles-for-html-demos

BPMN layout demo & data provider

fabiopigna opened this issue · 3 comments

Hello,

I'm Fabio, and I'm evaluating the yFiles layout library.
Experimenting with the BPMN layout code from the demo, I found that (not sure if it's a bug or something I didn't understand):

const affectedEdges = IMapper.fromDelegate(
edge =>
adapter.selectionModel.isSelected(edge) ||
adapter.selectionModel.isSelected(edge.sourceNode) ||
adapter.selectionModel.isSelected(edge.targetNode)
)
adapter.addDataProvider(
INode.$class,
YBoolean.$class,
LayoutKeys.AFFECTED_NODES_DP_KEY,
affectedEdges
)

the mapper maps edges, the data provider is using that mapper for nodes.
Is it correct? What I am missing?

thanks,
Fabio Pignaton

yGuy commented

Indeed, this does look fishy. We're checking whether this is just a typo that does not affect functionality or actually a bug.
Good catch!

yGuy commented

OK.

The current code does not fail, and it will often have similar effects, but you are right that this is a bug and this should be AFFECTED_EDGES_DP_KEY - with IEdge.$class as the first parameter in the addDataProvider call.

Actually we have fixed the bug recently when we refactored the BpmnLayoutData class, but the fix will only become available with the upcoming 2.4 release. I don't think we will be doing a bugfix release for the demo until then, unless a critical bug is reported against the library that is hard or impossible to work around.

So please make the patch. With the 2.4 release (where this part of the demo will get quite a bit nicer in TypeScript), you can can simply upgrade that file.

Thanks for your report!

Yep, thanks!

(and upvote to the TypeScript version!)