fix: textureImage is not defined

This commit is contained in:
Azgaar 2023-08-08 17:07:10 +04:00
parent 1847270482
commit f7cb157cf3
4 changed files with 7 additions and 7 deletions

View file

@ -7940,7 +7940,7 @@
<script src="config/heightmap-templates.js"></script>
<script src="config/precreated-heightmaps.js"></script>
<script src="modules/heightmap-generator.js?v=1.88.00"></script>
<script src="modules/ocean-layers.js?v=1.91.00"></script>
<script src="modules/ocean-layers.js?v=1.91.02"></script>
<script src="modules/river-generator.js?v=1.89.13"></script>
<script src="modules/lakes.js"></script>
<script src="modules/names-generator.js?v=1.87.14"></script>

View file

@ -637,10 +637,11 @@ export function resolveVersionConflicts(version) {
});
}
if (version < 1.9) {
if (version < 1.91) {
// from v1.90.02 texture image is always there
if (!texture.selectAll("*").size()) {
texture.style("display", "none");
texture
.append("image")
.attr("id", "textureImage")
@ -649,9 +650,7 @@ export function resolveVersionConflicts(version) {
.attr("preserveAspectRatio", "xMidYMid slice")
.attr("src", "https://i2.wp.com/azgaar.files.wordpress.com/2021/10/marble-big.jpg");
}
}
if (version < 1.91) {
// from 1.91.00 custom coa is moved to coa object
pack.states.forEach(state => {
if (state.coa === "custom") state.coa = {custom: true};

View file

@ -1518,8 +1518,9 @@ function toggleTexture(event) {
if (!layerIsOn("toggleTexture")) {
turnButtonOn("toggleTexture");
// href is not set directly to avoid image loading when layer is off
const src = texture.select("image").attr("src");
texture.select("image").attr("href", src);
const textureImage = byId("textureImage");
if (textureImage) textureImage.setAttribute("href", textureImage.getAttribute("src"));
if (event && isCtrlClick(event)) editStyle("texture");
} else {
if (event && isCtrlClick(event)) return editStyle("texture");

View file

@ -1,7 +1,7 @@
"use strict";
// version and caching control
const version = "1.91.01"; // generator version, update each time
const version = "1.91.02"; // generator version, update each time
{
document.title += " v" + version;