feat: separate prettier from eslint

This commit is contained in:
Rainer Killinger
2023-01-11 13:25:18 +01:00
committed by Thea Schöbl
parent 939fb6ef0f
commit a88d000ccd
381 changed files with 17952 additions and 38411 deletions

View File

@@ -1,24 +1,21 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-card class="compact">
<ion-card-header>
<stapps-data-list-item
[item]="$any(item)"
id="show-more"
></stapps-data-list-item>
<stapps-data-list-item [item]="$any(item)" id="show-more"></stapps-data-list-item>
<stapps-skeleton-list-item *ngIf="!item"></stapps-skeleton-list-item>
</ion-card-header>
<ion-card-content>

View File

@@ -1,3 +1,18 @@
/*!
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
@import '../../../../theme/util/mixins';
:host {
@@ -8,7 +23,7 @@
padding: 0;
overflow: visible;
ion-card-header{
ion-card-header {
padding: 0;
border-bottom: var(--border-width-default) solid var(--border-color-default);
@@ -53,5 +68,4 @@
}
}
}
}

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
@@ -42,14 +42,9 @@ import {IonIconModule} from '../../util/ion-icon/ion-icon.module';
* @param configProvider An instance of the ConfigProvider to read the campus polygon from
* @param mapProvider An instance of the MapProvider to set the default polygon (area to show on the map)
*/
export function initMapConfigFactory(
configProvider: ConfigProvider,
mapProvider: MapProvider,
) {
export function initMapConfigFactory(configProvider: ConfigProvider, mapProvider: MapProvider) {
return async () => {
mapProvider.defaultPolygon = (await configProvider.getValue(
'campusPolygon',
)) as Polygon;
mapProvider.defaultPolygon = (await configProvider.getValue('campusPolygon')) as Polygon;
};
}
@@ -62,12 +57,7 @@ const mapRoutes: Routes = [
* Module containing map related stuff
*/
@NgModule({
declarations: [
MapPageComponent,
MapListModalComponent,
MapSingleModalComponent,
MapItemComponent,
],
declarations: [MapPageComponent, MapListModalComponent, MapSingleModalComponent, MapItemComponent],
exports: [],
imports: [
CommonModule,
@@ -83,12 +73,6 @@ const mapRoutes: Routes = [
ThingTranslateModule,
UtilModule,
],
providers: [
Geolocation,
MapProvider,
DataProvider,
DataFacetsProvider,
StAppsWebHttpClient,
],
providers: [Geolocation, MapProvider, DataProvider, DataFacetsProvider, StAppsWebHttpClient],
})
export class MapModule {}

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {ElementRef, Injectable} from '@angular/core';
import {
@@ -70,11 +70,7 @@ export class MapProvider {
* @param className CSS class name
* @param iconSize Size of the position icon
*/
static getPositionMarker(
position: MapPosition,
className: string,
iconSize: number,
) {
static getPositionMarker(position: MapPosition, className: string, iconSize: number) {
return new Marker(new LatLng(position.latitude, position.longitude), {
icon: divIcon({
className: className,
@@ -107,11 +103,7 @@ export class MapProvider {
* @param element The element containing the map
* @param interval Interval to clear when map's appearance is corrected
*/
static invalidateWhenRendered = (
map: Map,
element: ElementRef,
interval: number,
) => {
static invalidateWhenRendered = (map: Map, element: ElementRef, interval: number) => {
if (element.nativeElement.offsetWidth === 0) {
return;
}
@@ -127,9 +119,7 @@ export class MapProvider {
private positionService: PositionService,
private configProvider: ConfigProvider,
) {
this.defaultPolygon = this.configProvider.getValue(
'campusPolygon',
) as Polygon;
this.defaultPolygon = this.configProvider.getValue('campusPolygon') as Polygon;
}
/**
@@ -155,10 +145,7 @@ export class MapProvider {
* @param contextFilter Additional contextual filter (e.g. from the context menu)
* @param queryText Query (text) of the search query
*/
async searchPlaces(
contextFilter?: SCSearchFilter,
queryText?: string,
): Promise<SCSearchResponse> {
async searchPlaces(contextFilter?: SCSearchFilter, queryText?: string): Promise<SCSearchResponse> {
const buildingFilter: SCSearchFilter = {
arguments: {
field: 'type',
@@ -240,10 +227,7 @@ export class MapProvider {
order: 'asc',
arguments: {
field: 'geo',
position: [
this.positionService.position.longitude,
this.positionService.position.latitude,
],
position: [this.positionService.position.longitude, this.positionService.position.latitude],
},
},
];
@@ -251,9 +235,7 @@ export class MapProvider {
const result = await this.dataProvider.search(query);
result.data = result.data.filter(place =>
hasValidLocation(place as SCBuilding),
);
result.data = result.data.filter(place => hasValidLocation(place as SCBuilding));
return result;
}

View File

@@ -1,49 +1,25 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Location} from '@angular/common';
import {
ChangeDetectorRef,
Component,
ElementRef,
ViewChild,
} from '@angular/core';
import {ChangeDetectorRef, Component, ElementRef, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Keyboard} from '@capacitor/keyboard';
import {
AlertController,
IonRouterOutlet,
ModalController,
} from '@ionic/angular';
import {AlertController, IonRouterOutlet, ModalController} from '@ionic/angular';
import {TranslateService} from '@ngx-translate/core';
import {
SCBuilding,
SCPlace,
SCRoom,
SCSearchFilter,
SCUuid,
} from '@openstapps/core';
import {
featureGroup,
geoJSON,
LatLng,
Layer,
Map,
MapOptions,
Marker,
tileLayer,
} from 'leaflet';
import {SCBuilding, SCPlace, SCRoom, SCSearchFilter, SCUuid} from '@openstapps/core';
import {featureGroup, geoJSON, LatLng, Layer, Map, MapOptions, Marker, tileLayer} from 'leaflet';
import {Subscription} from 'rxjs';
import {DataRoutingService} from '../../data/data-routing.service';
import {ContextMenuService} from '../../menu/context/context-menu.service';
@@ -162,14 +138,10 @@ export class MapPageComponent {
this.options = {
center: geoJSON(this.mapProvider.defaultPolygon).getBounds().getCenter(),
layers: [
tileLayer(
'https://osm.server.uni-frankfurt.de/tiles/roads/x={x}&y={y}&z={z}',
{
attribution:
'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
maxZoom: this.MAX_ZOOM,
},
),
tileLayer('https://osm.server.uni-frankfurt.de/tiles/roads/x={x}&y={y}&z={z}', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
maxZoom: this.MAX_ZOOM,
}),
],
zoom: this.DEFAULT_ZOOM,
zoomControl: false,
@@ -211,11 +183,7 @@ export class MapPageComponent {
return polygonLayer.on('click', this.showItem.bind(this, place.uid));
}
const markerLayer = MapProvider.getPointMarker(
place.geo.point,
'stapps-location',
32,
);
const markerLayer = MapProvider.getPointMarker(place.geo.point, 'stapps-location', 32);
return markerLayer.on('click', this.showItem.bind(this, place.uid));
};
@@ -249,15 +217,9 @@ export class MapPageComponent {
* @param fetchAll Should fetch all items
* @param animate Should the fly animation be used
*/
async fetchAndUpdateItems(
fetchAll = false,
animate?: boolean,
): Promise<void> {
async fetchAndUpdateItems(fetchAll = false, animate?: boolean): Promise<void> {
try {
const result = await this.mapProvider.searchPlaces(
this.filterQuery,
fetchAll ? '' : this.queryText,
);
const result = await this.mapProvider.searchPlaces(this.filterQuery, fetchAll ? '' : this.queryText);
if (result.data.length === 0) {
const alert = await this.alertController.create({
buttons: [this.translateService.instant('ok')],
@@ -302,10 +264,7 @@ export class MapPageComponent {
this.dataRoutingService.itemSelectListener().subscribe(async item => {
// in case the list item is clicked
if (this.items.length > 1) {
await Promise.all([
this.modalController.dismiss(),
this.showItem(item.uid),
]);
await Promise.all([this.modalController.dismiss(), this.showItem(item.uid)]);
} else {
void this.router.navigate(['/data-detail', item.uid]);
}
@@ -313,11 +272,7 @@ export class MapPageComponent {
this.positionService.watchCurrentLocation({maximumAge: 3000}).subscribe({
next: (position: MapPosition) => {
this.position = position;
this.positionMarker = MapProvider.getPositionMarker(
position,
'stapps-device-location',
32,
);
this.positionMarker = MapProvider.getPositionMarker(position, 'stapps-device-location', 32);
},
error: async _error => {
this.locationStatus = await Geolocation.checkPermissions();

View File

@@ -1,16 +1,16 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<stapps-context contentId="map"></stapps-context>
@@ -65,26 +65,13 @@
size="small"
(click)="mapListModal.present()"
>
<ion-icon name="list"></ion-icon>&nbsp;&nbsp;{{
'map.page.buttons.SHOW_LIST' | translate
}}
<ion-icon name="list"></ion-icon>&nbsp;&nbsp;{{ 'map.page.buttons.SHOW_LIST' | translate }}
</ion-button>
<ion-button
color="light"
shape="round"
size="small"
(click)="onPositionClick()"
>
<ion-icon
*ngIf="position !== null; else noLocationIcon"
name="my_location"
></ion-icon>
<ion-button color="light" shape="round" size="small" (click)="onPositionClick()">
<ion-icon *ngIf="position !== null; else noLocationIcon" name="my_location"></ion-icon>
<ng-template #noLocationIcon>
<ion-icon
*ngIf="
locationStatus.location !== 'denied';
else deniedLocationIcon
"
*ngIf="locationStatus.location !== 'denied'; else deniedLocationIcon"
name="location_searching"
></ion-icon>
</ng-template>
@@ -93,11 +80,7 @@
</ng-template>
</ion-button>
</div>
<stapps-map-item
*ngIf="items.length === 1"
[item]="items[0]"
(onClose)="resetView()"
></stapps-map-item>
<stapps-map-item *ngIf="items.length === 1" [item]="items[0]" (onClose)="resetView()"></stapps-map-item>
</div>
<div class="map-buttons floating-buttons">
<ion-button
@@ -107,20 +90,10 @@
size="small"
(click)="mapListModal.present()"
>
<ion-icon name="list"></ion-icon>&nbsp;&nbsp;{{
'map.page.buttons.SHOW_LIST' | translate
}}
<ion-icon name="list"></ion-icon>&nbsp;&nbsp;{{ 'map.page.buttons.SHOW_LIST' | translate }}
</ion-button>
<ion-button
color="light"
shape="round"
size="small"
(click)="onPositionClick()"
>
<ion-icon
*ngIf="position !== null; else noLocationIcon"
name="my_location"
></ion-icon>
<ion-button color="light" shape="round" size="small" (click)="onPositionClick()">
<ion-icon *ngIf="position !== null; else noLocationIcon" name="my_location"></ion-icon>
<ng-template #noLocationIcon>
<ion-icon
*ngIf="locationStatus.location !== 'denied'; else deniedLocationIcon"

View File

@@ -1,3 +1,18 @@
/*!
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
ion-content {
// fixes the unexpected issue that the content is not fullscreen (behind the header)
position: absolute;
@@ -42,7 +57,7 @@ ion-toolbar:first-of-type {
width: 100%;
padding: 0 var(--spacing-md) 8vh;
justify-content: center;
ion-card {
margin: 0;
}
@@ -69,7 +84,6 @@ div.floating-buttons {
}
div.map-buttons {
ion-button {
margin: 4px;
// important for iOS
@@ -81,7 +95,8 @@ div.map-buttons {
background: white;
}
ion-button::part(native):hover, ion-button::part(native):focus {
ion-button::part(native):hover,
ion-button::part(native):focus {
background: whitesmoke;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -47,10 +47,7 @@ export class MapListModalComponent implements OnInit {
*/
@Input() queryText?: string;
constructor(
private mapProvider: MapProvider,
readonly modalController: ModalController,
) {}
constructor(private mapProvider: MapProvider, readonly modalController: ModalController) {}
/**
* Populate the list with the results from the search
@@ -68,14 +65,8 @@ export class MapListModalComponent implements OnInit {
field: 'geo',
shape: {
coordinates: [
[
this.mapBounds.getNorthWest().lng,
this.mapBounds.getNorthWest().lat,
],
[
this.mapBounds.getSouthEast().lng,
this.mapBounds.getSouthEast().lat,
],
[this.mapBounds.getNorthWest().lng, this.mapBounds.getNorthWest().lat],
[this.mapBounds.getSouthEast().lng, this.mapBounds.getSouthEast().lat],
],
type: 'envelope',
},
@@ -92,10 +83,8 @@ export class MapListModalComponent implements OnInit {
}
const geofencedFilterQuery = geofencedFilter ?? this.filterQuery;
this.mapProvider
.searchPlaces(geofencedFilterQuery, this.queryText)
.then(result => {
this.items = result.data as SCPlace[];
});
this.mapProvider.searchPlaces(geofencedFilterQuery, this.queryText).then(result => {
this.items = result.data as SCPlace[];
});
}
}

View File

@@ -1,16 +1,16 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<div class="container">
@@ -18,16 +18,11 @@
<ion-toolbar color="primary" mode="ios">
<ion-title>{{ 'map.modals.list.TITLE' | translate }}</ion-title>
<ion-buttons slot="end">
<ion-button (click)="modalController.dismiss()">{{
'app.ui.CLOSE' | translate
}}</ion-button>
<ion-button (click)="modalController.dismiss()">{{ 'app.ui.CLOSE' | translate }}</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content fullscreen>
<stapps-data-list
[loading]="!items"
[items]="$any(items)"
></stapps-data-list>
<stapps-data-list [loading]="!items" [items]="$any(items)"></stapps-data-list>
</ion-content>
</div>

View File

@@ -1,16 +1,26 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header translucent>
<ion-toolbar color="primary" mode="ios">
<ion-title>{{ 'map.modals.single.TITLE' | translate }}</ion-title>
<ion-buttons slot="end">
<ion-button (click)="modalController.dismiss()">{{
'app.ui.CLOSE' | translate
}}</ion-button>
<ion-button (click)="modalController.dismiss()">{{ 'app.ui.CLOSE' | translate }}</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<stapps-data-detail-content
[item]="$any(item)"
[openAsModal]="true"
></stapps-data-detail-content>
<stapps-data-detail-content [item]="$any(item)" [openAsModal]="true"></stapps-data-detail-content>
</ion-content>

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2021 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -18,12 +18,7 @@ import {HttpClientModule} from '@angular/common/http';
import {StorageModule} from '../storage/storage.module';
import {MapPosition, PositionService} from './position.service';
import {ConfigProvider} from '../config/config.provider';
import {
LoggerConfig,
LoggerModule,
NGXLogger,
NGXMapperService,
} from 'ngx-logger';
import {LoggerConfig, LoggerModule, NGXLogger, NGXMapperService} from 'ngx-logger';
describe('PositionService', () => {
let positionService: PositionService;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -51,16 +51,12 @@ export class PositionService {
* @param options Options which define which data should be provided (e.g. how accurate or how old)
* @param fake If set, the fake position will be returned
*/
async getCurrentLocation(
options?: PositionOptions,
fake?: Position,
): Promise<MapPosition> {
async getCurrentLocation(options?: PositionOptions, fake?: Position): Promise<MapPosition> {
const geoPosition = fake ?? (await Geolocation.getCurrentPosition(options));
this.position = {
heading:
Number.isNaN(geoPosition.coords.heading) ||
geoPosition.coords.heading == undefined
Number.isNaN(geoPosition.coords.heading) || geoPosition.coords.heading == undefined
? undefined
: geoPosition.coords.heading,
latitude: geoPosition.coords.latitude,
@@ -80,10 +76,9 @@ export class PositionService {
return undefined;
}
return new LatLng(
this.position.latitude,
this.position.longitude,
).distanceTo(geoJSON(point).getBounds().getCenter());
return new LatLng(this.position.latitude, this.position.longitude).distanceTo(
geoJSON(point).getBounds().getCenter(),
);
}
/**
@@ -99,8 +94,7 @@ export class PositionService {
} else {
this.position = {
heading:
Number.isNaN(position?.coords.heading) ||
position?.coords.heading == undefined
Number.isNaN(position?.coords.heading) || position?.coords.heading == undefined
? undefined
: position.coords.heading,
latitude: position?.coords.latitude ?? 0,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -58,24 +58,16 @@ export class MapWidgetComponent implements OnInit {
* Prepare the map
*/
ngOnInit() {
const markerLayer = MapProvider.getPointMarker(
this.place.geo.point,
'stapps-location',
32,
);
const markerLayer = MapProvider.getPointMarker(this.place.geo.point, 'stapps-location', 32);
this.options = {
center: geoJSON(this.place.geo.polygon || this.place.geo.point)
.getBounds()
.getCenter(),
layers: [
tileLayer(
'https://osm.server.uni-frankfurt.de/tiles/roads/x={x}&y={y}&z={z}',
{
attribution:
'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 18,
},
),
tileLayer('https://osm.server.uni-frankfurt.de/tiles/roads/x={x}&y={y}&z={z}', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
maxZoom: 18,
}),
markerLayer,
],
zoom: 16,

View File

@@ -1,16 +1,16 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<div
@@ -21,12 +21,7 @@
[leafletOptions]="options"
></div>
<div class="map-buttons" *ngIf="showExpandButton">
<ion-button
color="primary"
shape="round"
size="small"
[routerLink]="['/map', place.uid]"
>
<ion-button color="primary" shape="round" size="small" [routerLink]="['/map', place.uid]">
<ion-icon name="zoom_out_map"></ion-icon>
</ion-button>
</div>