From d5fecf4cb7aa60e3333c270293d20b81ade472ee Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Fri, 2 Feb 2024 11:27:32 +0100 Subject: [PATCH] dropdownHorizontalPosition / dropdownVerticalPosition --- haxe/ui/components/DropDown.hx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haxe/ui/components/DropDown.hx b/haxe/ui/components/DropDown.hx index 7ccc4243f..2c5370cba 100644 --- a/haxe/ui/components/DropDown.hx +++ b/haxe/ui/components/DropDown.hx @@ -39,6 +39,8 @@ class DropDown extends Button implements IDataComponent { @:clonable @:behaviour(DefaultBehaviour) public var dropdownWidth:Null; @:clonable @:behaviour(DefaultBehaviour) public var dropdownHeight:Null; @:clonable @:behaviour(DefaultBehaviour) public var dropdownSize:Null; + @:clonable @:behaviour(DefaultBehaviour) public var dropdownHorizontalPosition:String; + @:clonable @:behaviour(DefaultBehaviour) public var dropdownVerticalPosition:String; @:clonable @:behaviour(SelectedIndexBehaviour, -1) public var selectedIndex:Int; @:clonable @:behaviour(SelectedItemBehaviour) public var selectedItem:Dynamic; @:clonable @:behaviour(DefaultBehaviour, false) public var searchable:Bool; @@ -781,13 +783,13 @@ class DropDownEvents extends ButtonEvents { var popupToRight = false; var popupFromBottom = false; - if (_wrapper.screenLeft + _wrapper.actualComponentWidth > Screen.instance.actualWidth) { + if (_dropdown.dropdownHorizontalPosition == "right" || _wrapper.screenLeft + _wrapper.actualComponentWidth > Screen.instance.actualWidth) { var left = _wrapper.screenLeft - _wrapper.actualComponentWidth + _dropdown.actualComponentWidth; _wrapper.left = left >= 0 ? left : (Screen.instance.actualWidth / 2) - (_wrapper.actualComponentWidth / 2); popupToRight = true; } _wrapper.removeClass("popup-from-bottom"); - if (_wrapper.screenTop + _wrapper.actualComponentHeight > Screen.instance.actualHeight) { + if (_dropdown.dropdownVerticalPosition == "bottom" || _wrapper.screenTop + _wrapper.actualComponentHeight > Screen.instance.actualHeight) { _wrapper.addClass("popup-from-bottom"); _wrapper.top = (_dropdown.screenTop - _wrapper.actualComponentHeight) + Toolkit.scaleY; _wrapper.syncComponentValidation();