-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement - Add more click options #73
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package io.github.kakaocup.compose.node.action.extension | ||
|
||
import androidx.compose.ui.geometry.Offset | ||
import androidx.compose.ui.test.TouchInjectionScope | ||
import io.github.kakaocup.compose.node.action.option.Offsets | ||
|
||
internal fun TouchInjectionScope.createOffset( | ||
offset: Offsets, | ||
offsetX: Float? = null, | ||
offsetY: Float? = null | ||
): Offset { | ||
return when (offset) { | ||
Offsets.CENTER -> center | ||
Offsets.CENTER_LEFT -> centerLeft.copy(x = 1f) | ||
Offsets.CENTER_RIGHT -> centerRight | ||
Offsets.TOP_CENTER -> topCenter.copy(y = 1f) | ||
Offsets.TOP_LEFT -> topLeft.copy(x = 1f, y = 1f) | ||
Offsets.TOP_RIGHT -> topRight.copy(y = 1f) | ||
Offsets.BOTTOM_CENTER -> bottomCenter | ||
Offsets.BOTTOM_LEFT -> bottomLeft.copy(x = 1f) | ||
Offsets.BOTTOM_RIGHT -> bottomRight | ||
}.run { | ||
copy(x = x + (offsetX ?: 0F), y = y + (offsetY ?: 0F)) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package io.github.kakaocup.compose.node.action.option | ||
|
||
data class ClickConfig(val xOffset: Float = 0F, val yOffset: Float = 0F) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.kakaocup.compose.node.action.option | ||
|
||
data class DoubleClickConfig( | ||
val xOffset: Float = 0F, | ||
val yOffset: Float = 0F, | ||
val delayMs: Long? = null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.kakaocup.compose.node.action.option | ||
|
||
data class LongClickConfig( | ||
val xOffset: Float = 0F, | ||
val yOffset: Float = 0F, | ||
val durationMs: Long? = null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package io.github.kakaocup.compose.node.action.option | ||
|
||
enum class Offsets { | ||
CENTER, CENTER_LEFT, CENTER_RIGHT, | ||
TOP_CENTER, TOP_LEFT, TOP_RIGHT, | ||
BOTTOM_CENTER, BOTTOM_LEFT, BOTTOM_RIGHT | ||
} | ||
Comment on lines
+3
to
+7
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think will be better to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applying
offsetX
offsetY
to existingoffset
looks misleading to me.sealed
class with defaultobjects
+data class
will be more clear IMO