* @function LevelRenderer.Handler.prototype.dispose * @description 释放,解绑所有事件。
()
| 705 | * @description 释放,解绑所有事件。 |
| 706 | */ |
| 707 | dispose() { |
| 708 | var root = this.root; |
| 709 | |
| 710 | if (window.removeEventListener) { |
| 711 | window.removeEventListener('resize', this._resizeHandler); |
| 712 | |
| 713 | if (SUtil.Util_env.os.tablet || SUtil.Util_env.os.phone) { |
| 714 | // mobile支持 |
| 715 | root.removeEventListener('touchstart', this._touchstartHandler); |
| 716 | root.removeEventListener('touchmove', this._touchmoveHandler); |
| 717 | root.removeEventListener('touchend', this._touchendHandler); |
| 718 | } else { |
| 719 | // mobile的click自己模拟 |
| 720 | root.removeEventListener('click', this._clickHandler); |
| 721 | root.removeEventListener('dblclick', this._dblclickHandler); |
| 722 | root.removeEventListener('mousewheel', this._mousewheelHandler); |
| 723 | root.removeEventListener('mousemove', this._mousemoveHandler); |
| 724 | root.removeEventListener('mousedown', this._mousedownHandler); |
| 725 | root.removeEventListener('mouseup', this._mouseupHandler); |
| 726 | } |
| 727 | root.removeEventListener('DOMMouseScroll', this._mousewheelHandler); |
| 728 | root.removeEventListener('mouseout', this._mouseoutHandler); |
| 729 | } else { |
| 730 | window.detachEvent('onresize', this._resizeHandler); |
| 731 | |
| 732 | root.detachEvent('onclick', this._clickHandler); |
| 733 | root.detachEvent('dblclick', this._dblclickHandler); |
| 734 | root.detachEvent('onmousewheel', this._mousewheelHandler); |
| 735 | root.detachEvent('onmousemove', this._mousemoveHandler); |
| 736 | root.detachEvent('onmouseout', this._mouseoutHandler); |
| 737 | root.detachEvent('onmousedown', this._mousedownHandler); |
| 738 | root.detachEvent('onmouseup', this._mouseupHandler); |
| 739 | } |
| 740 | |
| 741 | this.root = null; |
| 742 | this._domHover = null; |
| 743 | this.storage = null; |
| 744 | this.painter = null; |
| 745 | |
| 746 | this.un(); |
| 747 | } |
| 748 | |
| 749 | |
| 750 | /** |