mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.56k stars 263 forks source link

each code change generates a new history record, breaking prev/next buttons #1

Closed millermedeiros closed 12 years ago

millermedeiros commented 12 years ago

here is a diff that fixes it:

diff --git a/build/index.html b/build/index.html
index 1d2b60b..13f76b2 100644
--- a/build/index.html
+++ b/build/index.html
@@ -254,7 +254,8 @@
                if ( currentProgram ) {

                    gl.deleteProgram( currentProgram );
-                   window.location.hash = encodeURIComponent( fragment );
+                   //avoid storing multiple values in the history (so back/prev buttons works properly)
+                   window.location.replace('#'+ encodeURIComponent( fragment ) );

                }
mrdoob commented 12 years ago

Oh, wasn't aware of this workaround. Lovely! Thanks! https://github.com/mrdoob/glsl-sandbox/commit/31db75a9714769d1139389d8c61ad9f283a15f90

millermedeiros commented 12 years ago

I added the same feature to Hasher a few days ago :D hasher.replaceHash()