aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/api')
-rw-r--r--src/api/dashboard/dashboard.html19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html
index 3789bb1..c4e6276 100644
--- a/src/api/dashboard/dashboard.html
+++ b/src/api/dashboard/dashboard.html
@@ -353,7 +353,7 @@
<span class="hint">drag to pan, wheel or pinch to zoom, turn with two fingers;
drag a node to move it, middle-click it to pin it there or let it go,
double-click it to subscribe to its links (or not), right-click it for its
- dashboard</span>
+ menu (subscribing, its dashboard)</span>
</div>
</div>
</div>
@@ -1516,7 +1516,12 @@ function renderGraph() {
style: "fill-opacity: var(" + (shown ? "--halo-focused" : "--halo-hovered") + ")" }));
}
const pressed = element => {
- element.addEventListener("pointerdown", event => { event.stopPropagation(); drag(event, id); });
+ // The right button opens its menu: no drag, whose holding the pointer on the map
+ // would take the right-click from the node.
+ element.addEventListener("pointerdown", event => {
+ event.stopPropagation();
+ if (event.button !== 2) drag(event, id);
+ });
element.addEventListener("contextmenu", event => {
event.preventDefault();
nodeMenu(id, event.clientX, event.clientY);
@@ -2771,7 +2776,9 @@ async function read(url, signal, opened, event) {
}
}
}
-// A node's menu (right-click): subscribing to its links, or no longer; its dashboard.
+// A node's menu (right-click): subscribing to its links, or no longer; going to its
+// dashboard, greyed where it publishes none (`--dashboard-url`), and on this node's own,
+// which is here.
function nodeMenu(id, x, y) {
const menu = document.getElementById("node-menu");
const member = state.graph.members[id] || {};
@@ -2784,8 +2791,10 @@ function nodeMenu(id, x, y) {
menu.replaceChildren(
item(subscriptions.has(id) ? "unsubscribe" : "subscribe to its links", !member.self,
() => toggleSubscription(id)),
- item(member.dashboard ? "open its dashboard" : "no dashboard published", !member.self && !!member.dashboard,
- () => openDashboard(id)));
+ item("go to its dashboard", !member.self && !!member.dashboard, () => openDashboard(id)));
+ const goto = menu.lastElementChild;
+ goto.title = member.self ? "this node's: here" : member.dashboard ? member.dashboard.split("#")[0]
+ : "it publishes no dashboard (--dashboard-url)";
menu.hidden = false;
menu.style.left = Math.min(x, innerWidth - menu.offsetWidth - 8) + "px";
menu.style.top = Math.min(y, innerHeight - menu.offsetHeight - 8) + "px";