From 58b92fc8fb134b5106452e00dcbf6c6177c435d6 Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Mon, 15 Mar 2021 18:31:22 +0100 Subject: [PATCH 1/2] Przygotowanie protytypu --- src/grid.js | 17 ++++++++++++----- src/main.js | 1 + 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/grid.js b/src/grid.js index 78cb453..c81f719 100644 --- a/src/grid.js +++ b/src/grid.js @@ -1,6 +1,7 @@ const Grid = function(canvas) { let grid = [[]]; let ctx; + let storages = [] this.setCanvasSize = (canvas) => { canvas.width = 2000; @@ -27,15 +28,21 @@ const Grid = function(canvas) { } } - this.neonRect = (x, y, w, h) => { - this.ctx.globalCompositeOperation = 'lighter'; - this.ctx.shadowColor = "#fff"; + this.neonRect = (x, y, w, h, clr = '#fff', lw = 5) => { + this.ctx.globalCompositeOperation = 'darker'; + this.ctx.shadowColor = clr; this.ctx.shadowBlur = 10; - this.ctx.strokeStyle= "#fff"; - this.ctx.lineWidth = 5; + this.ctx.strokeStyle= clr; + this.ctx.lineWidth = lw; this.ctx.strokeRect(x, y, w, h); } + this.addStorageCenter = (x, y) => { + this.neonRect(x * 100, y * 100, 100, 100, '#ff0000', 10); + } + + this.getStorageCenters = () => storages + this.ctx = canvas.getContext('2d'); this.setCanvasSize(canvas); this.processGrid(); diff --git a/src/main.js b/src/main.js index 1c3219c..d869846 100644 --- a/src/main.js +++ b/src/main.js @@ -1,4 +1,5 @@ window.addEventListener('DOMContentLoaded', () => { const gridCanvas = document.getElementById('canvas-grid'); const grid = new Grid(gridCanvas); + grid.addStorageCenter(9, 0); }); \ No newline at end of file From 5ab3be9161f3543c1e86e9afda02db438cbba703 Mon Sep 17 00:00:00 2001 From: Robert Bendun Date: Mon, 15 Mar 2021 18:36:46 +0100 Subject: [PATCH 2/2] test --- nowy | 1 + 1 file changed, 1 insertion(+) create mode 100644 nowy diff --git a/nowy b/nowy new file mode 100644 index 0000000..c32bed5 --- /dev/null +++ b/nowy @@ -0,0 +1 @@ +witam