Open dousha opened 3 weeks ago
The idea is good, I implemented this function with a simple widget and provided it to those who need it:
let shiftPressed = false; // Used to determine horizontal scrolling
$(document).ready(function () {
$(document).on('keydown', function (event) {
if (event.shiftKey) {
shiftPressed = true;
}
});
$(document).on('keyup', function (event) {
if (event.key === 'Shift') {
shiftPressed = false;
}
});
});
class noteSplitScroll extends api.NoteContextAwareWidget {
get position() {
return 100;
}
get parentWidget() {
return 'center-pane';
}
doRender() {
this.$widget = $(``);
return this.$widget;
}
async refreshWithNote() {
const $noteSplit = $(`.note-split[data-ntx-id="${this.noteContext.ntxId}"]`);
const $scrollingContainer = $noteSplit.children('.scrolling-container');
const $splitNoteContainerWidget = $noteSplit.parent()
$splitNoteContainerWidget.on('wheel', function (event) {
if ($(event.target).is($splitNoteContainerWidget)) {
if (shiftPressed) {
$scrollingContainer.scrollLeft($scrollingContainer.scrollLeft() + event.originalEvent.deltaY);
} else {
$scrollingContainer.scrollTop($scrollingContainer.scrollTop() + event.originalEvent.deltaY);
}
}
});
}
}
module.exports = new noteSplitScroll();
Describe feature
In the current implementation, when the mouse cursor is in the margins of a note, scrolling with the mouse wheel has no effect. (Margins are the blank spaces on either side of a note, as marked in the picture below with red boxes.) However, if you start scrolling, you can then move the mouse cursor into the margin and keep scrolling. It would be more intuitive if the user could start scrolling without having to move the cursor into the note.
Additional Information
No response