Raphaël Error: arrow

I use the Raphaël library to create a quick drawing tool. But there is an error with an arrow, they are assigned the same for all lines.

Let's say I have line A with the arrow arrow # raphael-marker-oval. Then I draw line B and assign the arrow to the arrow with the symbol # raphael-marker-oval. Whenever I change the arrow pointer of line A to a new color, the line arrow of the line will also be changed to the same color.

Please, help!

+6
source share
2 answers

I have a similar problem when the arrows disappear when the containment div is hidden. This seems to be a bug in Raphael: https://github.com/DmitryBaranovskiy/raphael/pull/525 I'm just researching it and trying to figure out how to fix it ...

It seems that the problem is resolved if the unique markers. This is what I did to fix this: in raphael.js: Line 28:

var raphaelMarkerIdFixCount = 1; 

Line 5938: replace this:

 markerId = "raphael-marker-" + se + type + w + h; 

with this:

 markerId = "raphael-marker-" + se + type + w + h + raphaelMarkerIdFixCount; raphaelMarkerIdFixCount++; 

Since now this means that each marker element is created every time, it can lead to memory problems if you draw a huge number of arrows - someone can come up with a better patch, this fix is ​​definitely “quick and dirty”, but it’s worked for me.

+4
source

I have the same problem. And tried to fix it, but it comes from Raphael.js

I am sure this is a mistake. Do not waste time on this. Perhaps you can report it to THEM

0
source

Source: https://habr.com/ru/post/948920/


All Articles