Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline: fix low zoom limit for huge simultion tmes - prevent crashe… #583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alexrayne
Copy link
Contributor

Timeline: fix low zoom limit for huge simultion tmes - prevent crashes and blank screen

          enhance max zoom levels to 1sec/pixel,  for event activity on secnds scale
  • if suimulation time to huge on current zoom level, try adjust to higher zoom, keeping timeline still functional.

…s and blank screen

              enhance max zoom levels to 1sec/pixel,  for event activity on secnds scale

* if suimulation time to huge on current zoom level, try adjust to higher zoom, keeping timeline still functional.
final long focusTime,
final double focusCenter) {
currentPixelDivisor = zoomDivisor;
final double focusCenter)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the opening brace where it was (this is how almost all code in Cooja is formatted).

long now = simulation.getSimulationTime();
if (now/zoomDivisor > Integer.MAX_VALUE) {
// limit zoom to fits sim-time in timeline
int min_level = zoomGetLevel( now/Integer.MAX_VALUE );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other variables use camelCase for naming, and remove the space before/after the method argument.


long now = simulation.getSimulationTime();
if (now/zoomDivisor > Integer.MAX_VALUE) {
// limit zoom to fits sim-time in timeline
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the same indentation size as the rest of the file, in this file the code uses 2 spaces.

@@ -604,6 +616,8 @@ private void zoomFinish (final double zoomDivisor,
if (zoomDivisor != currentPixelDivisor) {
logger.info("Zoom level: adjusted out-of-range " + zoomDivisor + " us/pixel");
}

if (note != "")
logger.info("Zoom level: " + currentPixelDivisor + " microseconds/pixel " + note);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I removed the noise in commit 83c13a9, just remove this line instead of making it conditional.

@@ -124,7 +124,9 @@ public class TimeLine extends VisPlugin implements HasQuickHelp {
private static final long[] ZOOM_LEVELS = {
1, 2, 5, 10,
20, 50, 100, 200, 500, 1000,
2000, 5000, 10000, 20000, 50000, 100000 };
2000, 5000, 10000, 20000, 50000, 100000,
100000*2, 100000*5, 100000*10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the crash related to zoom levels not containing enough values, or is this change for usability?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants