mirror of
https://github.com/zadam/trilium.git
synced 2025-02-20 21:13:11 +08:00
fixes for drag & create new note in relation map
This commit is contained in:
parent
810aa8c2fb
commit
494a980ecb
1 changed files with 22 additions and 20 deletions
|
@ -85,6 +85,27 @@ class NoteDetailRelationMap {
|
|||
this.relations = null;
|
||||
this.pzInstance = null;
|
||||
|
||||
this.$relationMapWrapper = ctx.$tabContent.find('.relation-map-wrapper');
|
||||
this.$relationMapWrapper.click(event => {
|
||||
if (this.clipboard) {
|
||||
let {x, y} = this.getMousePosition(event);
|
||||
|
||||
// modifying position so that cursor is on the top-center of the box
|
||||
x -= 80;
|
||||
y -= 15;
|
||||
|
||||
this.createNoteBox(this.clipboard.noteId, this.clipboard.title, x, y);
|
||||
|
||||
this.mapData.notes.push({ noteId: this.clipboard.noteId, x, y });
|
||||
|
||||
this.saveData();
|
||||
|
||||
this.clipboard = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
this.$relationMapContainer.attr("id", "relation-map-container-" + (containerCounter++));
|
||||
this.$relationMapContainer.on("contextmenu", ".note-box", e => {
|
||||
contextMenuWidget.initContextMenu(e, {
|
||||
|
@ -130,7 +151,7 @@ class NoteDetailRelationMap {
|
|||
this.pzInstance.moveTo(0, 0);
|
||||
});
|
||||
|
||||
this.$component.on("drop", this.dropNoteOntoRelationMapHandler);
|
||||
this.$component.on("drop", ev => this.dropNoteOntoRelationMapHandler(ev));
|
||||
this.$component.on("dragover", ev => ev.preventDefault());
|
||||
}
|
||||
|
||||
|
@ -314,25 +335,6 @@ class NoteDetailRelationMap {
|
|||
maxZoom: 2,
|
||||
minZoom: 0.3,
|
||||
smoothScroll: false,
|
||||
onMouseDown: event => {
|
||||
if (this.clipboard) {
|
||||
let {x, y} = this.getMousePosition(event);
|
||||
|
||||
// modifying position so that cursor is on the top-center of the box
|
||||
x -= 80;
|
||||
y -= 15;
|
||||
|
||||
this.createNoteBox(this.clipboard.noteId, this.clipboard.title, x, y);
|
||||
|
||||
this.mapData.notes.push({ noteId: this.clipboard.noteId, x, y });
|
||||
|
||||
this.saveData();
|
||||
|
||||
this.clipboard = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
filterKey: function(e, dx, dy, dz) {
|
||||
// if ALT is pressed then panzoom should bubble the event up
|
||||
// this is to preserve ALT-LEFT, ALT-RIGHT navigation working
|
||||
|
|
Loading…
Reference in a new issue