svgdotjs / svg.draw.js

An extension of svg.js which allows to draw elements with mouse
MIT License
236 stars 57 forks source link

Solid shapes #45

Closed audas closed 5 years ago

audas commented 5 years ago

When drawing shapes I get a solid shape instead of the outline ? I am setting it to be used with a canvas.

Fuzzyma commented 5 years ago

Stroke and fill rules still apply. When you want the outline, use fill "none" and set a stroke. Please ask these kind of questions on stackoverflow.

audas commented 5 years ago

I can't ask questions on stackoverflow.

Further its more appropriate to respond to issues here than stackoverflow as this is not a "programming" issue its specific to your extension.

Why not just provide an example ?

Where do we set the fill and stroke ? We can not pass these as options to the draw() method, we can not set them on the item itself and not on the drawing either.

This does not work.

`
drawing = new SVG("image_holder'").size($('#image_preview').width(), $('#image_preview').height());

    var rectOptions={
            fill: "none",
            stroke: "red", 
    };

drawing.options=rectOptions;

`

And nor does

drawing.rect(rectOptions);

And nor does

drawing.rect().draw(rectOptions);

Have tried with every permutation of colour including rgba.

Your extension loops through the "options" and implements them or resorts to the defaults - except this does not work.

audas commented 5 years ago

Ok so your extension does not accept the options at all - we have to set them specifically via the SVG.JS API via attributes.

Your read me suggests otherwise.