Drawer related refactoring :
- removed NekoDrawerEvent Button related refactoring : - removed NekoIconButton
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
package components;
|
||||
|
||||
import model.Constants;
|
||||
import feathers.events.TriggerEvent;
|
||||
import feathers.controls.Button;
|
||||
import feathers.layout.VerticalLayout;
|
||||
import feathers.controls.LayoutGroup;
|
||||
import feathers.events.FeathersEvent;
|
||||
import t9.util.ColorTraces.*;
|
||||
import feathers.controls.Drawer;
|
||||
|
||||
class NekoDrawer extends Drawer {
|
||||
|
||||
public static final CLOSE:String = "close";
|
||||
public static final OPEN:String = "open";
|
||||
|
||||
private var openDrawerButton:Button;
|
||||
private var closeDrawerButton:Button;
|
||||
private var coucou:Bool;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
super.initialize();
|
||||
|
||||
var d1 = new LayoutGroup();
|
||||
var drawerLayout = new VerticalLayout();
|
||||
drawerLayout.setPadding(10);
|
||||
drawerLayout.horizontalAlign = CENTER;
|
||||
drawerLayout.verticalAlign = TOP;
|
||||
d1.layout = drawerLayout;
|
||||
closeDrawerButton = new Button();
|
||||
closeDrawerButton.text = "Close Drawer";
|
||||
closeDrawerButton.addEventListener(TriggerEvent.TRIGGER, (event) -> {
|
||||
opened = false;
|
||||
});
|
||||
d1.addChild(closeDrawerButton);
|
||||
|
||||
overlaySkin = new NekoRectangle(Constants.HERO_COLOR);
|
||||
|
||||
drawer = d1;
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package components;
|
||||
|
||||
import feathers.controls.Button;
|
||||
import feathers.controls.Label;
|
||||
import feathers.events.FeathersEvent;
|
||||
import format.SVG;
|
||||
import model.Constants;
|
||||
import openfl.Assets;
|
||||
import openfl.display.Shape;
|
||||
import openfl.geom.ColorTransform;
|
||||
import openfl.text.Font;
|
||||
import openfl.text.TextFormat;
|
||||
import t9.util.ColorTraces.*;
|
||||
|
||||
class NekoIconButton extends Button {
|
||||
|
||||
private var svgSkinPath:String;
|
||||
private var w:Int;
|
||||
private var h:Int;
|
||||
private var normalStateColor:Int;
|
||||
private var selectedStateColor:Int;
|
||||
private var disabledStateColor:Int;
|
||||
private var backgroundColor:Int;
|
||||
private var t:String;
|
||||
|
||||
private var iconShape:Shape;
|
||||
private var lb1:Label;
|
||||
|
||||
public function new(pSvgSkinPath:String,
|
||||
pWidth:Int = 100,
|
||||
pHeight:Int = 100,
|
||||
pNormalStateColor:Int = 0x000000,
|
||||
pSelectedStateColor:Int = 0xFF0000,
|
||||
pDisabledStateColor:Int = 0xAAAAAA,
|
||||
pBackgroundColor:Int = null,
|
||||
pText:String = null) {
|
||||
super();
|
||||
|
||||
svgSkinPath = pSvgSkinPath;
|
||||
w = pWidth;
|
||||
h = pHeight;
|
||||
normalStateColor = pNormalStateColor;
|
||||
selectedStateColor = pSelectedStateColor;
|
||||
disabledStateColor = pDisabledStateColor;
|
||||
backgroundColor = pBackgroundColor;
|
||||
t = pText;
|
||||
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
|
||||
if(pBackgroundColor == null){
|
||||
backgroundSkin = new NekoRectangle(0xFF0000, 0, 0, pWidth, pHeight);
|
||||
backgroundSkin.alpha = 0;
|
||||
} else {
|
||||
backgroundSkin = new NekoRectangle(pBackgroundColor, 0, 0, pWidth, pHeight);
|
||||
}
|
||||
|
||||
iconShape = new Shape();
|
||||
new SVG(pSvgSkinPath).render(iconShape.graphics);
|
||||
iconShape.width = pWidth;
|
||||
iconShape.height = pHeight;
|
||||
|
||||
var ct = new ColorTransform();
|
||||
ct.color = pNormalStateColor;
|
||||
iconShape.transform.colorTransform = ct;
|
||||
addChild(iconShape);
|
||||
|
||||
if(pText != null){
|
||||
lb1.text = Constants.MENU_ITEM_0_STRING;
|
||||
lb1.embedFonts = true;
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_LIGHT_300);
|
||||
lb1.textFormat = new TextFormat(fnt.fontName, 20, Constants.BUTTON_NORMAL_STATE_COLOR);
|
||||
addChild(lb1);
|
||||
}
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user