Skip to content

Commit c1d6270

Browse files
author
pandamicro
committed
Forbidden screen adaptation during edit box focus
1 parent e102082 commit c1d6270

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

extensions/editbox/CCEditBox.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ cc.EditBox = cc.ControlButton.extend({
265265
tmpEdTxt.style.padding = "0";
266266

267267
this.__fullscreen = false;
268+
this.__autoResize = false;
268269
var onCanvasClick = function() { this._edTxt.blur();};
269270
this._onCanvasClick = onCanvasClick.bind(this);
270271

@@ -285,13 +286,15 @@ cc.EditBox = cc.ControlButton.extend({
285286
this._keyPressEvent = keypressEvent.bind(this);
286287
var focusEvent = function () {
287288
// Exit fullscreen
288-
if(cc.view.isAutoFullScreenEnabled()) {
289+
if (cc.view.isAutoFullScreenEnabled()) {
289290
this.__fullscreen = true;
290291
cc.view.enableAutoFullScreen(false);
291292
cc.screen.exitFullScreen();
292293
} else {
293294
this.__fullscreen = false;
294295
}
296+
this.__autoResize = cc.view.__resizeWithBrowserSize;
297+
cc.view.resizeWithBrowserSize(false);
295298

296299
if (this._edTxt.value === this._placeholderText) {
297300
this._edTxt.value = "";
@@ -309,9 +312,12 @@ cc.EditBox = cc.ControlButton.extend({
309312
this._focusEvent = focusEvent.bind(this);
310313
var blurEvent = function () {
311314
// Resume fullscreen logic
312-
if(this.__fullscreen) {
315+
if (this.__fullscreen) {
313316
cc.view.enableAutoFullScreen(true);
314317
}
318+
if (this.__autoResize) {
319+
cc.view.resizeWithBrowserSize(true);
320+
}
315321

316322
if (this._edTxt.value === "") {
317323
this._edTxt.value = this._placeholderText;

0 commit comments

Comments
 (0)