forked from mbk-lab/rui_orig
2
0
Fork 0

Renamed ColorPropery constant to ColorTag

This commit is contained in:
Alexei Anoshenko 2021-10-04 18:05:57 +03:00
parent be954df7c7
commit f64f6d2bca
8 changed files with 87 additions and 87 deletions

View File

@ -79,7 +79,7 @@ func newBorderProperty(value interface{}) BorderProperty {
case ViewBorder: case ViewBorder:
border.properties[Style] = value.Style border.properties[Style] = value.Style
border.properties[Width] = value.Width border.properties[Width] = value.Width
border.properties[ColorProperty] = value.Color border.properties[ColorTag] = value.Color
case ViewBorders: case ViewBorders:
if value.Left.Style == value.Right.Style && if value.Left.Style == value.Right.Style &&
@ -105,7 +105,7 @@ func newBorderProperty(value interface{}) BorderProperty {
if value.Left.Color == value.Right.Color && if value.Left.Color == value.Right.Color &&
value.Left.Color == value.Top.Color && value.Left.Color == value.Top.Color &&
value.Left.Color == value.Bottom.Color { value.Left.Color == value.Bottom.Color {
border.properties[ColorProperty] = value.Left.Color border.properties[ColorTag] = value.Left.Color
} else { } else {
border.properties[LeftColor] = value.Left.Color border.properties[LeftColor] = value.Left.Color
border.properties[RightColor] = value.Right.Color border.properties[RightColor] = value.Right.Color
@ -126,7 +126,7 @@ func NewBorder(params Params) BorderProperty {
border := new(borderProperty) border := new(borderProperty)
border.properties = map[string]interface{}{} border.properties = map[string]interface{}{}
if params != nil { if params != nil {
for _, tag := range []string{Style, Width, ColorProperty, Left, Right, Top, Bottom, for _, tag := range []string{Style, Width, ColorTag, Left, Right, Top, Bottom,
LeftStyle, RightStyle, TopStyle, BottomStyle, LeftStyle, RightStyle, TopStyle, BottomStyle,
LeftWidth, RightWidth, TopWidth, BottomWidth, LeftWidth, RightWidth, TopWidth, BottomWidth,
LeftColor, RightColor, TopColor, BottomColor} { LeftColor, RightColor, TopColor, BottomColor} {
@ -184,7 +184,7 @@ func (border *borderProperty) normalizeTag(tag string) string {
return BottomWidth return BottomWidth
case BorderColor, CellBorderColor: case BorderColor, CellBorderColor:
return ColorProperty return ColorTag
case BorderLeftColor, CellBorderLeftColor, "color-left": case BorderLeftColor, CellBorderLeftColor, "color-left":
return LeftColor return LeftColor
@ -205,7 +205,7 @@ func (border *borderProperty) normalizeTag(tag string) string {
func (border *borderProperty) ruiString(writer ruiWriter) { func (border *borderProperty) ruiString(writer ruiWriter) {
writer.startObject("_") writer.startObject("_")
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if value, ok := border.properties[tag]; ok { if value, ok := border.properties[tag]; ok {
writer.writeProperty(Style, value) writer.writeProperty(Style, value)
} }
@ -214,7 +214,7 @@ func (border *borderProperty) ruiString(writer ruiWriter) {
for _, side := range []string{Top, Right, Bottom, Left} { for _, side := range []string{Top, Right, Bottom, Left} {
style, okStyle := border.properties[side+"-"+Style] style, okStyle := border.properties[side+"-"+Style]
width, okWidth := border.properties[side+"-"+Width] width, okWidth := border.properties[side+"-"+Width]
color, okColor := border.properties[side+"-"+ColorProperty] color, okColor := border.properties[side+"-"+ColorTag]
if okStyle || okWidth || okColor { if okStyle || okWidth || okColor {
writer.startObjectProperty(side, "_") writer.startObjectProperty(side, "_")
if okStyle { if okStyle {
@ -224,7 +224,7 @@ func (border *borderProperty) ruiString(writer ruiWriter) {
writer.writeProperty(Width, width) writer.writeProperty(Width, width)
} }
if okColor { if okColor {
writer.writeProperty(ColorProperty, color) writer.writeProperty(ColorTag, color)
} }
writer.endObject() writer.endObject()
} }
@ -246,7 +246,7 @@ func (border *borderProperty) setSingleBorderObject(prefix string, obj DataObjec
result = false result = false
} }
} }
if text, ok := obj.PropertyValue(ColorProperty); ok { if text, ok := obj.PropertyValue(ColorTag); ok {
if !border.setColorProperty(prefix+"-color", text) { if !border.setColorProperty(prefix+"-color", text) {
result = false result = false
} }
@ -297,11 +297,11 @@ func (border *borderProperty) setBorderObject(obj DataObject) bool {
} }
} }
if text, ok := obj.PropertyValue(ColorProperty); ok { if text, ok := obj.PropertyValue(ColorTag); ok {
values := split4Values(text) values := split4Values(text)
switch len(values) { switch len(values) {
case 1: case 1:
if !border.setColorProperty(ColorProperty, values[0]) { if !border.setColorProperty(ColorTag, values[0]) {
return false return false
} }
@ -313,7 +313,7 @@ func (border *borderProperty) setBorderObject(obj DataObject) bool {
} }
default: default:
notCompatibleType(ColorProperty, text) notCompatibleType(ColorTag, text)
result = false result = false
} }
} }
@ -356,7 +356,7 @@ func (border *borderProperty) Remove(tag string) {
delete(border.properties, t) delete(border.properties, t)
} }
case ColorProperty: case ColorTag:
for _, t := range []string{tag, TopColor, RightColor, BottomColor, LeftColor} { for _, t := range []string{tag, TopColor, RightColor, BottomColor, LeftColor} {
delete(border.properties, t) delete(border.properties, t)
} }
@ -392,7 +392,7 @@ func (border *borderProperty) Remove(tag string) {
case LeftColor, RightColor, TopColor, BottomColor: case LeftColor, RightColor, TopColor, BottomColor:
delete(border.properties, tag) delete(border.properties, tag)
if color, ok := border.properties[ColorProperty]; ok && color != nil { if color, ok := border.properties[ColorTag]; ok && color != nil {
for _, t := range []string{TopColor, RightColor, BottomColor, LeftColor} { for _, t := range []string{TopColor, RightColor, BottomColor, LeftColor} {
if t != tag { if t != tag {
if _, ok := border.properties[t]; !ok { if _, ok := border.properties[t]; !ok {
@ -432,8 +432,8 @@ func (border *borderProperty) Set(tag string, value interface{}) bool {
return true return true
} }
case ColorProperty: case ColorTag:
if border.setColorProperty(ColorProperty, value) { if border.setColorProperty(ColorTag, value) {
for _, side := range []string{TopColor, RightColor, BottomColor, LeftColor} { for _, side := range []string{TopColor, RightColor, BottomColor, LeftColor} {
delete(border.properties, side) delete(border.properties, side)
} }
@ -464,7 +464,7 @@ func (border *borderProperty) Set(tag string, value interface{}) bool {
if style := value.Get(styleTag); value != nil { if style := value.Get(styleTag); value != nil {
border.properties[styleTag] = style border.properties[styleTag] = style
} }
colorTag := tag + "-" + ColorProperty colorTag := tag + "-" + ColorTag
if color := value.Get(colorTag); value != nil { if color := value.Get(colorTag); value != nil {
border.properties[colorTag] = color border.properties[colorTag] = color
} }
@ -477,7 +477,7 @@ func (border *borderProperty) Set(tag string, value interface{}) bool {
case ViewBorder: case ViewBorder:
border.properties[tag+"-"+Style] = value.Style border.properties[tag+"-"+Style] = value.Style
border.properties[tag+"-"+Width] = value.Width border.properties[tag+"-"+Width] = value.Width
border.properties[tag+"-"+ColorProperty] = value.Color border.properties[tag+"-"+ColorTag] = value.Color
return true return true
} }
fallthrough fallthrough
@ -509,10 +509,10 @@ func (border *borderProperty) Get(tag string) interface{} {
} else if width, ok := border.properties[Width]; ok { } else if width, ok := border.properties[Width]; ok {
result.Set(Width, width) result.Set(Width, width)
} }
if color, ok := border.properties[tag+"-"+ColorProperty]; ok { if color, ok := border.properties[tag+"-"+ColorTag]; ok {
result.Set(ColorProperty, color) result.Set(ColorTag, color)
} else if color, ok := border.properties[ColorProperty]; ok { } else if color, ok := border.properties[ColorTag]; ok {
result.Set(ColorProperty, color) result.Set(ColorTag, color)
} }
return result return result
@ -532,7 +532,7 @@ func (border *borderProperty) Get(tag string) interface{} {
if color, ok := border.properties[tag]; ok { if color, ok := border.properties[tag]; ok {
return color return color
} }
return border.properties[ColorProperty] return border.properties[ColorTag]
} }
return nil return nil
@ -549,15 +549,15 @@ func (border *borderProperty) delete(tag string) {
case Width: case Width:
remove = []string{Width, LeftWidth, RightWidth, TopWidth, BottomWidth} remove = []string{Width, LeftWidth, RightWidth, TopWidth, BottomWidth}
case ColorProperty: case ColorTag:
remove = []string{ColorProperty, LeftColor, RightColor, TopColor, BottomColor} remove = []string{ColorTag, LeftColor, RightColor, TopColor, BottomColor}
case Left, Right, Top, Bottom: case Left, Right, Top, Bottom:
if border.Get(Style) != nil { if border.Get(Style) != nil {
border.properties[tag+"-"+Style] = 0 border.properties[tag+"-"+Style] = 0
remove = []string{tag + "-" + ColorProperty, tag + "-" + Width} remove = []string{tag + "-" + ColorTag, tag + "-" + Width}
} else { } else {
remove = []string{tag + "-" + Style, tag + "-" + ColorProperty, tag + "-" + Width} remove = []string{tag + "-" + Style, tag + "-" + ColorTag, tag + "-" + Width}
} }
case LeftStyle, RightStyle, TopStyle, BottomStyle: case LeftStyle, RightStyle, TopStyle, BottomStyle:
@ -575,7 +575,7 @@ func (border *borderProperty) delete(tag string) {
} }
case LeftColor, RightColor, TopColor, BottomColor: case LeftColor, RightColor, TopColor, BottomColor:
if border.Get(ColorProperty) != nil { if border.Get(ColorTag) != nil {
border.properties[tag] = 0 border.properties[tag] = 0
} else { } else {
remove = []string{tag} remove = []string{tag}
@ -591,7 +591,7 @@ func (border *borderProperty) ViewBorders(session Session) ViewBorders {
defStyle, _ := valueToEnum(border.getRaw(Style), BorderStyle, session, NoneLine) defStyle, _ := valueToEnum(border.getRaw(Style), BorderStyle, session, NoneLine)
defWidth, _ := sizeProperty(border, Width, session) defWidth, _ := sizeProperty(border, Width, session)
defColor, _ := colorProperty(border, ColorProperty, session) defColor, _ := colorProperty(border, ColorTag, session)
getBorder := func(prefix string) ViewBorder { getBorder := func(prefix string) ViewBorder {
var result ViewBorder var result ViewBorder
@ -602,7 +602,7 @@ func (border *borderProperty) ViewBorders(session Session) ViewBorders {
if result.Width, ok = sizeProperty(border, prefix+Width, session); !ok { if result.Width, ok = sizeProperty(border, prefix+Width, session); !ok {
result.Width = defWidth result.Width = defWidth
} }
if result.Color, ok = colorProperty(border, prefix+ColorProperty, session); !ok { if result.Color, ok = colorProperty(border, prefix+ColorTag, session); !ok {
result.Color = defColor result.Color = defColor
} }
return result return result

View File

@ -42,7 +42,7 @@ func (picker *colorPickerData) Init(session Session) {
func (picker *colorPickerData) normalizeTag(tag string) string { func (picker *colorPickerData) normalizeTag(tag string) string {
tag = strings.ToLower(tag) tag = strings.ToLower(tag)
switch tag { switch tag {
case Value, ColorProperty: case Value, ColorTag:
return ColorPickerValue return ColorPickerValue
} }
@ -224,7 +224,7 @@ func GetColorPickerValue(view View, subviewID string) Color {
if result, ok := colorStyledProperty(view, ColorPickerValue); ok { if result, ok := colorStyledProperty(view, ColorPickerValue); ok {
return result return result
} }
for _, tag := range []string{Value, ColorProperty} { for _, tag := range []string{Value, ColorTag} {
if value, ok := valueFromStyle(view, tag); ok { if value, ok := valueFromStyle(view, tag); ok {
if result, ok := valueToColor(value, view.Session()); ok { if result, ok := valueToColor(value, view.Session()); ok {
return result return result

View File

@ -33,7 +33,7 @@ func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
case DataObject: case DataObject:
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.properties = map[string]interface{}{} separator.properties = map[string]interface{}{}
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if val, ok := value.PropertyValue(tag); ok && val != "" { if val, ok := value.PropertyValue(tag); ok && val != "" {
separator.set(tag, value) separator.set(tag, value)
} }
@ -43,9 +43,9 @@ func newColumnSeparatorProperty(value interface{}) ColumnSeparatorProperty {
case ViewBorder: case ViewBorder:
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.properties = map[string]interface{}{ separator.properties = map[string]interface{}{
Style: value.Style, Style: value.Style,
Width: value.Width, Width: value.Width,
ColorProperty: value.Color, ColorTag: value.Color,
} }
return separator return separator
} }
@ -59,7 +59,7 @@ func NewColumnSeparator(params Params) ColumnSeparatorProperty {
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.properties = map[string]interface{}{} separator.properties = map[string]interface{}{}
if params != nil { if params != nil {
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if value, ok := params[tag]; ok && value != nil { if value, ok := params[tag]; ok && value != nil {
separator.Set(tag, value) separator.Set(tag, value)
} }
@ -78,7 +78,7 @@ func (separator *columnSeparatorProperty) normalizeTag(tag string) string {
return Width return Width
case ColumnSeparatorColor, "separator-color": case ColumnSeparatorColor, "separator-color":
return ColorProperty return ColorTag
} }
return tag return tag
@ -86,7 +86,7 @@ func (separator *columnSeparatorProperty) normalizeTag(tag string) string {
func (separator *columnSeparatorProperty) ruiString(writer ruiWriter) { func (separator *columnSeparatorProperty) ruiString(writer ruiWriter) {
writer.startObject("_") writer.startObject("_")
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if value, ok := separator.properties[tag]; ok { if value, ok := separator.properties[tag]; ok {
writer.writeProperty(Style, value) writer.writeProperty(Style, value)
} }
@ -103,7 +103,7 @@ func (separator *columnSeparatorProperty) String() string {
func (separator *columnSeparatorProperty) Remove(tag string) { func (separator *columnSeparatorProperty) Remove(tag string) {
switch tag = separator.normalizeTag(tag); tag { switch tag = separator.normalizeTag(tag); tag {
case Style, Width, ColorProperty: case Style, Width, ColorTag:
delete(separator.properties, tag) delete(separator.properties, tag)
default: default:
@ -126,8 +126,8 @@ func (separator *columnSeparatorProperty) Set(tag string, value interface{}) boo
case Width: case Width:
return separator.setSizeProperty(Width, value) return separator.setSizeProperty(Width, value)
case ColorProperty: case ColorTag:
return separator.setColorProperty(ColorProperty, value) return separator.setColorProperty(ColorTag, value)
} }
ErrorLogF(`"%s" property is not compatible with the ColumnSeparatorProperty`, tag) ErrorLogF(`"%s" property is not compatible with the ColumnSeparatorProperty`, tag)
@ -147,7 +147,7 @@ func (separator *columnSeparatorProperty) Get(tag string) interface{} {
func (separator *columnSeparatorProperty) ViewBorder(session Session) ViewBorder { func (separator *columnSeparatorProperty) ViewBorder(session Session) ViewBorder {
style, _ := valueToEnum(separator.getRaw(Style), BorderStyle, session, NoneLine) style, _ := valueToEnum(separator.getRaw(Style), BorderStyle, session, NoneLine)
width, _ := sizeProperty(separator, Width, session) width, _ := sizeProperty(separator, Width, session)
color, _ := colorProperty(separator, ColorProperty, session) color, _ := colorProperty(separator, ColorTag, session)
return ViewBorder{ return ViewBorder{
Style: style, Style: style,

View File

@ -100,17 +100,17 @@ func createColumnLayoutDemo(session rui.Session) rui.View {
case 2: case 2:
rui.Set(view, "columnLayout", rui.ColumnSeparator, rui.Set(view, "columnLayout", rui.ColumnSeparator,
rui.NewColumnSeparator(rui.Params{ rui.NewColumnSeparator(rui.Params{
rui.Width: rui.Px(2), rui.Width: rui.Px(2),
rui.Style: rui.DottedLine, rui.Style: rui.DottedLine,
rui.ColorProperty: rui.Red, rui.ColorTag: rui.Red,
})) }))
case 3: case 3:
rui.Set(view, "columnLayout", rui.ColumnSeparator, rui.Set(view, "columnLayout", rui.ColumnSeparator,
rui.NewColumnSeparator(rui.Params{ rui.NewColumnSeparator(rui.Params{
rui.Width: rui.Px(3), rui.Width: rui.Px(3),
rui.Style: rui.DashedLine, rui.Style: rui.DashedLine,
rui.ColorProperty: rui.Blue, rui.ColorTag: rui.Blue,
})) }))
case 4: case 4:

View File

@ -73,9 +73,9 @@ func createTableViewDemo(session rui.Session) rui.View {
switch number { switch number {
case 1: case 1:
rui.Set(view, "demoTableView1", borderTag, rui.NewBorder(rui.Params{ rui.Set(view, "demoTableView1", borderTag, rui.NewBorder(rui.Params{
rui.Style: rui.SolidLine, rui.Style: rui.SolidLine,
rui.ColorProperty: rui.Black, rui.ColorTag: rui.Black,
rui.Width: rui.Px(1), rui.Width: rui.Px(1),
})) }))
case 2: case 2:
@ -117,9 +117,9 @@ func createTableViewDemo(session rui.Session) rui.View {
case 2: case 2:
rui.Set(view, "demoTableView1", rui.HeadStyle, rui.Params{ rui.Set(view, "demoTableView1", rui.HeadStyle, rui.Params{
rui.CellBorder: rui.NewBorder(rui.Params{ rui.CellBorder: rui.NewBorder(rui.Params{
rui.Style: rui.SolidLine, rui.Style: rui.SolidLine,
rui.ColorProperty: rui.Green, rui.ColorTag: rui.Green,
rui.Width: "2px", rui.Width: "2px",
}), }),
rui.CellPadding: "8px", rui.CellPadding: "8px",
rui.BackgroundColor: rui.LightGrey, rui.BackgroundColor: rui.LightGrey,
@ -138,9 +138,9 @@ func createTableViewDemo(session rui.Session) rui.View {
case 2: case 2:
rui.Set(view, "demoTableView1", rui.FootStyle, rui.Params{ rui.Set(view, "demoTableView1", rui.FootStyle, rui.Params{
rui.Border: rui.NewBorder(rui.Params{ rui.Border: rui.NewBorder(rui.Params{
rui.Style: rui.SolidLine, rui.Style: rui.SolidLine,
rui.ColorProperty: rui.Black, rui.ColorTag: rui.Black,
rui.Width: "2px", rui.Width: "2px",
}), }),
rui.CellPadding: "4px", rui.CellPadding: "4px",
rui.BackgroundColor: rui.LightYellow, rui.BackgroundColor: rui.LightYellow,

View File

@ -28,7 +28,7 @@ func NewOutlineProperty(params Params) OutlineProperty {
func (outline *outlinePropertyData) ruiString(writer ruiWriter) { func (outline *outlinePropertyData) ruiString(writer ruiWriter) {
writer.startObject("_") writer.startObject("_")
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if value, ok := outline.properties[tag]; ok { if value, ok := outline.properties[tag]; ok {
writer.writeProperty(Style, value) writer.writeProperty(Style, value)
} }
@ -72,8 +72,8 @@ func (outline *outlinePropertyData) Set(tag string, value interface{}) bool {
} }
return outline.setSizeProperty(Width, value) return outline.setSizeProperty(Width, value)
case ColorProperty: case ColorTag:
return outline.setColorProperty(ColorProperty, value) return outline.setColorProperty(ColorTag, value)
default: default:
ErrorLogF(`"%s" property is not compatible with the OutlineProperty`, tag) ErrorLogF(`"%s" property is not compatible with the OutlineProperty`, tag)
@ -88,7 +88,7 @@ func (outline *outlinePropertyData) Get(tag string) interface{} {
func (outline *outlinePropertyData) ViewOutline(session Session) ViewOutline { func (outline *outlinePropertyData) ViewOutline(session Session) ViewOutline {
style, _ := valueToEnum(outline.getRaw(Style), BorderStyle, session, NoneLine) style, _ := valueToEnum(outline.getRaw(Style), BorderStyle, session, NoneLine)
width, _ := sizeProperty(outline, Width, session) width, _ := sizeProperty(outline, Width, session)
color, _ := colorProperty(outline, ColorProperty, session) color, _ := colorProperty(outline, ColorTag, session)
return ViewOutline{Style: style, Width: width, Color: color} return ViewOutline{Style: style, Width: width, Color: color}
} }
@ -130,14 +130,14 @@ func (style *viewStyle) setOutline(value interface{}) bool {
style.properties[Outline] = value style.properties[Outline] = value
case ViewOutline: case ViewOutline:
style.properties[Outline] = NewOutlineProperty(Params{Style: value.Style, Width: value.Width, ColorProperty: value.Color}) style.properties[Outline] = NewOutlineProperty(Params{Style: value.Style, Width: value.Width, ColorTag: value.Color})
case ViewBorder: case ViewBorder:
style.properties[Outline] = NewOutlineProperty(Params{Style: value.Style, Width: value.Width, ColorProperty: value.Color}) style.properties[Outline] = NewOutlineProperty(Params{Style: value.Style, Width: value.Width, ColorTag: value.Color})
case DataObject: case DataObject:
outline := NewOutlineProperty(nil) outline := NewOutlineProperty(nil)
for _, tag := range []string{Style, Width, ColorProperty} { for _, tag := range []string{Style, Width, ColorTag} {
if text, ok := value.PropertyValue(tag); ok && text != "" { if text, ok := value.PropertyValue(tag); ok && text != "" {
outline.Set(tag, text) outline.Set(tag, text)
} }

View File

@ -7,7 +7,7 @@ import (
) )
var colorProperties = []string{ var colorProperties = []string{
ColorProperty, ColorTag,
BackgroundColor, BackgroundColor,
TextColor, TextColor,
BorderColor, BorderColor,

View File

@ -6,8 +6,8 @@ import (
) )
const ( const (
// ColorProperty is the name of the color property of the shadow. // ColorTag is the name of the color property of the shadow.
ColorProperty = "color" ColorTag = "color"
// Inset is the name of bool property of the shadow. If it is set to "false" (default) then the shadow // Inset is the name of bool property of the shadow. If it is set to "false" (default) then the shadow
// is assumed to be a drop shadow (as if the box were raised above the content). // is assumed to be a drop shadow (as if the box were raised above the content).
// If it is set to "true" then the shadow to one inside the frame (as if the content was depressed inside the box). // If it is set to "true" then the shadow to one inside the frame (as if the content was depressed inside the box).
@ -48,11 +48,11 @@ type viewShadowData struct {
// color - the color of the shadow // color - the color of the shadow
func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow { func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, XOffset: offsetX,
YOffset: offsetY, YOffset: offsetY,
BlurRadius: blurRadius, BlurRadius: blurRadius,
SpreadRadius: spreadRadius, SpreadRadius: spreadRadius,
ColorProperty: color, ColorTag: color,
}) })
} }
@ -63,12 +63,12 @@ func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Co
// color - the color of the shadow // color - the color of the shadow
func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow { func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, XOffset: offsetX,
YOffset: offsetY, YOffset: offsetY,
BlurRadius: blurRadius, BlurRadius: blurRadius,
SpreadRadius: spreadRadius, SpreadRadius: spreadRadius,
ColorProperty: color, ColorTag: color,
Inset: true, Inset: true,
}) })
} }
@ -78,10 +78,10 @@ func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, col
// color - the color of the shadow // color - the color of the shadow
func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShadow { func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, XOffset: offsetX,
YOffset: offsetY, YOffset: offsetY,
BlurRadius: blurRadius, BlurRadius: blurRadius,
ColorProperty: color, ColorTag: color,
}) })
} }
@ -90,7 +90,7 @@ func NewShadowWithParams(params Params) ViewShadow {
shadow := new(viewShadowData) shadow := new(viewShadowData)
shadow.propertyList.init() shadow.propertyList.init()
if params != nil { if params != nil {
for _, tag := range []string{ColorProperty, Inset, XOffset, YOffset, BlurRadius, SpreadRadius} { for _, tag := range []string{ColorTag, Inset, XOffset, YOffset, BlurRadius, SpreadRadius} {
if value, ok := params[tag]; ok && value != nil { if value, ok := params[tag]; ok && value != nil {
shadow.Set(tag, value) shadow.Set(tag, value)
} }
@ -119,7 +119,7 @@ func (shadow *viewShadowData) Set(tag string, value interface{}) bool {
tag = strings.ToLower(tag) tag = strings.ToLower(tag)
switch tag { switch tag {
case ColorProperty, Inset, XOffset, YOffset, BlurRadius, SpreadRadius: case ColorTag, Inset, XOffset, YOffset, BlurRadius, SpreadRadius:
return shadow.propertyList.Set(tag, value) return shadow.propertyList.Set(tag, value)
} }
@ -132,7 +132,7 @@ func (shadow *viewShadowData) Get(tag string) interface{} {
} }
func (shadow *viewShadowData) cssStyle(buffer *strings.Builder, session Session, lead string) bool { func (shadow *viewShadowData) cssStyle(buffer *strings.Builder, session Session, lead string) bool {
color, _ := colorProperty(shadow, ColorProperty, session) color, _ := colorProperty(shadow, ColorTag, session)
offsetX, _ := sizeProperty(shadow, XOffset, session) offsetX, _ := sizeProperty(shadow, XOffset, session)
offsetY, _ := sizeProperty(shadow, YOffset, session) offsetY, _ := sizeProperty(shadow, YOffset, session)
blurRadius, _ := sizeProperty(shadow, BlurRadius, session) blurRadius, _ := sizeProperty(shadow, BlurRadius, session)
@ -164,7 +164,7 @@ func (shadow *viewShadowData) cssStyle(buffer *strings.Builder, session Session,
} }
func (shadow *viewShadowData) cssTextStyle(buffer *strings.Builder, session Session, lead string) bool { func (shadow *viewShadowData) cssTextStyle(buffer *strings.Builder, session Session, lead string) bool {
color, _ := colorProperty(shadow, ColorProperty, session) color, _ := colorProperty(shadow, ColorTag, session)
offsetX, _ := sizeProperty(shadow, XOffset, session) offsetX, _ := sizeProperty(shadow, XOffset, session)
offsetY, _ := sizeProperty(shadow, YOffset, session) offsetY, _ := sizeProperty(shadow, YOffset, session)
blurRadius, _ := sizeProperty(shadow, BlurRadius, session) blurRadius, _ := sizeProperty(shadow, BlurRadius, session)
@ -188,7 +188,7 @@ func (shadow *viewShadowData) cssTextStyle(buffer *strings.Builder, session Sess
} }
func (shadow *viewShadowData) visible(session Session) bool { func (shadow *viewShadowData) visible(session Session) bool {
color, _ := colorProperty(shadow, ColorProperty, session) color, _ := colorProperty(shadow, ColorTag, session)
offsetX, _ := sizeProperty(shadow, XOffset, session) offsetX, _ := sizeProperty(shadow, XOffset, session)
offsetY, _ := sizeProperty(shadow, YOffset, session) offsetY, _ := sizeProperty(shadow, YOffset, session)
blurRadius, _ := sizeProperty(shadow, BlurRadius, session) blurRadius, _ := sizeProperty(shadow, BlurRadius, session)