remove default texture base64

This commit is contained in:
Azgaar 2021-10-09 15:48:03 +03:00
parent 9116d03e76
commit eb76ec8e48
4 changed files with 20 additions and 18 deletions

View file

@ -430,9 +430,10 @@
<td> <td>
<select id="styleTextureInput"> <select id="styleTextureInput">
<option value="none">None</option> <option value="none">None</option>
<option value="default" selected>Default</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2021/10/folded-paper-big.jpg">Folded paper big</option>
<option value="https://i.imgur.com/EWvXSou.jpg">Folded paper</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2021/10/folded-paper-small.jpg">Folded paper small</option>
<option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-big.jpg">Marble big</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2021/10/marble-big.jpg" selected>Marble big</option>
<option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-small.jpg">Marble small</option>
<option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-blue-small.jpg">Marble Blue</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-blue-small.jpg">Marble Blue</option>
<option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-blue-big.jpg">Marble Blue big</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/marble-blue-big.jpg">Marble Blue big</option>
<option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/stone-small.jpg">Stone small</option> <option value="https://i2.wp.com/azgaar.files.wordpress.com/2019/07/stone-small.jpg">Stone small</option>

View file

@ -1435,8 +1435,8 @@ function toggleTexture(event) {
turnButtonOn("toggleTexture"); turnButtonOn("toggleTexture");
// append default texture image selected by default. Don't append on load to not harm performance // append default texture image selected by default. Don't append on load to not harm performance
if (!texture.selectAll("*").size()) { if (!texture.selectAll("*").size()) {
const x = +styleTextureShiftX.value, const x = +styleTextureShiftX.value;
y = +styleTextureShiftY.value; const y = +styleTextureShiftY.value;
const image = texture const image = texture
.append("image") .append("image")
.attr("id", "textureImage") .attr("id", "textureImage")
@ -1444,18 +1444,14 @@ function toggleTexture(event) {
.attr("y", y) .attr("y", y)
.attr("width", graphWidth - x) .attr("width", graphWidth - x)
.attr("height", graphHeight - y) .attr("height", graphHeight - y)
.attr("xlink:href", getDefaultTexture())
.attr("preserveAspectRatio", "xMidYMid slice"); .attr("preserveAspectRatio", "xMidYMid slice");
if (styleTextureInput.value !== "default") getBase64(styleTextureInput.value, base64 => image.attr("xlink:href", base64)); getBase64(styleTextureInput.value, base64 => image.attr("xlink:href", base64));
} }
$("#texture").fadeIn(); $("#texture").fadeIn();
zoom.scaleBy(svg, 1.00001); // enforce browser re-draw zoom.scaleBy(svg, 1.00001); // enforce browser re-draw
if (event && isCtrlClick(event)) editStyle("texture"); if (event && isCtrlClick(event)) editStyle("texture");
} else { } else {
if (event && isCtrlClick(event)) { if (event && isCtrlClick(event)) return editStyle("texture");
editStyle("texture");
return;
}
$("#texture").fadeOut(); $("#texture").fadeOut();
turnButtonOff("toggleTexture"); turnButtonOff("toggleTexture");
} }

View file

@ -335,7 +335,6 @@ styleFilterInput.addEventListener("change", function () {
styleTextureInput.addEventListener("change", function () { styleTextureInput.addEventListener("change", function () {
if (this.value === "none") texture.select("image").attr("xlink:href", ""); if (this.value === "none") texture.select("image").attr("xlink:href", "");
if (this.value === "default") texture.select("image").attr("xlink:href", getDefaultTexture());
else getBase64(this.value, base64 => texture.select("image").attr("xlink:href", base64)); else getBase64(this.value, base64 => texture.select("image").attr("xlink:href", base64));
}); });

File diff suppressed because one or more lines are too long