Fix: show / hide AnimalRecordList, TabLayout

This commit is contained in:
2019-08-06 19:22:46 +09:00
parent 56f7d1a03a
commit a8728cc6bf
11 changed files with 534 additions and 43 deletions
+28 -7
View File
@@ -11,6 +11,8 @@ function BasicTab() {
this.mainText = null;
this.subText = null;
this.posY = 0;
}
@@ -25,6 +27,7 @@ BasicTab.prototype.createButton = function(setting, clickEvent) {
this.activeLineSprite = this.makeActiveLineSprite();
this.setEventMethod(this.activeLineSprite);
this.buttonSprite.addChild(this.activeLineSprite);
this.mainText = this.makeMainText();
this.buttonSprite.addChild(this.mainText);
@@ -56,8 +59,8 @@ BasicTab.prototype.makeButtonSprite = function() {
var posX = setting.x - btnWidth / 2;
var posY = setting.y - btnHeight / 2;
var buttonSprite = game.add.sprite(posX, posY, texture);
this.posY = posY;
// buttonSprite.anchor.setTo(0.5, 0.5);
buttonSprite.inputEnabled = true;
return buttonSprite;
@@ -68,7 +71,7 @@ BasicTab.prototype.makeActiveLineSprite = function() {
// console.log("strokeWidthPx : " + setting.strokeWidthPx);
// console.log("round : " + setting.roundAmount);
var OFFSET_POS_Y = 6;
var OFFSET_POS_Y = setting.height - 6;
var ACTIVE_LINE_HEIGHT = 3;
var buttonWidth = setting.width;
@@ -83,11 +86,10 @@ BasicTab.prototype.makeActiveLineSprite = function() {
.endFill()
.generateTexture();
var posX = setting.x - lineWidth / 2;
var posY = setting.y + setting.height / 2 - OFFSET_POS_Y;
var posX = setting.width / 2 - lineWidth / 2;
var posY = OFFSET_POS_Y;
var activeLineSprite = game.add.sprite(posX, posY, texture);
// buttonSprite.anchor.setTo(0.5, 0.5);
activeLineSprite.inputEnabled = true;
return activeLineSprite;
@@ -166,7 +168,6 @@ BasicTab.prototype.setMainTextFontWeight = function(option) {
this.mainText.fontWeight = "normal";
else
this.mainText.fontWeight = option;
console.log(this.mainText.fontWeight);
}
BasicTab.prototype.makeSubText = function() {
@@ -269,6 +270,9 @@ BasicTab.prototype.setEventMethod = function(target) {
}
BasicTab.prototype.mouseOut = function() {
if(!this.buttonSprite.inputEnabled)
return;
this.buttonSprite.tint = this.setting.buttonColors.out;
if((typeof this.iconSprite !== "undefined") && (this.iconSprite !== null))
@@ -282,6 +286,9 @@ BasicTab.prototype.mouseOut = function() {
}
BasicTab.prototype.mouseOver = function() {
if(!this.buttonSprite.inputEnabled)
return;
this.buttonSprite.tint = this.setting.buttonColors.over;
if((typeof this.iconSprite !== "undefined") && (this.iconSprite !== null))
@@ -295,6 +302,9 @@ BasicTab.prototype.mouseOver = function() {
}
BasicTab.prototype.mouseDown = function() {
if(!this.buttonSprite.inputEnabled)
return;
this.buttonSprite.tint = this.setting.buttonColors.down;
if((typeof this.iconSprite !== "undefined") && (this.iconSprite !== null))
@@ -341,6 +351,7 @@ BasicTab.prototype.getInputEnabled = function() {
BasicTab.prototype.setInputEnabled = function(isEnabled) {
this.buttonSprite.inputEnabled = isEnabled;
this.activeLineSprite.inputEnabled = isEnabled;
if(isEnabled === true) {
this.mouseOut();
@@ -353,7 +364,17 @@ BasicTab.prototype.setLineSpacing = function(spacingInPixels) {
this.mainText.lineSpacing = spacingInPixels;
}
BasicTab.prototype.show = function() {
this.buttonSprite.y = this.posY;
}
BasicTab.prototype.hide = function() {
this.buttonSprite.y = BasicTab.HIDE_POS_Y;
}
BasicTab.NONE_ICON = "";
BasicTab.NONE_BUTTON_TEXT = "";
BasicTab.SUBTEXT_FONTSIZE = 12;
BasicTab.SUBTEXT_FONTSIZE = 12;
BasicTab.HIDE_POS_Y = 1000;