AshTyson
AshTyson

Reputation: 493

FabricJS Import SVG into canvas not rendering

I am experimenting with fabricJS. I'm stuck while importing SVG files into the canvas. I saw examples in fabricjs site and used code suggested in SO answers. The imported image is not rendered in the canvas as shown in the fiddle below.

https://jsfiddle.net/d6p80yuk/

Am I missing anything?

Other code that I have tried

var group = [];

fabric.loadSVGFromURL($(this).attr("src"),function(objects,options) {
    var loadedObjects = new fabric.Group(group);
    loadedObjects.set({
        width: 200,
        height: 200
    });
    canvas.centerObject(loadedObjects);
    canvas.add(loadedObjects);
    canvas.renderAll();
},function(item, object) {
    object.set('id',item.getAttribute('id'));
    group.push(object);
});

Upvotes: 2

Views: 5443

Answers (1)

Dreamer
Dreamer

Reputation: 171

After a little messing around with the Chrome error log,I found a error message that says mixed request was loaded. If you are using chrome and working on jsfiddle like me, try to use http while loading to jsfiddle. Hope this can help you!

edit: Means to use http to load jsfiddle: http://jsfiddle.net/d6p80yuk/

Upvotes: 1

Related Questions