SizeFunc
Table of contents
Describes a function that calculates the SizeUnit
size. Used as the value of the SizeUnit
properties. "min", "max", "clamp", "sum", "sub", "mul", "div", "mod", "rem", "round", "round-up", "round-down" and "round-to-zero" functions are available
Create from source
func ClampSize(min, value, max any) SizeFunc
Creates a SizeUnit
function whose the result is calculated as follows: min ≤ value ≤ max -> value; value < min -> min; max < value -> max; Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
.
func DivSize(arg0, arg1 any) SizeFunc
Creates a SizeUnit
function that calculates the result of dividing the arguments (arg1 / arg2). Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float64
, float32
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func MaxSize(arg0, arg1 any, args ...any) SizeFunc
Creates a SizeUnit
function that calculates the maximum argument. Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
func MinSize(arg0, arg1 any, args ...any) SizeFunc
Creates a SizeUnit
function that calculates the minimum argument. Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
func ModSize(arg0, arg1 any) SizeFunc
Creates a SizeUnit
function that calculates the remainder of a division operation with the same sign as the divisor (arg1 % arg2). Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func MulSize(arg0, arg1 any) SizeFunc
Creates a SizeUnit
function that calculates the result of multiplying the arguments (arg1 * arg2). Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float64
, float32
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func RemSize(arg0, arg1 any) SizeFunc
Creates a SizeUnit
function that calculates the remainder of a division operation with the same sign as the dividend (arg1 % arg2). Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func RoundDownSize(valueToRound, roundingInterval any) SizeFunc
Creates a SizeUnit
function that calculates a rounded number. The function rounds valueToRound (first argument) down to the nearest integer multiple of roundingInterval (second argument) (if the value is negative, it will become "more negative"). Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func RoundSize(valueToRound, roundingInterval any) SizeFunc
Creates a SizeUnit
function that calculates a rounded number. The function rounds valueToRound (first argument) to the nearest integer multiple of roundingInterval (second argument), which may be either above or below the value. If the valueToRound is half way between the rounding targets above and below (neither is "nearest"), it will be rounded up. Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func RoundToZeroSize(valueToRound, roundingInterval any) SizeFunc
Creates a SizeUnit
function that calculates a rounded number. The function rounds valueToRound (first argument) to the nearest integer multiple of roundingInterval (second argument), which may be either above or below the value. If the valueToRound is half way between the rounding targets above and below. Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func RoundUpSize(valueToRound, roundingInterval any) SizeFunc
Creates a SizeUnit
function that calculates a rounded number. The function rounds valueToRound (first argument) up to the nearest integer multiple of roundingInterval (second argument) (if the value is negative, it will become "more positive"). Valid arguments types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
. The second argument can also be a number (float32
, float64
, int
, int8
...int64
, uint
, uint8
...unit64
) or a string which is a text representation of a number
func SubSize(arg0, arg1 any) SizeFunc
Creates a SizeUnit
function that calculates the result of subtracting the arguments (arg1 - arg2). Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
func SumSize(arg0, arg1 any, args ...any) SizeFunc
SumSize
creates a SizeUnit
function that calculates the sum of arguments. Valid argument types are SizeUnit
, SizeFunc
and a string which is a text description of SizeUnit
or SizeFunc
.
Create from resource
View {
width = "min(50%, 250px)",
}
Interface description
Inherit methods from fmt.Stringer
Args() []any
Returns a list of function arguments
Name() string
Returns the function name: "min", "max", "clamp", "sum", "sub", "mul", "div", "mod", "rem", "round", "round-up", "round-down" and "round-to-zero"