Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- let PIXELSIZE = 2;
- let REPEATSX = 20;
- let REPEATSY = 15;
- let DIMENSION = 25;
- let canvas = id('mycanvas');
- let ctx = canvas.getContext("2d");
- let canvasWidth = DIMENSION * REPEATSX * PIXELSIZE;
- let canvasHeight = DIMENSION * REPEATSY * PIXELSIZE;
- let selectedBox = null;
- canvas.width = canvasWidth;
- canvas.height = canvasHeight;
- // draw grid
- ctx.strokeStyle = '#cccccc';
- for (let i = 0; i < DIMENSION * REPEATSX; i += DIMENSION) {
- x = i * PIXELSIZE;
- ctx.beginPath();
- ctx.moveTo(x, 0);
- ctx.lineTo(x, canvasHeight);
- ctx.stroke();
- y = i * PIXELSIZE;
- ctx.beginPath();
- ctx.moveTo(0, y);
- ctx.lineTo(canvasWidth, y);
- ctx.stroke();
- }
- function id(id) {
- return document.getElementById(id);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment