Skip to content

Commit 79a5851

Browse files
authored
Merge pull request #3375 from pandamicro/editbox
Fix issues when orientation changing and screen resize
2 parents fb8079f + 37eecbc commit 79a5851

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

cocos2d/core/platform/CCEGLView.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,9 @@ cc.EGLView = cc.Class.extend(/** @lends cc.view# */{
331331
cc.container.style.transformOrigin = '0px 0px 0px';
332332
this._isRotated = true;
333333
}
334-
this._orientationChanging = false;
334+
setTimeout(function () {
335+
cc.view._orientationChanging = false;
336+
}, 1000);
335337
},
336338

337339
// hack

extensions/editbox/CCEditBox.js

+16
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ cc.EditBox = cc.ControlButton.extend({
263263
tmpEdTxt.style.active = 0;
264264
tmpEdTxt.style.outline = "medium";
265265
tmpEdTxt.style.padding = "0";
266+
267+
this.__fullscreen = false;
266268
var onCanvasClick = function() { this._edTxt.blur();};
267269
this._onCanvasClick = onCanvasClick.bind(this);
268270

@@ -282,6 +284,15 @@ cc.EditBox = cc.ControlButton.extend({
282284
};
283285
this._keyPressEvent = keypressEvent.bind(this);
284286
var focusEvent = function () {
287+
// Exit fullscreen
288+
if(cc.view.isAutoFullScreenEnabled()) {
289+
this.__fullscreen = true;
290+
cc.view.enableAutoFullScreen(false);
291+
cc.screen.exitFullScreen();
292+
} else {
293+
this.__fullscreen = false;
294+
}
295+
285296
if (this._edTxt.value === this._placeholderText) {
286297
this._edTxt.value = "";
287298
this._edTxt.style.fontSize = this._edFontSize + "px";
@@ -297,6 +308,11 @@ cc.EditBox = cc.ControlButton.extend({
297308
};
298309
this._focusEvent = focusEvent.bind(this);
299310
var blurEvent = function () {
311+
// Resume fullscreen logic
312+
if(this.__fullscreen) {
313+
cc.view.enableAutoFullScreen(true);
314+
}
315+
300316
if (this._edTxt.value === "") {
301317
this._edTxt.value = this._placeholderText;
302318
this._edTxt.style.fontSize = this._placeholderFontSize + "px";

extensions/spine/Spine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ spine.SkeletonJson.prototype = {
18571857
}
18581858

18591859
slotData.attachmentName = slotMap["attachment"];
1860-
slotData.blendMode = spine.AttachmentType[slotMap["blend"] || "normal"];
1860+
slotData.blendMode = spine.BlendMode[slotMap["blend"] || "normal"];
18611861

18621862
skeletonData.slots.push(slotData);
18631863
}

0 commit comments

Comments
 (0)