diff --git a/css/solid.min.css b/css/solid.min.css new file mode 100644 index 0000000..286fa55 --- /dev/null +++ b/css/solid.min.css @@ -0,0 +1 @@ +@font-face{font-family:"Font Awesome";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.eot);src:url(../webfonts/fa-solid-900.eot?#iefix) format("embedded-opentype"),url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.woff) format("woff"),url(../webfonts/fa-solid-900.ttf) format("truetype"),url(../webfonts/fa-solid-900.svg#fontawesome) format("svg")}.fa,.fas{font-family:"Font Awesome 5 Free";font-weight:900} diff --git a/js/Map.class.js b/js/Map.class.js index 7570285..9157b7a 100644 --- a/js/Map.class.js +++ b/js/Map.class.js @@ -73,7 +73,7 @@ class Map { c.drawImage( t.image, - x * (t.tileRealWidth + t.border), + x * (t.tileRealWidth + t.border), y * (t.tileRealHeight + t.border), t.tileRealWidth, t.tileRealHeight, -t.tileWidth/2, -t.tileRealHeight+t.tileHeight+t.bottomOffset, @@ -147,10 +147,13 @@ class Map { } paintCustomIsometric(brush,nlayer,posy,posx){ + const scaleV = Math.floor(t.tileRealHeight/t.tileHeight) for(let i = 0; i < brush.data.length; i++){ for(let j = 0; j < brush.data[0].length; j++){ - if( posy+i+j < this.intH && posx+i-j < this.intW ) - this.layers[nlayer][posy+i+j][posx+i-j] = brush.data[i][j] + const posY = posy + (i * scaleV) + j + const posX = posx + (i * scaleV) - j + if( posY < this.intH && posX < this.intW ) + this.layers[nlayer][posY][posX] = brush.data[i][j] } } } diff --git a/js/Texture.class.js b/js/Texture.class.js new file mode 100644 index 0000000..6a3da6a --- /dev/null +++ b/js/Texture.class.js @@ -0,0 +1,21 @@ +class Texture { + + constructor(imgSrc, imgName, tileRealWidth, tileRealHeight, border, tileWidth, tileHeight, bottomOffset){ + this.src = imgSrc + this.name = imgName + this.tileRealWidth = tileRealWidth + this.tileRealHeight = tileRealHeight + this.border = border + this.tileWidth = tileWidth + this.tileHeight = tileHeight + this.bottomOffset = bottomOffset + } + + load(callback){ + const url = window.URL || window.webkitURL + this.image = new Image() + this.image.src = this.src = url.createObjectURL(this.src) + this.image.onload = callback + } + +} diff --git a/js/main.js b/js/main.js index 8d82b84..bd05b70 100644 --- a/js/main.js +++ b/js/main.js @@ -157,6 +157,10 @@ const createTexturePalette = (imgSrc, imgName, tileRealWidth, tileRealHeight, bo eraser.className = 'tool' eraser.innerText = '\uf12d' eraser.onclick = () => { + if(!brush) + brush = { + 'type': 'default' + } if(brush.type == 'custom') brush.type = 'default' brush.data = 0 @@ -171,6 +175,8 @@ const createTexturePalette = (imgSrc, imgName, tileRealWidth, tileRealHeight, bo bucket.className = 'tool' bucket.innerText = '\uf576' bucket.onclick = () => { + if(!brush) + return if(brush.type == 'custom') brush.type = 'default' brush.type = 'bucket' diff --git a/webfonts/fa-solid-900.eot b/webfonts/fa-solid-900.eot new file mode 100644 index 0000000..5da4fa0 Binary files /dev/null and b/webfonts/fa-solid-900.eot differ diff --git a/webfonts/fa-solid-900.svg b/webfonts/fa-solid-900.svg new file mode 100644 index 0000000..313b311 --- /dev/null +++ b/webfonts/fa-solid-900.svg @@ -0,0 +1,5028 @@ + + + + +Created by FontForge 20200314 at Mon Oct 5 09:50:45 2020 + By Robert Madole +Copyright (c) Font Awesome + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/webfonts/fa-solid-900.ttf b/webfonts/fa-solid-900.ttf new file mode 100644 index 0000000..e074608 Binary files /dev/null and b/webfonts/fa-solid-900.ttf differ diff --git a/webfonts/fa-solid-900.woff b/webfonts/fa-solid-900.woff new file mode 100644 index 0000000..ef6b447 Binary files /dev/null and b/webfonts/fa-solid-900.woff differ diff --git a/webfonts/fa-solid-900.woff2 b/webfonts/fa-solid-900.woff2 new file mode 100644 index 0000000..120b300 Binary files /dev/null and b/webfonts/fa-solid-900.woff2 differ