Skip to content

Commit

Permalink
Fix coordinates panel ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Waguramu committed Jan 24, 2025
1 parent caecb53 commit ac31970
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions erdblick_app/app/coordinates.panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {CesiumMath} from "./cesium";
import {ClipboardService} from "./clipboard.service";
import {coreLib} from "./wasm";
import {InspectionService} from "./inspection.service";
import {KeyValue} from "@angular/common";

interface PanelOption {
name: string,
Expand Down Expand Up @@ -37,15 +38,15 @@ interface PanelOption {
<span *ngFor="let component of coords.value" class="coord-span">{{ component }}</span>
</div>
</ng-container>
<ng-container *ngFor="let tileId of mapgetTileIds | keyvalue">
<ng-container *ngFor="let tileId of mapgetTileIds | keyvalue: compareLevels">
<div *ngIf="isSelectedOption(tileId.key)" class="coordinates-entry">
<span class="name-span"
(click)="clipboardService.copyToClipboard(tileId.value.toString())">{{ tileId.key }}
:</span>
<span class="coord-span">{{ tileId.value }}</span>
</div>
</ng-container>
<ng-container *ngFor="let tileId of auxiliaryTileIds | keyvalue">
<ng-container *ngFor="let tileId of auxiliaryTileIds | keyvalue: compareLevels">
<div *ngIf="isSelectedOption(tileId.key)" class="coordinates-entry">
<span class="name-span"
(click)="clipboardService.copyToClipboard(tileId.value.toString())">{{ tileId.key }}
Expand Down Expand Up @@ -227,4 +228,11 @@ export class CoordinatesPanelComponent {
return array;
}, new Array<string>()));
}

compareLevels(a: KeyValue<string, bigint> , b: KeyValue<string, bigint>): number {
const aLevel = parseInt(a.key.match(/\d+/)?.[0] ?? '0', 10);
const bLevel = parseInt(b.key.match(/\d+/)?.[0] ?? '0', 10);

return aLevel - bLevel;
}
}
2 changes: 1 addition & 1 deletion erdblick_app/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ body {
padding-bottom: 0;
gap: 0.5em;
overflow-y: auto;
max-width: calc(100vw - 25em);
max-width: calc(100vw - 35em);
align-items: center;

& > .coordinates-entry:nth-child(1) {
Expand Down

0 comments on commit ac31970

Please sign in to comment.