diff --git a/build/bundle.js b/build/bundle.js index 22767e60..3cca18f9 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -14890,14 +14890,25 @@ function detectZoom() { return window.outerWidth / window.innerWidth; } +var locked = true; var setupZoomPoll = function(callback, context) { var currentZoom = 0; setInterval(function() { var newZoom = detectZoom(); + if (newZoom !== currentZoom) { + // we need to wait one more before issuing callback + // to avoid window resize issues + if (locked) { + locked = false; + return; + } + currentZoom = newZoom; callback.apply(context, [newZoom]); + } else { + locked = true; } }, 500); }; @@ -19162,14 +19173,25 @@ function detectZoom() { return window.outerWidth / window.innerWidth; } +var locked = true; var setupZoomPoll = function(callback, context) { var currentZoom = 0; setInterval(function() { var newZoom = detectZoom(); + if (newZoom !== currentZoom) { + // we need to wait one more before issuing callback + // to avoid window resize issues + if (locked) { + locked = false; + return; + } + currentZoom = newZoom; callback.apply(context, [newZoom]); + } else { + locked = true; } }, 500); }; diff --git a/src/js/util/zoomLevel.js b/src/js/util/zoomLevel.js index 084853ef..8e879759 100644 --- a/src/js/util/zoomLevel.js +++ b/src/js/util/zoomLevel.js @@ -21,14 +21,25 @@ function detectZoom() { return window.outerWidth / window.innerWidth; } +var locked = true; var setupZoomPoll = function(callback, context) { var currentZoom = 0; setInterval(function() { var newZoom = detectZoom(); + if (newZoom !== currentZoom) { + // we need to wait one more before issuing callback + // to avoid window resize issues + if (locked) { + locked = false; + return; + } + currentZoom = newZoom; callback.apply(context, [newZoom]); + } else { + locked = true; } }, 500); }; diff --git a/todo.txt b/todo.txt index 80173e29..32fa886d 100644 --- a/todo.txt +++ b/todo.txt @@ -4,7 +4,6 @@ Big things: Big Graphic things: ~~~~~~~~~~~~~~~~~~~~~~~~~ [ ] levels dropdown selection? -[.] level teardown [ ] git demonstration view [ ] sandbox can launch and takedown levels @@ -22,7 +21,6 @@ Minor Bugs to fix: Big Bugs to fix: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -[ ] window zoom alert thing -- this just needs to be timeouted one more time [ ] click handlers on goal visualization for the actual canvas elements /************************************* @@ -34,6 +32,8 @@ Big Bugs to fix: Done things: (I only started this on Dec 17th 2012 to get a better sense of what was done) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[x] window zoom alert thing -- this just needs to be timeouted one more time +[x] level teardown [x] great die for levels [x] show which level you are in! with a little thing on the top [x] allow command history to clear finished ones