UniversalLocationInteractableStep
非路点交互(地图中立)
基本信息
| 属性 | 值 |
|---|---|
| 路径 | com.gtnewhorizons.navigator.api.model.steps.UniversalLocationInteractableStep |
| 行数 | 75 |
| 声明 | public abstract class ...<T extends ILocationProvider> extends UniversalRenderStep<T>(:16) |
README.md 推荐路径之一:
Use UniversalLocationInteractableStep for non-waypoint interaction。
构造器(:19-21)
public UniversalLocationInteractableStep(T location) { super(location); }
只透传数据点。
唯一抽象方法(:23)
public abstract void draw(double x, double y, float drawScale, double zoom);
⚠️ 4 个参数且 drawScale 是 float 而 zoom 是 double ——
类型不对称。drawScale 传 float(精度受限),
zoom 传 double。
⚠️ 父类 UniversalRenderStep 有
x / y / zoom 等 protected 字段,
但 draw 又从参数接收 x / y / zoom ——
所以字段与方法参数是两套来源,
子类必须弄清该用哪个(本类显然用参数)。
命中测试的三个重载
| 方法 | 行 | 说明 |
|---|---|---|
isMouseOver(int mouseX, int mouseY) |
:44-~53 |
可覆写的矩形命中 |
isMouseOver(double, double, double scale) |
:64-66 |
final,带缩放 |
mouseOver(int, int) |
:55-62 |
final,内部调上面的 |
javadoc(:38)明写
Tests the default rectangular hit area ——
即 isMouseOver(int,int) 默认按 width × height 的矩形判定,
子类可覆写成圆形/多边形等。
⚠️ mouseOver 与 isMouseOver(double,double,double) 都是 final ——
子类只能覆写 isMouseOver(int,int)。
这保证了 mouseOver 内部永远调用到子类的覆写版本。
三个 no-op / 转发方法
| 方法 | 行 | 说明 |
|---|---|---|
drawCustomTooltip(FontRenderer, int, int, int, int) |
:34-36 |
空实现(子类覆写画自定义 tooltip) |
drawCustomTooltip(GuiScreen, double, double, double, int) |
:68-72 |
同上,另一套签名 |
onActionKeyPressed() |
:74 |
空实现,收到 ACTION_KEY 时的钩子 |
⚠️ 两个 drawCustomTooltip 重载签名完全不同
(FontRenderer vs GuiScreen;int vs double 坐标)——
分别对应 JourneyMap 与 Xaero 的 tooltip 绘制入口。
⚠️ onActionKeyPressed() 是 ACTION_KEY
(NavigatorApi,默认 DELETE)的钩子,
默认什么都不做。
子类
UniversalInteractableStep(21 行)——
泛型收窄到 T extends IWaypointAndLocationProvider,
加「双击切换路点」的默认行为。
相关
- UniversalRenderStep - 父类
- UniversalInteractableStep - 子类
- UniversalInteractableRenderer - 生成方
- NavigatorApi -
ACTION_KEY