javascript - Give a stroke to svg objects -


good day everyone,

i trying give svg object in fabric stroke around bounding box. unfortunately

obj.set({   'stroke': 'red',   'strokewidth': 2 }); 

won't work, after updating with.

obj.setcoords(); canvas.renderall(); 

all other attributes in fill or angle seem work. did has come across problem , know how solve it?

thank sebastian

edit: how loading svg:

var group = [];     var loadedobjects;  fabric.loadsvgfromurl(              'bla.svg',               function(objects, options) {                 loadedobjects = new fabric.group(group);             },               function(item, object) {                 object.set('id', item.getattribute('id'));                 group.push(object);             } ); 

fabricjs not support border drawing group or pathgroup. can load svg pathgroup. once loaded create rect same width , height, give him same top , left. stroke rect , group them togheter:

fabric.loadsvgfromurl(              'bla.svg',               function(objects, options) {                 var svg = fabric.util.groupsvg(objects, options);                 var rect = new fabric.rect({width:svg.width, height: svg.height, top:svg.top, left: svg.left, stroke: 'red', strokewidth: 5});                 group = new fabric.group([svg, rect]);                 canvas.add(group);             } ); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -