Skip to content

Commit

Permalink
Fix bug with insertion point moving before placing vertex
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Sep 19, 2020
1 parent f16d846 commit e44084e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ui.js
Expand Up @@ -736,6 +736,14 @@ class UI {

// Moving the insertion point, panning, and rearranging cells.
this.element.addEventListener("mousemove", (event) => {
// If the user has currently clicked to place a vertex, then don't reposition the
// insertion point until the new vertex has been created: otherwise we might move the
// insertion point before the vertex has been created and accidentally place the vertex
// in the new position of the insertion point, rather than the old one.
if (this.in_mode(UIState.Default) && insertion_point.classList.contains("revealed")) {
return;
}

const position = reposition_insertion_point(event);

if (this.in_mode(UIState.Pan) && this.state.origin !== null) {
Expand Down

0 comments on commit e44084e

Please sign in to comment.