forked from mbk-lab/rui_orig
Added "outline-offset" property
This commit is contained in:
parent
372f5971e8
commit
eac3379fb1
712
README-ru.md
712
README-ru.md
File diff suppressed because it is too large
Load Diff
44
README.md
44
README.md
|
@ -745,7 +745,7 @@ If all the lines of the frame are the same, then the following properties can be
|
|||
|-----------|----------|----------|---------------------|
|
||||
| "style" | Style | int | Border line style |
|
||||
| "width" | Width | SizeUnit | Border line width |
|
||||
| "color" | Color | Color | Border line color |
|
||||
| "color" | ColorTag | Color | Border line color |
|
||||
|
||||
Example
|
||||
|
||||
|
@ -836,6 +836,48 @@ equivalent to
|
|||
rui.ColorProperty: rui.Black,
|
||||
}))
|
||||
|
||||
### "outline" and "outline-offset" properties
|
||||
|
||||
The "outline" property defines the border outside the View.
|
||||
A frame line is described by three attributes: line style, thickness, and color.
|
||||
|
||||
The "outline" property is similar to the "border" property. The three main differences between an "outline" frame and a "border" frame are:
|
||||
|
||||
1) the "border" frame is always located inside the boundaries of the View, and the "outline" frame can be located both inside the View and outside it;
|
||||
|
||||
2) all sides of the "outline" frame are the same, while the sides of the "border" frame can have different color, style and thickness.
|
||||
|
||||
3) "border" thickness is added to "padding" and "outline" thickness does not affect "padding".
|
||||
|
||||
The value of the "border" property is stored as an OutlineProperty interface that implements the Properties interface (see above).
|
||||
OutlineProperty can contain the following properties:
|
||||
|
||||
| Property | Constant | Type | Description |
|
||||
|-----------|----------|----------|---------------------|
|
||||
| "style" | Style | int | Border line style |
|
||||
| "width" | Width | SizeUnit | Border line width |
|
||||
| "color" | ColorTag | Color | Border line color |
|
||||
|
||||
Line style can take the following values:
|
||||
|
||||
| Value | Constant | Name | Description |
|
||||
|:-----:|------------|----------|---------------------|
|
||||
| 0 | NoneLine | "none" | No frame |
|
||||
| 1 | SolidLine | "solid" | Solid line |
|
||||
| 2 | DashedLine | "dashed" | Dashed line |
|
||||
| 3 | DottedLine | "dotted" | Dotted line |
|
||||
| 4 | DoubleLine | "double" | Double solid line |
|
||||
|
||||
All other style values are ignored.
|
||||
|
||||
The NewOutline function is used to create the OutlineProperty interface.
|
||||
|
||||
By default, the inner border of the "outline" border is the same as the border of the View (i.e. the border is drawn around the View).
|
||||
To change this behavior, use the "outline-offset" SizeUnit property (OutlineOffset constant).
|
||||
This property defines the distance between the inner border of the frame and the border of the View.
|
||||
A positive value moves the frame away from the View's boundaries, while a negative value forces the frame to be inside the View
|
||||
(in this case, the frame is drawn on top of the contents of the View).
|
||||
|
||||
### "radius" property
|
||||
|
||||
The "radius" property sets the elliptical corner radius of the View. Radii are specified by the RadiusProperty
|
||||
|
|
|
@ -277,6 +277,10 @@ const (
|
|||
// The "outline-width" SizeUnit property sets the width of an view's outline.
|
||||
OutlineWidth = "outline-width"
|
||||
|
||||
// OutlineWidth is the constant for the "outline-offset" property tag.
|
||||
// The "outline-offset" SizeUnit property sets the amount of space between an outline and the edge or border of an element..
|
||||
OutlineOffset = "outline-offset"
|
||||
|
||||
// Shadow is the constant for the "shadow" property tag.
|
||||
// The "shadow" property adds shadow effects around a view's frame. A shadow is described
|
||||
// by X and Y offsets relative to the element, blur and spread radius, and color.
|
||||
|
|
|
@ -136,6 +136,7 @@ var sizeProperties = map[string]string{
|
|||
BorderTopWidth: BorderTopWidth,
|
||||
BorderBottomWidth: BorderBottomWidth,
|
||||
OutlineWidth: OutlineWidth,
|
||||
OutlineOffset: OutlineOffset,
|
||||
XOffset: XOffset,
|
||||
YOffset: YOffset,
|
||||
BlurRadius: BlurRadius,
|
||||
|
|
|
@ -212,7 +212,7 @@ func (style *viewStyle) cssViewStyle(builder cssBuilder, session Session) {
|
|||
for _, tag := range []string{
|
||||
Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, Left, Right, Top, Bottom,
|
||||
TextSize, TextIndent, LetterSpacing, WordSpacing, LineHeight, TextLineThickness,
|
||||
ListRowGap, ListColumnGap, GridRowGap, GridColumnGap, ColumnGap, ColumnWidth} {
|
||||
ListRowGap, ListColumnGap, GridRowGap, GridColumnGap, ColumnGap, ColumnWidth, OutlineOffset} {
|
||||
|
||||
if size, ok := sizeProperty(style, tag, session); ok && size.Type != Auto {
|
||||
cssTag, ok := sizeProperties[tag]
|
||||
|
|
|
@ -321,6 +321,12 @@ func GetOutline(view View, subviewID ...string) ViewOutline {
|
|||
return ViewOutline{Style: NoneLine, Width: AutoSize(), Color: 0}
|
||||
}
|
||||
|
||||
// GetOutlineOffset returns the subview outline offset.
|
||||
// If the second argument (subviewID) is not specified or it is "" then a offset of the first argument (view) is returned
|
||||
func GetOutlineOffset(view View, subviewID ...string) SizeUnit {
|
||||
return sizeStyledProperty(view, subviewID, OutlineOffset, false)
|
||||
}
|
||||
|
||||
// GetViewShadows returns shadows of the subview.
|
||||
// If the second argument (subviewID) is not specified or it is "" then shadows of the first argument (view) is returned.
|
||||
func GetViewShadows(view View, subviewID ...string) []ViewShadow {
|
||||
|
|
Loading…
Reference in New Issue