File tree Expand file tree Collapse file tree
LayerController/src/main/java/com/movtery/layer_controller
ZalithLauncher/src/main/java/com/movtery/zalithlauncher/ui/control/mouse Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -170,6 +170,15 @@ private fun BoxWithConstraintsScope.BaseControlBoxLayout(
170170 val pointerId = change.id
171171 val isPressed = change.pressed
172172
173+ // 抬起时,总是尝试释放该指针下活跃的按钮
174+ // 避免子级占用了指针后,导致按钮状态无法被释放
175+ if (! isPressed) {
176+ allActiveWidgets.remove(pointerId)?.forEach { widget ->
177+ widget.onReleaseEvent(eventHandler, reversedLayers)
178+ }
179+ return @forEach
180+ }
181+
173182 if (
174183 change.isConsumed ||
175184 // 不处理被子级占用的指针
@@ -285,10 +294,6 @@ private fun BoxWithConstraintsScope.BaseControlBoxLayout(
285294 }
286295 }
287296 }
288- } else {
289- allActiveWidgets.remove(pointerId)?.forEach { widget ->
290- widget.onReleaseEvent(eventHandler, reversedLayers)
291- }
292297 }
293298 }
294299 }
Original file line number Diff line number Diff line change @@ -163,14 +163,14 @@ fun TouchpadLayout(
163163 // 是否被父级标记为仅处理滑动
164164 val isMoveOnly = isMoveOnlyPointer(pointerId)
165165
166- // 仅在未被父级消费且未被占用的情况下,尝试占用指针
167- if (! isMoveOnly && ! change.isConsumed && pointerId !in occupiedPointers) {
168- onOccupiedPointer(pointerId)
169- occupiedPointers.add(pointerId)
170- }
171-
172166 // 如果没有活跃指针,且当前指针未被消费,则开始处理这个指针
173167 if (activePointer == null && (! change.isConsumed || isMoveOnly)) {
168+ // fix: 只有真正成为 activePointer 的指针,才标记为已占用
169+ if (! isMoveOnly && pointerId !in occupiedPointers) {
170+ onOccupiedPointer(pointerId)
171+ occupiedPointers.add(pointerId)
172+ }
173+
174174 activePointer = pointerId
175175
176176 dragStates[pointerId] =
You can’t perform that action at this time.
0 commit comments