Skip to content

Commit

Permalink
Simpler code for removing a mapping: only update the model, rely on r…
Browse files Browse the repository at this point in the history
…edraw for the UI
  • Loading branch information
Lorp committed Apr 22, 2024
1 parent 8f29ef1 commit 8aac8fb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/fencer.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,10 @@ function deleteMapping() {
console.log(`document.querySelector('.input.location[data-index="${GLOBAL.draggingIndex}"]')`);
console.log(`document.querySelector('.output.location[data-index="${GLOBAL.draggingIndex}"]')`);

Q(`.arrow[data-index="${GLOBAL.draggingIndex}"]`).remove();
Q(`.input.location[data-index="${GLOBAL.draggingIndex}"]`).remove();
Q(`.output.location[data-index="${GLOBAL.draggingIndex}"]`).remove();
// we don’t actually have to remove the elements, because we immediately redraw the SVG
// Q(`.arrow[data-index="${GLOBAL.draggingIndex}"]`).remove();
// Q(`.input.location[data-index="${GLOBAL.draggingIndex}"]`).remove();
// Q(`.output.location[data-index="${GLOBAL.draggingIndex}"]`).remove();

GLOBAL.mappings.splice(GLOBAL.draggingIndex, 1);

Expand Down

0 comments on commit 8aac8fb

Please sign in to comment.