@@ -138,6 +138,9 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
138
138
_viewName : "" ,
139
139
// Custom callback for resize event
140
140
_resizeCallback : null ,
141
+
142
+ _orientationChanging : true ,
143
+
141
144
_scaleX : 1 ,
142
145
_originalScaleX : 1 ,
143
146
_scaleY : 1 ,
@@ -224,6 +227,11 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
224
227
}
225
228
} ,
226
229
230
+ _orientationChange : function ( ) {
231
+ this . _orientationChanging = true ;
232
+ this . _resizeEvent ( ) ;
233
+ } ,
234
+
227
235
/**
228
236
* <p>
229
237
* Sets view's target-densitydpi for android mobile browser. it can be set to: <br/>
@@ -259,14 +267,14 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
259
267
if ( ! this . __resizeWithBrowserSize ) {
260
268
this . __resizeWithBrowserSize = true ;
261
269
window . addEventListener ( 'resize' , this . _resizeEvent ) ;
262
- window . addEventListener ( 'orientationchange' , this . _resizeEvent ) ;
270
+ window . addEventListener ( 'orientationchange' , this . _orientationChange ) ;
263
271
}
264
272
} else {
265
273
//disable
266
274
if ( this . __resizeWithBrowserSize ) {
267
275
this . __resizeWithBrowserSize = false ;
268
276
window . removeEventListener ( 'resize' , this . _resizeEvent ) ;
269
- window . removeEventListener ( 'orientationchange' , this . _resizeEvent ) ;
277
+ window . removeEventListener ( 'orientationchange' , this . _orientationChange ) ;
270
278
}
271
279
}
272
280
} ,
@@ -305,7 +313,7 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
305
313
var h = __BrowserGetter . availHeight ( this . _frame ) ;
306
314
var isLandscape = w >= h ;
307
315
308
- if ( ! cc . sys . isMobile ||
316
+ if ( ! this . _orientationChanging || ! cc . sys . isMobile ||
309
317
( isLandscape && this . _orientation & cc . ORIENTATION_LANDSCAPE ) ||
310
318
( ! isLandscape && this . _orientation & cc . ORIENTATION_PORTRAIT ) ) {
311
319
locFrameSize . width = w ;
@@ -323,6 +331,7 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
323
331
cc . container . style . transformOrigin = '0px 0px 0px' ;
324
332
this . _isRotated = true ;
325
333
}
334
+ this . _orientationChanging = false ;
326
335
} ,
327
336
328
337
// hack
0 commit comments