Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created January 26, 2012 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zubairov/1682293 to your computer and use it in GitHub Desktop.
Save zubairov/1682293 to your computer and use it in GitHub Desktop.
fabric.js issue with groups
var left = this.get('left');
var top = this.get('top');
var title = this.get('title');
fabric.Image.fromURL(this.get('icon'), function(img) {
img.set('left', left + img.width / 2 + 6).set('top', top + img.height / 2 + 6);
var text = new fabric.Text(title, {
fontFamily: 'Delicious_500',
left: left + 38,
top: top + 90,
fontSize: 20,
textAlign: 'center'
});
canvas.add(new fabric.Group([img, text]));
]);
@kangax
Copy link

kangax commented Jan 26, 2012

Groups have somewhat limited behavior right now. You can only have one at any time and it should be the active one. If you need to add 2 objects to canvas just pass them to addcanvas.add(img, text). I'll be fixing groups soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment