mirror of https://github.com/anoshenko/rui.git
Renamed ClipShape -> ClipShapeProperty
This commit is contained in:
parent
a8242c99fe
commit
5039998cf9
|
@ -18,10 +18,17 @@
|
||||||
NewInsetViewShadow function -> NewInsetShadow
|
NewInsetViewShadow function -> NewInsetShadow
|
||||||
NewShadowWithParams function -> NewShadowProperty
|
NewShadowWithParams function -> NewShadowProperty
|
||||||
NewColumnSeparator function -> NewColumnSeparatorProperty
|
NewColumnSeparator function -> NewColumnSeparatorProperty
|
||||||
|
ClipShape interface -> ClipShapeProperty
|
||||||
|
InsetClip function -> NewInsetClip
|
||||||
|
CircleClip function -> NewCircleClip
|
||||||
|
EllipseClip function -> NewEllipseClip
|
||||||
|
PolygonClip function -> NewPolygonClip
|
||||||
|
PolygonPointsClip function -> NewPolygonPointsClip
|
||||||
|
|
||||||
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
|
* Added functions: NewBounds, NewEllipticRadius, NewRadii, NewLinearGradient, NewCircleRadialGradient,
|
||||||
NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation,
|
NewEllipseRadialGradient, GetPushTransform, GetPushDuration, GetPushTiming, IsMoveToFrontAnimation,
|
||||||
GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin, NewColumnSeparator.
|
GetBackground, GetMask, GetBackgroundClip,GetBackgroundOrigin, GetMaskClip, GetMaskOrigin, NewColumnSeparator,
|
||||||
|
NewClipShapeProperty.
|
||||||
|
|
||||||
* Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface.
|
* Added SetConicGradientFillStyle and SetConicGradientStrokeStyle methods to Canvas interface.
|
||||||
|
|
||||||
|
|
12
README-ru.md
12
README-ru.md
|
@ -1322,14 +1322,14 @@ AngleUnit или string (угловая константа или текстов
|
||||||
|
|
||||||
### Свойство "clip"
|
### Свойство "clip"
|
||||||
|
|
||||||
Свойство "clip" (константа Clip) типа ClipShape задает задает область образки.
|
Свойство "clip" (константа Clip) типа ClipShapeProperty задает задает область образки.
|
||||||
Есть 4 типа областей обрезки
|
Есть 4 типа областей обрезки
|
||||||
|
|
||||||
#### inset
|
#### inset
|
||||||
|
|
||||||
Прямоугольная область обрезки. Создается с помощью функции:
|
Прямоугольная область обрезки. Создается с помощью функции:
|
||||||
|
|
||||||
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape
|
func NewInsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShapeProperty
|
||||||
|
|
||||||
где top, right, bottom, left это расстояние от соответственно верхней, правой, нижней и левой границы
|
где top, right, bottom, left это расстояние от соответственно верхней, правой, нижней и левой границы
|
||||||
View до одноименной границы обрезки; radius - задает радиусы скругления углов области обрезки
|
View до одноименной границы обрезки; radius - задает радиусы скругления углов области обрезки
|
||||||
|
@ -1346,7 +1346,7 @@ radius необходимо передать nil
|
||||||
|
|
||||||
Круглая область обрезки. Создается с помощью функции:
|
Круглая область обрезки. Создается с помощью функции:
|
||||||
|
|
||||||
func CircleClip(x, y, radius SizeUnit) ClipShape
|
func NewCircleClip(x, y, radius SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
где x, y - координаты центра окружности; radius - радиус
|
где x, y - координаты центра окружности; radius - радиус
|
||||||
|
|
||||||
|
@ -1358,7 +1358,7 @@ radius необходимо передать nil
|
||||||
|
|
||||||
Эллиптическая область обрезки. Создается с помощью функции:
|
Эллиптическая область обрезки. Создается с помощью функции:
|
||||||
|
|
||||||
func EllipseClip(x, y, rx, ry SizeUnit) ClipShape
|
func NewEllipseClip(x, y, rx, ry SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
где x, y - координаты центра эллипса; rх - радиус эллипса по оси X; ry - радиус эллипса по оси Y.
|
где x, y - координаты центра эллипса; rх - радиус эллипса по оси X; ry - радиус эллипса по оси Y.
|
||||||
|
|
||||||
|
@ -1370,8 +1370,8 @@ radius необходимо передать nil
|
||||||
|
|
||||||
Многоугольная область обрезки. Создается с помощью функций:
|
Многоугольная область обрезки. Создается с помощью функций:
|
||||||
|
|
||||||
func PolygonClip(points []any) ClipShape
|
func NewPolygonClip(points []any) ClipShapeProperty
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape
|
func NewPolygonPointsClip(points []SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
в качестве аргумента передается массив угловых точек многоугольника в следующем порядке: x1, y1, x2, y2, …
|
в качестве аргумента передается массив угловых точек многоугольника в следующем порядке: x1, y1, x2, y2, …
|
||||||
В качестве элементов аргумента функции PolygonClip могут быть или текстовые константы, или
|
В качестве элементов аргумента функции PolygonClip могут быть или текстовые константы, или
|
||||||
|
|
12
README.md
12
README.md
|
@ -1301,14 +1301,14 @@ You can get the value of this property using the function
|
||||||
|
|
||||||
### "clip" property
|
### "clip" property
|
||||||
|
|
||||||
The "clip" property (Clip constant) of the ClipShape type specifies the crop area.
|
The "clip" property (Clip constant) of the ClipShapeProperty type specifies the crop area.
|
||||||
There are 4 types of crop areas
|
There are 4 types of crop areas
|
||||||
|
|
||||||
#### inset
|
#### inset
|
||||||
|
|
||||||
Rectangular cropping area. Created with the function:
|
Rectangular cropping area. Created with the function:
|
||||||
|
|
||||||
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape
|
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShapeProperty
|
||||||
|
|
||||||
where top, right, bottom, left are the distance from respectively the top, right, bottom and left borders of the View
|
where top, right, bottom, left are the distance from respectively the top, right, bottom and left borders of the View
|
||||||
to the cropping border of the same name; radius - sets the radii of the corners of the cropping area
|
to the cropping border of the same name; radius - sets the radii of the corners of the cropping area
|
||||||
|
@ -1324,7 +1324,7 @@ The textual description of the rectangular cropping area is in the following for
|
||||||
|
|
||||||
Round cropping area. Created with the function:
|
Round cropping area. Created with the function:
|
||||||
|
|
||||||
func CircleClip(x, y, radius SizeUnit) ClipShape
|
func CircleClip(x, y, radius SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
where x, y - coordinates of the center of the circle; radius - radius
|
where x, y - coordinates of the center of the circle; radius - radius
|
||||||
|
|
||||||
|
@ -1336,7 +1336,7 @@ The textual description of the circular cropping area is in the following format
|
||||||
|
|
||||||
Elliptical cropping area. Created with the function:
|
Elliptical cropping area. Created with the function:
|
||||||
|
|
||||||
func EllipseClip(x, y, rx, ry SizeUnit) ClipShape
|
func EllipseClip(x, y, rx, ry SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
where x, y - coordinates of the center of the ellipse; rх - radius of the ellipse along the X axis; ry is the radius of the ellipse along the Y axis.
|
where x, y - coordinates of the center of the ellipse; rх - radius of the ellipse along the X axis; ry is the radius of the ellipse along the Y axis.
|
||||||
|
|
||||||
|
@ -1348,8 +1348,8 @@ The textual description of the elliptical clipping region is in the following fo
|
||||||
|
|
||||||
Polygonal cropping area. Created using functions:
|
Polygonal cropping area. Created using functions:
|
||||||
|
|
||||||
func PolygonClip(points []any) ClipShape
|
func PolygonClip(points []any) ClipShapeProperty
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape
|
func PolygonPointsClip(points []SizeUnit) ClipShapeProperty
|
||||||
|
|
||||||
an array of corner points of the polygon is passed as an argument in the following order: x1, y1, x2, y2, …
|
an array of corner points of the polygon is passed as an argument in the following order: x1, y1, x2, y2, …
|
||||||
The elements of the argument to the PolygonClip function can be either text constants,
|
The elements of the argument to the PolygonClip function can be either text constants,
|
||||||
|
|
|
@ -5,39 +5,120 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ClipShape defines a View clipping area
|
type ClipShape string
|
||||||
type ClipShape interface {
|
|
||||||
|
const (
|
||||||
|
InsetClip ClipShape = "inset"
|
||||||
|
CircleClip ClipShape = "circle"
|
||||||
|
EllipseClip ClipShape = "ellipse"
|
||||||
|
PolygonClip ClipShape = "polygon"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ClipShapeProperty defines a View clipping area
|
||||||
|
type ClipShapeProperty interface {
|
||||||
Properties
|
Properties
|
||||||
fmt.Stringer
|
fmt.Stringer
|
||||||
stringWriter
|
stringWriter
|
||||||
|
|
||||||
|
// Shape returns the clip shape type
|
||||||
|
Shape() ClipShape
|
||||||
cssStyle(session Session) string
|
cssStyle(session Session) string
|
||||||
valid(session Session) bool
|
valid(session Session) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type insetClip struct {
|
type insetClipData struct {
|
||||||
dataProperty
|
dataProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
type ellipseClip struct {
|
type ellipseClipData struct {
|
||||||
dataProperty
|
dataProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
type circleClip struct {
|
type circleClipData struct {
|
||||||
dataProperty
|
dataProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
type polygonClip struct {
|
type polygonClipData struct {
|
||||||
dataProperty
|
dataProperty
|
||||||
}
|
}
|
||||||
|
|
||||||
// InsetClip creates a rectangle View clipping area.
|
// NewClipShapeProperty creates ClipShapeProperty.
|
||||||
|
//
|
||||||
|
// The following properties can be used for shapes:
|
||||||
|
//
|
||||||
|
// InsetClip:
|
||||||
|
// - "top" (Top) - offset (SizeUnit) from the top border of a View;
|
||||||
|
// - "right" (Right) - offset (SizeUnit) from the right border of a View;
|
||||||
|
// - "bottom" (Bottom) - offset (SizeUnit) from the bottom border of a View;
|
||||||
|
// - "left" (Left) - offset (SizeUnit) from the left border of a View;
|
||||||
|
// - "radius" (Radius) - corner radius (RadiusProperty).
|
||||||
|
//
|
||||||
|
// CircleClip:
|
||||||
|
// - "x" (X) - x-axis position (SizeUnit) of the circle clip center;
|
||||||
|
// - "y" (Y) - y-axis position (SizeUnit) of the circle clip center;
|
||||||
|
// - "radius" (Radius) - radius (SizeUnit) of the circle clip center.
|
||||||
|
//
|
||||||
|
// EllipseClip:
|
||||||
|
// - "x" (X) - x-axis position (SizeUnit) of the ellipse clip center;
|
||||||
|
// - "y" (Y) - y-axis position (SizeUnit) of the ellipse clip center;
|
||||||
|
// - "radius-x" (RadiusX) - x-axis radius (SizeUnit) of the ellipse clip center;
|
||||||
|
// - "radius-y" (RadiusY) - y-axis radius (SizeUnit) of the ellipse clip center.
|
||||||
|
//
|
||||||
|
// PolygonClip:
|
||||||
|
// - "points" (Points) - an array ([]SizeUnit) of corner points of the polygon in the following order: x1, y1, x2, y2, ….
|
||||||
|
//
|
||||||
|
// The function will return nil if no properties are specified, unsupported properties are specified, or at least one property has an invalid value.
|
||||||
|
func NewClipShapeProperty(shape ClipShape, params Params) ClipShapeProperty {
|
||||||
|
if len(params) == 0 {
|
||||||
|
ErrorLog("No ClipShapeProperty params")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var result ClipShapeProperty
|
||||||
|
|
||||||
|
switch shape {
|
||||||
|
case InsetClip:
|
||||||
|
clip := new(insetClipData)
|
||||||
|
clip.init()
|
||||||
|
result = clip
|
||||||
|
|
||||||
|
case CircleClip:
|
||||||
|
clip := new(circleClipData)
|
||||||
|
clip.init()
|
||||||
|
result = clip
|
||||||
|
|
||||||
|
case EllipseClip:
|
||||||
|
clip := new(ellipseClipData)
|
||||||
|
clip.init()
|
||||||
|
result = clip
|
||||||
|
|
||||||
|
case PolygonClip:
|
||||||
|
clip := new(polygonClipData)
|
||||||
|
clip.init()
|
||||||
|
result = clip
|
||||||
|
|
||||||
|
default:
|
||||||
|
ErrorLog("Unknown ClipShape: " + string(shape))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
for tag, value := range params {
|
||||||
|
if !result.Set(tag, value) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewInsetClip creates a rectangle View clipping area.
|
||||||
// - top - offset from the top border of a View;
|
// - top - offset from the top border of a View;
|
||||||
// - right - offset from the right border of a View;
|
// - right - offset from the right border of a View;
|
||||||
// - bottom - offset from the bottom border of a View;
|
// - bottom - offset from the bottom border of a View;
|
||||||
// - left - offset from the left border of a View;
|
// - left - offset from the left border of a View;
|
||||||
// - radius - corner radius, pass nil if you don't need to round corners
|
// - radius - corner radius, pass nil if you don't need to round corners
|
||||||
func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShape {
|
func NewInsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipShapeProperty {
|
||||||
clip := new(insetClip)
|
clip := new(insetClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
clip.setRaw(Top, top)
|
clip.setRaw(Top, top)
|
||||||
clip.setRaw(Right, right)
|
clip.setRaw(Right, right)
|
||||||
|
@ -49,9 +130,12 @@ func InsetClip(top, right, bottom, left SizeUnit, radius RadiusProperty) ClipSha
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
|
|
||||||
// CircleClip creates a circle View clipping area.
|
// NewCircleClip creates a circle View clipping area.
|
||||||
func CircleClip(x, y, radius SizeUnit) ClipShape {
|
// - x - x-axis position of the circle clip center;
|
||||||
clip := new(circleClip)
|
// - y - y-axis position of the circle clip center;
|
||||||
|
// - radius - radius of the circle clip center.
|
||||||
|
func NewCircleClip(x, y, radius SizeUnit) ClipShapeProperty {
|
||||||
|
clip := new(circleClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
clip.setRaw(X, x)
|
clip.setRaw(X, x)
|
||||||
clip.setRaw(Y, y)
|
clip.setRaw(Y, y)
|
||||||
|
@ -59,9 +143,13 @@ func CircleClip(x, y, radius SizeUnit) ClipShape {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
|
|
||||||
// EllipseClip creates a ellipse View clipping area.
|
// NewEllipseClip creates a ellipse View clipping area.
|
||||||
func EllipseClip(x, y, rx, ry SizeUnit) ClipShape {
|
// - x - x-axis position of the ellipse clip center;
|
||||||
clip := new(ellipseClip)
|
// - y - y-axis position of the ellipse clip center;
|
||||||
|
// - rx - x-axis radius of the ellipse clip center;
|
||||||
|
// - ry - y-axis radius of the ellipse clip center.
|
||||||
|
func NewEllipseClip(x, y, rx, ry SizeUnit) ClipShapeProperty {
|
||||||
|
clip := new(ellipseClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
clip.setRaw(X, x)
|
clip.setRaw(X, x)
|
||||||
clip.setRaw(Y, y)
|
clip.setRaw(Y, y)
|
||||||
|
@ -70,32 +158,34 @@ func EllipseClip(x, y, rx, ry SizeUnit) ClipShape {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
|
|
||||||
// PolygonClip creates a polygon View clipping area.
|
// NewPolygonClip creates a polygon View clipping area.
|
||||||
|
// - points - an array of corner points of the polygon in the following order: x1, y1, x2, y2, …
|
||||||
//
|
//
|
||||||
// The elements of the function argument can be or text constants,
|
// The elements of the function argument can be or text constants,
|
||||||
// or the text representation of SizeUnit, or elements of SizeUnit type.
|
// or the text representation of SizeUnit, or elements of SizeUnit type.
|
||||||
func PolygonClip(points []any) ClipShape {
|
func NewPolygonClip(points []any) ClipShapeProperty {
|
||||||
clip := new(polygonClip)
|
clip := new(polygonClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
if polygonClipSet(clip, Points, points) != nil {
|
if polygonClipDataSet(clip, Points, points) != nil {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// PolygonPointsClip creates a polygon View clipping area.
|
// NewPolygonPointsClip creates a polygon View clipping area.
|
||||||
func PolygonPointsClip(points []SizeUnit) ClipShape {
|
// - points - an array of corner points of the polygon in the following order: x1, y1, x2, y2, …
|
||||||
clip := new(polygonClip)
|
func NewPolygonPointsClip(points []SizeUnit) ClipShapeProperty {
|
||||||
|
clip := new(polygonClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
if polygonClipSet(clip, Points, points) != nil {
|
if polygonClipDataSet(clip, Points, points) != nil {
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) init() {
|
func (clip *insetClipData) init() {
|
||||||
clip.dataProperty.init()
|
clip.dataProperty.init()
|
||||||
clip.set = insetClipSet
|
clip.set = insetClipDataSet
|
||||||
clip.supportedProperties = []PropertyName{
|
clip.supportedProperties = []PropertyName{
|
||||||
Top, Right, Bottom, Left, Radius,
|
Top, Right, Bottom, Left, Radius,
|
||||||
RadiusX, RadiusY, RadiusTopLeft, RadiusTopLeftX, RadiusTopLeftY,
|
RadiusX, RadiusY, RadiusTopLeft, RadiusTopLeftX, RadiusTopLeftY,
|
||||||
|
@ -105,7 +195,11 @@ func (clip *insetClip) init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func insetClipSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
func (clip *insetClipData) Shape() ClipShape {
|
||||||
|
return InsetClip
|
||||||
|
}
|
||||||
|
|
||||||
|
func insetClipDataSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch tag {
|
switch tag {
|
||||||
case Top, Right, Bottom, Left:
|
case Top, Right, Bottom, Left:
|
||||||
return setSizeProperty(properties, tag, value)
|
return setSizeProperty(properties, tag, value)
|
||||||
|
@ -127,11 +221,11 @@ func insetClipSet(properties Properties, tag PropertyName, value any) []Property
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) String() string {
|
func (clip *insetClipData) String() string {
|
||||||
return runStringWriter(clip)
|
return runStringWriter(clip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) writeString(buffer *strings.Builder, indent string) {
|
func (clip *insetClipData) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString("inset { ")
|
buffer.WriteString("inset { ")
|
||||||
comma := false
|
comma := false
|
||||||
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius} {
|
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius} {
|
||||||
|
@ -149,7 +243,7 @@ func (clip *insetClip) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString(" }")
|
buffer.WriteString(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) cssStyle(session Session) string {
|
func (clip *insetClipData) cssStyle(session Session) string {
|
||||||
|
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
@ -171,7 +265,7 @@ func (clip *insetClip) cssStyle(session Session) string {
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *insetClip) valid(session Session) bool {
|
func (clip *insetClipData) valid(session Session) bool {
|
||||||
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius, RadiusX, RadiusY} {
|
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius, RadiusX, RadiusY} {
|
||||||
if value, ok := sizeProperty(clip, tag, session); ok && value.Type != Auto && value.Value != 0 {
|
if value, ok := sizeProperty(clip, tag, session); ok && value.Type != Auto && value.Value != 0 {
|
||||||
return true
|
return true
|
||||||
|
@ -180,13 +274,17 @@ func (clip *insetClip) valid(session Session) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) init() {
|
func (clip *circleClipData) init() {
|
||||||
clip.dataProperty.init()
|
clip.dataProperty.init()
|
||||||
clip.set = circleClipSet
|
clip.set = circleClipDataSet
|
||||||
clip.supportedProperties = []PropertyName{X, Y, Radius}
|
clip.supportedProperties = []PropertyName{X, Y, Radius}
|
||||||
}
|
}
|
||||||
|
|
||||||
func circleClipSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
func (clip *circleClipData) Shape() ClipShape {
|
||||||
|
return CircleClip
|
||||||
|
}
|
||||||
|
|
||||||
|
func circleClipDataSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch tag {
|
switch tag {
|
||||||
case X, Y, Radius:
|
case X, Y, Radius:
|
||||||
return setSizeProperty(properties, tag, value)
|
return setSizeProperty(properties, tag, value)
|
||||||
|
@ -196,11 +294,11 @@ func circleClipSet(properties Properties, tag PropertyName, value any) []Propert
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) String() string {
|
func (clip *circleClipData) String() string {
|
||||||
return runStringWriter(clip)
|
return runStringWriter(clip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) writeString(buffer *strings.Builder, indent string) {
|
func (clip *circleClipData) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString("circle { ")
|
buffer.WriteString("circle { ")
|
||||||
comma := false
|
comma := false
|
||||||
for _, tag := range []PropertyName{Radius, X, Y} {
|
for _, tag := range []PropertyName{Radius, X, Y} {
|
||||||
|
@ -218,7 +316,7 @@ func (clip *circleClip) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString(" }")
|
buffer.WriteString(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) cssStyle(session Session) string {
|
func (clip *circleClipData) cssStyle(session Session) string {
|
||||||
|
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
@ -239,20 +337,24 @@ func (clip *circleClip) cssStyle(session Session) string {
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *circleClip) valid(session Session) bool {
|
func (clip *circleClipData) valid(session Session) bool {
|
||||||
if value, ok := sizeProperty(clip, Radius, session); ok && value.Value == 0 {
|
if value, ok := sizeProperty(clip, Radius, session); ok && value.Value == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) init() {
|
func (clip *ellipseClipData) init() {
|
||||||
clip.dataProperty.init()
|
clip.dataProperty.init()
|
||||||
clip.set = ellipseClipSet
|
clip.set = ellipseClipDataSet
|
||||||
clip.supportedProperties = []PropertyName{X, Y, Radius, RadiusX, RadiusY}
|
clip.supportedProperties = []PropertyName{X, Y, Radius, RadiusX, RadiusY}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ellipseClipSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
func (clip *ellipseClipData) Shape() ClipShape {
|
||||||
|
return EllipseClip
|
||||||
|
}
|
||||||
|
|
||||||
|
func ellipseClipDataSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch tag {
|
switch tag {
|
||||||
case X, Y, RadiusX, RadiusY:
|
case X, Y, RadiusX, RadiusY:
|
||||||
return setSizeProperty(properties, tag, value)
|
return setSizeProperty(properties, tag, value)
|
||||||
|
@ -269,11 +371,11 @@ func ellipseClipSet(properties Properties, tag PropertyName, value any) []Proper
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) String() string {
|
func (clip *ellipseClipData) String() string {
|
||||||
return runStringWriter(clip)
|
return runStringWriter(clip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) writeString(buffer *strings.Builder, indent string) {
|
func (clip *ellipseClipData) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString("ellipse { ")
|
buffer.WriteString("ellipse { ")
|
||||||
comma := false
|
comma := false
|
||||||
for _, tag := range []PropertyName{RadiusX, RadiusY, X, Y} {
|
for _, tag := range []PropertyName{RadiusX, RadiusY, X, Y} {
|
||||||
|
@ -291,7 +393,7 @@ func (clip *ellipseClip) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteString(" }")
|
buffer.WriteString(" }")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) cssStyle(session Session) string {
|
func (clip *ellipseClipData) cssStyle(session Session) string {
|
||||||
|
|
||||||
buffer := allocStringBuilder()
|
buffer := allocStringBuilder()
|
||||||
defer freeStringBuilder(buffer)
|
defer freeStringBuilder(buffer)
|
||||||
|
@ -315,19 +417,23 @@ func (clip *ellipseClip) cssStyle(session Session) string {
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *ellipseClip) valid(session Session) bool {
|
func (clip *ellipseClipData) valid(session Session) bool {
|
||||||
rx, _ := sizeProperty(clip, RadiusX, session)
|
rx, _ := sizeProperty(clip, RadiusX, session)
|
||||||
ry, _ := sizeProperty(clip, RadiusY, session)
|
ry, _ := sizeProperty(clip, RadiusY, session)
|
||||||
return rx.Value != 0 && ry.Value != 0
|
return rx.Value != 0 && ry.Value != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) init() {
|
func (clip *polygonClipData) init() {
|
||||||
clip.dataProperty.init()
|
clip.dataProperty.init()
|
||||||
clip.set = polygonClipSet
|
clip.set = polygonClipDataSet
|
||||||
clip.supportedProperties = []PropertyName{Points}
|
clip.supportedProperties = []PropertyName{Points}
|
||||||
}
|
}
|
||||||
|
|
||||||
func polygonClipSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
func (clip *polygonClipData) Shape() ClipShape {
|
||||||
|
return PolygonClip
|
||||||
|
}
|
||||||
|
|
||||||
|
func polygonClipDataSet(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
if Points == tag {
|
if Points == tag {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case []any:
|
case []any:
|
||||||
|
@ -385,11 +491,11 @@ func polygonClipSet(properties Properties, tag PropertyName, value any) []Proper
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) String() string {
|
func (clip *polygonClipData) String() string {
|
||||||
return runStringWriter(clip)
|
return runStringWriter(clip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) points() []any {
|
func (clip *polygonClipData) points() []any {
|
||||||
if value := clip.getRaw(Points); value != nil {
|
if value := clip.getRaw(Points); value != nil {
|
||||||
if points, ok := value.([]any); ok {
|
if points, ok := value.([]any); ok {
|
||||||
return points
|
return points
|
||||||
|
@ -398,7 +504,7 @@ func (clip *polygonClip) points() []any {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) writeString(buffer *strings.Builder, indent string) {
|
func (clip *polygonClipData) writeString(buffer *strings.Builder, indent string) {
|
||||||
|
|
||||||
buffer.WriteString("inset { ")
|
buffer.WriteString("inset { ")
|
||||||
|
|
||||||
|
@ -417,7 +523,7 @@ func (clip *polygonClip) writeString(buffer *strings.Builder, indent string) {
|
||||||
buffer.WriteRune('}')
|
buffer.WriteRune('}')
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) cssStyle(session Session) string {
|
func (clip *polygonClipData) cssStyle(session Session) string {
|
||||||
|
|
||||||
points := clip.points()
|
points := clip.points()
|
||||||
count := len(points)
|
count := len(points)
|
||||||
|
@ -459,47 +565,47 @@ func (clip *polygonClip) cssStyle(session Session) string {
|
||||||
return buffer.String()
|
return buffer.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clip *polygonClip) valid(session Session) bool {
|
func (clip *polygonClipData) valid(session Session) bool {
|
||||||
return len(clip.points()) > 0
|
return len(clip.points()) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseClipShape(obj DataObject) ClipShape {
|
func parseClipShapeProperty(obj DataObject) ClipShapeProperty {
|
||||||
switch obj.Tag() {
|
switch obj.Tag() {
|
||||||
case "inset":
|
case "inset":
|
||||||
clip := new(insetClip)
|
clip := new(insetClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius, RadiusX, RadiusY} {
|
for _, tag := range []PropertyName{Top, Right, Bottom, Left, Radius, RadiusX, RadiusY} {
|
||||||
if value, ok := obj.PropertyValue(string(tag)); ok {
|
if value, ok := obj.PropertyValue(string(tag)); ok {
|
||||||
insetClipSet(clip, tag, value)
|
insetClipDataSet(clip, tag, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clip
|
return clip
|
||||||
|
|
||||||
case "circle":
|
case "circle":
|
||||||
clip := new(ellipseClip)
|
clip := new(circleClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
for _, tag := range []PropertyName{X, Y, Radius} {
|
for _, tag := range []PropertyName{X, Y, Radius} {
|
||||||
if value, ok := obj.PropertyValue(string(tag)); ok {
|
if value, ok := obj.PropertyValue(string(tag)); ok {
|
||||||
circleClipSet(clip, tag, value)
|
circleClipDataSet(clip, tag, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clip
|
return clip
|
||||||
|
|
||||||
case "ellipse":
|
case "ellipse":
|
||||||
clip := new(ellipseClip)
|
clip := new(ellipseClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
for _, tag := range []PropertyName{X, Y, RadiusX, RadiusY} {
|
for _, tag := range []PropertyName{X, Y, RadiusX, RadiusY} {
|
||||||
if value, ok := obj.PropertyValue(string(tag)); ok {
|
if value, ok := obj.PropertyValue(string(tag)); ok {
|
||||||
ellipseClipSet(clip, tag, value)
|
ellipseClipDataSet(clip, tag, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return clip
|
return clip
|
||||||
|
|
||||||
case "polygon":
|
case "polygon":
|
||||||
clip := new(ellipseClip)
|
clip := new(polygonClipData)
|
||||||
clip.init()
|
clip.init()
|
||||||
if value, ok := obj.PropertyValue(string(Points)); ok {
|
if value, ok := obj.PropertyValue(string(Points)); ok {
|
||||||
polygonClipSet(clip, Points, value)
|
polygonClipDataSet(clip, Points, value)
|
||||||
}
|
}
|
||||||
return clip
|
return clip
|
||||||
}
|
}
|
||||||
|
@ -507,9 +613,9 @@ func parseClipShape(obj DataObject) ClipShape {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func setClipShapeProperty(properties Properties, tag PropertyName, value any) []PropertyName {
|
func setClipShapePropertyProperty(properties Properties, tag PropertyName, value any) []PropertyName {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case ClipShape:
|
case ClipShapeProperty:
|
||||||
properties.setRaw(tag, value)
|
properties.setRaw(tag, value)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
|
|
||||||
|
@ -520,21 +626,21 @@ func setClipShapeProperty(properties Properties, tag PropertyName, value any) []
|
||||||
}
|
}
|
||||||
|
|
||||||
if obj := NewDataObject(value); obj == nil {
|
if obj := NewDataObject(value); obj == nil {
|
||||||
if clip := parseClipShape(obj); clip != nil {
|
if clip := parseClipShapeProperty(obj); clip != nil {
|
||||||
properties.setRaw(tag, clip)
|
properties.setRaw(tag, clip)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case DataObject:
|
case DataObject:
|
||||||
if clip := parseClipShape(value); clip != nil {
|
if clip := parseClipShapeProperty(value); clip != nil {
|
||||||
properties.setRaw(tag, clip)
|
properties.setRaw(tag, clip)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
|
|
||||||
case DataValue:
|
case DataValue:
|
||||||
if value.IsObject() {
|
if value.IsObject() {
|
||||||
if clip := parseClipShape(value.Object()); clip != nil {
|
if clip := parseClipShapeProperty(value.Object()); clip != nil {
|
||||||
properties.setRaw(tag, clip)
|
properties.setRaw(tag, clip)
|
||||||
return []PropertyName{tag}
|
return []PropertyName{tag}
|
||||||
}
|
}
|
||||||
|
@ -545,16 +651,16 @@ func setClipShapeProperty(properties Properties, tag PropertyName, value any) []
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func getClipShape(prop Properties, tag PropertyName, session Session) ClipShape {
|
func getClipShapeProperty(prop Properties, tag PropertyName, session Session) ClipShapeProperty {
|
||||||
if value := prop.getRaw(tag); value != nil {
|
if value := prop.getRaw(tag); value != nil {
|
||||||
switch value := value.(type) {
|
switch value := value.(type) {
|
||||||
case ClipShape:
|
case ClipShapeProperty:
|
||||||
return value
|
return value
|
||||||
|
|
||||||
case string:
|
case string:
|
||||||
if text, ok := session.resolveConstants(value); ok {
|
if text, ok := session.resolveConstants(value); ok {
|
||||||
if obj := NewDataObject(text); obj == nil {
|
if obj := NewDataObject(text); obj == nil {
|
||||||
return parseClipShape(obj)
|
return parseClipShapeProperty(obj)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -565,9 +671,9 @@ func getClipShape(prop Properties, tag PropertyName, session Session) ClipShape
|
||||||
|
|
||||||
// GetClip returns a View clipping area.
|
// GetClip returns a View clipping area.
|
||||||
// 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 GetClip(view View, subviewID ...string) ClipShape {
|
func GetClip(view View, subviewID ...string) ClipShapeProperty {
|
||||||
if view = getSubview(view, subviewID); view != nil {
|
if view = getSubview(view, subviewID); view != nil {
|
||||||
return getClipShape(view, Clip, view.Session())
|
return getClipShapeProperty(view, Clip, view.Session())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -575,9 +681,9 @@ func GetClip(view View, subviewID ...string) ClipShape {
|
||||||
|
|
||||||
// GetShapeOutside returns a shape around which adjacent inline content.
|
// GetShapeOutside returns a shape around which adjacent inline content.
|
||||||
// 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 GetShapeOutside(view View, subviewID ...string) ClipShape {
|
func GetShapeOutside(view View, subviewID ...string) ClipShapeProperty {
|
||||||
if view = getSubview(view, subviewID); view != nil {
|
if view = getSubview(view, subviewID); view != nil {
|
||||||
return getClipShape(view, ShapeOutside, view.Session())
|
return getClipShapeProperty(view, ShapeOutside, view.Session())
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
8
popup.go
8
popup.go
|
@ -381,28 +381,28 @@ func (arrow *popupArrow) createView(popupView View) View {
|
||||||
case TopArrow:
|
case TopArrow:
|
||||||
params[Row] = 0
|
params[Row] = 0
|
||||||
params[Column] = 1
|
params[Column] = 1
|
||||||
params[Clip] = PolygonClip([]any{"0%", "100%", "50%", "0%", "100%", "100%"})
|
params[Clip] = NewPolygonClip([]any{"0%", "100%", "50%", "0%", "100%", "100%"})
|
||||||
params[Width] = arrow.width
|
params[Width] = arrow.width
|
||||||
params[Height] = arrow.size
|
params[Height] = arrow.size
|
||||||
|
|
||||||
case RightArrow:
|
case RightArrow:
|
||||||
params[Row] = 1
|
params[Row] = 1
|
||||||
params[Column] = 0
|
params[Column] = 0
|
||||||
params[Clip] = PolygonClip([]any{"0%", "0%", "100%", "50%", "0%", "100%"})
|
params[Clip] = NewPolygonClip([]any{"0%", "0%", "100%", "50%", "0%", "100%"})
|
||||||
params[Width] = arrow.size
|
params[Width] = arrow.size
|
||||||
params[Height] = arrow.width
|
params[Height] = arrow.width
|
||||||
|
|
||||||
case BottomArrow:
|
case BottomArrow:
|
||||||
params[Row] = 0
|
params[Row] = 0
|
||||||
params[Column] = 1
|
params[Column] = 1
|
||||||
params[Clip] = PolygonClip([]any{"0%", "0%", "50%", "100%", "100%", "0%"})
|
params[Clip] = NewPolygonClip([]any{"0%", "0%", "50%", "100%", "100%", "0%"})
|
||||||
params[Width] = arrow.width
|
params[Width] = arrow.width
|
||||||
params[Height] = arrow.size
|
params[Height] = arrow.size
|
||||||
|
|
||||||
case LeftArrow:
|
case LeftArrow:
|
||||||
params[Row] = 1
|
params[Row] = 1
|
||||||
params[Column] = 0
|
params[Column] = 0
|
||||||
params[Clip] = PolygonClip([]any{"100%", "0%", "0%", "50%", "100%", "100%"})
|
params[Clip] = NewPolygonClip([]any{"100%", "0%", "0%", "50%", "100%", "100%"})
|
||||||
params[Width] = arrow.size
|
params[Width] = arrow.size
|
||||||
params[Height] = arrow.width
|
params[Height] = arrow.width
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ const (
|
||||||
|
|
||||||
// Left is the constant for "left" property tag.
|
// Left is the constant for "left" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, BoundsProperty, ClipShape.
|
// Used by View, BoundsProperty, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// # Usage in View:
|
// # Usage in View:
|
||||||
//
|
//
|
||||||
|
@ -248,7 +248,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See [SizeUnit] description for more details.
|
// See [SizeUnit] description for more details.
|
||||||
//
|
//
|
||||||
// # Usage in ClipShape:
|
// # Usage in ClipShapeProperty:
|
||||||
//
|
//
|
||||||
// Specifies the left border position of inset clip shape.
|
// Specifies the left border position of inset clip shape.
|
||||||
//
|
//
|
||||||
|
@ -260,7 +260,7 @@ const (
|
||||||
|
|
||||||
// Right is the constant for "right" property tag.
|
// Right is the constant for "right" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, BoundsProperty, ClipShape.
|
// Used by View, BoundsProperty, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// # Usage in View:
|
// # Usage in View:
|
||||||
//
|
//
|
||||||
|
@ -280,7 +280,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See [SizeUnit] description for more details.
|
// See [SizeUnit] description for more details.
|
||||||
//
|
//
|
||||||
// # Usage in ClipShape:
|
// # Usage in ClipShapeProperty:
|
||||||
//
|
//
|
||||||
// Specifies the right border position of inset clip shape.
|
// Specifies the right border position of inset clip shape.
|
||||||
//
|
//
|
||||||
|
@ -292,7 +292,7 @@ const (
|
||||||
|
|
||||||
// Top is the constant for "top" property tag.
|
// Top is the constant for "top" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, BoundsProperty, ClipShape.
|
// Used by View, BoundsProperty, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// # Usage in View:
|
// # Usage in View:
|
||||||
//
|
//
|
||||||
|
@ -312,7 +312,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See [SizeUnit] description for more details.
|
// See [SizeUnit] description for more details.
|
||||||
//
|
//
|
||||||
// # Usage in ClipShape:
|
// # Usage in ClipShapeProperty:
|
||||||
//
|
//
|
||||||
// Specifies the top border position of inset clip shape.
|
// Specifies the top border position of inset clip shape.
|
||||||
//
|
//
|
||||||
|
@ -324,7 +324,7 @@ const (
|
||||||
|
|
||||||
// Bottom is the constant for "bottom" property tag.
|
// Bottom is the constant for "bottom" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, BoundsProperty, ClipShape.
|
// Used by View, BoundsProperty, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// # Usage in View:
|
// # Usage in View:
|
||||||
//
|
//
|
||||||
|
@ -344,7 +344,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See [SizeUnit] description for more details.
|
// See [SizeUnit] description for more details.
|
||||||
//
|
//
|
||||||
// # Usage in ClipShape:
|
// # Usage in ClipShapeProperty:
|
||||||
//
|
//
|
||||||
// Specifies the bottom border position of inset clip shape.
|
// Specifies the bottom border position of inset clip shape.
|
||||||
//
|
//
|
||||||
|
@ -2526,15 +2526,15 @@ const (
|
||||||
// Used by View.
|
// Used by View.
|
||||||
// Creates a clipping region that sets what part of a view should be shown.
|
// Creates a clipping region that sets what part of a view should be shown.
|
||||||
//
|
//
|
||||||
// Supported types: ClipShape, string.
|
// Supported types: ClipShapeProperty, string.
|
||||||
//
|
//
|
||||||
// Internal type is ClipShape, other types converted to it during assignment.
|
// Internal type is ClipShapeProperty, other types converted to it during assignment.
|
||||||
// See ClipShape description for more details.
|
// See ClipShapeProperty description for more details.
|
||||||
Clip PropertyName = "clip"
|
Clip PropertyName = "clip"
|
||||||
|
|
||||||
// Points is the constant for "points" property tag.
|
// Points is the constant for "points" property tag.
|
||||||
//
|
//
|
||||||
// Used by ClipShape.
|
// Used by ClipShapeProperty.
|
||||||
// Points which describe polygon clip area. Values are in a sequence of pair like: x1, y1, x2, y2 ...
|
// Points which describe polygon clip area. Values are in a sequence of pair like: x1, y1, x2, y2 ...
|
||||||
//
|
//
|
||||||
// Supported types: []SizeUnit, string.
|
// Supported types: []SizeUnit, string.
|
||||||
|
@ -2547,10 +2547,10 @@ const (
|
||||||
// inline content should wrap. By default, inline content wraps around its margin box. Property provides a way to
|
// inline content should wrap. By default, inline content wraps around its margin box. Property provides a way to
|
||||||
// customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes.
|
// customize this wrapping, making it possible to wrap text around complex objects rather than simple boxes.
|
||||||
//
|
//
|
||||||
// Supported types: ClipShape, string.
|
// Supported types: ClipShapeProperty, string.
|
||||||
//
|
//
|
||||||
// Internal type is ClipShape, other types converted to it during assignment.
|
// Internal type is ClipShapeProperty, other types converted to it during assignment.
|
||||||
// See ClipShape description for more details.
|
// See ClipShapeProperty description for more details.
|
||||||
ShapeOutside PropertyName = "shape-outside"
|
ShapeOutside PropertyName = "shape-outside"
|
||||||
|
|
||||||
// Float is the constant for "float" property tag.
|
// Float is the constant for "float" property tag.
|
||||||
|
|
24
radius.go
24
radius.go
|
@ -9,7 +9,7 @@ import (
|
||||||
const (
|
const (
|
||||||
// Radius is the constant for "radius" property tag.
|
// Radius is the constant for "radius" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, BackgroundElement, ClipShape.
|
// Used by View, BackgroundElement, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// Usage in View:
|
// Usage in View:
|
||||||
// Specifies the corners rounding radius of an element's outer border edge.
|
// Specifies the corners rounding radius of an element's outer border edge.
|
||||||
|
@ -30,7 +30,7 @@ const (
|
||||||
// Usage in BackgroundElement:
|
// Usage in BackgroundElement:
|
||||||
// Same as "radial-gradient-radius".
|
// Same as "radial-gradient-radius".
|
||||||
//
|
//
|
||||||
// Usage in ClipShape:
|
// Usage in ClipShapeProperty:
|
||||||
// Specifies the radius of the corners or the radius of the cropping area.
|
// Specifies the radius of the corners or the radius of the cropping area.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
|
@ -41,7 +41,7 @@ const (
|
||||||
|
|
||||||
// RadiusX is the constant for "radius-x" property tag.
|
// RadiusX is the constant for "radius-x" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, ClipShape.
|
// Used by View, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// Usage in View:
|
// Usage in View:
|
||||||
// Specifies the x-axis corners elliptic rounding radius of an element's outer border edge.
|
// Specifies the x-axis corners elliptic rounding radius of an element's outer border edge.
|
||||||
|
@ -51,7 +51,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See SizeUnit description for more details.
|
// See SizeUnit description for more details.
|
||||||
//
|
//
|
||||||
// Usage in ClipShape:
|
// Usage in ClipShapeProperty:
|
||||||
// Specifies the x-axis corners elliptic rounding radius of the elliptic clip shape.
|
// Specifies the x-axis corners elliptic rounding radius of the elliptic clip shape.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
|
@ -62,7 +62,7 @@ const (
|
||||||
|
|
||||||
// RadiusY is the constant for "radius-y" property tag.
|
// RadiusY is the constant for "radius-y" property tag.
|
||||||
//
|
//
|
||||||
// Used by View, ClipShape.
|
// Used by View, ClipShapeProperty.
|
||||||
//
|
//
|
||||||
// Usage in View:
|
// Usage in View:
|
||||||
// Specifies the y-axis corners elliptic rounding radius of an element's outer border edge.
|
// Specifies the y-axis corners elliptic rounding radius of an element's outer border edge.
|
||||||
|
@ -72,7 +72,7 @@ const (
|
||||||
// Internal type is SizeUnit, other types converted to it during assignment.
|
// Internal type is SizeUnit, other types converted to it during assignment.
|
||||||
// See SizeUnit description for more details.
|
// See SizeUnit description for more details.
|
||||||
//
|
//
|
||||||
// Usage in ClipShape:
|
// Usage in ClipShapeProperty:
|
||||||
// Specifies the y-axis corners elliptic rounding radius of of the elliptic clip shape.
|
// Specifies the y-axis corners elliptic rounding radius of of the elliptic clip shape.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
|
@ -215,10 +215,10 @@ const (
|
||||||
|
|
||||||
// X is the constant for "x" property tag.
|
// X is the constant for "x" property tag.
|
||||||
//
|
//
|
||||||
// Used by ClipShape, RadiusProperty.
|
// Used by ClipShapeProperty, RadiusProperty.
|
||||||
//
|
//
|
||||||
// Usage in ClipShape:
|
// Usage in ClipShapeProperty:
|
||||||
// Specifies x-axis position of the clip shape.
|
// Specifies x-axis position of the clip shape center.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
//
|
//
|
||||||
|
@ -236,10 +236,10 @@ const (
|
||||||
|
|
||||||
// Y is the constant for "y" property tag.
|
// Y is the constant for "y" property tag.
|
||||||
//
|
//
|
||||||
// Used by ClipShape, RadiusProperty.
|
// Used by ClipShapeProperty, RadiusProperty.
|
||||||
//
|
//
|
||||||
// Usage in ClipShape:
|
// Usage in ClipShapeProperty:
|
||||||
// Specifies y-axis position of the clip shape.
|
// Specifies y-axis position of the clip shape center.
|
||||||
//
|
//
|
||||||
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
// Supported types: SizeUnit, SizeFunc, string, float, int.
|
||||||
//
|
//
|
||||||
|
|
4
view.go
4
view.go
|
@ -560,14 +560,14 @@ func (view *viewData) propertyChanged(tag PropertyName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case Clip:
|
case Clip:
|
||||||
if clip := getClipShape(view, Clip, session); clip != nil && clip.valid(session) {
|
if clip := getClipShapeProperty(view, Clip, session); clip != nil && clip.valid(session) {
|
||||||
session.updateCSSProperty(htmlID, `clip-path`, clip.cssStyle(session))
|
session.updateCSSProperty(htmlID, `clip-path`, clip.cssStyle(session))
|
||||||
} else {
|
} else {
|
||||||
session.updateCSSProperty(htmlID, `clip-path`, "none")
|
session.updateCSSProperty(htmlID, `clip-path`, "none")
|
||||||
}
|
}
|
||||||
|
|
||||||
case ShapeOutside:
|
case ShapeOutside:
|
||||||
if clip := getClipShape(view, ShapeOutside, session); clip != nil && clip.valid(session) {
|
if clip := getClipShapeProperty(view, ShapeOutside, session); clip != nil && clip.valid(session) {
|
||||||
session.updateCSSProperty(htmlID, string(ShapeOutside), clip.cssStyle(session))
|
session.updateCSSProperty(htmlID, string(ShapeOutside), clip.cssStyle(session))
|
||||||
} else {
|
} else {
|
||||||
session.updateCSSProperty(htmlID, string(ShapeOutside), "none")
|
session.updateCSSProperty(htmlID, string(ShapeOutside), "none")
|
||||||
|
|
|
@ -382,11 +382,11 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
|
||||||
|
|
||||||
style.writeViewTransformCSS(builder, session)
|
style.writeViewTransformCSS(builder, session)
|
||||||
|
|
||||||
if clip := getClipShape(style, Clip, session); clip != nil && clip.valid(session) {
|
if clip := getClipShapeProperty(style, Clip, session); clip != nil && clip.valid(session) {
|
||||||
builder.add(`clip-path`, clip.cssStyle(session))
|
builder.add(`clip-path`, clip.cssStyle(session))
|
||||||
}
|
}
|
||||||
|
|
||||||
if clip := getClipShape(style, ShapeOutside, session); clip != nil && clip.valid(session) {
|
if clip := getClipShapeProperty(style, ShapeOutside, session); clip != nil && clip.valid(session) {
|
||||||
builder.add(`shape-outside`, clip.cssStyle(session))
|
builder.add(`shape-outside`, clip.cssStyle(session))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,7 +412,7 @@ func viewStyleSet(style Properties, tag PropertyName, value any) []PropertyName
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
case Clip, ShapeOutside:
|
case Clip, ShapeOutside:
|
||||||
return setClipShapeProperty(style, tag, value)
|
return setClipShapePropertyProperty(style, tag, value)
|
||||||
|
|
||||||
case Filter, BackdropFilter:
|
case Filter, BackdropFilter:
|
||||||
return setFilterProperty(style, tag, value)
|
return setFilterProperty(style, tag, value)
|
||||||
|
|
Loading…
Reference in New Issue