This commit is contained in:
@@ -3772,13 +3772,45 @@ HIDDEN_APP_HTML = r"""<!doctype html>
|
||||
|
||||
function beginNodeDrag(event, id) {
|
||||
if (event.button !== 0) return;
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
hideContextMenu();
|
||||
selectNode(id);
|
||||
|
||||
// First click/press only loads/selects the node.
|
||||
// Dragging is only allowed when the node is already selected.
|
||||
if (state.selectedId !== id) {
|
||||
state.drag = null;
|
||||
state.draggingId = "";
|
||||
selectNode(id);
|
||||
updateDragPreview();
|
||||
setStatus("memory loaded. click and drag it again to create a connection.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Second click + drag starts the connection.
|
||||
const point = pointerWorld(event);
|
||||
const entry = state.entries.find((item) => item.id === id);
|
||||
const related = new Set([...(entry?.continuationLinks || []), ...(entry?.echoes || []), ...(entry?.thematicLinks || []), ...(entry?.symbolicLinks || []), ...(entry?.mirroredEntries || [])]);
|
||||
state.drag = { sourceId: id, pointerId: event.pointerId, x: point.x, y: point.y, targetId: "", targetKind: "", relation: relationForEvent(event), compatibleIds: related, startedAt: Date.now() };
|
||||
const related = new Set([
|
||||
...(entry?.continuationLinks || []),
|
||||
...(entry?.echoes || []),
|
||||
...(entry?.thematicLinks || []),
|
||||
...(entry?.symbolicLinks || []),
|
||||
...(entry?.mirroredEntries || []),
|
||||
]);
|
||||
|
||||
state.drag = {
|
||||
sourceId: id,
|
||||
pointerId: event.pointerId,
|
||||
x: point.x,
|
||||
y: point.y,
|
||||
targetId: "",
|
||||
targetKind: "",
|
||||
relation: relationForEvent(event),
|
||||
compatibleIds: related,
|
||||
startedAt: Date.now(),
|
||||
};
|
||||
|
||||
state.draggingId = id;
|
||||
$("dragGuide").classList.remove("hidden");
|
||||
$("graph").setPointerCapture(event.pointerId);
|
||||
|
||||
Reference in New Issue
Block a user