mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Fix: rework texture data format (#1017)
* fix: rework texture save format * refactor: move textures to a local folder * fix: export texture * fix: don't export empty texture * chore: pump version * fix: rescale water mask on screen size change --------- Co-authored-by: Azgaar <azgaar.fmg@yandex.com>
This commit is contained in:
parent
958a2c6ef8
commit
ada39b47ad
47 changed files with 225 additions and 273 deletions
|
|
@ -638,19 +638,6 @@ export function resolveVersionConflicts(version) {
|
|||
}
|
||||
|
||||
if (version < 1.91) {
|
||||
// from v1.90.02 texture image is always there
|
||||
if (!texture.select("#textureImage").size()) {
|
||||
// cleanup old texture if it has no id and add new one
|
||||
texture.selectAll("*").remove();
|
||||
texture
|
||||
.append("image")
|
||||
.attr("id", "textureImage")
|
||||
.attr("width", "100%")
|
||||
.attr("height", "100%")
|
||||
.attr("preserveAspectRatio", "xMidYMid slice")
|
||||
.attr("src", "https://i2.wp.com/azgaar.files.wordpress.com/2021/10/marble-big.jpg");
|
||||
}
|
||||
|
||||
// from 1.91.00 custom coa is moved to coa object
|
||||
pack.states.forEach(state => {
|
||||
if (state.coa === "custom") state.coa = {custom: true};
|
||||
|
|
@ -704,19 +691,23 @@ export function resolveVersionConflicts(version) {
|
|||
labels.selectAll("tspan").each(function () {
|
||||
this.setAttribute("x", 0);
|
||||
});
|
||||
}
|
||||
|
||||
// leftover from v1.90.02
|
||||
if (version < 1.94) {
|
||||
// from v1.94.00 texture image is removed when layer is off
|
||||
texture.style("display", null);
|
||||
const textureImage = texture.select("#textureImage");
|
||||
if (textureImage.size()) {
|
||||
const xlink = textureImage.attr("xlink:href");
|
||||
const href = textureImage.attr("href");
|
||||
const src = xlink || href;
|
||||
|
||||
if (src) {
|
||||
textureImage.attr("src", src);
|
||||
textureImage.attr("xlink:href", null);
|
||||
}
|
||||
const textureImage = texture.select("image");
|
||||
if (textureImage.size()) {
|
||||
// restore parameters
|
||||
const x = Number(textureImage.attr("x") || 0);
|
||||
const y = Number(textureImage.attr("y") || 0);
|
||||
const href = textureImage.attr("xlink:href") || textureImage.attr("href") || textureImage.attr("src");
|
||||
// save parameters to parent element
|
||||
texture.attr("data-href", href).attr("data-x", x).attr("data-y", y);
|
||||
// recreate image in expected format
|
||||
textureImage.remove();
|
||||
drawTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue