feat(joystick):增加摇杆半屏式移动功能#546
Open
LanRhyme wants to merge 7 commits into
Open
Conversation
MovTery
requested changes
Jan 1, 2026
Lo-quee
suggested changes
Jan 1, 2026
Collaborator
Lo-quee
left a comment
There was a problem hiding this comment.
其次,你应当考虑到,虽然大部分情况,启动器是LTR布局,但是仍有部分语种是RTL布局,比如阿拉伯语,我没有对你的代码进行测试,不过你应该考虑到这样的情况。
可以尝试增加两半屏的选项,同时启用绝对坐标的形式进行实现,同时修改语言文本减少歧义。
Collaborator
Author
|
修好了 |
Lo-quee
suggested changes
Jan 17, 2026
Collaborator
Lo-quee
left a comment
There was a problem hiding this comment.
以及,现在已经使用CompositionLocalProvider限制了布局方向,理论上不用担心RTL布局导致的问题,但是现在有一个新的习惯问题需要解决,我们貌似没有考虑到左撇子(
目前只有左半屏摇杆功能,可以将现有实现通用化(更改函数、数据类的名称,加入新的状态决定作用到左右半屏),用户可以自己进行调整
Comment on lines
+48
to
+60
| * 左半屏动态摇杆组件 | ||
| * 使用 PointerEventPass.Final 实现不阻塞底层按钮的探测 | ||
| */ | ||
| class LeftHalfScreenJoystickState { | ||
| var isVisible by mutableStateOf(false) | ||
| var center by mutableStateOf(Offset.Zero) | ||
| var joystickOffset by mutableStateOf(Offset.Zero) // 摇杆相对于中心的偏移 | ||
| var isLocked by mutableStateOf(false) | ||
| var internalCanLock by mutableStateOf(false) | ||
| } | ||
|
|
||
| @Composable | ||
| fun rememberLeftHalfScreenJoystickState() = remember { LeftHalfScreenJoystickState() } |
Collaborator
There was a problem hiding this comment.
请将状态请修改为data class形式:
data class LeftHalfScreenJoystickState(
val isVisible: Boolean = false,
val center: Offset = Offset.Zero,
val joystickOffset: Offset = Offset.Zero,
val isLocked: Boolean = false,
val internalCanLock: Boolean = false
)
@Composable
fun rememberLeftHalfScreenJoystickState() = remember { LeftHalfScreenJoystickState() }后续要进行更新状态,则可以这么做:
var state = rememberLeftHalfScreenJoystickState()
//...
state = state.copy(isVisible = true, internalCanLock = true)方便配置的同时,也有利于状态同步
Collaborator
Author
There was a problem hiding this comment.
这个我认为是没有必要的,反而会更复杂
|
这PR多久了 |
Collaborator
Author
🤔等我这两天有时间同步上游修改解决冲突后再提交一下吧 |
Collaborator
Author
|
已解决冲突,经过测试没有问题,当前pr可以被审查合并 @MovTery |
|
wow |
|
传奇PR546 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.