alyssaxuu / flowy

The minimal javascript library to create flowcharts ✨

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rearranging blocks on canvas disturbe style

er-chaan opened this issue · comments

steps to reproduce

  • make a tree with (A parent with child B,C)
  • add grand child D to node B
  • rearrange child D to node C
  • add new child E to node D (it will break css)

Screenshot_2020-12-16

after doing r&d with canvas properties and style.css issue sorted

Hey @er-chaan,

Could you share which solution worked for you? I remember having this same issue on & off

For anyone encountering the same issue this is what worked for me.

In the js file line 328 i removed the absy variable. Not sure if it was required or not but it is what worked for me.

Replaced line 328 with the line given below.

blockstemp.filter(a => a.id == parseInt(drag.querySelector(".blockid").value))[0].y = (drag.getBoundingClientRect().top + window.scrollY) + (parseInt(window.getComputedStyle(drag).height) / 2) + canvas_div.scrollTop - canvas_div.getBoundingClientRect().top;

For anyone encountering the same issue this is what worked for me.

In the js file line 328 i removed the absy variable. Not sure if it was required or not but it is what worked for me.

Replaced line 328 with the line given below.

blockstemp.filter(a => a.id == parseInt(drag.querySelector(".blockid").value))[0].y = (drag.getBoundingClientRect().top + window.scrollY) + (parseInt(window.getComputedStyle(drag).height) / 2) + canvas_div.scrollTop - canvas_div.getBoundingClientRect().top;

Oops, yes, the absy variable isn't supposed to go there (it's used for offsets in the x/y positions in the DOM, but not when storing the data). Just updated it, should be fine now.