1 /* 2 * Copyright 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.compose.ui.input.rotary 18 19 /** 20 * This event represents a rotary input event. 21 * 22 * Some Wear OS devices contain a physical rotating side button, or a rotating bezel. When the user 23 * turns the button or rotates the bezel, a [RotaryScrollEvent] is sent to the item in focus. 24 */ 25 actual class RotaryScrollEvent 26 internal constructor( 27 /** 28 * The amount to scroll (in pixels) in response to a [RotaryScrollEvent] in a container that can 29 * scroll vertically. 30 */ 31 actual val verticalScrollPixels: Float, 32 33 /** 34 * The amount to scroll (in pixels) in response to a [RotaryScrollEvent] in a container that can 35 * scroll horizontally. 36 */ 37 actual val horizontalScrollPixels: Float, 38 39 /** 40 * The time in milliseconds at which this even occurred. The start (`0`) time is 41 * platform-dependent. 42 */ 43 actual val uptimeMillis: Long, 44 45 /** The id for the input device that this event came from */ 46 val inputDeviceId: Int 47 ) { equalsnull48 override fun equals(other: Any?): Boolean = 49 other is RotaryScrollEvent && 50 other.verticalScrollPixels == verticalScrollPixels && 51 other.horizontalScrollPixels == horizontalScrollPixels && 52 other.uptimeMillis == uptimeMillis && 53 other.inputDeviceId == inputDeviceId 54 55 override fun hashCode(): Int = 56 0.let { verticalScrollPixels.hashCode() } <lambda>null57 .let { 31 * it + horizontalScrollPixels.hashCode() } <lambda>null58 .let { 31 * it + uptimeMillis.hashCode() } <lambda>null59 .let { 31 * it + inputDeviceId.hashCode() } 60 toStringnull61 override fun toString(): String = 62 "RotaryScrollEvent(" + 63 "verticalScrollPixels=$verticalScrollPixels," + 64 "horizontalScrollPixels=$horizontalScrollPixels," + 65 "uptimeMillis=$uptimeMillis," + 66 "deviceId=$inputDeviceId)" 67 } 68