Commit 1eb99bc4 authored by Andres Käver's avatar Andres Käver
Browse files

leafletjs

parent 2aaf2926
Pipeline #782 passed with stages
in 1 minute and 19 seconds
......@@ -380,6 +380,11 @@
"integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==",
"dev": true
},
"@types/geojson": {
"version": "7946.0.7",
"resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.7.tgz",
"integrity": "sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ=="
},
"@types/glob": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
......@@ -406,6 +411,14 @@
"integrity": "sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA==",
"dev": true
},
"@types/leaflet": {
"version": "1.5.12",
"resolved": "https://registry.npmjs.org/@types/leaflet/-/leaflet-1.5.12.tgz",
"integrity": "sha512-61HRMIng+bWvnnAIqUWLBlrd/TQZc4gU+gN1JL4K47EDtwIrcMEhWgi7PdcpbG1YmpH4F0EfOimkvV82gJIl9w==",
"requires": {
"@types/geojson": "*"
}
},
"@types/lodash": {
"version": "4.14.150",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.150.tgz",
......@@ -7039,6 +7052,11 @@
"flush-write-stream": "^1.0.2"
}
},
"leaflet": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.6.0.tgz",
"integrity": "sha512-CPkhyqWUKZKFJ6K8umN5/D2wrJ2+/8UIpXppY7QDnUZW5bZL5+SEI2J7GBpwh4LIupOKqbNSQXgqmrEJopHVNQ=="
},
"levn": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
......
......@@ -8,12 +8,14 @@
},
"license": "MIT",
"dependencies": {
"@types/leaflet": "^1.5.12",
"aurelia-animator-css": "^1.0.4",
"aurelia-bootstrapper": "^2.3.3",
"bootstrap": "^4.4.1",
"eslint": "^6.8.0",
"font-awesome": "^4.7.0",
"jquery": "3.4.1",
"leaflet": "^1.6.0",
"popper.js": "^1.16.1",
"tslib": "^1.11.1",
"whatwg-fetch": "^3.0.0"
......
......@@ -3,6 +3,7 @@ import { autoinject, LogManager, View } from 'aurelia-framework';
import { RouterConfiguration, Router, RouteConfig, NavigationInstruction } from 'aurelia-router';
import { EventAggregator, Subscription } from 'aurelia-event-aggregator';
export const log = LogManager.getLogger('app.App');
@autoinject
......@@ -10,6 +11,8 @@ export class App {
router?: Router;
private subscriptions: Subscription[] = [];
map?: L.Map;
// ================================= view lifecycle ===============================
created(owningView: View, myView: View): void {
log.debug("created");
......@@ -57,7 +60,7 @@ export class App {
this.router = router;
config.title = 'SportMap';
config.map([
{route: ['','home'], name: 'home', moduleId: PLATFORM.moduleName('views/home/index'), nav: true, title: 'Home'},
{ route: ['', 'home'], name: 'home', moduleId: PLATFORM.moduleName('views/home/index'), nav: true, title: 'Home' },
]);
config.mapUnknownRoutes('views/home/index');
......
<template>
home-index
<div id="map"></div>
</template>
import { PLATFORM } from 'aurelia-pal';
import { autoinject, LogManager, View } from 'aurelia-framework';
import { RouterConfiguration, Router, RouteConfig, NavigationInstruction } from 'aurelia-router';
import { EventAggregator, Subscription } from 'aurelia-event-aggregator';
import * as L from 'leaflet';
import 'leaflet/dist/leaflet.css';
delete (L.Icon.Default.prototype as any)._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png'),
});
export const log = LogManager.getLogger('app.App');
@autoinject
export class HomeIndex {
private subscriptions: Subscription[] = [];
map?: L.Map;
// ================================= view lifecycle ===============================
created(owningView: View, myView: View): void {
log.debug("created");
}
bind(bindingContext: Record<string, any>, overrideContext: Record<string, any>): void {
log.debug("bind");
}
attached(): void {
log.debug("attached");
this.map = L.map('map').setView([59.3953607, 24.6643414], 15);
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{
attribution: '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}
).addTo(this.map);
}
detached(): void {
log.debug("detached");
this.subscriptions.forEach(subscription => {
subscription.dispose();
});
this.subscriptions = [];
}
unbind(): void {
log.debug("unbind");
}
// ================================= Route lifecycle ===============================
canActivate(params: any, routeConfig: RouteConfig, navigationInstruction: NavigationInstruction): void {
log.debug("canActivate");
}
activate(params: any, routeConfig: RouteConfig, navigationInstruction: NavigationInstruction): void {
log.debug("activate");
}
canDeactivate(): void {
log.debug("canDeactivate");
}
deactivate(): void {
log.debug("deactivate");
}
// ================================= View ===============================
// ================================= Event ===============================
// ================================= Helpers ===============================
}
......@@ -2,3 +2,8 @@
body {
padding-top: 5rem;
}
#map {
width: 100%;
height: 800px;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment