Skip to content

Commit

Permalink
additional picker styles
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Feb 28, 2024
1 parent a282cb4 commit b07fb51
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
18 changes: 17 additions & 1 deletion haxe/ui/_module/styles/default/pickers.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@
vertical-align: center;
}

.item-picker.no-trigger-icon .item-picker-trigger-icon {
.item-picker.no-icon .image {
hidden: true;
}

.item-picker.no-text .label {
hidden: true;
}

.item-picker.no-trigger-icon .item-picker-trigger-icon, .item-picker.no-trigger-icon .item-picker-trigger-icon-container {
hidden: true;
}

Expand Down Expand Up @@ -72,6 +80,14 @@
filter: box-shadow(2, -2, #000000, 0.15, 6);
}

.item-picker-container.rounded.position-up {
border-bottom-right-radius: 4px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
padding: 4px;
background-color: $secondary-background-color;
}

/************************************************************************
** MONTH PICKER
*************************************************************************/
Expand Down
13 changes: 12 additions & 1 deletion haxe/ui/components/pickers/ItemPicker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ class ItemPicker extends InteractiveComponent implements IDataComponent implemen
builder.panelSelectionEvent = _panelSelectionEvent;
return value;
}

public function showPanel() {
var builder:ItemPickerBuilder = cast(_compositeBuilder, ItemPickerBuilder);
builder.showPanel();
}

public function hidePanel() {
var builder:ItemPickerBuilder = cast(_compositeBuilder, ItemPickerBuilder);
builder.hidePanel();
}
}

class ItemPickerHandler {
Expand Down Expand Up @@ -326,6 +336,7 @@ class ItemPickerBuilder extends CompositeBuilder {
marginBottom = panelContainer.style.marginBottom;
marginRight = panelContainer.style.marginRight;
horizontalPadding = panelContainer.style.paddingLeft + panelContainer.style.paddingRight;
verticalPadding = panelContainer.style.paddingTop + panelContainer.style.paddingBottom;
borderSize = panelContainer.style.borderTopSize;
}

Expand Down Expand Up @@ -362,7 +373,7 @@ class ItemPickerBuilder extends CompositeBuilder {
_panelFiller.top = 0;
} else if (panelPosition == "up") {
panelContainer.top = picker.screenTop - panelContainer.height - marginTop;
_panelFiller.top = panelHeight + borderSize;
_panelFiller.top = panelHeight + (verticalPadding - borderSize);
}
}

Expand Down
2 changes: 1 addition & 1 deletion haxe/ui/components/pickers/MenuItemPicker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import haxe.ui.util.Variant;
<hbox id="itemPickerRenderer">
<image id="itemIcon" verticalAlign="center" />
<label id="itemText" text="Select Item" verticalAlign="center" />
<box height="100%">
<box height="100%" styleName="item-picker-trigger-icon-container">
<image styleName="item-picker-trigger-icon" />
</box>
</hbox>
Expand Down
9 changes: 5 additions & 4 deletions haxe/ui/core/Component.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2170,20 +2170,21 @@ class Component extends ComponentImpl
}
}

private var recursivePointerEvents:Bool = true;
private function onPointerEventsMouseOver(e:MouseEvent) {
addClass(":hover", true, true);
addClass(":hover", true, recursivePointerEvents);
}

private function onPointerEventsMouseOut(e:MouseEvent) {
removeClass(":hover", true, true);
removeClass(":hover", true, recursivePointerEvents);
}

private function onPointerEventsMouseDown(e:MouseEvent) {
addClass(":down", true, true);
addClass(":down", true, recursivePointerEvents);
}

private function onPointerEventsMouseUp(e:MouseEvent) {
removeClass(":down", true, true);
removeClass(":down", true, recursivePointerEvents);
}

//***********************************************************************************************************
Expand Down

0 comments on commit b07fb51

Please sign in to comment.