first try of drawer event chain

currently stuck in NekoDrawerCommand
TODO : extract the event from NekoDrawerCommand
This commit is contained in:
2025-11-19 14:48:54 +01:00
parent 28c36c699a
commit a6e2e7aa58
8 changed files with 125 additions and 18 deletions
+57
View File
@@ -0,0 +1,57 @@
package components;
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 {
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 c1 = new LayoutGroup();
var contentLayout = new VerticalLayout();
contentLayout.horizontalAlign = CENTER;
contentLayout.verticalAlign = MIDDLE;
c1.layout = contentLayout;
openDrawerButton = new Button();
openDrawerButton.text = "Open Drawer";
openDrawerButton.addEventListener(TriggerEvent.TRIGGER, (event) -> {
opened = true;
});
c1.addChild(openDrawerButton);
content = c1;
var d1 = new LayoutGroup();
var drawerLayout = new VerticalLayout();
drawerLayout.horizontalAlign = CENTER;
drawerLayout.verticalAlign = MIDDLE;
d1.layout = drawerLayout;
closeDrawerButton = new Button();
closeDrawerButton.text = "Close Drawer";
closeDrawerButton.addEventListener(TriggerEvent.TRIGGER, (event) -> {
opened = false;
});
d1.addChild(closeDrawerButton);
drawer = d1;
}
private function onCreationComplete(event:FeathersEvent):Void {
traceBlue(this + " --> onCreationComplete()");
}
}
+11 -13
View File
@@ -5,18 +5,16 @@ import openfl.display.BitmapData;
import feathers.controls.Button;
import t9.util.ColorTraces.*;
class NekoIconButton extends Button{
class NekoIconButton extends Button {
private var bmp:Bitmap;
private var bmp:Bitmap;
public function new(pSkin:BitmapData, pX:Int = 0, pY:Int = 0, pWidth:Int = 100, pHeight:Int = 100) {
super();
public function new(pSkin:BitmapData, pX:Int = 0, pY:Int = 0, pWidth:Int = 100, pHeight:Int = 100) {
super();
bmp = new Bitmap(pSkin);
backgroundSkin = bmp;
bmp.width = pWidth;
bmp.height = pHeight;
bmp.smoothing = true;
}
}
bmp = new Bitmap(pSkin);
backgroundSkin = bmp;
bmp.width = pWidth;
bmp.height = pHeight;
bmp.smoothing = true;
}
}