Add basic map
Some checks failed
CI / Lint (push) Has been cancelled
CI / Test (push) Has been cancelled

This commit is contained in:
2026-01-13 19:44:18 +07:00
parent 037a9b5b3e
commit 19522256d7
5 changed files with 233 additions and 0 deletions

35
app/components/map.gjs Normal file
View File

@@ -0,0 +1,35 @@
import { modifier } from 'ember-modifier';
import 'ol/ol.css';
import Map from 'ol/Map.js';
import View from 'ol/View.js';
import { fromLonLat } from 'ol/proj.js';
import LayerGroup from 'ol/layer/Group.js';
import { apply } from 'ol-mapbox-style';
let mapInstance;
const setupMap = modifier((element) => {
if (mapInstance) return;
const openfreemap = new LayerGroup();
mapInstance = new Map({
target: element,
layers: [openfreemap],
view: new View({
center: fromLonLat([99.05738, 7.56087]),
zoom: 12.5,
projection: 'EPSG:3857',
}),
});
apply(openfreemap, 'https://tiles.openfreemap.org/styles/positron');
});
<template>
<div
{{setupMap}}
style="position: absolute; inset: 0;"
></div>
</template>

View File

@@ -1 +1,20 @@
/* Ember supports plain CSS out of the box. More info: https://cli.emberjs.com/release/advanced-use/stylesheets/ */
html,
body {
height: 100%;
}
body {
margin: 0;
}
#root,
#ember-testing {
height: 100%;
}
/* Ensure map container has a visible background while tiles load */
[style*='position: absolute; inset: 0;'] {
background: #f8f9fa;
}

View File

@@ -1,7 +1,10 @@
import { pageTitle } from 'ember-page-title';
import Map from '#components/map';
<template>
{{pageTitle "M/\RCO"}}
<Map />
{{outlet}}
</template>