mirror of https://github.com/anoshenko/rui.git
Renamed ViewFilter interface -> FilterProperty
This commit is contained in:
parent
ec796b3697
commit
1a60488537
|
@ -24,6 +24,8 @@
|
||||||
EllipseClip function -> NewEllipseClip
|
EllipseClip function -> NewEllipseClip
|
||||||
PolygonClip function -> NewPolygonClip
|
PolygonClip function -> NewPolygonClip
|
||||||
PolygonPointsClip function -> NewPolygonPointsClip
|
PolygonPointsClip function -> NewPolygonPointsClip
|
||||||
|
ViewFilter interface -> FilterProperty
|
||||||
|
NewViewFilter function -> NewFilterProperty
|
||||||
|
|
||||||
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
|
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
|
||||||
NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation,
|
NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation,
|
||||||
|
|
|
@ -1435,10 +1435,10 @@ radius необходимо передать nil
|
||||||
Свойство "filter" (константа Filter) применяет ко View такие графические эффекты, как размытие, смещение цвета, изменение яркости/контрастности и т.п.
|
Свойство "filter" (константа Filter) применяет ко View такие графические эффекты, как размытие, смещение цвета, изменение яркости/контрастности и т.п.
|
||||||
Свойства "backdrop-filter" (константа BackdropFilter) применяет такие же эффекты но к содержимому располагающемся ниже View.
|
Свойства "backdrop-filter" (константа BackdropFilter) применяет такие же эффекты но к содержимому располагающемся ниже View.
|
||||||
|
|
||||||
В качестве значения свойств "filter" и "backdrop-filter" используется только интерфейс ViewFilter. ViewFilter создается с помощью
|
В качестве значения свойств "filter" и "backdrop-filter" используется только интерфейс FilterProperty. FilterProperty создается с помощью
|
||||||
функции
|
функции
|
||||||
|
|
||||||
func NewViewFilter(params Params) ViewFilter
|
func NewFilterProperty(params Params) FilterProperty
|
||||||
|
|
||||||
В аргументе перечисляются применяемые эффекты. Возможны следующие эффекты:
|
В аргументе перечисляются применяемые эффекты. Возможны следующие эффекты:
|
||||||
|
|
||||||
|
@ -1457,8 +1457,8 @@ radius необходимо передать nil
|
||||||
|
|
||||||
Получить значение текущего фильтра можно с помощью функций
|
Получить значение текущего фильтра можно с помощью функций
|
||||||
|
|
||||||
func GetFilter(view View, subviewID ...string) ViewFilter
|
func GetFilter(view View, subviewID ...string) FilterProperty
|
||||||
func GetBackdropFilter(view View, subviewID ...string) ViewFilter
|
func GetBackdropFilter(view View, subviewID ...string) FilterProperty
|
||||||
|
|
||||||
### Свойство "semantics"
|
### Свойство "semantics"
|
||||||
|
|
||||||
|
|
10
README.md
10
README.md
|
@ -1413,10 +1413,10 @@ You can get the value of this property using the function
|
||||||
The "filter" property (Filter constant) applies graphical effects to the View, such as blurring, color shifting, changing brightness/contrast, etc.
|
The "filter" property (Filter constant) applies graphical effects to the View, such as blurring, color shifting, changing brightness/contrast, etc.
|
||||||
The "backdrop-filter" property (BackdropFilter constant) applies the same effects but to the area behind a View.
|
The "backdrop-filter" property (BackdropFilter constant) applies the same effects but to the area behind a View.
|
||||||
|
|
||||||
Only the ViewFilter interface is used as the value of the "filter" properties.
|
Only the FilterProperty interface is used as the value of the "filter" properties.
|
||||||
ViewFilter is created using the function
|
FilterProperty is created using the function
|
||||||
|
|
||||||
func NewViewFilter(params Params) ViewFilter
|
func NewFilterProperty(params Params) FilterProperty
|
||||||
|
|
||||||
The argument lists the effects to apply. The following effects are possible:
|
The argument lists the effects to apply. The following effects are possible:
|
||||||
|
|
||||||
|
@ -1442,8 +1442,8 @@ Example
|
||||||
|
|
||||||
You can get the value of the current filter using functions
|
You can get the value of the current filter using functions
|
||||||
|
|
||||||
func GetFilter(view View, subviewID ...string) ViewFilter
|
func GetFilter(view View, subviewID ...string) FilterProperty
|
||||||
func GetBackdropFilter(view View, subviewID ...string) ViewFilter
|
func GetBackdropFilter(view View, subviewID ...string) FilterProperty
|
||||||
|
|
||||||
### "semantics" property
|
### "semantics" property
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Constants for [ViewFilter] specific properties and events
|
// Constants for [FilterProperty] specific properties and events
|
||||||
const (
|
const (
|
||||||
// Blur is the constant for "blur" property tag.
|
// Blur is the constant for "blur" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Applies a Gaussian blur. The value of radius defines the value of the standard deviation to the Gaussian function, or
|
// Applies a Gaussian blur. The value of radius defines the value of the standard deviation to the Gaussian function, or
|
||||||
// how many pixels on the screen blend into each other, so a larger value will create more blur. The lacuna value for
|
// how many pixels on the screen blend into each other, so a larger value will create more blur. The lacuna value for
|
||||||
// interpolation is 0. The parameter is specified as a length in pixels.
|
// interpolation is 0. The parameter is specified as a length in pixels.
|
||||||
|
@ -21,7 +21,7 @@ const (
|
||||||
|
|
||||||
// Brightness is the constant for "brightness" property tag.
|
// Brightness is the constant for "brightness" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Applies a linear multiplier to input image, making it appear more or less bright. A value of 0% will create an image
|
// Applies a linear multiplier to input image, making it appear more or less bright. A value of 0% will create an image
|
||||||
// that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the
|
// that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the
|
||||||
// effect. Values of an amount over 100% are allowed, providing brighter results.
|
// effect. Values of an amount over 100% are allowed, providing brighter results.
|
||||||
|
@ -33,7 +33,7 @@ const (
|
||||||
|
|
||||||
// Contrast is the constant for "contrast" property tag.
|
// Contrast is the constant for "contrast" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Adjusts the contrast of the input. A value of 0% will create an image that is completely black. A value of 100% leaves
|
// Adjusts the contrast of the input. A value of 0% will create an image that is completely black. A value of 100% leaves
|
||||||
// the input unchanged. Values of amount over 100% are allowed, providing results with less contrast.
|
// the input unchanged. Values of amount over 100% are allowed, providing results with less contrast.
|
||||||
//
|
//
|
||||||
|
@ -44,7 +44,7 @@ const (
|
||||||
|
|
||||||
// DropShadow is the constant for "drop-shadow" property tag.
|
// DropShadow is the constant for "drop-shadow" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input
|
// Applies a drop shadow effect to the input image. A drop shadow is effectively a blurred, offset version of the input
|
||||||
// image's alpha mask drawn in a particular color, composited below the image. Shadow parameters are set using the
|
// image's alpha mask drawn in a particular color, composited below the image. Shadow parameters are set using the
|
||||||
// ShadowProperty interface.
|
// ShadowProperty interface.
|
||||||
|
@ -62,7 +62,7 @@ const (
|
||||||
|
|
||||||
// Grayscale is the constant for "grayscale" property tag.
|
// Grayscale is the constant for "grayscale" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Converts the input image to grayscale. The value of ‘amount’ defines the proportion of the conversion. A value of 100%
|
// Converts the input image to grayscale. The value of ‘amount’ defines the proportion of the conversion. A value of 100%
|
||||||
// is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
|
// is completely grayscale. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
|
||||||
// the effect.
|
// the effect.
|
||||||
|
@ -74,7 +74,7 @@ const (
|
||||||
|
|
||||||
// HueRotate is the constant for "hue-rotate" property tag.
|
// HueRotate is the constant for "hue-rotate" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Applies a hue rotation on the input image. The value of ‘angle’ defines the number of degrees around the color circle
|
// Applies a hue rotation on the input image. The value of ‘angle’ defines the number of degrees around the color circle
|
||||||
// the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the ‘angle’ parameter is missing, a
|
// the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the ‘angle’ parameter is missing, a
|
||||||
// value of 0deg is used. Though there is no maximum value, the effect of values above 360deg wraps around.
|
// value of 0deg is used. Though there is no maximum value, the effect of values above 360deg wraps around.
|
||||||
|
@ -93,7 +93,7 @@ const (
|
||||||
|
|
||||||
// Invert is the constant for "invert" property tag.
|
// Invert is the constant for "invert" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Inverts the samples in the input image. The value of ‘amount’ defines the proportion of the conversion. A value of 100%
|
// Inverts the samples in the input image. The value of ‘amount’ defines the proportion of the conversion. A value of 100%
|
||||||
// is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
|
// is completely inverted. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on
|
||||||
// the effect.
|
// the effect.
|
||||||
|
@ -105,7 +105,7 @@ const (
|
||||||
|
|
||||||
// Saturate is the constant for "saturate" property tag.
|
// Saturate is the constant for "saturate" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Saturates the input image. The value of ‘amount’ defines the proportion of the conversion. A value of 0% is completely
|
// Saturates the input image. The value of ‘amount’ defines the proportion of the conversion. A value of 0% is completely
|
||||||
// un-saturated. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of
|
// un-saturated. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of
|
||||||
// amount over 100% are allowed, providing super-saturated results.
|
// amount over 100% are allowed, providing super-saturated results.
|
||||||
|
@ -117,7 +117,7 @@ const (
|
||||||
|
|
||||||
// Sepia is the constant for "sepia" property tag.
|
// Sepia is the constant for "sepia" property tag.
|
||||||
//
|
//
|
||||||
// Used by ViewFilter.
|
// Used by FilterProperty.
|
||||||
// Converts the input image to sepia. The value of ‘amount’ defines the proportion of the conversion. A value of 100% is
|
// Converts the input image to sepia. The value of ‘amount’ defines the proportion of the conversion. A value of 100% is
|
||||||
// completely sepia. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the
|
// completely sepia. A value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the
|
||||||
// effect.
|
// effect.
|
||||||
|
@ -128,23 +128,23 @@ const (
|
||||||
Sepia PropertyName = "sepia"
|
Sepia PropertyName = "sepia"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ViewFilter defines an applied to a View a graphical effects like blur or color shift.
|
// FilterProperty defines an applied to a View a graphical effects like blur or color shift.
|
||||||
// Allowable properties are Blur, Brightness, Contrast, DropShadow, Grayscale, HueRotate, Invert, Opacity, Saturate, and Sepia
|
// Allowable properties are Blur, Brightness, Contrast, DropShadow, Grayscale, HueRotate, Invert, Opacity, Saturate, and Sepia
|
||||||
type ViewFilter interface {
|
type FilterProperty interface {
|
||||||
Properties
|
Properties
|
||||||
fmt.Stringer
|
fmt.Stringer
|
||||||
stringWriter
|
stringWriter
|
||||||
cssStyle(session Session) string
|
cssStyle(session Session) string
|
||||||
}
|
}
|
||||||
|
|
||||||
type viewFilter struct {
|
type filterData struct {
|
||||||
dataProperty
|
dataProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewViewFilter creates the new ViewFilter
|
// NewFilterProperty creates the new FilterProperty
|
||||||
func NewViewFilter(params Params) ViewFilter {
|
func NewFilterProperty(params Params) FilterProperty {
|
||||||
if len(params) > 0 {
|
if len(params) > 0 {
|
||||||
filter := new(viewFilter)
|
filter := new(filterData)
|
||||||
filter.init()
|
filter.init()
|
||||||
for tag, value := range params {
|
for tag, value := range params {
|
||||||
if !filter.Set(tag, value) {
|
if !filter.Set(tag, value) {
|
||||||
|
@ -156,8 +156,8 @@ func NewViewFilter(params Params) ViewFilter {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newViewFilter(obj DataObject) ViewFilter {
|
func newFilterProperty(obj DataObject) FilterProperty {
|
||||||
filter := new(viewFilter)
|
filter := new(filterData)
|
||||||
filter.init()
|
filter.init()
|
||||||
for i := 0; i < obj.PropertyCount(); i++ {
|
for i := 0; i < obj.PropertyCount(); i++ {
|
||||||
if node := obj.Property(i); node != nil {
|
if node := obj.Property(i); node != nil {
|
||||||
|
@ -186,13 +186,13 @@ func newViewFilter(obj DataObject) ViewFilter {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (filter *viewFilter) init() {
|
func (filter *filterData) init() {
|
||||||
filter.dataProperty.init()
|
filter.dataProperty.init()
|
||||||
filter.set = viewFilterSet
|
filter.set = filterDataSet
|
||||||
filter.supportedProperties = []PropertyName{Blur, Brightness, Contrast, Saturate, Grayscale, Invert, Opacity, Sepia, HueRotate, DropShadow}
|
filter.supportedProperties = []PropertyName{Blur, Brightness, Contrast, Saturate, Grayscale, Invert, Opacity, Sepia, HueRotate, DropShadow}
|
||||||
}
|
}
|
||||||
|
|
||||||
func viewFilterSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
func filterDataSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Blur, Brightness, Contrast, Saturate:
|
case Blur, Brightness, Contrast, Saturate:
|
||||||
return setFloatProperty(properties, tag, value, 0, 10000)
|
return setFloatProperty(properties, tag, value, 0, 10000)
|
||||||
|
@ -213,11 +213,11 @@ func viewFilterSet(properties Properties, tag PropertyName, value any) []Propert
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (filter *viewFilter) String() string {
|
func (filter *filterData) String() string {
|
||||||
return runStringWriter(filter)
|
return runStringWriter(filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (filter *viewFilter) writeString(buffer *strings.Builder, indent string) {
|
func (filter *filterData) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString("filter { ")
|
buffer.WriteString("filter { ")
|
||||||
comma := false
|
comma := false
|
||||||
tags := filter.AllTags()
|
tags := filter.AllTags()
|
||||||
|
@ -235,7 +235,7 @@ func (filter *viewFilter) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString(" }")
|
buffer.WriteString(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (filter *viewFilter) cssStyle(session Session) string {
|
func (filter *filterData) cssStyle(session Session) string {
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
|
||||||
|
@ -287,27 +287,27 @@ func (filter *viewFilter) cssStyle(session Session) string {
|
||||||
|
|
||||||
func setFilterProperty(properties Properties, tag PropertyName, value any) []PropertyName {
|
func setFilterProperty(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case ViewFilter:
|
case FilterProperty:
|
||||||
properties.setRaw(tag, value)
|
properties.setRaw(tag, value)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
|
|
||||||
case string:
|
case string:
|
||||||
if obj := NewDataObject(value); obj == nil {
|
if obj := NewDataObject(value); obj == nil {
|
||||||
if filter := newViewFilter(obj); filter != nil {
|
if filter := newFilterProperty(obj); filter != nil {
|
||||||
properties.setRaw(tag, filter)
|
properties.setRaw(tag, filter)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case DataObject:
|
case DataObject:
|
||||||
if filter := newViewFilter(value); filter != nil {
|
if filter := newFilterProperty(value); filter != nil {
|
||||||
properties.setRaw(tag, filter)
|
properties.setRaw(tag, filter)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
|
|
||||||
case DataValue:
|
case DataValue:
|
||||||
if value.IsObject() {
|
if value.IsObject() {
|
||||||
if filter := newViewFilter(value.Object()); filter != nil {
|
if filter := newFilterProperty(value.Object()); filter != nil {
|
||||||
properties.setRaw(tag, filter)
|
properties.setRaw(tag, filter)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
|
@ -320,15 +320,15 @@ func setFilterProperty(properties Properties, tag PropertyName, value any) []Pro
|
||||||
|
|
||||||
// GetFilter returns a View graphical effects like blur or color shift.
|
// GetFilter returns a View graphical effects like blur or color shift.
|
||||||
// If the second argument (subviewID) is not specified or it is "" then a top position of the first argument (view) is returned
|
// If the second argument (subviewID) is not specified or it is "" then a top position of the first argument (view) is returned
|
||||||
func GetFilter(view View, subviewID ...string) ViewFilter {
|
func GetFilter(view View, subviewID ...string) FilterProperty {
|
||||||
if view = getSubview(view, subviewID); view != nil {
|
if view = getSubview(view, subviewID); view != nil {
|
||||||
if value := view.getRaw(Filter); value != nil {
|
if value := view.getRaw(Filter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
return filter
|
return filter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value := valueFromStyle(view, Filter); value != nil {
|
if value := valueFromStyle(view, Filter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
return filter
|
return filter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,15 +339,15 @@ func GetFilter(view View, subviewID ...string) ViewFilter {
|
||||||
|
|
||||||
// GetBackdropFilter returns the area behind a View graphical effects like blur or color shift.
|
// GetBackdropFilter returns the area behind a View graphical effects like blur or color shift.
|
||||||
// If the second argument (subviewID) is not specified or it is "" then a top position of the first argument (view) is returned
|
// If the second argument (subviewID) is not specified or it is "" then a top position of the first argument (view) is returned
|
||||||
func GetBackdropFilter(view View, subviewID ...string) ViewFilter {
|
func GetBackdropFilter(view View, subviewID ...string) FilterProperty {
|
||||||
if view = getSubview(view, subviewID); view != nil {
|
if view = getSubview(view, subviewID); view != nil {
|
||||||
if value := view.getRaw(BackdropFilter); value != nil {
|
if value := view.getRaw(BackdropFilter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
return filter
|
return filter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if value := valueFromStyle(view, BackdropFilter); value != nil {
|
if value := valueFromStyle(view, BackdropFilter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
return filter
|
return filter
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -162,7 +162,7 @@ const (
|
||||||
|
|
||||||
// Opacity is the constant for "opacity" property tag.
|
// Opacity is the constant for "opacity" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, ViewFilter.
|
// Used by View, FilterProperty.
|
||||||
//
|
//
|
||||||
// # Usage in View:
|
// # Usage in View:
|
||||||
//
|
//
|
||||||
|
@ -173,7 +173,7 @@ const (
|
||||||
//
|
//
|
||||||
// Internal type is float, other types converted to it during assignment.
|
// Internal type is float, other types converted to it during assignment.
|
||||||
//
|
//
|
||||||
// # Usage in ViewFilter:
|
// # Usage in FilterProperty:
|
||||||
//
|
//
|
||||||
// Opacity is the degree to which content behind the view is hidden, and is the opposite of transparency. Value is in
|
// Opacity is the degree to which content behind the view is hidden, and is the opposite of transparency. Value is in
|
||||||
// range 0% to 100%, where 0% is fully transparent.
|
// range 0% to 100%, where 0% is fully transparent.
|
||||||
|
@ -2505,9 +2505,9 @@ const (
|
||||||
// Used by View.
|
// Used by View.
|
||||||
// Applies graphical effects to a view, such as blurring, color shifting, changing brightness/contrast, etc.
|
// Applies graphical effects to a view, such as blurring, color shifting, changing brightness/contrast, etc.
|
||||||
//
|
//
|
||||||
// Supported types: ViewFilter.
|
// Supported types: FilterProperty.
|
||||||
//
|
//
|
||||||
// See ViewFilter description for more details.
|
// See FilterProperty description for more details.
|
||||||
Filter PropertyName = "filter"
|
Filter PropertyName = "filter"
|
||||||
|
|
||||||
// BackdropFilter is the constant for "backdrop-filter" property tag.
|
// BackdropFilter is the constant for "backdrop-filter" property tag.
|
||||||
|
@ -2516,9 +2516,9 @@ const (
|
||||||
// Applies graphical effects to the area behind a view, such as blurring, color shifting, changing brightness/contrast,
|
// Applies graphical effects to the area behind a view, such as blurring, color shifting, changing brightness/contrast,
|
||||||
// etc.
|
// etc.
|
||||||
//
|
//
|
||||||
// Supported types: ViewFilter.
|
// Supported types: FilterProperty.
|
||||||
//
|
//
|
||||||
// See ViewFilter description for more details.
|
// See FilterProperty description for more details.
|
||||||
BackdropFilter PropertyName = "backdrop-filter"
|
BackdropFilter PropertyName = "backdrop-filter"
|
||||||
|
|
||||||
// Clip is the constant for "clip" property tag.
|
// Clip is the constant for "clip" property tag.
|
||||||
|
|
4
view.go
4
view.go
|
@ -576,7 +576,7 @@ func (view *viewData) propertyChanged(tag PropertyName) {
|
||||||
case Filter:
|
case Filter:
|
||||||
text := ""
|
text := ""
|
||||||
if value := view.getRaw(Filter); value != nil {
|
if value := view.getRaw(Filter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
text = filter.cssStyle(session)
|
text = filter.cssStyle(session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -585,7 +585,7 @@ func (view *viewData) propertyChanged(tag PropertyName) {
|
||||||
case BackdropFilter:
|
case BackdropFilter:
|
||||||
text := ""
|
text := ""
|
||||||
if value := view.getRaw(BackdropFilter); value != nil {
|
if value := view.getRaw(BackdropFilter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
text = filter.cssStyle(session)
|
text = filter.cssStyle(session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,7 +391,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if value := style.getRaw(Filter); value != nil {
|
if value := style.getRaw(Filter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
if text := filter.cssStyle(session); text != "" {
|
if text := filter.cssStyle(session); text != "" {
|
||||||
builder.add(string(Filter), text)
|
builder.add(string(Filter), text)
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if value := style.getRaw(BackdropFilter); value != nil {
|
if value := style.getRaw(BackdropFilter); value != nil {
|
||||||
if filter, ok := value.(ViewFilter); ok {
|
if filter, ok := value.(FilterProperty); ok {
|
||||||
if text := filter.cssStyle(session); text != "" {
|
if text := filter.cssStyle(session); text != "" {
|
||||||
builder.add(`-webkit-backdrop-filter`, text)
|
builder.add(`-webkit-backdrop-filter`, text)
|
||||||
builder.add(string(BackdropFilter), text)
|
builder.add(string(BackdropFilter), text)
|
||||||
|
|
Loading…
Reference in New Issue