Fix: icon color for out, in, pressed

Fix: make lib/util directory
Add: refresh browser if app goes wrong
This commit is contained in:
2018-12-15 23:46:48 +09:00
parent 3dd42ffe02
commit 9125e035b6
25 changed files with 237 additions and 79 deletions
+20 -4
View File
@@ -16,6 +16,7 @@ function RoundRectButtonSetting(x, y, width, height, roundAmount) {
this.strokeColors = RoundRectButtonSetting.DEFAULT_STROKE_COLORS;
this.buttonColors = RoundRectButtonSetting.DEFAULT_BUTTON_COLORS;
this.textColors = RoundRectButtonSetting.DEFAULT_TEXT_COLORS;
this.iconColors = RoundRectButtonSetting.DEFAULT_ICON_COLORS;
this.fontStyle = RoundRectButtonSetting.DEFAULT_TEXT_FONT;
};
@@ -43,6 +44,14 @@ RoundRectButtonSetting.prototype.setTextColor = function(out, over, down, disabl
this.textColors.disabled = disabled;
}
RoundRectButtonSetting.prototype.setIconColor = function(out, over, down, disabled) {
this.iconColors = { };
this.iconColors.out = out;
this.iconColors.over = over;
this.iconColors.down = down;
this.iconColors.disabled = disabled;
}
RoundRectButtonSetting.DEFAULT_STROKE_COLORS = {
out: 0x666666,
@@ -65,6 +74,13 @@ RoundRectButtonSetting.DEFAULT_TEXT_COLORS = {
disabled: "#999"
};
RoundRectButtonSetting.DEFAULT_ICON_COLORS = {
out: 0xffffff,
over: 0xddffdd,
down: 0xaaffaa,
disabled: 0x333333
};
RoundRectButtonSetting.DEFAULT_TEXT_FONT = {
font: "30px Arial",
boundsAlignH: "center", // left, center. right
@@ -212,7 +228,7 @@ RoundRectButton.prototype.mouseOut = function() {
this.buttonStroke.tint = this.setting.strokeColors.out;
this.button.tint = this.setting.buttonColors.out;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.out;
this.buttonIcon.tint = this.setting.iconColors.out;
}
}
@@ -223,7 +239,7 @@ RoundRectButton.prototype.mouseOver = function() {
this.buttonStroke.tint = this.setting.strokeColors.over;
this.button.tint = this.setting.buttonColors.over;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.over;
this.buttonIcon.tint = this.setting.iconColors.over;
}
}
@@ -234,7 +250,7 @@ RoundRectButton.prototype.mouseDown = function() {
this.buttonStroke.tint = this.setting.strokeColors.down;
this.button.tint = this.setting.buttonColors.down;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.down;
this.buttonIcon.tint = this.setting.iconColors.down;
}
}
@@ -245,7 +261,7 @@ RoundRectButton.prototype.buttonDisabled = function() {
this.buttonStroke.tint = this.setting.strokeColors.disabled;
this.button.tint = this.setting.buttonColors.disabled;
if(typeof this.buttonIcon !== "undefined") {
this.buttonIcon.tint = this.setting.strokeColors.disabled;
this.buttonIcon.tint = this.setting.iconColors.disabled;
}
}
+6
View File
@@ -50,6 +50,12 @@ function TypingAppButton(type, x, y, iconSprite, buttonText, appInfo) {
"#a66",
"#333"
);
setting.setIconColor(
0xffeeee,
0xeedddd,
0xddcccc,
0x666666
);
break;
}
@@ -21,4 +21,17 @@ NumberUtil.getRecordText = function(value) {
return numberWithCommas + " 타";
else
return numberWithCommas + " 점";
}
}
NumberUtil.hexToRGB = function(hexCode) {
var hex = "";
if(hexCode.length == 4)
hex = "#" + hexCode[1] + hexCode[1] + hexCode[2] + hexCode[2] + hexCode[3] + hexCode[3];
var hexValue = "0x" + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
// console.log(hexCode);
// console.log(hexValue);
return hexValue;
}