我必须用显示当前时间的线创建时间轴.我正在使用AnchorPane添加放置在ScrollPane中的行.我需要模拟1天,滚动窗格宽度为(2880px,每60px为1小时).我的限制是(前一天12小时,第二天12小时).移动我的线路工作正常.
我需要做的就是在视口中间设置一行并在其下移动内容.对于移动线我使用这种方法:
scrollPane.setHvalue( line.getStartX() - anchorPane.width);
Run Code Online (Sandbox Code Playgroud)
它工作"很好".内容正在移动,但线路正在向前发展.我在线路为0:00(位置设置为0.25)时开始,当位置为(0.75)24 h时结束.我也正在缩放我的时间轴Y轴
/* where line position is calculate by scale, scale is x2, x3, x4.... */
scrollPane.setHvalue( line.getStartX() - anchorPane.width * scale);
Run Code Online (Sandbox Code Playgroud)
请看imgs几小时:0:00,12:00,24:00 ...正确的行位置仅在12:00 ...如何修改功能来设置行的位置?

小智 0
该行必须位于滚动窗格内是否有原因。为什么不将其覆盖在整个滚动窗格上呢?
或者参阅这篇关于使用绑定来修复滚动窗格内的节点的文章:AlwaysvisiblewhenscrolledanchoredNodeinJavaFX2.0?
| 归档时间: |
|
| 查看次数: |
2032 次 |
| 最近记录: |