[Interaction Parity] 鼠标悬停在地面掉落物品图标上时应即时显示该物品名称标签 (Hover Ground Item Icon to Reveal Name Label) #447
Labels
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: troytt/diablo2-web#447
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
1. 问题背景与现状 (Bug Description & Current Behavior)
在当前客户端中,怪物掉落或玩家从包裹扔到地上的物品会以等距地面图标(Ground Sprite / Flippy 动画)形式展示在世界场景中。
然而,目前的地面名称标签(Ground Item Label)完全绑定在键盘
Alt键的按下状态上:Alt键(hudManager.showGroundLabels === true)时,系统才会批量计算并显示所有地面物品的名称标签。Alt键时,即使将鼠标光标移动并悬停在地面物品图标正上方,屏幕上也毫无任何反馈(没有名称提示框、没有品质颜色提示)。这导致玩家若不按住
Alt键,便无法通过鼠标悬停来快速查验地上的掉落物究竟为何物,与原版《暗黑破坏神 2》经典交互体验严重脱节。2. 原版 Diablo II v1.13c 地面交互规范 (Ground Truth Invariants)
在《暗黑破坏神 2》原版(v1.13c)中,地面的每个掉落物(
UNIT_ITEM,animmode = ITEMMODE_ONGROUND/ 0)均属于可悬停高亮的目标实体:Alt键时,鼠标指针滑过地面任意掉落物品的碰撞/判定区域(D2Client.dll命中测试pItemUnderMouse)时,该物品的正上方会立即单独浮现该物品的名称标签框。rgba(0, 0, 0, 0.88))、1px 细线边框、点阵字体、原版 1.13c 品质文字色彩(D2WinFont调色板)。#FFFFFF/#D8D8D8)#808080)#6868FF)#FFFF64)#00FC00)#C8A15A)#FF9C18)150 金币)Alt键时:视野内所有地面物品标签全屏展开(执行防重叠垂直阶梯排列);Alt键时:所有非悬停标签隐去;若此时鼠标仍停留在某物品图标上,该悬停物品的名称标签应无缝保留显示。pickupGroundItem将其收回背包。3. 缺陷代码定位与根因分析 (Root Cause Analysis)
标签渲染更新缺乏悬停判断分支:
在
src/scene/act-scene.ts(第 6985–7005 行):此处仅依据
hudManager.showGroundLabels(即键盘 Alt 键按下事件)决定是否显示标签,完全缺失hoveredGroundItem的单体标签显示分支。onPointerMove未针对地面物品做拾取碰撞检测 (Hit-Test Missing):在
src/scene/act-scene.ts(第 3156–3176 行):onPointerMove仅记录了lastClientPos,未在鼠标划过场景时使用engine.groundItems.findAtPoint(worldX, worldY, radius)测定鼠标下的地面物品,因此系统无法得知当前是否有物品处于悬停状态。4. 修复方案建议 (Proposed Implementation Plan)
hoveredGroundItem状态:在
ActScene(或其输入控制器中):onPointerMove时计算光标世界坐标(worldX, worldY);engine.groundItems.findAtPoint(worldX, worldY, 28)判定是否悬停在地面物品上,并缓存在场景状态中。hudManager.showGroundLabels为 true:全量显示所有物品标签(阶梯避让);hudManager.showGroundLabels为 false 但存在hoveredGroundItem:将该单个物品作为GroundLabelLayout传入,单独在该物品正上方渲染其名称标签;groundLabelOverlay.update(false, [])隐藏。pointerdown/ 点击拾取回调,保证点击标签和点击图标均能触发物品捡拾。5. 验收标准 (Acceptance Criteria)
npm run typecheck与自动化测试 100% 通过。