From 180eebb77a469db63201a7043f3906dc456e1758 Mon Sep 17 00:00:00 2001 From: BrokenEagle Date: Sat, 16 Jan 2021 22:09:14 +0000 Subject: [PATCH] Don't normalize on the nudge event The normalization always ends up being less than a pixels difference, and the clamp applied later on removes that difference. Before the clamp was added, it had the effect of moving the box along it's angle of rotation. Now it moves it along the x,y axis of the image itself, which is probably more intuitive anyways. It's still needed for the drag and drop though, otherwise, it displaces by a certain amount making it impossible to accurately place. --- app/javascript/src/javascripts/notes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/src/javascripts/notes.js b/app/javascript/src/javascripts/notes.js index 9335aed98..eae9c936e 100644 --- a/app/javascript/src/javascripts/notes.js +++ b/app/javascript/src/javascripts/notes.js @@ -112,8 +112,8 @@ class Note { } // Place the note box. The input values are pixel coordinates relative to the full image. - place_note(x, y, w, h) { - if (this.note.embed && this.note.has_rotation) { + place_note(x, y, w, h, was_nudged = false) { + if (this.note.embed && this.note.has_rotation && !was_nudged) { let position = this.get_min_max_position(); x = position.norm_left / this.note.scale_factor; y = position.norm_top / this.note.scale_factor; @@ -212,7 +212,7 @@ class Note { // do nothing } - this.place_note(this.note.x, this.note.y, this.note.w, this.note.h); + this.place_note(this.note.x, this.note.y, this.note.w, this.note.h, true); Note.Body.hide_all(); this.$note_box.addClass("unsaved"); event.preventDefault();