destroy window events when calling destroy correctly

This commit is contained in:
Fabian Irsara 2015-12-01 22:36:31 +01:00
parent 8f0eba8ade
commit afd4003835

View File

@ -425,10 +425,14 @@ define([
}
dom.bind(window, 'resize', function() { _this.onResize() });
dom.bind(this.__ul, 'webkitTransitionEnd', function() { _this.onResize(); });
dom.bind(this.__ul, 'transitionend', function() { _this.onResize() });
dom.bind(this.__ul, 'oTransitionEnd', function() { _this.onResize() });
var _resizeHandler = function () {
_this.onResize();
};
dom.bind(window, 'resize', _resizeHandler);
dom.bind(this.__ul, 'webkitTransitionEnd', _resizeHandler);
dom.bind(this.__ul, 'transitionend', _resizeHandler);
dom.bind(this.__ul, 'oTransitionEnd', _resizeHandler);
this.onResize();
@ -482,14 +486,14 @@ define([
GUI.TEXT_CLOSED = 'Close Controls';
GUI.TEXT_OPEN = 'Open Controls';
dom.bind(window, 'keydown', function(e) {
var _keydownHandler = function(e) {
if (document.activeElement.type !== 'text' &&
(e.which === HIDE_KEY_CODE || e.keyCode == HIDE_KEY_CODE)) {
GUI.toggleHide();
}
};
}, false);
dom.bind(window, 'keydown', _keydownHandler, false);
common.extend(
@ -558,6 +562,10 @@ define([
auto_place_container.removeChild(this.domElement);
}
dom.unbind(window, 'keydown', _keydownHandler, false);
dom.unbind(window, 'unload', saveToLocalStorage);
dom.unbind(window, 'resize', _resizeHandler);
},
/**