Skip to content

Commit f192b7d

Browse files
committed
Listen to orientationChange event only on mobile
1 parent d4d9cdf commit f192b7d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: cocos2d/core/platform/CCEGLView.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
184184
_t._rpFixedWidth = new cc.ResolutionPolicy(_strategyer.EQUAL_TO_FRAME, _strategy.FIXED_WIDTH);
185185

186186
_t._targetDensityDPI = cc.DENSITYDPI_HIGH;
187+
188+
if (sys.isMobile) {
189+
window.addEventListener('orientationchange', this._orientationChange);
190+
}
187191
},
188192

189193
// Resize helper functions
@@ -276,14 +280,12 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
276280
if (!this.__resizeWithBrowserSize) {
277281
this.__resizeWithBrowserSize = true;
278282
window.addEventListener('resize', this._resizeEvent);
279-
window.addEventListener('orientationchange', this._orientationChange);
280283
}
281284
} else {
282285
//disable
283286
if (this.__resizeWithBrowserSize) {
284287
this.__resizeWithBrowserSize = false;
285288
window.removeEventListener('resize', this._resizeEvent);
286-
window.removeEventListener('orientationchange', this._orientationChange);
287289
}
288290
}
289291
},

0 commit comments

Comments
 (0)