projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.6k stars 1.17k forks source link

Can't have differents colors on DiamondNode #769

Closed loucarpe closed 3 years ago

loucarpe commented 3 years ago

Hello, I am playing a little with this wonderful librairy to see if I can use it for an internship project. I have started working on the Drag And Drop Demo using the DiamondNode from the Custom Node Demo I modified myself.

But I am having an issue with the DiamondNode, I am not able to have color passed as property when I am calling the DiamondNodeModel class, I don't think this an issue with the librairy itself, it's more likely I didn't get something.

Here is some code to illustrate :

First the BodyWidget.tsx file from DnD Demo : https://pastebin.com/k7aUYukd Please don't mind the differents TrayItemWidget called that way I know it's ugly. You can see on line 70 that I am calling the DiamondNodeModel with a color property, but when the generated Node is dropped, no color is displayed. Here is my modified DiamondNodeModel.ts file : https://pastebin.com/LHV7FTET and my own DiamondNodeWidget.ts : https://pastebin.com/SZCekcKx

Can someone give me some tips to solve this issue ? I am planning to have differents PNG image file with the different colors but I think it will be the same issue for me so it will be two birds with one stone for me if I get some help.

Thanks =D

PS: I am thinking of starting all over from a clean slate rather than using DiamondNode.

berabulut commented 3 years ago

In DiamondNodeWidget class this.props.node.getOptions().color is this returning correct color codes that you are passing to it?

dylanvorster commented 3 years ago

Closing as this is not a library bug or feature, hope you were able to debug the issue.