burgs placement change + resource style

This commit is contained in:
Azgaar 2021-07-07 21:17:39 +03:00 committed by Peter
parent 1e227642c8
commit 84965cf0ca
5 changed files with 111 additions and 97 deletions

View file

@ -1951,11 +1951,17 @@ function drawResources() {
const [x, y] = pack.cells.p[i];
const stroke = Resources.getStroke(resource.color);
if (!drawCircle) {
resourcesHTML += `<use href="#${resource.icon}" x="${x - 3}" y="${y - 3}" width="6" height="6"/>`;
continue;
}
resourcesHTML += `<g>
<circle data-i="${resource.i}" cx=${x} cy=${y} r="3" fill="${resource.color}" stroke="${stroke}" />
<use href="#${resource.icon}" x="${x - 3}" y="${y - 3}" width="6" height="6"/>
</g>`;
}
goods.html(resourcesHTML);
console.timeEnd('drawResources');
}

View file

@ -727,6 +727,12 @@ styleResourcesCircle.addEventListener("change", function () {
drawResources();
});
styleResourcesCircle.addEventListener('change', function () {
goods.attr('data-circle', +this.checked);
goods.selectAll('*').remove();
drawResources();
});
// request a URL to image to be used as a texture
function textureProvideURL() {
alertMessage.innerHTML = /* html */ `Provide an image URL to be used as a texture: