Skip to content

Commit

Permalink
stop "selection flash"
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Aug 4, 2023
1 parent 6da098a commit a153d9f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
5 changes: 3 additions & 2 deletions haxe/ui/_module/styles/default/menus.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
border: 1px solid $normal-border-color;
filter: $menu-shadow;
spacing: 0;
initial-width: 200px;
__initial-width: 200px;
width: auto;
}

.menu.expanded {
Expand All @@ -81,7 +82,7 @@
*************************************************************************/
.menuitem {
background-color: $secondary-background-color;
width: 100%;
width: auto;
padding: 6px;
padding-left: 12px;
cursor: pointer;
Expand Down
22 changes: 20 additions & 2 deletions haxe/ui/containers/menus/Menu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import haxe.ui.components.Button;
import haxe.ui.containers.VBox;
import haxe.ui.core.Component;
import haxe.ui.core.CompositeBuilder;
import haxe.ui.events.MouseEvent;
import haxe.ui.core.Screen;
import haxe.ui.events.MouseEvent;
import haxe.ui.events.UIEvent;
import haxe.ui.layouts.VerticalLayout;

#if (haxe_ver >= 4.2)
import Std.isOfType;
Expand Down Expand Up @@ -41,8 +42,12 @@ class MenuEvent extends UIEvent {
}
}

@:composite(MenuEvents, Builder)
@:composite(MenuEvents, Builder, Layout)
class Menu extends VBox {
public function new() {
super();
trace("new menu");
}
@:behaviour(DefaultBehaviour) public var menuStyleNames:String;

/**
Expand Down Expand Up @@ -427,3 +432,16 @@ private class Builder extends CompositeBuilder {
return true;
}
}

private class Layout extends VerticalLayout {
private override function resizeChildren() {
trace("here");
for (child in component.childComponents) {
if (child.includeInLayout == false) {
continue;
}

trace(child.width);
}
}
}
3 changes: 2 additions & 1 deletion haxe/ui/containers/menus/MenuBar.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import haxe.ui.Toolkit;
import haxe.ui.behaviours.DefaultBehaviour;
import haxe.ui.components.Button;
import haxe.ui.containers.HBox;
import haxe.ui.containers.menus.Menu;
import haxe.ui.containers.menus.Menu.MenuEvent;
import haxe.ui.containers.menus.Menu.MenuEvents;
import haxe.ui.containers.menus.Menu;
import haxe.ui.core.Component;
import haxe.ui.core.CompositeBuilder;
import haxe.ui.core.Screen;
Expand Down Expand Up @@ -167,6 +167,7 @@ private class Events extends haxe.ui.events.Events {
}
menu.show();
menu.syncComponentValidation();
menu.removeClass(":hover", true, true);

if (left + menu.actualComponentWidth > Screen.instance.actualWidth) {
left = target.screenLeft - menu.actualComponentWidth + target.actualComponentWidth;
Expand Down
4 changes: 2 additions & 2 deletions haxe/ui/containers/menus/MenuItem.hx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ private class Builder extends CompositeBuilder {
super.create();

var box = new HBox();
box.percentWidth = 100;
//box.percentWidth = 100;
box.verticalAlign = "center";

var label = new Label();
label.id = "menuitem-label";
label.percentWidth = 100;
//label.percentWidth = 100;
label.styleNames = "menuitem-label";
label.scriptAccess = false;
box.addComponent(label);
Expand Down

0 comments on commit a153d9f

Please sign in to comment.