Skip to content

Commit 96c5c5d

Browse files
authored
🐛 fixed timeline bug where box shrank when panning (#499)
1 parent 0acd31b commit 96c5c5d

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Constellation Changes
22

33
## 2020-05-01 Changes in May 2020
4+
* Fixed a bug effecting the histogram scrolling
5+
* Changed parameter types for `OverviewPanel.setExtentPOV()` from longs to doubles.
46
* Fixed a bug effecting the histogram scrolling.
57
* Fixed a bug preventing v1 graphs from being open.
68

CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/OverviewPanel.java

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import javafx.scene.chart.NumberAxis;
3131
import javafx.scene.chart.XYChart;
3232
import javafx.scene.input.MouseEvent;
33-
import javafx.scene.input.ScrollEvent;
3433
import javafx.scene.layout.AnchorPane;
3534
import javafx.scene.layout.Pane;
3635
import 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>

CoreTimelineView/src/au/gov/asd/tac/constellation/views/timeline/TimelineTopComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void setExtents(final double lowerTimeExtent, final double upperTimeExten
211211

212212
timelinePanel.updateExclusionState(graphNode.getGraph(),
213213
(long) state.getLowerTimeExtent(), (long) state.getUpperTimeExtent(), state.exclusionState());
214-
overviewPanel.setExtentPOV((long) state.getLowerTimeExtent(), (long) state.getUpperTimeExtent());
214+
overviewPanel.setExtentPOV(state.getLowerTimeExtent(), state.getUpperTimeExtent());
215215
}
216216
}
217217

@@ -264,7 +264,7 @@ public void setExtents() {
264264

265265
timelinePanel.updateExclusionState(graphNode.getGraph(),
266266
(long) state.getLowerTimeExtent(), (long) state.getUpperTimeExtent(), state.exclusionState());
267-
overviewPanel.setExtentPOV((long) state.getLowerTimeExtent(), (long) state.getUpperTimeExtent());
267+
overviewPanel.setExtentPOV(state.getLowerTimeExtent(), state.getUpperTimeExtent());
268268
}
269269
}
270270

0 commit comments

Comments
 (0)