react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Label on link are not rendering properly

Open ganesh-sankey opened this issue 8 years ago • 4 comments

@dylanvorster I fresh cloned the library. Run the set of commands as mentioned in docs.

  1. yarn install
  2. yarn run storybook

I came across issue label not rendering properly on continuous drag of node and also after drag in the section storybook/demo Links with labels. I have attached the gif for the same.

ezgif-4-47b70288ed

ganesh-sankey avatar Apr 02 '18 13:04 ganesh-sankey

I had this issue too but was time pressured and didn't have the time to verify if it was me or a genuine fault.

My hacky temp solution follows below in case you need a quick fix.

constructor(props: any) {
     super(props);
     this.labelFixToken = setInterval(this.startFixLabels, 1);
     var state = new State();
     this.state = state;
 }

 startFixLabels() {
     var labels = document.getElementsByClassName('srd-default-link__label');
     for (var i = 0; i < labels.length; i++) {
         labels[i].setAttribute('width', '0px');
     }
 }

In addition to being terrible this comes with a bunch of caveats, it currently runs every 1ms so please change that and you should remember to call clearInterval when you're tearing down whatever you're using to render the editor.

Azim-Palmer avatar Apr 11 '18 11:04 Azim-Palmer

I encountered this problem too? is this issue already addressed?

screen shot 2019-02-22 at 12 33 43

Can someone tell me how to override the addLabel method? I'm using typescript

josephjesseyoung avatar Feb 22 '19 05:02 josephjesseyoung

UPDATE: just found a semi permanent solution without set interval, open the lib folder in node_modules and find main.js inside /dist/e2e. Open it and direcly find "__label", then change the width into 0.

Note that this fix will be reset everytime you update the library.

josephjesseyoung avatar Feb 22 '19 07:02 josephjesseyoung

closing due to investigation https://hackmd.io/@renato-bohler/react-diagrams-issues-analysis

dylanvorster avatar Dec 30 '19 20:12 dylanvorster