Fix: shortcutText -> subText
This commit is contained in:
@@ -8,7 +8,7 @@ function AppGroupTab(clickEvent) {
|
||||
|
||||
this.tabLayout = null;
|
||||
this.reservedMainText = "";
|
||||
this.reservedShortcutText = "";
|
||||
this.reservedSubText = "";
|
||||
this.reservedIconName = "";
|
||||
|
||||
}
|
||||
@@ -25,8 +25,8 @@ AppGroupTab.prototype.reserveIcon = function(iconName) {
|
||||
this.reservedIconName = iconName;
|
||||
}
|
||||
|
||||
AppGroupTab.prototype.reserveShortcutText = function(text) {
|
||||
this.reservedShortcutText = text;
|
||||
AppGroupTab.prototype.reserveSubText = function(text) {
|
||||
this.reservedSubText = text;
|
||||
}
|
||||
|
||||
AppGroupTab.prototype.createTab = function(index) {
|
||||
@@ -39,7 +39,7 @@ AppGroupTab.prototype.createTab = function(index) {
|
||||
// setting.setFont("Nanum Pen Script");
|
||||
setting.setFont("Nanum Gothic");
|
||||
setting.setMainFontSize(16);
|
||||
setting.setShortcutFontSize(16);
|
||||
setting.setSubFontSize(16);
|
||||
setting.setButtonColor(
|
||||
AppGroupTab.BUTTON_COLOR_OUT_HEX,
|
||||
AppGroupTab.BUTTON_COLOR_OVER_HEX,
|
||||
@@ -80,8 +80,8 @@ AppGroupTab.prototype.createTab = function(index) {
|
||||
if(this.reservedIconName.length > 0)
|
||||
this.addIcon(this.reservedIconName);
|
||||
|
||||
if(this.reservedShortcutText.length > 0)
|
||||
this.setShortcutText(this.reservedShortcutText);
|
||||
if(this.reservedSubText.length > 0)
|
||||
this.setSubText(this.reservedSubText);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function BasicTab() {
|
||||
this.iconSprite = null;
|
||||
|
||||
this.mainText = null;
|
||||
this.shortcutText = null;
|
||||
this.subText = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@ BasicTab.prototype.createButton = function(setting, clickEvent) {
|
||||
this.mainText = this.makeMainText();
|
||||
this.buttonSprite.addChild(this.mainText);
|
||||
|
||||
this.shortcutText = this.makeShortcutText();
|
||||
// this.shortcutText.fontWeight = "bold";
|
||||
this.buttonSprite.addChild(this.shortcutText);
|
||||
this.subText = this.makeSubText();
|
||||
// this.subText.fontWeight = "bold";
|
||||
this.buttonSprite.addChild(this.subText);
|
||||
|
||||
this.applyLoadedFont();
|
||||
|
||||
@@ -135,7 +135,7 @@ BasicTab.prototype.setFont = function(fontName) {
|
||||
|
||||
BasicTab.prototype.applyLoadedFont = function() {
|
||||
this.mainText.font = this.setting.font;
|
||||
this.shortcutText.font = this.setting.font;
|
||||
this.subText.font = this.setting.font;
|
||||
}
|
||||
|
||||
BasicTab.prototype.makeMainText = function() {
|
||||
@@ -169,23 +169,23 @@ BasicTab.prototype.setMainTextFontWeight = function(option) {
|
||||
console.log(this.mainText.fontWeight);
|
||||
}
|
||||
|
||||
BasicTab.prototype.makeShortcutText = function() {
|
||||
BasicTab.prototype.makeSubText = function() {
|
||||
var posX = this.buttonSprite.width / 2;
|
||||
var posY = this.buttonSprite.height / 2;
|
||||
var shortcutText = game.add.text(posX, posY, "");
|
||||
shortcutText.anchor.set(0.5);
|
||||
var subText = game.add.text(posX, posY, "");
|
||||
subText.anchor.set(0.5);
|
||||
|
||||
shortcutText.fontSize = BasicTab.SHORTCUT_TEXT_FONTSIZE;
|
||||
shortcutText.fontSize = this.setting.shortcutFontSize;
|
||||
shortcutText.fontWeight = "normal";
|
||||
// shortcutText.addColor(this.setting.textColors.over, 0);
|
||||
shortcutText.addColor("0xffffff", 0);
|
||||
subText.fontSize = BasicTab.SUBTEXT_FONTSIZE;
|
||||
subText.fontSize = this.setting.subFontSize;
|
||||
subText.fontWeight = "normal";
|
||||
// subText.addColor(this.setting.textColors.over, 0);
|
||||
subText.addColor("0xffffff", 0);
|
||||
|
||||
return shortcutText;
|
||||
return subText;
|
||||
}
|
||||
|
||||
BasicTab.prototype.setShortcutText = function(text) {
|
||||
this.shortcutText.text = text;
|
||||
BasicTab.prototype.setSubText = function(text) {
|
||||
this.subText.text = text;
|
||||
this.alignContents();
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ BasicTab.prototype.setActive = function(flag) {
|
||||
BasicTab.prototype.alignContents = function() {
|
||||
var mainTextHeight = 0;
|
||||
var iconSpriteHeight = 0;
|
||||
var shortcutTextHeight = 0;
|
||||
var subTextHeight = 0;
|
||||
|
||||
if(this.mainText.text.length > 0)
|
||||
mainTextHeight = this.mainText.fontSize;
|
||||
@@ -209,22 +209,22 @@ BasicTab.prototype.alignContents = function() {
|
||||
if (this.iconSprite !== null)
|
||||
iconSpriteHeight = this.iconSprite.height;
|
||||
|
||||
if(this.shortcutText !== null && this.shortcutText.text.length > 0)
|
||||
shortcutTextHeight = this.shortcutText.fontSize;
|
||||
if(this.subText !== null && this.subText.text.length > 0)
|
||||
subTextHeight = this.subText.fontSize;
|
||||
|
||||
var mainContentHeightHalf = 0;
|
||||
if(mainTextHeight > 0)
|
||||
mainContentHeightHalf = mainTextHeight / 2;
|
||||
else if(iconSpriteHeight > 0)
|
||||
mainContentHeightHalf = iconSpriteHeight / 2;
|
||||
var shortcutTextHeightHalf = shortcutTextHeight / 2;
|
||||
var subTextHeightHalf = subTextHeight / 2;
|
||||
|
||||
var offsetRatio = 7;
|
||||
var offsetMainText = mainTextHeight / offsetRatio;
|
||||
var offsetShortcutText = shortcutTextHeight / offsetRatio;
|
||||
var gap = (iconSpriteHeight > 0 ? 0 : BasicTab.SHORTCUT_TEXT_FONTSIZE / 2);
|
||||
var offsetSubText = subTextHeight / offsetRatio;
|
||||
var gap = (iconSpriteHeight > 0 ? 0 : BasicTab.SUBTEXT_FONTSIZE / 2);
|
||||
|
||||
if(shortcutTextHeight === 0) {
|
||||
if(subTextHeight === 0) {
|
||||
if(mainTextHeight > 0)
|
||||
this.mainText.y = this.buttonSprite.height / 2 + offsetMainText;
|
||||
else if(iconSpriteHeight > 0)
|
||||
@@ -232,13 +232,13 @@ BasicTab.prototype.alignContents = function() {
|
||||
}
|
||||
else {
|
||||
if(mainTextHeight > 0)
|
||||
this.mainText.y = this.buttonSprite.height / 2 - shortcutTextHeightHalf + offsetMainText;
|
||||
this.mainText.y = this.buttonSprite.height / 2 - subTextHeightHalf + offsetMainText;
|
||||
else if(iconSpriteHeight > 0)
|
||||
this.iconSprite.y = this.buttonSprite.height / 2 - shortcutTextHeightHalf;
|
||||
this.iconSprite.y = this.buttonSprite.height / 2 - subTextHeightHalf;
|
||||
}
|
||||
|
||||
// this.shortcutText.y = this.buttonSprite.height / 2 + mainContentHeightHalf + offsetShortcutText + gap;
|
||||
this.shortcutText.y = this.buttonSprite.height / 2 + mainContentHeightHalf + offsetShortcutText - 8;
|
||||
// this.subText.y = this.buttonSprite.height / 2 + mainContentHeightHalf + offsetSubText + gap;
|
||||
this.subText.y = this.buttonSprite.height / 2 + mainContentHeightHalf + offsetSubText - 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -275,8 +275,8 @@ BasicTab.prototype.mouseOut = function() {
|
||||
this.iconSprite.tint = this.setting.iconColors.out;
|
||||
|
||||
this.mainText.fill = this.setting.textColors.out;
|
||||
if(this.shortcutText !== undefined)
|
||||
this.shortcutText.fill = this.setting.textColors.out;
|
||||
if(this.subText !== undefined)
|
||||
this.subText.fill = this.setting.textColors.out;
|
||||
|
||||
this.activeLineSprite.tint = this.setting.activeLineColors.out;
|
||||
}
|
||||
@@ -288,8 +288,8 @@ BasicTab.prototype.mouseOver = function() {
|
||||
this.iconSprite.tint = this.setting.iconColors.over;
|
||||
|
||||
this.mainText.fill = this.setting.textColors.over;
|
||||
if(this.shortcutText !== undefined)
|
||||
this.shortcutText.fill = this.setting.textColors.over;
|
||||
if(this.subText !== undefined)
|
||||
this.subText.fill = this.setting.textColors.over;
|
||||
|
||||
this.activeLineSprite.tint = this.setting.activeLineColors.over;
|
||||
}
|
||||
@@ -301,8 +301,8 @@ BasicTab.prototype.mouseDown = function() {
|
||||
this.iconSprite.tint = this.setting.iconColors.down;
|
||||
|
||||
this.mainText.fill = this.setting.textColors.down;
|
||||
if(this.shortcutText !== undefined)
|
||||
this.shortcutText.fill = this.setting.textColors.down;
|
||||
if(this.subText !== undefined)
|
||||
this.subText.fill = this.setting.textColors.down;
|
||||
|
||||
this.activeLineSprite.tint = this.setting.activeLineColors.down;
|
||||
}
|
||||
@@ -314,8 +314,8 @@ BasicTab.prototype.buttonDisabled = function() {
|
||||
this.iconSprite.tint = this.setting.iconColors.disabled;
|
||||
|
||||
this.mainText.fill = this.setting.textColors.disabled;
|
||||
if(typeof this.shortcutText !== undefined)
|
||||
this.shortcutText.fill = this.setting.textColors.disabled;
|
||||
if(typeof this.subText !== undefined)
|
||||
this.subText.fill = this.setting.textColors.disabled;
|
||||
|
||||
this.activeLineSprite.tint = this.setting.activeLineColors.disabled;
|
||||
}
|
||||
@@ -356,4 +356,4 @@ BasicTab.prototype.setLineSpacing = function(spacingInPixels) {
|
||||
BasicTab.NONE_ICON = "";
|
||||
BasicTab.NONE_BUTTON_TEXT = "";
|
||||
|
||||
BasicTab.SHORTCUT_TEXT_FONTSIZE = 12;
|
||||
BasicTab.SUBTEXT_FONTSIZE = 12;
|
||||
@@ -5,7 +5,7 @@ function TabSetting(x, y, width, height) {
|
||||
this.height = height;
|
||||
|
||||
this.mainFontSize = 10;
|
||||
this.shortcutFontSize = BasicTab.SHORTCUT_TEXT_FONTSIZE;
|
||||
this.subFontSize = BasicTab.SUBTEXT_FONTSIZE;
|
||||
|
||||
this.buttonColors = TabSetting.DEFAULT_BUTTON_COLORS;
|
||||
this.textColors = TabSetting.DEFAULT_TEXT_COLORS;
|
||||
@@ -22,8 +22,8 @@ TabSetting.prototype.setMainFontSize = function(size) {
|
||||
this.mainFontSize = size;
|
||||
}
|
||||
|
||||
TabSetting.prototype.setShortcutFontSize = function(size) {
|
||||
this.shortcutFontSize = size;
|
||||
TabSetting.prototype.setSubFontSize = function(size) {
|
||||
this.subFontSize = size;
|
||||
}
|
||||
|
||||
TabSetting.prototype.setButtonColor = function(out, over, down, disabled) {
|
||||
|
||||
Reference in New Issue
Block a user