blob: 46413b2ef97fb3bd580eacc1652e74ccaae06d00 [file] [log] [blame]
<html devsite="true">
<head>
<title>ResistanceConfig</title>
{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>ResistanceConfig</h1>
<p>
<pre>class <a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html">ResistanceConfig</a></pre>
</p>
<hr>
<p>Specifies how resistance is calculated in <code><a href="/reference/kotlin/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code>.</p>
<p>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).</p>
<p>The resistance basis is usually either the size of the component which <code><a href="/reference/kotlin/androidx/compose/material/package-summary.html#(androidx.compose.ui.Modifier).swipeable(androidx.compose.material.SwipeableState,kotlin.collections.Map,androidx.compose.foundation.gestures.Orientation,kotlin.Boolean,kotlin.Boolean,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function2,androidx.compose.material.ResistanceConfig,androidx.compose.ui.unit.Dp)">swipeable</a></code> 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 <code><a href="/reference/kotlin/androidx/compose/material/SwipeableDefaults.html#resistanceConfig(kotlin.collections.Set,kotlin.Float,kotlin.Float)">resistanceConfig</a></code>.</p>
<p>You may specify different resistance factors for each bound. Consider using one of the default resistance factors in <code><a href="/reference/kotlin/androidx/compose/material/SwipeableDefaults.html">SwipeableDefaults</a></code>: <code>StandardResistanceFactor</code> to convey that the user has run out of things to see, and <code>StiffResistanceFactor</code> to convey that the user cannot swipe this right now. Also, you can set either factor to 0 to disable resistance at that bound.</p>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#ResistanceConfig(kotlin.Float,kotlin.Float,kotlin.Float)">ResistanceConfig</a>(basis:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>,&nbsp;factorAtMin:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>,&nbsp;factorAtMax:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public functions</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#computeResistance(kotlin.Float)">computeResistance</a>(overflow:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>open&nbsp;operator <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#equals(kotlin.Any)">equals</a>(other:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?)</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>open <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#hashCode()">hashCode</a>()</code></div>
</td>
</tr>
<tr>
<td width="40%"><code>open <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#toString()">toString</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%"><h3>Public properties</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#basis()">basis</a></code></div>
<p>Specifies the maximum amount of overflow that will be consumed.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#factorAtMax()">factorAtMax</a></code></div>
<p>The factor by which to scale the resistance at the maximum bound.</p>
</td>
</tr>
<tr>
<td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></code></td>
<td>
<div><code><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#factorAtMin()">factorAtMin</a></code></div>
<p>The factor by which to scale the resistance at the minimum bound.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public constructors</h2>
<div><a name="ResistanceConfig(kotlin.Float, kotlin.Float, kotlin.Float)"></a><a name="ResistanceConfig-kotlin.Float-kotlin.Float-kotlin.Float-"></a><a name="resistanceconfig"></a>
<h3 class="api-name" id="ResistanceConfig(kotlin.Float,kotlin.Float,kotlin.Float)">ResistanceConfig</h3>
<pre class="api-signature no-pretty-print"><a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#ResistanceConfig(kotlin.Float,kotlin.Float,kotlin.Float)">ResistanceConfig</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;basis:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>,<br>&nbsp;&nbsp;&nbsp;&nbsp;factorAtMin:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a> = StandardResistanceFactor,<br>&nbsp;&nbsp;&nbsp;&nbsp;factorAtMax:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a> = StandardResistanceFactor<br>)</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>basis:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></code></td>
<td>
<p>Specifies the maximum amount of overflow that will be consumed. Must be positive.</p>
</td>
</tr>
<tr>
<td width="40%"><code>factorAtMin:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a> = StandardResistanceFactor</code></td>
<td>
<p>The factor by which to scale the resistance at the minimum bound. Must not be negative.</p>
</td>
</tr>
<tr>
<td width="40%"><code>factorAtMax:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a> = StandardResistanceFactor</code></td>
<td>
<p>The factor by which to scale the resistance at the maximum bound. Must not be negative.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Public functions</h2>
<div><a name="computeResistance-kotlin.Float-"></a><a name="computeresistance"></a>
<h3 class="api-name" id="computeResistance(kotlin.Float)">computeResistance</h3>
<pre class="api-signature no-pretty-print">fun&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#computeResistance(kotlin.Float)">computeResistance</a>(overflow:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a>):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></pre>
</div>
<div><a name="equals-kotlin.Any-"></a><a name="equals"></a>
<h3 class="api-name" id="equals(kotlin.Any)">equals</h3>
<pre class="api-signature no-pretty-print">open&nbsp;operator&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#equals(kotlin.Any)">equals</a>(other:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>?):&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></pre>
</div>
<div><a name="hashCode--"></a><a name="hashcode"></a>
<h3 class="api-name" id="hashCode()">hashCode</h3>
<pre class="api-signature no-pretty-print">open&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#hashCode()">hashCode</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html">Int</a></pre>
</div>
<div><a name="toString--"></a><a name="tostring"></a>
<h3 class="api-name" id="toString()">toString</h3>
<pre class="api-signature no-pretty-print">open&nbsp;fun&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#toString()">toString</a>():&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html">String</a></pre>
</div>
<h2>Public properties</h2>
<div><a name="getBasis()"></a><a name="setBasis()"></a><a name="getBasis--"></a><a name="setBasis--"></a>
<h3 class="api-name" id="basis()">basis</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#basis()">basis</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></pre>
<p>Specifies the maximum amount of overflow that will be consumed. Must be positive.</p>
</div>
<div><a name="getFactorAtMax()"></a><a name="setFactorAtMax()"></a><a name="getFactorAtMax--"></a><a name="setFactorAtMax--"></a>
<h3 class="api-name" id="factorAtMax()">factorAtMax</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#factorAtMax()">factorAtMax</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></pre>
<p>The factor by which to scale the resistance at the maximum bound. Must not be negative.</p>
</div>
<div><a name="getFactorAtMin()"></a><a name="setFactorAtMin()"></a><a name="getFactorAtMin--"></a><a name="setFactorAtMin--"></a>
<h3 class="api-name" id="factorAtMin()">factorAtMin</h3>
<pre class="api-signature no-pretty-print">val&nbsp;<a href="/reference/kotlin/androidx/compose/material/ResistanceConfig.html#factorAtMin()">factorAtMin</a>:&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html">Float</a></pre>
<p>The factor by which to scale the resistance at the minimum bound. Must not be negative.</p>
</div>
</body>
</html>