nicholaswmin
nicholaswmin

Reputation: 22949

Select all in current layer and change stroke color. SVG

i am doing a modification of svg-editor, specifically a mod of the method-draw implementation.

I am trying to create a function that if called automatically selects all objects and changes their stroke color.

i am able to call within my function this:

svgCanvas.selectAllInCurrentLayer();    

which basically selects all items on canvas. However when i type below it the change stroke color function

svgCanvas.setcolor("stroke", "red");

it doesnt run the second command(the stroke change function).

Upvotes: 0

Views: 219

Answers (1)

methodofaction
methodofaction

Reputation: 72405

In Method Draw/SVG Edit you would do:

svgCanvas.selectAllInCurrentLayer();
var selected = svgCanvas.getSelectedElems();
selected.forEach(function(el){
  el.setAttribute("stroke", "red")
});

Upvotes: 1

Related Questions