Skip to content

Commit

Permalink
fix: support custom thershold map
Browse files Browse the repository at this point in the history
  • Loading branch information
fidelthomet committed Sep 4, 2024
1 parent feaa917 commit f26f801
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dither-dither",
"version": "1.1.0",
"version": "1.1.1",
"type": "module",
"files": [
"dist"
Expand Down
5 changes: 3 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DitherDither extends HTMLElement {
this.intersecting = false;
this.lastRestore = 0;
}
static observedAttributes = ["src", "thresholdSrc"];
static observedAttributes = ["src", "threshold-map"];
async attributeChangedCallback(name, oldValue, newValue) {
if (!this.initialized) return;
switch (name) {
Expand All @@ -31,7 +31,7 @@ class DitherDither extends HTMLElement {
} else this.resizeCanvas();
this.initGL();
break;
case "thresholdSrc":
case "threshold-map":
this.thresholdSrc = newValue;
await this.initThreshold();
this.img?.remove?.();
Expand All @@ -48,6 +48,7 @@ class DitherDither extends HTMLElement {
async connectedCallback() {
this.crossOrigin = this.getAttribute("cross-origin");
this.mediaSrc = this.getAttribute("src");
this.thresholdSrc = this.getAttribute("threshold-map");
this.immediate = this.getAttribute("immediate") != null;
this.restore = this.getAttribute("restore") !== "false";

Expand Down

0 comments on commit f26f801

Please sign in to comment.