mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2026-03-22 15:17:23 +01:00
refactor: Remove lastDrawnIcons tracking to simplify terrainLayer drawing logic
This commit is contained in:
parent
70e3eea4d1
commit
c7793d2578
1 changed files with 1 additions and 6 deletions
|
|
@ -16,7 +16,6 @@ const atlases = Object.fromEntries(
|
|||
);
|
||||
|
||||
const terrainLayer = new TextureAtlasLayer("terrain", atlases);
|
||||
let lastDrawnIcons: ReliefIcon[] | null = null;
|
||||
|
||||
function resolveQuads(icons: ReliefIcon[]) {
|
||||
return icons.map((r) => {
|
||||
|
|
@ -54,16 +53,12 @@ window.drawRelief = (
|
|||
if (type === "svg") {
|
||||
drawSvg(icons, parentEl);
|
||||
} else {
|
||||
if (icons !== lastDrawnIcons) {
|
||||
terrainLayer.draw(resolveQuads(icons));
|
||||
lastDrawnIcons = icons;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.undrawRelief = () => {
|
||||
terrainLayer.clear();
|
||||
lastDrawnIcons = null;
|
||||
const terrainEl = byId("terrain");
|
||||
if (terrainEl) terrainEl.innerHTML = "";
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue