mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 15:49:00 +02:00
fix(views/geomap): tooltip not showing
This commit is contained in:
parent
06fa59239c
commit
ff6b4effbd
@ -112,7 +112,6 @@ enum State {
|
|||||||
|
|
||||||
export default class GeoView extends ViewMode<MapData> {
|
export default class GeoView extends ViewMode<MapData> {
|
||||||
|
|
||||||
private args: ViewModeArgs;
|
|
||||||
private $root: JQuery<HTMLElement>;
|
private $root: JQuery<HTMLElement>;
|
||||||
private $container!: JQuery<HTMLElement>;
|
private $container!: JQuery<HTMLElement>;
|
||||||
private map?: Map;
|
private map?: Map;
|
||||||
@ -125,7 +124,6 @@ export default class GeoView extends ViewMode<MapData> {
|
|||||||
|
|
||||||
constructor(args: ViewModeArgs) {
|
constructor(args: ViewModeArgs) {
|
||||||
super(args, "geoMap");
|
super(args, "geoMap");
|
||||||
this.args = args;
|
|
||||||
this.$root = $(TPL);
|
this.$root = $(TPL);
|
||||||
this.$container = this.$root.find(".geo-map-container");
|
this.$container = this.$root.find(".geo-map-container");
|
||||||
this.spacedUpdate = new SpacedUpdate(() => this.onSave(), 5_000);
|
this.spacedUpdate = new SpacedUpdate(() => this.onSave(), 5_000);
|
||||||
|
@ -2,7 +2,6 @@ import markerIcon from "leaflet/dist/images/marker-icon.png";
|
|||||||
import markerIconShadow from "leaflet/dist/images/marker-shadow.png";
|
import markerIconShadow from "leaflet/dist/images/marker-shadow.png";
|
||||||
import { marker, latLng, divIcon, Map, type Marker } from "leaflet";
|
import { marker, latLng, divIcon, Map, type Marker } from "leaflet";
|
||||||
import type FNote from "../../../entities/fnote.js";
|
import type FNote from "../../../entities/fnote.js";
|
||||||
import note_tooltip from "../../../services/note_tooltip.js";
|
|
||||||
import openContextMenu from "./context_menu.js";
|
import openContextMenu from "./context_menu.js";
|
||||||
import server from "../../../services/server.js";
|
import server from "../../../services/server.js";
|
||||||
import { moveMarker } from "./editing.js";
|
import { moveMarker } from "./editing.js";
|
||||||
@ -11,7 +10,7 @@ let gpxLoaded = false;
|
|||||||
|
|
||||||
export default function processNoteWithMarker(map: Map, note: FNote, location: string) {
|
export default function processNoteWithMarker(map: Map, note: FNote, location: string) {
|
||||||
const [lat, lng] = location.split(",", 2).map((el) => parseFloat(el));
|
const [lat, lng] = location.split(",", 2).map((el) => parseFloat(el));
|
||||||
const icon = buildIcon(note.getIcon(), note.getColorClass(), note.title);
|
const icon = buildIcon(note.getIcon(), note.getColorClass(), note.title, note.noteId);
|
||||||
|
|
||||||
const newMarker = marker(latLng(lat, lng), {
|
const newMarker = marker(latLng(lat, lng), {
|
||||||
icon,
|
icon,
|
||||||
@ -36,13 +35,6 @@ export default function processNoteWithMarker(map: Map, note: FNote, location: s
|
|||||||
openContextMenu(note.noteId, e.originalEvent);
|
openContextMenu(note.noteId, e.originalEvent);
|
||||||
});
|
});
|
||||||
|
|
||||||
const el = newMarker.getElement();
|
|
||||||
if (el) {
|
|
||||||
const $el = $(el);
|
|
||||||
$el.attr("data-href", `#${note.noteId}`);
|
|
||||||
note_tooltip.setupElementTooltip($($el));
|
|
||||||
}
|
|
||||||
|
|
||||||
return newMarker;
|
return newMarker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,13 +68,19 @@ export async function processNoteWithGpxTrack(map: Map, note: FNote) {
|
|||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildIcon(bxIconClass: string, colorClass?: string, title?: string) {
|
function buildIcon(bxIconClass: string, colorClass?: string, title?: string, noteIdLink?: string) {
|
||||||
|
let html = /*html*/`\
|
||||||
|
<img class="icon" src="${markerIcon}" />
|
||||||
|
<img class="icon-shadow" src="${markerIconShadow}" />
|
||||||
|
<span class="bx ${bxIconClass} ${colorClass ?? ""}"></span>
|
||||||
|
<span class="title-label">${title ?? ""}</span>`;
|
||||||
|
|
||||||
|
if (noteIdLink) {
|
||||||
|
html = `<div data-href="#root/${noteIdLink}">${html}</div>`;
|
||||||
|
}
|
||||||
|
|
||||||
return divIcon({
|
return divIcon({
|
||||||
html: /*html*/`\
|
html,
|
||||||
<img class="icon" src="${markerIcon}" />
|
|
||||||
<img class="icon-shadow" src="${markerIconShadow}" />
|
|
||||||
<span class="bx ${bxIconClass} ${colorClass ?? ""}"></span>
|
|
||||||
<span class="title-label">${title ?? ""}</span>`,
|
|
||||||
iconSize: [25, 41],
|
iconSize: [25, 41],
|
||||||
iconAnchor: [12, 41]
|
iconAnchor: [12, 41]
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user