mirror of https://github.com/axmolengine/axmol.git
Fix label disableeffect (#17075)
* add toggle rendering type test * fix label additional kerning * only substract additionalKerning when bold is enabled
This commit is contained in:
parent
b57db96f09
commit
163e730849
|
@ -1217,9 +1217,11 @@ void Label::disableEffect(LabelEffect effect)
|
|||
setRotationSkewX(0);
|
||||
break;
|
||||
case cocos2d::LabelEffect::BOLD:
|
||||
_boldEnabled = false;
|
||||
_additionalKerning -= 1;
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
if (_boldEnabled) {
|
||||
_boldEnabled = false;
|
||||
_additionalKerning -= 1;
|
||||
disableEffect(LabelEffect::SHADOW);
|
||||
}
|
||||
break;
|
||||
case cocos2d::LabelEffect::UNDERLINE:
|
||||
if (_underlineNode) {
|
||||
|
|
|
@ -608,6 +608,45 @@ var S9SpriteOpacityWithFadeActionsTest = S9SpriteTestDemo.extend({
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
var S9SpriteRenderingTypeToggleTest = S9SpriteTestDemo.extend({
|
||||
_title:"Test Toggle Scale9Sprite RenderingType",
|
||||
|
||||
ctor:function() {
|
||||
this._super();
|
||||
|
||||
|
||||
var blocks = new ccui.Scale9Sprite('blocks9.png');
|
||||
blocks.x = winSize.width / 2;
|
||||
blocks.y = winSize.height / 2 + 50;
|
||||
|
||||
blocks.width = blocks.width * 2;
|
||||
|
||||
|
||||
var button = this._button = new ccui.Button();
|
||||
button.setTouchEnabled(true);
|
||||
button.x = winSize.width / 2.0;
|
||||
button.y = winSize.height / 2.0 - 50;
|
||||
button.setTitleText("Toggle SIMPLE");
|
||||
button.addTouchEventListener(function (sender, type) {
|
||||
if(type === ccui.Widget.TOUCH_ENDED) {
|
||||
if(blocks.getRenderingType() === ccui.Scale9Sprite.RenderingType.SLICED) {
|
||||
blocks.setRenderingType(ccui.Scale9Sprite.RenderingType.SIMPLE);
|
||||
button.setTitleText("Toggle SLICED");
|
||||
} else {
|
||||
blocks.setRenderingType(ccui.Scale9Sprite.RenderingType.SLICED);
|
||||
button.setTitleText("Toggle SIMPLE");
|
||||
}
|
||||
}
|
||||
} , this);
|
||||
|
||||
this.addChild(button);
|
||||
|
||||
|
||||
this.addChild(blocks);
|
||||
}
|
||||
});
|
||||
|
||||
var S9SpriteTestScene = TestScene.extend({
|
||||
runThisTest:function (num) {
|
||||
sceneIdx = (num || num == 0) ? (num - 1) : -1;
|
||||
|
@ -617,7 +656,6 @@ var S9SpriteTestScene = TestScene.extend({
|
|||
director.runScene(this);
|
||||
}
|
||||
});
|
||||
|
||||
//
|
||||
// Flow control
|
||||
//
|
||||
|
@ -637,7 +675,8 @@ var arrayOfS9SpriteTest = [
|
|||
S9_TexturePacker,
|
||||
S9SpriteActionTest,
|
||||
S9SpriteColorOpacityTest,
|
||||
S9SpriteOpacityWithFadeActionsTest
|
||||
S9SpriteOpacityWithFadeActionsTest,
|
||||
S9SpriteRenderingTypeToggleTest
|
||||
];
|
||||
|
||||
var nextS9SpriteTest = function () {
|
||||
|
|
Loading…
Reference in New Issue