Skip to content

Instantly share code, notes, and snippets.

@zaidalyafeai
Last active July 2, 2018 20:27
Show Gist options
  • Save zaidalyafeai/a804be9c58649beef3d46a94cc819ce2 to your computer and use it in GitHub Desktop.
Save zaidalyafeai/a804be9c58649beef3d46a94cc819ce2 to your computer and use it in GitHub Desktop.
$(function () {
//setup the canvas
canvas = window._canvas = new fabric.Canvas('canvas');
canvas.backgroundColor = '#ffffff';
canvas.isDrawingMode= 0;
canvas.freeDrawingBrush.color = "black";
canvas.freeDrawingBrush.width = 10;
canvas.renderAll();
//event listeners
canvas.on('mouse:up', function(e){getFrame(); mousePressed = false});
canvas.on('mouse:down', function(e){mousePressed = true});
canvas.on('mouse:move', function(e){recordCoor(e)});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment