From f0f11765ff73bc4bfa3353301186f2c379bcf3cb Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Sat, 06 Jun 2026 23:34:46 +0800
Subject: [PATCH] fix: 严格 Space Lane hit test 垂直 band 检查,空区域(非 lane y band)直接 nil,彻底防止 hoveredSpaceLaneID 误设导致 spaceFocused 粘住 (v0.0.32)
---
C1.source/Sources/Aligner/QuickSwitchRootView.swift | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/C1.source/Sources/Aligner/QuickSwitchRootView.swift b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
index cb47fe9..7c3bd30 100644
--- a/C1.source/Sources/Aligner/QuickSwitchRootView.swift
+++ b/C1.source/Sources/Aligner/QuickSwitchRootView.swift
@@ -1929,6 +1929,16 @@
private func spaceLaneSegment(at windowLocation: CGPoint) -> SpaceLaneSegmentLayers? {
let locationInView = convert(windowLocation, from: nil)
+
+ // 严格 band 检查:只有鼠标在 lane 的垂直 band 内才考虑是 lane hover。
+ // 防止“完全空的地方”(y 不在 lane 高度范围内)误 hit 到 segment frame,
+ // 导致 hoveredSpaceLaneID 粘住、activeSpaceFocusID 非 nil、窗口 spaceFocused 高亮。
+ let laneMinYInView = glassLayer.frame.minY + laneLayer.frame.minY
+ let laneMaxYInView = laneMinYInView + laneLayer.frame.height
+ if locationInView.y < laneMinYInView || locationInView.y > laneMaxYInView {
+ return nil
+ }
+
let locationInSpaceLaneContent = CGPoint(
x: locationInView.x - glassLayer.frame.minX - laneLayer.frame.minX - spaceLaneContentLayer.frame.minX,
y: locationInView.y - glassLayer.frame.minY - laneLayer.frame.minY - spaceLaneContentLayer.frame.minY
--
Gitblit v1.9.3