I need to create a timeline with a line showing the current time. I am using AnchorPane with an added line located in a ScrollPane. I need to simulate 1 day, scroll width (2880 pixels, every 60 pixels - one hour). My limits (previous day 12 hours and next day 12 hours). Moving my line is working fine.
All I have to do is set the line in the middle of the viewport and move the content under it. For a moving line, I use this method:
scrollPane.setHvalue( line.getStartX() - anchorPane.width);
It works "excellent." The content moves, but the line moves. I start when the line is 0:00 (the position is set to 0.25) and ends when the position (0.75) is 24 hours. I also scale my axis of the timeline Y so
scrollPane.setHvalue( line.getStartX() - anchorPane.width * scale);
Please see imgs for several hours: 0:00, 12:00, 24:00 ... The correct line position is only at 12:00 ... How can I modify the function to set the line position?



source share