Skip to content

Commit

Permalink
Merge branch 'v2.0-release' into v2.1-release
Browse files Browse the repository at this point in the history
  • Loading branch information
jareguo committed Nov 9, 2018
2 parents e8bc547 + 8f21f49 commit 9b02927
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 20 deletions.
16 changes: 8 additions & 8 deletions cocos2d/core/components/CCLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,18 +343,13 @@ let Label = cc.Class({
}

this._N$file = value;
this._bmFontOriginalSize = -1;
if (value && this._isSystemFontUsed)
this._isSystemFontUsed = false;

if ( typeof value === 'string' ) {
cc.warnID(4000);
}

if (value instanceof cc.BitmapFont) {
this._bmFontOriginalSize = value.fontSize;
}

if (this._renderData) {
this.destroyRenderData(this._renderData);
this._renderData = null;
Expand Down Expand Up @@ -412,9 +407,14 @@ let Label = cc.Class({

_bmFontOriginalSize: {
displayName: 'BMFont Original Size',
default: -1,
serializable: false,
readonly: true,
get () {
if (this._N$file instanceof cc.BitmapFont) {
return this._N$file.fontSize;
}
else {
return -1;
}
},
visible: true,
animatable: false
},
Expand Down
19 changes: 14 additions & 5 deletions cocos2d/core/components/editbox/CCEditBoxImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ let EditBoxImpl = cc.Class({
this._node = null;
this.setDelegate(null);
this.removeDom();
if (this.__orientationChanged) {
window.removeEventListener('orientationchange', this.__orientationChanged);
this.__orientationChanged = null;
}
},

_onTouchBegan (touch) {
Expand Down Expand Up @@ -434,10 +438,12 @@ _p.createInput = function() {
// Called before editbox focus to register cc.view status
_p._beginEditingOnMobile = function () {
let self = this;
this.__orientationChanged = function () {
self._adjustEditBoxPosition();
};
window.addEventListener('orientationchange', this.__orientationChanged);
if (!this.__orientationChanged) {
this.__orientationChanged = function () {
self._adjustEditBoxPosition();
};
window.addEventListener('orientationchange', this.__orientationChanged);
}

if (cc.view.isAutoFullScreenEnabled()) {
this.__fullscreen = true;
Expand Down Expand Up @@ -466,7 +472,10 @@ _p._endEditingOnMobile = function () {
this.__rotateScreen = false;
}

window.removeEventListener('orientationchange', this.__orientationChanged);
if (this.__orientationChanged) {
window.removeEventListener('orientationchange', this.__orientationChanged);
this.__orientationChanged = null;
}

if(this.__fullscreen) {
cc.view.enableAutoFullScreen(true);
Expand Down
14 changes: 7 additions & 7 deletions cocos2d/core/platform/CCSys.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ function initSys () {
* Indicate the running platform
* @property {Number} platform
*/
if (typeof FbPlayableAd !== undefined) {
if (typeof FbPlayableAd !== "undefined") {
sys.platform = sys.FB_PLAYABLE_ADS;
}
else {
Expand Down Expand Up @@ -1143,17 +1143,17 @@ function initSys () {
};

/**
* !#en
* Return the safe area rect. only available on the iOS device. <br/>
* when the safeArea rect is unavailable, it will return a rect with design resolution size.
* !#en
* Return the safe area rect. <br/>
* only available on the iOS native platform, otherwise it will return a rect with design resolution size.
* !#zh
* 返回手机屏幕安全区域,目前仅在 iOS 设备上有效。其它平台将默认返回设计分辨率尺寸。
* 返回手机屏幕安全区域,目前仅在 iOS 原生平台有效。其它平台将默认返回设计分辨率尺寸。
* @method getSafeAreaRect
* @return {Rect}
*/
sys.getSafeAreaRect = function () {
let designSize = cc.view.getDesignResolutionSize();
return cc.rect(0, 0, designSize.width, designSize.height);
let visibleSize = cc.view.getVisibleSize();
return cc.rect(0, 0, visibleSize.width, visibleSize.height);
};

/**
Expand Down

0 comments on commit 9b02927

Please sign in to comment.