ResistanceConfig

Added in 1.0.0
Deprecated in 1.6.0

Specifies how resistance is calculated in swipeable.

There are two things needed to calculate resistance: the resistance basis determines how much overflow will be consumed to achieve maximum resistance, and the resistance factor determines the amount of resistance (the larger the resistance factor, the stronger the resistance).

The resistance basis is usually either the size of the component which swipeable is applied to, or the distance between the minimum and maximum anchors. For a constructor in which the resistance basis defaults to the latter, consider using resistanceConfig.

You may specify different resistance factors for each bound. Consider using one of the default resistance factors in SwipeableDefaults: StandardResistanceFactor to convey that the user has run out of things to see, and StiffResistanceFactor to convey that the user cannot swipe this right now. Also, you can set either factor to 0 to disable resistance at that bound.

Summary

Public constructors

ResistanceConfig(basis: Float, factorAtMin: Float, factorAtMax: Float)
Cmn

Public functions

Float
Cmn
open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open String
Cmn

Public properties

Float

Specifies the maximum amount of overflow that will be consumed.

Cmn
Float

The factor by which to scale the resistance at the maximum bound.

Cmn
Float

The factor by which to scale the resistance at the minimum bound.

Cmn

Public constructors

ResistanceConfig

ResistanceConfig(
    basis: Float,
    factorAtMin: Float = StandardResistanceFactor,
    factorAtMax: Float = StandardResistanceFactor
)
Parameters
basis: Float

Specifies the maximum amount of overflow that will be consumed. Must be positive.

factorAtMin: Float = StandardResistanceFactor

The factor by which to scale the resistance at the minimum bound. Must not be negative.

factorAtMax: Float = StandardResistanceFactor

The factor by which to scale the resistance at the maximum bound. Must not be negative.

Public functions

computeResistance

fun computeResistance(overflow: Float): Float

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

basis

val basisFloat

Specifies the maximum amount of overflow that will be consumed. Must be positive.

factorAtMax

val factorAtMaxFloat

The factor by which to scale the resistance at the maximum bound. Must not be negative.

factorAtMin

val factorAtMinFloat

The factor by which to scale the resistance at the minimum bound. Must not be negative.