Trying get rid of the scroll bars
- moved view classes instanciation into CREATION_COMPLETE triggered methods
This commit is contained in:
@@ -35,7 +35,7 @@ class ToolbarToggleButton extends ToggleButton {
|
||||
iconSize = pIconSize;
|
||||
textSize = pTextSize;
|
||||
|
||||
traceRed("iconSize : " + iconSize + " / textSize : " + textSize);
|
||||
//traceRed("iconSize : " + iconSize + " / textSize : " + textSize);
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
|
||||
@@ -46,6 +46,6 @@ class MainDrawer extends Drawer {
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,12 @@ class MainFooter extends LayoutGroup {
|
||||
var hdl:HorizontalDistributedLayout = new HorizontalDistributedLayout();
|
||||
layout = hdl;
|
||||
|
||||
// Buttons
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
|
||||
// Buttons
|
||||
btn1 = new ToolbarToggleButton(Assets.getText("vector/rider_icon_black.svg"),
|
||||
Constants.MAIN_COLOR2,
|
||||
Constants.HERO_COLOR,
|
||||
@@ -49,10 +54,4 @@ class MainFooter extends LayoutGroup {
|
||||
addChild(btn2);
|
||||
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
trace(height);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+17
-17
@@ -1,6 +1,5 @@
|
||||
package view;
|
||||
|
||||
import feathers.skins.RectangleSkin;
|
||||
import com.adobe.cairngorm.control.CairngormEvent;
|
||||
import com.adobe.cairngorm.control.CairngormEventDispatcher;
|
||||
import components.IconButton;
|
||||
@@ -11,6 +10,7 @@ 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;
|
||||
@@ -22,6 +22,11 @@ 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();
|
||||
|
||||
@@ -31,10 +36,10 @@ class MainHeader extends LayoutGroup {
|
||||
override private function initialize():Void {
|
||||
super.initialize();
|
||||
|
||||
final sw:Int = stage.stageWidth;
|
||||
final sh:Int = stage.stageHeight;
|
||||
final headerWidth = Std.int(sw * Constants.MAIN_HEADER_WIDTH_RATIO);
|
||||
final headerHeight = Std.int(sh * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
||||
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));
|
||||
@@ -42,36 +47,31 @@ class MainHeader extends LayoutGroup {
|
||||
|
||||
// Layout settings
|
||||
var l:HorizontalLayout = new HorizontalLayout();
|
||||
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .3);
|
||||
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .2);
|
||||
l.verticalAlign = MIDDLE;
|
||||
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .1);
|
||||
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .1);
|
||||
//l.verticalAlign = MIDDLE;
|
||||
layout = l;
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
|
||||
// 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();
|
||||
//lb1.backgroundSkin = new RectangleSkin(SolidColor(Constants.ACCENT_COLOR2, 1));
|
||||
|
||||
//lb1.verticalAlign = VerticalAlign.TOP;
|
||||
lbl1.text = Constants.MENU_ITEM_0_STRING;
|
||||
lbl1.embedFonts = true;
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
|
||||
|
||||
lbl1.textFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .4), Constants.MAIN_COLOR3);
|
||||
addChild(lbl1);
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
}
|
||||
|
||||
|
||||
function onMenuButtonPress(e:TriggerEvent):Void {
|
||||
var e:CairngormEvent = new CairngormEvent(AppController.OPEN_DRAWER_EVENT);
|
||||
CairngormEventDispatcher.getInstance().dispatchEvent(e);
|
||||
|
||||
+6
-11
@@ -28,6 +28,11 @@ class MainPanel extends Panel {
|
||||
autoSizeMode = STAGE;
|
||||
backgroundSkin = new RectangleSkin(SolidColor(Constants.MAIN_COLOR2, 1));
|
||||
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
|
||||
mh = new MainHeader();
|
||||
header = mh;
|
||||
|
||||
@@ -35,19 +40,9 @@ class MainPanel extends Panel {
|
||||
footer = mf;
|
||||
|
||||
sn = new StackNavigator();
|
||||
sn.width = 400;
|
||||
sn.height = 300;
|
||||
sn.autoSizeMode = STAGE;
|
||||
sn.addItem(StackItem.withClass("ridersScreen", RidersScreen));
|
||||
sn.rootItemID = "ridersScreen";
|
||||
addChild(sn);
|
||||
|
||||
/*var rl:RidersList = new RidersList();
|
||||
rl.width = 300;
|
||||
rl.height = 400;
|
||||
addChild(rl);*/
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package view;
|
||||
|
||||
import feathers.layout.AutoSizeMode;
|
||||
import feathers.controls.ListView;
|
||||
import feathers.events.FeathersEvent;
|
||||
import model.AppModelLocator;
|
||||
@@ -12,8 +13,9 @@ class RidersList extends ListView {
|
||||
public function new() {
|
||||
super();
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
width = 300;
|
||||
height = 400;
|
||||
|
||||
//width = 300;
|
||||
//height = 400;
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
@@ -24,15 +26,15 @@ class RidersList extends ListView {
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
}
|
||||
|
||||
private function onRideListDpChange(e:Event):Void {
|
||||
traceGreen(this + " : onRideListDpChange");
|
||||
dataProvider = model.ridersListDP;
|
||||
|
||||
itemToText = function(item:Dynamic):String {
|
||||
return item.firstName;
|
||||
};
|
||||
traceGreen(this + " --> onRideListDpChange() - w: " + width + " h: " + height );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package view;
|
||||
|
||||
import feathers.events.FeathersEvent;
|
||||
import feathers.layout.VerticalLayout;
|
||||
import feathers.controls.ScrollContainer;
|
||||
import t9.util.ColorTraces.*;
|
||||
|
||||
class RidersScreen extends ScrollContainer {
|
||||
|
||||
@@ -10,6 +12,7 @@ class RidersScreen extends ScrollContainer {
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
addEventListener(FeathersEvent.CREATION_COMPLETE, onCreationComplete);
|
||||
}
|
||||
|
||||
override private function initialize():Void {
|
||||
@@ -19,11 +22,15 @@ class RidersScreen extends ScrollContainer {
|
||||
vl.verticalAlign = TOP;
|
||||
layout = vl;
|
||||
|
||||
tb = new ToolBar();
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
|
||||
tb = new ToolBar();
|
||||
addChild(tb);
|
||||
|
||||
rl = new RidersList();
|
||||
addChild(rl);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+10
-8
@@ -1,5 +1,6 @@
|
||||
package view;
|
||||
|
||||
import feathers.layout.HorizontalLayoutData;
|
||||
import feathers.controls.Label;
|
||||
import feathers.controls.LayoutGroup;
|
||||
import feathers.events.FeathersEvent;
|
||||
@@ -30,31 +31,32 @@ class ToolBar extends LayoutGroup {
|
||||
final headerHeight = Std.int(sh * Constants.MAIN_HEADER_HEIGHT_RATIO);
|
||||
|
||||
autoSizeMode = CONTENT;
|
||||
backgroundSkin = new RectangleSkin(SolidColor(Constants.ACCENT_COLOR1, 1));
|
||||
variant = LayoutGroup.VARIANT_TOOL_BAR;
|
||||
backgroundSkin = new RectangleSkin(SolidColor(Constants.ACCENT_COLOR2, 1));
|
||||
//variant = LayoutGroup.VARIANT_TOOL_BAR;
|
||||
|
||||
// Layout settings
|
||||
var l:HorizontalLayout = new HorizontalLayout();
|
||||
l.paddingLeft = l.paddingRight = Std.int(headerHeight * .3);
|
||||
l.paddingTop = l.paddingBottom = Std.int(headerHeight * .2);
|
||||
l.setPadding(Std.int(headerHeight * .1));
|
||||
l.verticalAlign = MIDDLE;
|
||||
layout = l;
|
||||
|
||||
// Title label
|
||||
lbl1 = new Label();
|
||||
|
||||
//lbl1.layoutData = ld1;
|
||||
//lb1.backgroundSkin = new RectangleSkin(SolidColor(Constants.ACCENT_COLOR2, 1));
|
||||
|
||||
//lb1.verticalAlign = VerticalAlign.TOP;
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
|
||||
lbl1.text = "Toolbar";
|
||||
lbl1.embedFonts = true;
|
||||
var fnt:Font = Assets.getFont(Constants.MONTSERRAT_MEDIUM_500);
|
||||
|
||||
lbl1.textFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .4), Constants.MAIN_COLOR3);
|
||||
lbl1.textFormat = new TextFormat(fnt.fontName, Std.int(headerHeight * .3), Constants.MAIN_COLOR3);
|
||||
addChild(lbl1);
|
||||
}
|
||||
|
||||
private function onCreationComplete(event:FeathersEvent):Void {
|
||||
traceBlue(this + " --> onCreationComplete()");
|
||||
traceBlue(this + " --> onCreationComplete() - w: " + width + " h: " + height );
|
||||
traceYellow(width + " / " + height);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user