mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
burgs placement change + resource style
This commit is contained in:
parent
9722470a3d
commit
2df06c1b7e
4 changed files with 107 additions and 82 deletions
|
|
@ -1942,6 +1942,7 @@ function toggleResources(event) {
|
|||
function drawResources() {
|
||||
console.time('drawResources');
|
||||
const someArePinned = pack.resources.some((resource) => resource.pinned);
|
||||
const drawCircle = +goods.attr('data-circle');
|
||||
|
||||
let resourcesHTML = '';
|
||||
for (const i of pack.cells.i) {
|
||||
|
|
@ -1951,11 +1952,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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue