@rogieking/figui3 1.8.2 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example.html +2 -2
- package/fig.js +10 -2
- package/package.json +1 -1
package/example.html
CHANGED
|
@@ -294,8 +294,8 @@
|
|
|
294
294
|
function updateImages() {
|
|
295
295
|
const images = document.querySelectorAll('fig-image');
|
|
296
296
|
images.forEach(image => {
|
|
297
|
-
|
|
298
|
-
image.src = "https://picsum.photos/200?random=" + Math.random();
|
|
297
|
+
image.setAttribute("src", "https://picsum.photos/200?random=" + Math.random());
|
|
298
|
+
//image.src = "https://picsum.photos/200?random=" + Math.random();
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
</script>
|
package/fig.js
CHANGED
|
@@ -2042,13 +2042,21 @@ class FigImage extends HTMLElement {
|
|
|
2042
2042
|
|
|
2043
2043
|
// Get blob from canvas
|
|
2044
2044
|
canvas.toBlob((blob) => {
|
|
2045
|
-
this.blob
|
|
2045
|
+
if (this.blob) {
|
|
2046
|
+
URL.revokeObjectURL(this.blob);
|
|
2047
|
+
}
|
|
2048
|
+
if (blob) {
|
|
2049
|
+
this.blob = URL.createObjectURL(blob);
|
|
2050
|
+
}
|
|
2046
2051
|
});
|
|
2047
2052
|
};
|
|
2048
2053
|
this.image.src = src;
|
|
2049
2054
|
});
|
|
2050
2055
|
}
|
|
2051
2056
|
async #handleFileInput(e) {
|
|
2057
|
+
if (this.blob) {
|
|
2058
|
+
URL.revokeObjectURL(this.blob);
|
|
2059
|
+
}
|
|
2052
2060
|
this.blob = URL.createObjectURL(e.target.files[0]);
|
|
2053
2061
|
//set base64 url
|
|
2054
2062
|
const reader = new FileReader();
|
|
@@ -2093,7 +2101,7 @@ class FigImage extends HTMLElement {
|
|
|
2093
2101
|
|
|
2094
2102
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
2095
2103
|
if (name === "src") {
|
|
2096
|
-
|
|
2104
|
+
this.#src = newValue;
|
|
2097
2105
|
if (this.chit) {
|
|
2098
2106
|
this.chit.setAttribute("src", this.#src);
|
|
2099
2107
|
}
|