diff options
author | sanine <sanine.not@pm.me> | 2022-05-31 20:52:15 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-05-31 20:52:15 -0500 |
commit | 5efc7885e1c3959aa165be640858ffb3f8a5860b (patch) | |
tree | 6865327d6affd6df2c4f61ed3b9d5ab446e2b23e /src/main.js | |
parent | 8aa6645f2311de78f74b35f804cc45c7fcf38f57 (diff) |
refactor: remove modules/ folder
Diffstat (limited to 'src/main.js')
-rw-r--r-- | src/main.js | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/main.js b/src/main.js deleted file mode 100644 index f73a17b..0000000 --- a/src/main.js +++ /dev/null @@ -1,39 +0,0 @@ -import Terrain from './Terrain.js'; -import Canvas from './Canvas.js'; -import Brush from './Brush.js'; -import BrushSelector from './BrushSelector.js'; - -const $ = id => document.getElementById(id) - -window.onload = () => { - const canvas = new Canvas('root'); - const terrain = new Terrain(); - const selector = new BrushSelector('root', canvas, terrain); - - let brushing = false; - - canvas.onMouseDown = e => { - if (e.button == 0) brushing = true; - }; - canvas.onMouseUp = e => { - if (e.button == 0) brushing = false; - }; - - const pos = canvas.mouse.drawingPos; - canvas.onMouseMove = () => { - if (brushing) selector.apply(); - canvas.draw(); - }; - - canvas.onDraw = ct => { - terrain.render(ct); - - ct.strokeStyle = '#fff'; - ct.lineWidth = canvas.pixelsToUnits(1); - ct.beginPath(); - ct.arc(pos.x, pos.y, canvas.pixelsToUnits(selector.radiusSlider.value), 0, 2*Math.PI); - ct.closePath(); - ct.stroke(); - }; - canvas.draw(); -} |