From 1dfa4a8bc201f2e1092796d800fc77ed1c351ae2 Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Sun, 23 Feb 2025 06:17:57 +0200 Subject: [PATCH] client: note map: improve the appearance --- src/public/app/widgets/note_map.ts | 86 ++++++++++++++++++------------ 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/src/public/app/widgets/note_map.ts b/src/public/app/widgets/note_map.ts index f8c34f9d5..c6cb53ea7 100644 --- a/src/public/app/widgets/note_map.ts +++ b/src/public/app/widgets/note_map.ts @@ -12,7 +12,7 @@ import type FNote from "../entities/fnote.js"; const esc = utils.escapeHtml; -const TPL = `
+const TPL = `
- - + +
-
- - - +
+ +
@@ -163,6 +179,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget { private themeStyle!: string; private $container!: JQuery; private $styleResolver!: JQuery; + private $fixNodesButton!: JQuery; graph!: ForceGraph; private noteIdToSizeMap!: Record; private zoomLevel!: number; @@ -182,6 +199,7 @@ export default class NoteMapWidget extends NoteContextAwareWidget { this.$container = this.$widget.find(".note-map-container"); this.$styleResolver = this.$widget.find(".style-resolver"); + this.$fixNodesButton = this.$widget.find(".fixnodes-type-switcher > button"); new ResizeObserver(() => this.setDimensions()).observe(this.$container[0]); @@ -191,11 +209,11 @@ export default class NoteMapWidget extends NoteContextAwareWidget { await attributeService.setLabel(this.noteId ?? "", "mapType", type); }); - // Reading the status of the Drag nodes Ui element. Changing it´s color when activated. Reading Force value of the link distance. - - this.$widget.find(".fixnodes-type-switcher").on("click", async (event) => { + // Reading the status of the Drag nodes Ui element. Changing it´s color when activated. + // Reading Force value of the link distance. + this.$fixNodesButton.on("click", async (event) => { this.fixNodes = !this.fixNodes; - event.target.style.backgroundColor = this.fixNodes ? "#661822" : "transparent"; + this.$fixNodesButton.toggleClass("toggled", this.fixNodes); }); super.doRender();