mirror of https://github.com/anoshenko/rui.git
Added "outside-color" add "outside-filter" properties to Popup interface
This commit is contained in:
parent
5272354205
commit
c07cf52081
|
|
@ -5,6 +5,7 @@
|
||||||
* Added functions: GetWhiteSpace, GetWordBreak, ScrollIntoViewIfNeeded
|
* Added functions: GetWhiteSpace, GetWordBreak, ScrollIntoViewIfNeeded
|
||||||
* Added Popups, PopupDefault, PopupDefaultsSeq, and SetPopupDefaults methods to Session interface
|
* Added Popups, PopupDefault, PopupDefaultsSeq, and SetPopupDefaults methods to Session interface
|
||||||
* Added DismissWithoutAnimation add SetHotKey methods to Popup interface
|
* Added DismissWithoutAnimation add SetHotKey methods to Popup interface
|
||||||
|
* Added "outside-color" add "outside-filter" properties to Popup interface
|
||||||
* Added ViewSeq add ViewCount methods to ParentView interface
|
* Added ViewSeq add ViewCount methods to ParentView interface
|
||||||
* Added ToBoundsProperty method to Bounds struct
|
* Added ToBoundsProperty method to Bounds struct
|
||||||
|
|
||||||
|
|
|
||||||
12
filter.go
12
filter.go
|
|
@ -142,6 +142,18 @@ type filterData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFilterProperty creates the new FilterProperty
|
// NewFilterProperty creates the new FilterProperty
|
||||||
|
//
|
||||||
|
// The argument lists the effects to apply. The following effects are possible:
|
||||||
|
// - "blur" (Blur) - Gaussian blur in pixels (type: float64, value: 0…10000);
|
||||||
|
// - "brightness" (Brightness) - Brightness change in percents (type: float64, value: 0…10000);
|
||||||
|
// - "contrast" (Contrast) - Contrast change in percents (type: float64, value: 0…10000);
|
||||||
|
// - "drop-shadow" (DropShadow) - Adding shadow (type: []ShadowProperty);
|
||||||
|
// - "grayscale" (Grayscale) - Converting to grayscale in percents (type: float64, value: 0…100%);
|
||||||
|
// - "hue-rotate" (HueRotate) - Hue rotation (type: AngleUnit);
|
||||||
|
// - "invert" (Invert) - Invert colors in percents (type: float64, value: 0…100);
|
||||||
|
// - "opacity" (Opacity) - Changing transparency in percents (type: float64, value: 0…100);
|
||||||
|
// - "saturate" (Saturate) - Saturation change in percents (type: float64, value: 0…10000);
|
||||||
|
// - "sepia" (Sepia) - Conversion to sepia in percents (type: float64, value: 0…100).
|
||||||
func NewFilterProperty(params Params) FilterProperty {
|
func NewFilterProperty(params Params) FilterProperty {
|
||||||
if len(params) > 0 {
|
if len(params) > 0 {
|
||||||
filter := new(filterData)
|
filter := new(filterData)
|
||||||
|
|
|
||||||
70
popup.go
70
popup.go
|
|
@ -152,6 +152,17 @@ const (
|
||||||
// See SizeUnit description for more details.
|
// See SizeUnit description for more details.
|
||||||
ArrowWidth PropertyName = "arrow-width"
|
ArrowWidth PropertyName = "arrow-width"
|
||||||
|
|
||||||
|
// ArrowOffset is the constant for "arrow-offset" property tag.
|
||||||
|
//
|
||||||
|
// Used by Popup.
|
||||||
|
// Set the offset of the popup arrow.
|
||||||
|
//
|
||||||
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
|
//
|
||||||
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
|
// See SizeUnit description for more details.
|
||||||
|
ArrowOffset PropertyName = "arrow-offset"
|
||||||
|
|
||||||
// ShowTransform is the constant for "show-transform" property tag.
|
// ShowTransform is the constant for "show-transform" property tag.
|
||||||
//
|
//
|
||||||
// Used by Popup.
|
// Used by Popup.
|
||||||
|
|
@ -207,16 +218,27 @@ const (
|
||||||
// Internal type is float, other types converted to it during assignment.
|
// Internal type is float, other types converted to it during assignment.
|
||||||
ShowOpacity PropertyName = "show-opacity"
|
ShowOpacity PropertyName = "show-opacity"
|
||||||
|
|
||||||
// ArrowOffset is the constant for "arrow-offset" property tag.
|
// OutsideColor is the constant for "outside-color" property tag.
|
||||||
//
|
//
|
||||||
// Used by Popup.
|
// Used by Popup.
|
||||||
// Set the offset of the popup arrow.
|
// Specifies the color used to paint the space outside and below the Popup.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: Color, string.
|
||||||
//
|
//
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is Color, other types converted to it during assignment.
|
||||||
// See SizeUnit description for more details.
|
// See [Color] description for more details.
|
||||||
ArrowOffset PropertyName = "arrow-offset"
|
OutsideColor PropertyName = "outside-color"
|
||||||
|
|
||||||
|
// OutsideFilter is the constant for "outside-filter" property tag.
|
||||||
|
//
|
||||||
|
// Used by Popup.
|
||||||
|
// Applies graphical effects to the area outside and below a popup, such as blurring, color shifting, changing brightness/contrast,
|
||||||
|
// etc.
|
||||||
|
//
|
||||||
|
// Supported types: FilterProperty.
|
||||||
|
//
|
||||||
|
// See FilterProperty description for more details.
|
||||||
|
OutsideFilter PropertyName = "outside-filter"
|
||||||
|
|
||||||
// NoneArrow is value of the popup "arrow" property: no arrow
|
// NoneArrow is value of the popup "arrow" property: no arrow
|
||||||
NoneArrow = 0
|
NoneArrow = 0
|
||||||
|
|
@ -682,6 +704,24 @@ func (popup *popupData) Set(tag PropertyName, value any) bool {
|
||||||
popup.setRaw(ShowTiming, timing)
|
popup.setRaw(ShowTiming, timing)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OutsideColor:
|
||||||
|
if len(setColorProperty(popup, OutsideColor, value)) > 0 {
|
||||||
|
popup.propertyChanged(OutsideColor)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
|
||||||
|
case OutsideFilter:
|
||||||
|
if len(setFilterProperty(popup, OutsideFilter, value)) > 0 {
|
||||||
|
popup.propertyChanged(OutsideColor)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
|
||||||
|
//if filter := GetBackdropFilter(popup.popupView); filter != nil {
|
||||||
|
//params[BackdropFilter] = filter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if popup.supported(tag) {
|
if popup.supported(tag) {
|
||||||
|
|
@ -791,6 +831,12 @@ func (popup *popupData) propertyChanged(tag PropertyName) {
|
||||||
popup.layerView.SetTransition(Transform, popup.animationProperty())
|
popup.layerView.SetTransition(Transform, popup.animationProperty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case OutsideColor:
|
||||||
|
popup.layerView.Set(BackgroundColor, popup.Get(OutsideColor))
|
||||||
|
|
||||||
|
case OutsideFilter:
|
||||||
|
popup.layerView.Set(BackdropFilter, popup.Get(OutsideFilter))
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if popup.supported(tag) {
|
if popup.supported(tag) {
|
||||||
popup.popupView.Set(tag, popup.getRaw(tag))
|
popup.popupView.Set(tag, popup.getRaw(tag))
|
||||||
|
|
@ -1313,6 +1359,8 @@ func (popup *popupData) createLayerView() GridLayout {
|
||||||
TitleStyle,
|
TitleStyle,
|
||||||
CloseButton,
|
CloseButton,
|
||||||
OutsideClose,
|
OutsideClose,
|
||||||
|
OutsideColor,
|
||||||
|
OutsideFilter,
|
||||||
Buttons,
|
Buttons,
|
||||||
ButtonsAlign,
|
ButtonsAlign,
|
||||||
DismissEvent,
|
DismissEvent,
|
||||||
|
|
@ -1379,6 +1427,16 @@ func (popup *popupData) createLayerView() GridLayout {
|
||||||
layerParams[ClickEvent] = popup.cancel
|
layerParams[ClickEvent] = popup.cancel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if color, ok := colorProperty(popup, OutsideColor, session); ok {
|
||||||
|
layerParams[BackgroundColor] = color
|
||||||
|
}
|
||||||
|
|
||||||
|
if value := popup.getRaw(OutsideFilter); value != nil {
|
||||||
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
|
layerParams[BackdropFilter] = filter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
popup.layerView = NewGridLayout(session, layerParams)
|
popup.layerView = NewGridLayout(session, layerParams)
|
||||||
|
|
||||||
opacity, _ := floatProperty(popup, ShowOpacity, session, 1)
|
opacity, _ := floatProperty(popup, ShowOpacity, session, 1)
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,10 @@ func (popup *popupMenuData) IsListItemEnabled(index int) bool {
|
||||||
// Supported types: `func(index int)`.
|
// Supported types: `func(index int)`.
|
||||||
const PopupMenuResult PropertyName = "popup-menu-result"
|
const PopupMenuResult PropertyName = "popup-menu-result"
|
||||||
|
|
||||||
// ShowMenu displays the menu. Menu items are set using the Items property.
|
// ShowMenu displays the menu.
|
||||||
|
//
|
||||||
|
// Menu items are set using the Items property.
|
||||||
|
//
|
||||||
// The "popup-menu-result" property sets the function (format: func(int)) to be called when a menu item is selected.
|
// The "popup-menu-result" property sets the function (format: func(int)) to be called when a menu item is selected.
|
||||||
func ShowMenu(session Session, params Params) Popup {
|
func ShowMenu(session Session, params Params) Popup {
|
||||||
value, ok := params[Items]
|
value, ok := params[Items]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue