diff --git a/apps/client/src/widgets/geo_map.ts b/apps/client/src/widgets/geo_map.ts
index 14df22e3b..2e8fc41f7 100644
--- a/apps/client/src/widgets/geo_map.ts
+++ b/apps/client/src/widgets/geo_map.ts
@@ -8,10 +8,7 @@ const TPL = /*html*/`\
-
`;
export type Leaflet = typeof L;
@@ -27,8 +23,6 @@ export type InitCallback = (L: Leaflet) => void;
export default class GeoMapWidget extends NoteContextAwareWidget {
- map?: Map;
- $container!: JQuery;
private initCallback?: InitCallback;
constructor(widgetMode: "type", initCallback?: InitCallback) {
@@ -39,20 +33,10 @@ export default class GeoMapWidget extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
- this.$container = this.$widget.find(".geo-map-container");
-
- const map = L.map(this.$container[0], {
- worldCopyJump: true
- });
-
- this.map = map;
if (this.initCallback) {
this.initCallback(L);
}
- L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
- attribution: '© OpenStreetMap contributors',
- detectRetina: true
- }).addTo(map);
+
}
}
diff --git a/apps/client/src/widgets/view_widgets/geo_view/index.ts b/apps/client/src/widgets/view_widgets/geo_view/index.ts
index cb203c004..faf4c3814 100644
--- a/apps/client/src/widgets/view_widgets/geo_view/index.ts
+++ b/apps/client/src/widgets/view_widgets/geo_view/index.ts
@@ -1,4 +1,5 @@
import ViewMode, { ViewModeArgs } from "../view_mode.js";
+import L from "leaflet";
const TPL = /*html*/`
@@ -8,26 +9,46 @@ const TPL = /*html*/`
position: relative;
height: 100%;
}
+
+ .geo-map-container {
+ height: 100%;
+ overflow: hidden;
+ }
- Geo View is not implemented yet.
+
`;
export default class GeoView extends ViewMode<{}> {
private $root: JQuery;
+ private $container!: JQuery;
+ private map?: L.Map;
constructor(args: ViewModeArgs) {
super(args, "geoMap");
this.$root = $(TPL);
+ this.$container = this.$root.find(".geo-map-container");
args.$parent.append(this.$root);
}
async renderList() {
- console.log("Rendered");
+ this.renderMap();
return this.$root;
}
+ async renderMap() {
+ const map = L.map(this.$container[0], {
+ worldCopyJump: true
+ });
+ L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
+ attribution: '© OpenStreetMap contributors',
+ detectRetina: true
+ }).addTo(map);
+
+ this.map = map;
+ }
+
get isFullHeight(): boolean {
return true;
}