Skip to content

Commit

Permalink
perf: click
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Jan 31, 2024
1 parent e41064c commit 0c1a13c
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions app/src/main/kotlin/li/songe/gkd/data/GkdAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ val clickCenter: ActionFc = { context, node ->
}

val click: ActionFc = { context, node ->
if (node.isClickable) clickNode(context, node) else clickCenter(context, node)
if (node.isClickable) {
val result = clickNode(context, node)
if (result.result) {
result
} else {
clickCenter(context, node)
}
} else {
clickCenter(context, node)
}
}

val longClickNode: ActionFc = { _, node ->
Expand Down Expand Up @@ -96,7 +105,16 @@ val longClickCenter: ActionFc = { context, node ->


val longClick: ActionFc = { context, node ->
if (node.isLongClickable) longClickNode(context, node) else longClickCenter(context, node)
if (node.isLongClickable) {
val result = longClickNode(context, node)
if (result.result) {
result
} else {
longClickCenter(context, node)
}
} else {
longClickCenter(context, node)
}
}

val backFc: ActionFc = { context, _ ->
Expand Down

0 comments on commit 0c1a13c

Please sign in to comment.