react-node-graph icon indicating copy to clipboard operation
react-node-graph copied to clipboard

Style dependent position calculations

Open AlesJiranek opened this issue 9 years ago • 3 comments

Hello,

are you going to update position calculations to be independent on style, or maybe configurable with props?

AlesJiranek avatar Feb 03 '16 14:02 AlesJiranek

I guess those are the options - I'd prefer to not pass props. Do you think its safe to calculate using dom methods (e.g. getBoundingClientRect)? I'll take a shot or you can send me a PR, the example should suffice for validation.

lightsinthesky avatar Feb 03 '16 14:02 lightsinthesky

I think it is safe, but we will lose server side rendering suppor If we will use them. I think best option would be to use inline styles and allow to pass custom style prop. Then we can use properties like width, padding and line height from style object in calculations and also it can be changed with passed style

AlesJiranek avatar Feb 03 '16 15:02 AlesJiranek

agreed

lightsinthesky avatar Feb 03 '16 15:02 lightsinthesky