Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drawing a rectangle with dashed lines using Rafael.js

I am using Rafael.js to draw rectangles on an image. My problem with setting the stroke color is that the background may be dark or light or any color. I thought that the best way to deal with that would be using dashed lines. However this call

circle = Canvas.paper.rect(left, topCoord, width, height).attr({stroke-dasharray:"---"});

does not work. Firebug (on FireFox 20.0) returns an error message saying that an existing function in my .js file does not exist. It appears that stroke-dasharray is not valid for rectangles.

like image 962
OtagoHarbour Avatar asked Apr 09 '13 20:04

OtagoHarbour


1 Answers

Basic JavaScript error:

{stroke-dasharray:"---"}

Should be:

{"stroke-dasharray":"---"}

Also: "---" isn't a supported value for stroke-dasharray; it should be:

{"stroke-dasharray":"--"}
like image 151
searlea Avatar answered Sep 19 '22 22:09

searlea