Skip to content

Commit

Permalink
Add button to center vessel in the Vessels List
Browse files Browse the repository at this point in the history
  • Loading branch information
panaaj committed Aug 4, 2023
1 parent d892441 commit 5517e07
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG: Freeboard

### v2.2.0

- **Added**: Ability to center a vessel in the Vessels List.

### v2.1.0

- **Added**: Ability to limit map zoom to min / max of displayed charts.
Expand Down
1 change: 1 addition & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
(properties)="featureProperties({ id: $event, type: 'ais' })"
(closed)="displayLeftMenu()"
(focusVessel)="switchActiveVessel($event)"
(pan)="centerResource($event.center, $event.zoomLevel)"
>
</ais-list>

Expand Down
10 changes: 9 additions & 1 deletion src/app/modules/skresources/lists/aislist.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,20 @@
UNFOCUS
</button>
</div>
<button
mat-icon-button
color="primary"
[disabled]="app.config.map.moveMap"
(click)="emitCenter(r[1].position)"
matTooltip="Center Vessel"
>
<mat-icon>center_focus_strong</mat-icon>
</button>
<div>
<button
mat-button
(click)="itemProperties(r[0])"
matTooltip="Vessel Properties"
matTooltipPosition="right"
>
<mat-icon color="primary">info_outline</mat-icon>
INFO
Expand Down
12 changes: 11 additions & 1 deletion src/app/modules/skresources/lists/aislist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@angular/core';
import { AppInfo } from 'src/app/app.info';
import { SKVessel } from 'src/app/modules/skresources/resource-classes';
import { Position } from 'src/app/lib/geoutils';

//** AIS Dialog **
@Component({
Expand All @@ -22,14 +23,16 @@ export class AISListComponent {
@Output() closed: EventEmitter<void> = new EventEmitter();
@Output() properties: EventEmitter<string> = new EventEmitter();
@Output() focusVessel: EventEmitter<string> = new EventEmitter();
@Output() pan: EventEmitter<{ center: Position; zoomLevel: number }> =
new EventEmitter();

aisAvailable = [];
filterList = [];
filterText = '';
someSel = false;
allSel = false;

constructor(private app: AppInfo) {}
constructor(public app: AppInfo) {}

ngOnInit() {
this.initItems();
Expand Down Expand Up @@ -130,4 +133,11 @@ export class AISListComponent {
focus(id?: string) {
this.focusVessel.emit(id);
}

emitCenter(position: Position) {
this.pan.emit({
center: position,
zoomLevel: this.app.config.map.zoomLevel
});
}
}

0 comments on commit 5517e07

Please sign in to comment.