alyssaxuu / flowy

The minimal javascript library to create flowcharts ✨
MIT License
11.47k stars 998 forks source link

rearranging blocks on canvas disturbe style #112

Closed er-chaan closed 3 years ago

er-chaan commented 3 years ago

steps to reproduce

Screenshot_2020-12-16

er-chaan commented 3 years ago

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

juanmalunatic commented 3 years ago

Hey @er-chaan,

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

sureshmatsio commented 3 years ago

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;

alyssaxuu commented 3 years ago

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.