Closes #52 Add attribution to map.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
</div>
|
||||
</mat-toolbar>
|
||||
|
||||
<mat-sidenav-container style="flex:1;">
|
||||
<mat-sidenav-container style="flex:1;" autosize>
|
||||
<mat-sidenav [mode]="compact?'over':'side'" [opened]="opened">
|
||||
<app-drawer></app-drawer>
|
||||
</mat-sidenav>
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ResourceService {
|
||||
'share_dialog_placeholder': 'Freigabelink',
|
||||
'share_dialog_success': 'Die Freigabe wurde erfolgreich hinzugefügt.',
|
||||
'share_dialog_error': 'Die Freigabe konnte nicht erstellt werden. Hast Du den Freigabelink vollständig eingegeben?',
|
||||
'tile_map_attribution': 'Maptology',
|
||||
'tile_map_attribution': 'Kartendaten: <a href="https://www.openstreetmap.de">© OpenStreetMap</a> | Visualisierung: <a href="https://www.locoslab.com/de/">© Locoslab GmbH</a>',
|
||||
// views
|
||||
'export_title' : 'Export',
|
||||
'export_explain_title' : 'Daten exportieren',
|
||||
@@ -506,7 +506,7 @@ export class ResourceService {
|
||||
'share_dialog_placeholder': 'Sharing link',
|
||||
'share_dialog_success': 'The share was added successfully.',
|
||||
'share_dialog_error': 'Unable to add the sharing link. Did you type it in correctly?',
|
||||
'tile_map_attribution': 'Maptology',
|
||||
'tile_map_attribution': 'Map data: <a href="https://www.openstreetmap.org">© OpenStreetMap</a> | Visualization: <a href="https://www.locoslab.com/en/">© Locoslab GmbH</a>',
|
||||
// views
|
||||
'export_title' : 'Export',
|
||||
'export_explain_title' : 'Export data',
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
<div fxLayout.gt-sm="row" fxLayout.lt-md="column" fxLayoutAlign.gt-sm="center start" fxLayoutAlign.lt-md="center center" fxLayoutGap="10px" style="margin: 20px;" >
|
||||
<mat-card class="mat-typography" style="width:400px">
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>{{ res.strings('reset_title') }}</mat-card-title>
|
||||
<mat-card-subtitle>{{ res.strings('reset_subtitle') }}</mat-card-subtitle>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<form #resetForm="ngForm">
|
||||
<app-login-field [login]="login" (keyup.enter)="onReset()"></app-login-field>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center">
|
||||
<ng-container *ngIf="idle | async as submittable;else progressBar">
|
||||
<button #loginButton mat-raised-button color="accent" [disabled]="!submittable || resetForm.invalid" (click)="onReset()">
|
||||
<mat-icon class="icon-button">lock_open</mat-icon>
|
||||
<span>{{ res.strings('button_reset') }}</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
<ng-template #progressBar>
|
||||
<mat-spinner [diameter]="36"></mat-spinner>
|
||||
</ng-template>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
<div style="min-height:100%;width:100%;display:flex">
|
||||
<div style="display:flex;flex: 1;justify-content: center;align-items: center">
|
||||
<mat-card class="mat-typography" style="width:400px">
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>{{ res.strings('reset_title') }}</mat-card-title>
|
||||
<mat-card-subtitle>{{ res.strings('reset_subtitle') }}</mat-card-subtitle>
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<form #resetForm="ngForm">
|
||||
<app-login-field [login]="login" (keyup.enter)="onReset()"></app-login-field>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center">
|
||||
<ng-container *ngIf="idle | async as submittable;else progressBar">
|
||||
<button #loginButton mat-raised-button color="accent"
|
||||
[disabled]="!submittable || resetForm.invalid" (click)="onReset()">
|
||||
<mat-icon class="icon-button">lock_open</mat-icon>
|
||||
<span>{{ res.strings('button_reset') }}</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
<ng-template #progressBar>
|
||||
<mat-spinner [diameter]="36"></mat-spinner>
|
||||
</ng-template>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
<div style="display:flex;flex:1;height:100%">
|
||||
<div style="display:flex;flex:1;height:100%;width:100%">
|
||||
<app-tile-map #tile style="display:flex;flex:1;min-height:100%;min-width:100%;"></app-tile-map>
|
||||
<div #overlay style="position:absolute;flex-direction:column;right:0px;overflow:auto;max-height: 100%;z-index:1000000;">
|
||||
<ng-content></ng-content>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, ElementRef, ViewChild, DoCheck } from '@angular/core';
|
||||
import * as L from 'leaflet';
|
||||
import { ResourceService } from '../services/resource.service';
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ResourceService } from '../services/resource.service';
|
||||
selector: 'app-tile-map',
|
||||
templateUrl: './tile-map.component.html'
|
||||
})
|
||||
export class TileMapComponent implements OnInit {
|
||||
export class TileMapComponent implements OnInit, DoCheck {
|
||||
|
||||
private static readonly DEFAULT_LOCATION = new L.LatLng(51.461663, 7.016645);
|
||||
private static readonly DEFAULT_ZOOM = 13;
|
||||
@@ -23,6 +23,7 @@ export class TileMapComponent implements OnInit {
|
||||
|
||||
map: L.Map;
|
||||
layer: L.TileLayer;
|
||||
attribution: L.Control;
|
||||
|
||||
readonly iconNormal: L.Icon;
|
||||
readonly iconSelected: L.Icon;
|
||||
@@ -35,6 +36,13 @@ export class TileMapComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
ngDoCheck() {
|
||||
this.map.removeControl(this.attribution);
|
||||
this.attribution = L.control.attribution({ position: 'bottomleft' });
|
||||
this.map.addControl(this.attribution);
|
||||
this.map.invalidateSize();
|
||||
}
|
||||
|
||||
getWidth(): number {
|
||||
if (this.mapElement) {
|
||||
return this.mapElement.nativeElement.clientWidth;
|
||||
@@ -52,12 +60,17 @@ export class TileMapComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.map = new L.Map('map');
|
||||
const object = this;
|
||||
this.map = new L.Map('map', { attributionControl: false });
|
||||
this.map.setView(TileMapComponent.DEFAULT_LOCATION, TileMapComponent.DEFAULT_ZOOM);
|
||||
this.attribution = L.control.attribution({ position: 'bottomleft' });
|
||||
this.map.addControl(this.attribution);
|
||||
this.layer = new L.TileLayer(TileMapComponent.DEFAULT_TILE_URL, {
|
||||
attribution: this.res.strings('tile_map_attribution'),
|
||||
maxZoom: 18
|
||||
}).addTo(this.map);
|
||||
this.layer.getAttribution = function(): string {
|
||||
return object.res.strings('tile_map_attribution');
|
||||
};
|
||||
}
|
||||
|
||||
private createMarkerIcon(url: string): L.Icon {
|
||||
|
||||
Reference in New Issue
Block a user