Reputation: 1271
I am drawing shapes using html5 canvas library Fabric js :
Code :
canvas.add(new fabric.Rect({top: 100,
left: 100,
width: 50,
height: 50,
fill: 'empty',
stroke: 'white',
strokeWidth: 1}));
But it is filling black in the middle area which I dont want . I want the functionality like strokeRect in html5 canvas . Any suggestions?
Upvotes: 1
Views: 726
Reputation: 1271
canvas.add(new fabric.Rect({
top : 100,
left : 100,
width : 50,
height : 50,
fill : '',
stroke : 'white',
strokeWidth : 1
}));
Upvotes: 1
Reputation: 969
Use transparent
instead of empty
to fill
the rectangle.
Sample:
canvas.add(new fabric.Rect({top: 100,
left: 100,
width: 50,
height: 50,
fill: 'transparent',
stroke: 'white',
strokeWidth: 1
}));
Upvotes: 1