forked from mbk-lab/rui_orig
2
0
Fork 0

Bug fixing

This commit is contained in:
Alexei Anoshenko 2022-08-08 17:00:49 +03:00
parent 082c30b062
commit 9af68bc5f3
2 changed files with 24 additions and 23 deletions

View File

@ -176,47 +176,44 @@ func (arrow *popupArrow) createView(popupView View) View {
arrow.width = defaultSize("ruiArrowWidth", Px(16)) arrow.width = defaultSize("ruiArrowWidth", Px(16))
} }
color := GetBackgroundColor(popupView, "") params := Params{BackgroundColor: GetBackgroundColor(popupView, "")}
border := NewBorder(Params{
Style: SolidLine,
ColorTag: color,
Width: arrow.size,
})
border2 := NewBorder(Params{
Style: SolidLine,
Width: SizeUnit{Type: arrow.width.Type, Value: arrow.width.Value / 2},
})
params := Params{} if shadow := GetViewShadows(popupView, ""); shadow != nil {
params[Shadow] = shadow
}
if filter := GetBackdropFilter(popupView, ""); filter != nil {
params[BackdropFilter] = filter
}
switch arrow.location { switch arrow.location {
case TopArrow: case TopArrow:
params[Row] = 0 params[Row] = 0
params[Column] = 1 params[Column] = 1
params[BorderBottom] = border params[Clip] = PolygonClip([]any{"0%", "100%", "50%", "0%", "100%", "100%"})
params[BorderLeft] = border2 params[Width] = arrow.width
params[BorderRight] = border2 params[Height] = arrow.size
case RightArrow: case RightArrow:
params[Row] = 1 params[Row] = 1
params[Column] = 0 params[Column] = 0
params[BorderLeft] = border params[Clip] = PolygonClip([]any{"0%", "0%", "100%", "50%", "0%", "100%"})
params[BorderTop] = border2 params[Width] = arrow.size
params[BorderBottom] = border2 params[Height] = arrow.width
case BottomArrow: case BottomArrow:
params[Row] = 0 params[Row] = 0
params[Column] = 1 params[Column] = 1
params[BorderTop] = border params[Clip] = PolygonClip([]any{"0%", "0%", "50%", "100%", "100%", "0%"})
params[BorderLeft] = border2 params[Width] = arrow.width
params[BorderRight] = border2 params[Height] = arrow.size
case LeftArrow: case LeftArrow:
params[Row] = 1 params[Row] = 1
params[Column] = 0 params[Column] = 0
params[BorderRight] = border params[Clip] = PolygonClip([]any{"100%", "0%", "0%", "50%", "100%", "100%"})
params[BorderTop] = border2 params[Width] = arrow.size
params[BorderBottom] = border2 params[Height] = arrow.width
} }
arrowView := NewView(session, params) arrowView := NewView(session, params)

View File

@ -152,6 +152,10 @@ func stringToSizeUnit(value string) (SizeUnit, error) {
} }
} }
if val, err := strconv.ParseFloat(value, 64); err != nil {
return SizeUnit{Type: SizeInPixel, Value: val}, nil
}
return SizeUnit{Type: Auto, Value: 0}, errors.New(`Invalid SizeUnit value: "` + value + `"`) return SizeUnit{Type: Auto, Value: 0}, errors.New(`Invalid SizeUnit value: "` + value + `"`)
} }