631c86d653
- fixed RiderCardDrawer layout - added fake avatars - avatars are now loaded dynammically
79 lines
2.4 KiB
Haxe
79 lines
2.4 KiB
Haxe
package view;
|
|
|
|
import haxe.macro.Expr.Constant;
|
|
import com.adobe.cairngorm.control.CairngormEvent;
|
|
import com.adobe.cairngorm.control.CairngormEventDispatcher;
|
|
import components.IconButton;
|
|
import control.AppController;
|
|
import feathers.controls.Button;
|
|
import feathers.controls.Label;
|
|
import feathers.controls.LayoutGroup;
|
|
import feathers.events.FeathersEvent;
|
|
import feathers.events.TriggerEvent;
|
|
import feathers.layout.HorizontalLayout;
|
|
import feathers.skins.RectangleSkin;
|
|
import feathers.text.TextFormat;
|
|
import model.Constants;
|
|
import openfl.Assets;
|
|
import openfl.text.Font;
|
|
import t9.util.ColorTraces.*;
|
|
|
|
class MainHeader extends LayoutGroup {
|
|
|
|
private var btn1:Button;
|
|
private var lbl1:Label;
|
|
|
|
private var sw:Int;
|
|
private var sh:Int;
|
|
private var headerWidth:Int;
|
|
private var headerHeight:Int;
|
|
|
|
public function new() {
|
|
super();
|
|
|
|
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
|
}
|
|
|
|
override private function initialize():Void {
|
|
super.initialize();
|
|
|
|
sw = stage.stageWidth;
|
|
sh = stage.stage.stageHeight;
|
|
headerWidth = Std.int(sw * Constants.MAIN_HEADER_WIDTH_RATIO);
|
|
headerHeight = Std.int(sh * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
|
|
|
autoSizeMode = CONTENT;
|
|
backgroundSkin = new RectangleSkin(SolidColor(Constants.HERO_COLOR, 1));
|
|
variant = LayoutGroup.VARIANT_TOOL_BAR;
|
|
|
|
// Layout settings
|
|
var l:HorizontalLayout = new HorizontalLayout();
|
|
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .1);
|
|
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .1);
|
|
l.verticalAlign = MIDDLE;
|
|
layout = l;
|
|
|
|
// Menu button
|
|
var svgIconString:String = Assets.getText("vector/menu_icon_black.svg");
|
|
btn1 = new IconButton(svgIconString, Constants.MAIN_COLOR3);
|
|
btn1.addEventListener(TriggerEvent.TRIGGER, onMenuButtonPress);
|
|
addChild(btn1);
|
|
|
|
// Title label
|
|
lbl1 = new Label();
|
|
lbl1.text = Constants.MENU_ITEM_0_STRING;
|
|
lbl1.embedFonts = true;
|
|
lbl1.textFormat = new TextFormat(Assets.getFont(Constants.MONTSERRAT_MEDIUM_500).fontName, Constants.FONT_SIZE_22, Constants.MAIN_COLOR3);
|
|
addChild(lbl1);
|
|
|
|
}
|
|
|
|
private function onCreationComplete(event:FeathersEvent):Void {
|
|
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
|
}
|
|
|
|
function onMenuButtonPress(e:TriggerEvent):Void {
|
|
var ce:CairngormEvent = new CairngormEvent(AppController.OPEN_DRAWER_EVENT);
|
|
CairngormEventDispatcher.getInstance().dispatchEvent(ce);
|
|
}
|
|
} |