From 96e482bd74de6b318535edc97eec5d7838c19cc8 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Fri, 22 Jun 2018 18:51:14 +0800 Subject: [PATCH] Fix view canvas-resize event emit (#2893) --- cocos2d/core/platform/CCView.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index 269a1f7aa0..31eebf58e9 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -186,9 +186,9 @@ cc.js.mixin(View.prototype, { // Resize helper functions _resizeEvent: function () { var view; - if(this.setDesignResolutionSize){ + if (this.setDesignResolutionSize) { view = this; - }else{ + } else { view = cc.view; } @@ -217,7 +217,7 @@ cc.js.mixin(View.prototype, { view.setDesignResolutionSize(width, height, view._resolutionPolicy); view._resizing = false; - this.emit('canvas-resize'); + view.emit('canvas-resize'); if (view._resizeCallback) { view._resizeCallback.call(); }