3030import javafx .scene .chart .NumberAxis ;
3131import javafx .scene .chart .XYChart ;
3232import javafx .scene .input .MouseEvent ;
33- import javafx .scene .input .ScrollEvent ;
3433import javafx .scene .layout .AnchorPane ;
3534import javafx .scene .layout .Pane ;
3635import javafx .scene .paint .Color ;
@@ -103,13 +102,7 @@ public OverviewPanel(final TimelineTopComponent coordinator) {
103102
104103 this .getStylesheets ().add (OverviewPanel .class .getResource (DARK_THEME ).toExternalForm ());
105104 this .getChildren ().add (innerPane );
106- this .setOnScroll (new EventHandler <ScrollEvent >() {
107-
108- @ Override
109- public void handle (final ScrollEvent t ) {
110- coordinator .zoomFromOverview (t );
111- }
112- });
105+ this .setOnScroll (coordinator ::zoomFromOverview );
113106
114107 }
115108
@@ -135,12 +128,22 @@ public void setParent(final TimelineTopComponent parent) {
135128 * @param upperBound The upper time extent that needs to be represented on
136129 * the POV component.
137130 */
138- public void setExtentPOV (long lowerBound , long upperBound ) {
139- if (lowerBound <= lowestTimeExtent ) {
140- lowerBound = (long ) lowestTimeExtent ;
131+ public void setExtentPOV (double lowerBound , double upperBound ) {
132+ if (lowerBound < lowestTimeExtent ) {
133+ lowerBound = lowestTimeExtent ;
134+
135+ final double currentUpperBound = ((pov .getX () + pov .getWidth ()) / this .getWidth () * range ) + lowestTimeExtent ;
136+ if (upperBound < currentUpperBound ) {
137+ upperBound = currentUpperBound ;
138+ }
141139 }
142- if (upperBound >= highestTimeExtent ) {
143- upperBound = (long ) highestTimeExtent ;
140+ if (upperBound > highestTimeExtent ) {
141+ upperBound = highestTimeExtent ;
142+
143+ final double currentLowerBound = (pov .getX () / this .getWidth () * range ) + lowestTimeExtent ;
144+ if (lowerBound > currentLowerBound ) {
145+ lowerBound = currentLowerBound ;
146+ }
144147 }
145148
146149 final double normalLowerBound = lowerBound - lowestTimeExtent ;
@@ -265,8 +268,8 @@ public void populateHistogram(final ReadableGraph graph, final String datetimeAt
265268 xAxis .setLowerBound (0 );
266269 xAxis .setUpperBound (intervals );
267270
268- setExtentPOV (( long ) coordinator .getTimelineLowerTimeExtent (),
269- ( long ) coordinator .getTimelineUpperTimeExtent ());
271+ setExtentPOV (coordinator .getTimelineLowerTimeExtent (),
272+ coordinator .getTimelineUpperTimeExtent ());
270273 }
271274 }
272275 // </editor-fold>
0 commit comments