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.
This commit is contained in:
BrokenEagle
2021-01-16 22:09:14 +00:00
parent 6ca007ee1f
commit 180eebb77a

View File

@@ -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();