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

Add:Make functionality to zoom out in the trajectory view more obvious. #93

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/trajectories/view/view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ <h4 class="modal-title">{{'trajectories.view.change-color-header' | translate}}<
tooltip="{{'trajectories.view.graph-ticks-tooltip' | translate}}" (onToggled)="onAxisTypeChanged($event)">
</n52-string-toggler>
</div>
<button type="button" class="btn btn-light" (click)="zoomOut()">Zoom Out
</button>
<hr>
<div class="chart-control">
<n52-bool-toggler [value]="graphOptions.dotted" icon="line-chart"
Expand Down
17 changes: 17 additions & 0 deletions src/common/trajectories/view/view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ export class TrajectoriesViewComponent implements OnInit {

public zoomToGeometry: GeoJSON.LineString;

public zoomOut() {
// Calculate the new timespan by reducing the current timespan
const newTimespan = new Timespan(
this.timespan.from - (this.timespan.to - this.timespan.from) / 2,
this.timespan.to + (this.timespan.to - this.timespan.from) / 2
);

// Fetch new data based on the updated timespan
this.servicesConnector.getDatasetData(this.trajectory, newTimespan).subscribe(
data => {
this.graphData = data.values;
this.timespan = new Timespan(newTimespan.from, newTimespan.to);
this.selectedTimespan = new Timespan(newTimespan.from, newTimespan.to);
}
);
}

public timespan: Timespan;

public datasetIds: Array<string>;
Expand Down