From b6088f95c341e983573b29dd47c19db8a5b4fd15 Mon Sep 17 00:00:00 2001 From: Shish Date: Wed, 5 Jun 2024 13:39:51 +0100 Subject: [PATCH] [notes] avoid jiggling on _commit() by accounting for border widths --- ext/notes/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/notes/script.js b/ext/notes/script.js index 80ea8995..94aec446 100644 --- a/ext/notes/script.js +++ b/ext/notes/script.js @@ -88,7 +88,7 @@ function renderEditor(noteDiv, note) { dragStart = { x: e.pageX, y: e.pageY, - mode: getArea(e.offsetX, e.offsetY, noteDiv.offsetWidth, noteDiv.offsetHeight), + mode: getArea(e.offsetX, e.offsetY, noteDiv.clientWidth, noteDiv.clientHeight), }; noteDiv.classList.add("dragging"); }); @@ -113,7 +113,7 @@ function renderEditor(noteDiv, note) { noteDiv.style.width = (note.width * scale) + (e.pageX - dragStart.x) + 'px'; } } else { - let area = getArea(e.offsetX, e.offsetY, noteDiv.offsetWidth, noteDiv.offsetHeight); + let area = getArea(e.offsetX, e.offsetY, noteDiv.clientWidth, noteDiv.clientHeight); if(area == "c") { noteDiv.style.cursor = 'move'; } else { @@ -126,8 +126,8 @@ function renderEditor(noteDiv, note) { dragStart = null; note.x1 = Math.round(noteDiv.offsetLeft / scale); note.y1 = Math.round(noteDiv.offsetTop / scale); - note.width = Math.round(noteDiv.offsetWidth / scale); - note.height = Math.round(noteDiv.offsetHeight / scale); + note.width = Math.round(noteDiv.clientWidth / scale); + note.height = Math.round(noteDiv.clientHeight / scale); renderNotes(); } noteDiv.addEventListener('mouseup', _commit);