Skip to content

Commit e6f9c8f

Browse files
committed
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-html5 into Iss3501_ReleaseV2.2.2
2 parents 218d737 + 5068a89 commit e6f9c8f

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

cocos2d/core/labelTTF/CCLabelTTF.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -728,34 +728,40 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
728728
return this._labelContext;
729729
},
730730

731-
_updateTTF:function () {
731+
_updateTTF: function () {
732732
var locDimensionsWidth = this._dimensions.width;
733733
this._lineWidths = [];
734734

735735
this._isMultiLine = false;
736-
if(locDimensionsWidth !== 0) {
736+
if (locDimensionsWidth !== 0) {
737737
// Content processing
738738
this._measureConfig();
739739
var text = this._string;
740740

741741
this._strings = [];
742-
for(var i = 0, length = this._string.length; i < length;) {
742+
for (var i = 0, length = this._string.length; i < length;) {
743743
// Find the index of next line
744744
var next = this._checkNextline(text.substr(i), locDimensionsWidth);
745745
var append = text.substr(i, next);
746746

747-
this._lineWidths.push(this._measure(append));
748747
this._strings.push(append);
749748
i += next;
750749
}
751-
if(this._strings.length > 0)
752-
this._isMultiLine = true;
750+
}
751+
else {
752+
this._strings = this._string.split('\n');
753+
for (var i = 0, length = this._strings.length; i < length; i++) {
754+
this._lineWidths.push(this._measure(this._strings[i]));
755+
}
753756
}
754757

758+
if (this._strings.length > 0)
759+
this._isMultiLine = true;
760+
755761
var locSize, locStrokeShadowOffsetX = 0, locStrokeShadowOffsetY = 0;
756-
if(this._strokeEnabled)
762+
if (this._strokeEnabled)
757763
locStrokeShadowOffsetX = locStrokeShadowOffsetY = this._strokeSize * 2;
758-
if(this._shadowEnabled){
764+
if (this._shadowEnabled) {
759765
var locOffsetSize = this._shadowOffset;
760766
locStrokeShadowOffsetX += Math.abs(locOffsetSize.width) * 2;
761767
locStrokeShadowOffsetY += Math.abs(locOffsetSize.height) * 2;
@@ -769,7 +775,7 @@ cc.LabelTTF = cc.Sprite.extend(/** @lends cc.LabelTTF# */{
769775
else
770776
locSize = cc.size(0 | (this._measure(this._string) + locStrokeShadowOffsetX), 0 | (this._fontClientHeight + locStrokeShadowOffsetY));
771777
} else {
772-
if(this._dimensions.height === 0){
778+
if (this._dimensions.height === 0) {
773779
if (this._isMultiLine)
774780
locSize = cc.size(0 | (locDimensionsWidth + locStrokeShadowOffsetX), 0 | ((this._fontClientHeight * this._strings.length) + locStrokeShadowOffsetY));
775781
else

cocos2d/core/platform/CCEGLView.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ cc.EGLView = cc.Class.extend(/** @lends cc.EGLView# */{
172172

173173
// hack
174174
_adjustSizeKeepCanvasSize: function (width, height) {
175-
this._frameSize.width = width;
176-
this._frameSize.height = height;
177-
178175
var designWidth = this._originalDesignResolutionSize.width;
179176
var designHeight = this._originalDesignResolutionSize.height;
180177
if (designWidth > 0)

0 commit comments

Comments
 (0)