2021-09-07 17:36:50 +03:00
|
|
|
package rui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
func setTransitionProperty(properties Properties, value any) bool {
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
transitions := map[PropertyName]Animation{}
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-06-29 12:05:27 +03:00
|
|
|
setObject := func(obj DataObject) bool {
|
|
|
|
if obj != nil {
|
2024-11-13 12:56:39 +03:00
|
|
|
tag := strings.ToLower(obj.Tag())
|
2024-06-29 12:05:27 +03:00
|
|
|
switch tag {
|
|
|
|
case "", "_":
|
|
|
|
ErrorLog("Invalid transition property name")
|
|
|
|
|
|
|
|
default:
|
2024-11-13 12:56:39 +03:00
|
|
|
transitions[PropertyName(tag)] = parseAnimation(obj)
|
2024-06-29 12:05:27 +03:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
switch value := value.(type) {
|
|
|
|
case Params:
|
|
|
|
for tag, val := range value {
|
2024-11-13 12:56:39 +03:00
|
|
|
tag = defaultNormalize(tag)
|
2024-06-29 12:05:27 +03:00
|
|
|
if tag == "" {
|
|
|
|
ErrorLog("Invalid transition property name")
|
2024-11-13 12:56:39 +03:00
|
|
|
return false
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
|
|
|
|
if val != nil {
|
|
|
|
if animation, ok := val.(Animation); ok {
|
|
|
|
transitions[PropertyName(tag)] = animation
|
|
|
|
} else {
|
|
|
|
notCompatibleType(Transition, val)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if len(transitions) == 0 {
|
|
|
|
transitions = nil
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
properties.setRaw(Transition, transitions)
|
|
|
|
return true
|
2024-06-29 12:05:27 +03:00
|
|
|
|
|
|
|
case DataObject:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setObject(value) {
|
|
|
|
properties.setRaw(Transition, transitions)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
2024-06-29 12:05:27 +03:00
|
|
|
|
|
|
|
case DataNode:
|
|
|
|
switch value.Type() {
|
|
|
|
case ObjectNode:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setObject(value.Object()) {
|
|
|
|
properties.setRaw(Transition, transitions)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
2024-06-29 12:05:27 +03:00
|
|
|
|
|
|
|
case ArrayNode:
|
|
|
|
for i := 0; i < value.ArraySize(); i++ {
|
|
|
|
if obj := value.ArrayElement(i).Object(); obj != nil {
|
2024-11-13 12:56:39 +03:00
|
|
|
if !setObject(obj) {
|
|
|
|
return false
|
|
|
|
}
|
2024-06-29 12:05:27 +03:00
|
|
|
} else {
|
2024-11-13 12:56:39 +03:00
|
|
|
notCompatibleType(Transition, value.ArrayElement(i))
|
|
|
|
return false
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
if len(transitions) == 0 {
|
|
|
|
transitions = nil
|
|
|
|
}
|
|
|
|
properties.setRaw(Transition, transitions)
|
|
|
|
return true
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
notCompatibleType(Transition, value)
|
2024-06-29 12:05:27 +03:00
|
|
|
return false
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
}
|
2024-07-01 19:17:03 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
/*
|
|
|
|
func (style *viewStyle) setTransition(tag PropertyName, value any) bool {
|
|
|
|
setObject := func(obj DataObject) bool {
|
|
|
|
if obj != nil {
|
|
|
|
tag := defaultNormalize(tag)
|
|
|
|
switch tag {
|
|
|
|
case "", "_":
|
|
|
|
ErrorLog("Invalid transition property name")
|
|
|
|
|
|
|
|
default:
|
|
|
|
style.transitions[tag] = parseAnimation(obj)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
2024-07-01 19:17:03 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
switch value := value.(type) {
|
|
|
|
case Params:
|
|
|
|
result := true
|
|
|
|
for tag, val := range value {
|
|
|
|
tag = defaultNormalize(tag)
|
|
|
|
if tag == "" {
|
|
|
|
ErrorLog("Invalid transition property name")
|
|
|
|
result = false
|
|
|
|
} else if val == nil {
|
|
|
|
delete(style.transitions, tag)
|
|
|
|
} else if animation, ok := val.(Animation); ok {
|
|
|
|
style.transitions[tag] = animation
|
|
|
|
} else {
|
|
|
|
notCompatibleType(Transition, val)
|
|
|
|
result = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result
|
2024-06-29 12:05:27 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case DataObject:
|
|
|
|
return setObject(value)
|
2024-06-29 12:05:27 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case DataNode:
|
|
|
|
switch value.Type() {
|
|
|
|
case ObjectNode:
|
|
|
|
return setObject(value.Object())
|
2024-06-29 12:05:27 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case ArrayNode:
|
|
|
|
result := true
|
|
|
|
for i := 0; i < value.ArraySize(); i++ {
|
|
|
|
if obj := value.ArrayElement(i).Object(); obj != nil {
|
|
|
|
result = setObject(obj) && result
|
|
|
|
} else {
|
|
|
|
notCompatibleType(tag, value.ArrayElement(i))
|
|
|
|
result = false
|
|
|
|
}
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return result
|
2024-06-29 12:05:27 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
notCompatibleType(tag, value)
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
*/
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
func viewStyleRemove(properties Properties, tag PropertyName) []PropertyName {
|
2021-09-07 17:36:50 +03:00
|
|
|
switch tag {
|
|
|
|
case BorderStyle, BorderColor, BorderWidth,
|
|
|
|
BorderLeft, BorderLeftStyle, BorderLeftColor, BorderLeftWidth,
|
|
|
|
BorderRight, BorderRightStyle, BorderRightColor, BorderRightWidth,
|
|
|
|
BorderTop, BorderTopStyle, BorderTopColor, BorderTopWidth,
|
|
|
|
BorderBottom, BorderBottomStyle, BorderBottomColor, BorderBottomWidth:
|
2024-11-13 12:56:39 +03:00
|
|
|
if border := getBorderProperty(properties, Border); border != nil && border.deleteTag(tag) {
|
|
|
|
return []PropertyName{Border}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
case CellBorderStyle, CellBorderColor, CellBorderWidth,
|
|
|
|
CellBorderLeft, CellBorderLeftStyle, CellBorderLeftColor, CellBorderLeftWidth,
|
|
|
|
CellBorderRight, CellBorderRightStyle, CellBorderRightColor, CellBorderRightWidth,
|
|
|
|
CellBorderTop, CellBorderTopStyle, CellBorderTopColor, CellBorderTopWidth,
|
|
|
|
CellBorderBottom, CellBorderBottomStyle, CellBorderBottomColor, CellBorderBottomWidth:
|
2024-11-13 12:56:39 +03:00
|
|
|
if border := getBorderProperty(properties, CellBorder); border != nil && border.deleteTag(tag) {
|
|
|
|
return []PropertyName{CellBorder}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case MarginTop, MarginRight, MarginBottom, MarginLeft:
|
|
|
|
return removeBoundsPropertySide(properties, Margin, tag)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case PaddingTop, PaddingRight, PaddingBottom, PaddingLeft:
|
|
|
|
return removeBoundsPropertySide(properties, Padding, tag)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case CellPaddingTop, CellPaddingRight, CellPaddingBottom, CellPaddingLeft:
|
2024-11-13 12:56:39 +03:00
|
|
|
return removeBoundsPropertySide(properties, CellPadding, tag)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case RadiusX, RadiusY, RadiusTopLeft, RadiusTopLeftX, RadiusTopLeftY,
|
|
|
|
RadiusTopRight, RadiusTopRightX, RadiusTopRightY,
|
|
|
|
RadiusBottomLeft, RadiusBottomLeftX, RadiusBottomLeftY,
|
|
|
|
RadiusBottomRight, RadiusBottomRightX, RadiusBottomRightY:
|
2024-11-13 12:56:39 +03:00
|
|
|
if removeRadiusPropertyElement(properties, tag) {
|
|
|
|
return []PropertyName{Radius, tag}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case OutlineStyle, OutlineWidth, OutlineColor:
|
2024-11-13 12:56:39 +03:00
|
|
|
if outline := getOutlineProperty(properties); outline != nil {
|
2021-09-07 17:36:50 +03:00
|
|
|
outline.Remove(tag)
|
2024-11-13 12:56:39 +03:00
|
|
|
if outline.empty() {
|
|
|
|
properties.setRaw(Outline, nil)
|
|
|
|
}
|
|
|
|
return []PropertyName{Outline, tag}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
2024-11-13 12:56:39 +03:00
|
|
|
return propertiesRemove(properties, tag)
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
return []PropertyName{}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
func viewStyleSet(style Properties, tag PropertyName, value any) []PropertyName {
|
2021-09-07 17:36:50 +03:00
|
|
|
switch tag {
|
|
|
|
case Shadow, TextShadow:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setShadowProperty(style, tag, value) {
|
|
|
|
return []PropertyName{tag}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case Background:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setBackgroundProperty(style, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case Border, CellBorder:
|
|
|
|
if border := newBorderProperty(value); border != nil {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, border)
|
|
|
|
return []PropertyName{tag}
|
|
|
|
} else {
|
|
|
|
return nil
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
case BorderStyle, BorderColor, BorderWidth,
|
|
|
|
BorderLeft, BorderLeftStyle, BorderLeftColor, BorderLeftWidth,
|
|
|
|
BorderRight, BorderRightStyle, BorderRightColor, BorderRightWidth,
|
|
|
|
BorderTop, BorderTopStyle, BorderTopColor, BorderTopWidth,
|
|
|
|
BorderBottom, BorderBottomStyle, BorderBottomColor, BorderBottomWidth:
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
return setBorderPropertyElement(style, Border, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case CellBorderStyle, CellBorderColor, CellBorderWidth,
|
|
|
|
CellBorderLeft, CellBorderLeftStyle, CellBorderLeftColor, CellBorderLeftWidth,
|
|
|
|
CellBorderRight, CellBorderRightStyle, CellBorderRightColor, CellBorderRightWidth,
|
|
|
|
CellBorderTop, CellBorderTopStyle, CellBorderTopColor, CellBorderTopWidth,
|
|
|
|
CellBorderBottom, CellBorderBottomStyle, CellBorderBottomColor, CellBorderBottomWidth:
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
return setBorderPropertyElement(style, CellBorder, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case Radius:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setRadiusProperty(style, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case RadiusX, RadiusY, RadiusTopLeft, RadiusTopLeftX, RadiusTopLeftY,
|
|
|
|
RadiusTopRight, RadiusTopRightX, RadiusTopRightY,
|
|
|
|
RadiusBottomLeft, RadiusBottomLeftX, RadiusBottomLeftY,
|
|
|
|
RadiusBottomRight, RadiusBottomRightX, RadiusBottomRightY:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setRadiusPropertyElement(style, tag, value) {
|
|
|
|
return []PropertyName{Radius, tag}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case Margin, Padding, CellPadding:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setBoundsProperty(style, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case MarginTop, MarginRight, MarginBottom, MarginLeft:
|
|
|
|
return setBoundsPropertySide(style, Margin, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case PaddingTop, PaddingRight, PaddingBottom, PaddingLeft:
|
|
|
|
return setBoundsPropertySide(style, Padding, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case CellPaddingTop, CellPaddingRight, CellPaddingBottom, CellPaddingLeft:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setBoundsPropertySide(style, CellPadding, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2023-05-04 16:45:03 +03:00
|
|
|
case HeadStyle, FootStyle:
|
|
|
|
switch value := value.(type) {
|
|
|
|
case string:
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, value)
|
2023-05-04 16:45:03 +03:00
|
|
|
|
|
|
|
case Params:
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, value)
|
2023-05-04 16:45:03 +03:00
|
|
|
|
|
|
|
case DataObject:
|
|
|
|
if params := value.ToParams(); len(params) > 0 {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, params)
|
|
|
|
} else {
|
|
|
|
style.setRaw(tag, nil)
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
|
|
|
|
default:
|
|
|
|
notCompatibleType(tag, value)
|
|
|
|
return nil
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return []PropertyName{tag}
|
2023-05-04 16:45:03 +03:00
|
|
|
|
|
|
|
case CellStyle, ColumnStyle, RowStyle:
|
|
|
|
switch value := value.(type) {
|
|
|
|
case string:
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, value)
|
2023-05-04 16:45:03 +03:00
|
|
|
|
|
|
|
case Params:
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, value)
|
2023-05-04 16:45:03 +03:00
|
|
|
|
|
|
|
case DataObject:
|
|
|
|
if params := value.ToParams(); len(params) > 0 {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, params)
|
|
|
|
} else {
|
|
|
|
style.setRaw(tag, nil)
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
case DataNode:
|
|
|
|
switch value.Type() {
|
|
|
|
case TextNode:
|
|
|
|
if text := value.Text(); text != "" {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, text)
|
|
|
|
} else {
|
|
|
|
style.setRaw(tag, nil)
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
case ObjectNode:
|
|
|
|
if obj := value.Object(); obj != nil {
|
|
|
|
if params := obj.ToParams(); len(params) > 0 {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(tag, params)
|
|
|
|
} else {
|
|
|
|
style.setRaw(tag, nil)
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
} else {
|
|
|
|
notCompatibleType(tag, value)
|
|
|
|
return nil
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
default:
|
|
|
|
notCompatibleType(tag, value)
|
|
|
|
return nil
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
|
|
|
|
default:
|
|
|
|
notCompatibleType(tag, value)
|
|
|
|
return nil
|
2023-05-04 16:45:03 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return []PropertyName{tag}
|
2023-05-04 16:45:03 +03:00
|
|
|
|
2021-09-07 17:36:50 +03:00
|
|
|
case Outline:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setOutlineProperty(style, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case OutlineStyle, OutlineWidth, OutlineColor:
|
2024-11-13 12:56:39 +03:00
|
|
|
if outline := getOutlineProperty(style); outline != nil {
|
|
|
|
if outline.Set(tag, value) {
|
|
|
|
return []PropertyName{Outline, tag}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
outline := NewOutlineProperty(nil)
|
|
|
|
if outline.Set(tag, value) {
|
|
|
|
style.setRaw(Outline, outline)
|
|
|
|
return []PropertyName{Outline, tag}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return nil
|
2021-09-07 17:36:50 +03:00
|
|
|
|
2024-11-24 09:52:43 +03:00
|
|
|
case Transform, PushTransform:
|
|
|
|
if setTransformProperty(style, tag, value) {
|
2024-11-18 17:35:21 +03:00
|
|
|
return []PropertyName{Transform}
|
2024-11-13 12:56:39 +03:00
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-13 13:52:47 +03:00
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
case Perspective, RotateX, RotateY, RotateZ, Rotate, SkewX, SkewY, ScaleX, ScaleY, ScaleZ,
|
2024-08-13 13:52:47 +03:00
|
|
|
TranslateX, TranslateY, TranslateZ:
|
* Added "push-perspective", "push-rotate-x", "push-rotate-y", "push-rotate-z", "push-rotate", "push-skew-x", "push-skew-y", "push-scale-x", "push-scale-y", "push-scale-z", "push-translate-x", "push-translate-y", "push-translate-z" properties.
2024-11-25 13:03:08 +03:00
|
|
|
return setTransformPropertyElement(style, tag, Transform, value)
|
|
|
|
|
|
|
|
case PushPerspective, PushRotateX, PushRotateY, PushRotateZ, PushRotate, PushSkewX, PushSkewY,
|
|
|
|
PushScaleX, PushScaleY, PushScaleZ, PushTranslateX, PushTranslateY, PushTranslateZ:
|
|
|
|
return setTransformPropertyElement(style, tag, PushTransform, value)
|
2024-08-13 13:52:47 +03:00
|
|
|
|
2021-09-07 17:36:50 +03:00
|
|
|
case Orientation:
|
|
|
|
if text, ok := value.(string); ok {
|
|
|
|
switch strings.ToLower(text) {
|
|
|
|
case "vertical":
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(Orientation, TopDownOrientation)
|
|
|
|
return []PropertyName{Orientation}
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case "horizontal":
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(Orientation, StartToEndOrientation)
|
|
|
|
return []PropertyName{Orientation}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
case TextWeight:
|
2024-11-13 12:56:39 +03:00
|
|
|
if n, ok := value.(int); ok {
|
|
|
|
if n >= 100 && n%100 == 0 {
|
|
|
|
n /= 100
|
|
|
|
if n > 0 && n <= 9 {
|
|
|
|
style.setRaw(TextWeight, n)
|
|
|
|
return []PropertyName{TextWeight}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
case Row, Column:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setRangeProperty(style, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case CellWidth, CellHeight:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setGridCellSize(style, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case ColumnSeparator:
|
|
|
|
if separator := newColumnSeparatorProperty(value); separator != nil {
|
2024-11-13 12:56:39 +03:00
|
|
|
style.setRaw(ColumnSeparator, separator)
|
|
|
|
return []PropertyName{tag}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return nil
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case ColumnSeparatorStyle, ColumnSeparatorWidth, ColumnSeparatorColor:
|
2024-11-13 12:56:39 +03:00
|
|
|
if separator := getColumnSeparatorProperty(style); separator != nil {
|
|
|
|
if separator.Set(tag, value) {
|
|
|
|
return []PropertyName{ColumnSeparator, tag}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
separator := newColumnSeparatorProperty(nil)
|
|
|
|
if separator.Set(tag, value) {
|
|
|
|
style.setRaw(ColumnSeparator, separator)
|
|
|
|
return []PropertyName{ColumnSeparator, tag}
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
2024-11-13 12:56:39 +03:00
|
|
|
return nil
|
2021-09-07 17:36:50 +03:00
|
|
|
|
|
|
|
case Clip, ShapeOutside:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setClipShapeProperty(style, tag, value)
|
2021-09-07 17:36:50 +03:00
|
|
|
|
Added some properties and functions
* Added "resize", "grid-auto-flow", "caret-color", and "backdrop-filter" properties
* Added BlurView, BlurViewByID, GetResize, GetGridAutoFlow, GetCaretColor, GetBackdropFilter functions
* The "warp" property for ListView and ListLayout renamed to "list-warp"
* The "warp" property for EditView renamed to "edit-warp"
* Added CertFile and KeyFile optional fields to the AppParams struct.If they are set, then an https connection is created, otherwise http.
2022-06-07 13:07:10 +03:00
|
|
|
case Filter, BackdropFilter:
|
2024-11-13 12:56:39 +03:00
|
|
|
return setFilterProperty(style, tag, value)
|
2021-10-04 17:58:17 +03:00
|
|
|
|
|
|
|
case Transition:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setTransitionProperty(style, value) {
|
|
|
|
return []PropertyName{tag}
|
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
2021-10-04 17:58:17 +03:00
|
|
|
|
|
|
|
case AnimationTag:
|
2024-11-13 12:56:39 +03:00
|
|
|
if setAnimationProperty(style, tag, value) {
|
|
|
|
return []PropertyName{tag}
|
|
|
|
} else {
|
|
|
|
return nil
|
|
|
|
}
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|
|
|
|
|
2024-11-13 12:56:39 +03:00
|
|
|
return propertiesSet(style, tag, value)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (style *viewStyle) Set(tag PropertyName, value any) bool {
|
|
|
|
if value == nil {
|
|
|
|
style.Remove(tag)
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return viewStyleSet(style, normalizeViewStyleTag(tag), value) != nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (style *viewStyle) Remove(tag PropertyName) {
|
|
|
|
viewStyleRemove(style, normalizeViewStyleTag(tag))
|
2021-09-07 17:36:50 +03:00
|
|
|
}
|