Reputation: 11
fabric.js
which needs your help.<!DOCTYPE HTML>
<html>
<head>
<title>fabric_test</title>
<script type="text/javascript" src="all.js"></script>
</head>
<body>
<canvas id="canvas" width="512" height="512" style="background-color: rgb(222, 222, 222)">
Your browser does not support canvas tag!
</canvas>
<script type="text/javascript">
var canvas = new fabric.Canvas('canvas');
// create a rectangle object
var rect = new fabric.Rect({
left: 100,
top: 100,
fill: 'red',
width: 20,
height: 20
});
// "add" rectangle onto canvas
canvas.add(rect);
</script>
</body>
</html>
My question is:
all.js
file on current location. Is this right?Upvotes: 1
Views: 2374
Reputation: 4460
This problem is caused because you put a background in your canvas object. So, the color is over the inside elements. Remove the background style from your canvas.
Upvotes: 1
Reputation: 1816
When you download the fabric zip file, on extraction you should find a folder fabric.js-1.4.4/dist copy the fabric.js file from there or the fabric.min.js file and include it instead of the all.js let me know if this works
Upvotes: 0