כדי לזהות תנועות מולטי-טאץ' שמשמשות להזזה, לשינוי מרחק התצוגה ולסיבוב, אפשר:
יש להשתמש בתכונת הצירוף transformable
. תכונת הצירוף הזו לא משנה יסודות באמצעות
בעצמו, הוא מזהה רק את התנועות.
@Composable private fun TransformableSample() { // set up all transformation states var scale by remember { mutableStateOf(1f) } var rotation by remember { mutableStateOf(0f) } var offset by remember { mutableStateOf(Offset.Zero) } val state = rememberTransformableState { zoomChange, offsetChange, rotationChange -> scale *= zoomChange rotation += rotationChange offset += offsetChange } Box( Modifier // apply other transformations like rotation and zoom // on the pizza slice emoji .graphicsLayer( scaleX = scale, scaleY = scale, rotationZ = rotation, translationX = offset.x, translationY = offset.y ) // add transformable to listen to multitouch transformation events // after offset .transformable(state = state) .background(Color.Blue) .fillMaxSize() ) }
אם צריך לשלב שינוי מרחק התצוגה, הזזה וסיבוב עם תנועות אחרות,
יכול להשתמש
PointerInputScope.detectTransformGestures
במכשיר נייד.
אין המלצות כרגע.
אפשר לנסות להיכנס לחשבון Google.