Skip to content

Commit

Permalink
Extend Vdom patch to WebGL for other project
Browse files Browse the repository at this point in the history
  • Loading branch information
Erudition committed Jun 5, 2024
1 parent a01c772 commit 0109b8f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
9 changes: 7 additions & 2 deletions elm-patches/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: VirtualDom Url Browser
all: VirtualDom Url Browser WebGL

VirtualDom:
rm -f ~/.elm/0.19.1/packages/elm/virtual-dom/1.0.3/artifacts.dat
Expand All @@ -13,4 +13,9 @@ Url:
Browser:
rm -f ~/.elm/0.19.1/packages/elm/browser/1.0.2/artifacts.dat
rm -f ~/.elm/0.19.1/packages/elm/browser/1.0.2/docs.json
patch -uN --no-backup-if-mismatch --reject-file=/tmp/rej ~/.elm/0.19.1/packages/elm/browser/1.0.2/src/Elm/Kernel/Browser.js ./PatchBrowserForFlipAnimations.patch || true
patch -uN --no-backup-if-mismatch --reject-file=/tmp/rej ~/.elm/0.19.1/packages/elm/browser/1.0.2/src/Elm/Kernel/Browser.js ./PatchBrowserForFlipAnimations.patch || true

WebGL:
rm -f ~/.elm/0.19.1/packages/elm-explorations/webgl/1.1.3/artifacts.dat
rm -f ~/.elm/0.19.1/packages/elm-explorations/webgl/1.1.3/docs.json
patch -uN --no-backup-if-mismatch --reject-file=/tmp/rej ~/.elm/0.19.1/packages/elm-explorations/webgl/1.1.3/src/Elm/Kernel/WebGL.js ./PatchWebGLForCanvasElement.patch || true
18 changes: 18 additions & 0 deletions elm-patches/PatchWebGLForCanvasElement.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--- /home/adroit/.elm/0.19.1/packages/elm-explorations/webgl/1.1.3/src/Elm/Kernel/WebGL.js 2024-06-04 20:49:20.496093720 -0500
+++ /home/adroit/.elm/0.19.1/packages/elm-explorations/webgl/1.1.3/src/Elm/Kernel/WebGL_patched.js 2024-06-04 20:49:51.076047240 -0500
@@ -787,6 +787,7 @@
}, model.__options);

var canvas = __VirtualDom_doc.createElement('canvas');
+ canvas.created_by_elm = true;
var gl = canvas.getContext && (
canvas.getContext('webgl', options.contextAttributes) ||
canvas.getContext('experimental-webgl', options.contextAttributes)
@@ -834,6 +835,7 @@

} else {
canvas = __VirtualDom_doc.createElement('div');
+ canvas.created_by_elm = true;
canvas.innerHTML = '<a href="https://get.webgl.org/">Enable WebGL</a> to see this content!';
}

3 changes: 2 additions & 1 deletion elm-patches/dummyproject/elm.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"elm/browser": "1.0.2",
"elm/core": "1.0.5",
"elm/html": "1.0.0",
"elm/url": "1.0.0"
"elm/url": "1.0.0",
"elm-explorations/webgl": "1.1.3"
},
"indirect": {
"elm/json": "1.1.3",
Expand Down

0 comments on commit 0109b8f

Please sign in to comment.