forked from mbk-lab/rui_orig
2
0
Fork 0

Added IsTimingFunctionValid function

This commit is contained in:
Alexei Anoshenko 2022-08-11 19:12:29 +03:00
parent f3f3ddb084
commit 38a8fd2920
3 changed files with 24 additions and 21 deletions

View File

@ -5,7 +5,7 @@
* Added "overflow", "arrow", "arrow-align", "arrow-size", "arrow-width", and "arrow-offset" properties
* Added "@ruiArrowSize" and "@ruiArrowWidth" constants to the default theme
* Added Transition, Transitions, and SetTransition functions to the ViewStyle interface
* Added GetOverflow, and GetTransitions functions
* Added GetOverflow, IsTimingFunctionValid, and GetTransitions functions
* Changed GetTransition functions
# v0.8.0

View File

@ -493,19 +493,22 @@ func (animation *animationData) writeTransitionString(tag string, buffer *string
func (animation *animationData) timingFunctionCSS(session Session) string {
if timingFunction, ok := stringProperty(animation, TimingFunction, session); ok {
if timingFunction, ok = session.resolveConstants(timingFunction); ok && validateTimingFunction(timingFunction) {
if timingFunction, ok = session.resolveConstants(timingFunction); ok && IsTimingFunctionValid(timingFunction, session) {
return timingFunction
}
}
return ("ease")
}
func validateTimingFunction(timingFunction string) bool {
// IsTimingFunctionValid returns "true" if the "timingFunction" argument is the valid timing function.
func IsTimingFunctionValid(timingFunction string, session Session) bool {
switch timingFunction {
case "", EaseTiming, EaseInTiming, EaseOutTiming, EaseInOutTiming, LinearTiming:
return true
}
if timingFunc, ok := session.resolveConstants(timingFunction); ok {
timingFunction = timingFunc
size := len(timingFunction)
if size > 0 && timingFunction[size-1] == ')' {
if index := strings.IndexRune(timingFunction, '('); index > 0 {
@ -528,6 +531,7 @@ func validateTimingFunction(timingFunction string) bool {
}
}
}
}
return false
}

View File

@ -59,7 +59,6 @@ ul:focus {
outline: none;
}
.ruiRoot {
position: absolute;
top: 0px;