Skip to content

Commit

Permalink
Update delete all, fixes #311
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Feb 3, 2025
1 parent 000c8d8 commit 538acfc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/gui/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,21 @@ dwvjq.gui.DrawList = function (app) {
};
};

var createDeleteAllOnClick = function () {
return function () {
const drawController = new dwv.DrawController(annotationGroup);
let list = annotationGroup.getList();
while (list.length !== 0) {
var annot = list[0];
drawController.removeAnnotationWithCommand(
annot.id,
app.addToUndoStack
);
list = annotationGroup.getList();
}
};
};

// append action column to the header row
var row0 = table.rows.item(0);
var cell00 = row0.insertCell(0);
Expand Down Expand Up @@ -610,9 +625,7 @@ dwvjq.gui.DrawList = function (app) {

// delete draw button
var deleteButton = document.createElement('button');
deleteButton.onclick = function () {
drawLayer.deleteDraws(app.addToUndoStack);
};
deleteButton.onclick = createDeleteAllOnClick();
deleteButton.setAttribute('class', 'ui-btn ui-btn-inline');
deleteButton.appendChild(
document.createTextNode(dwvjq.i18n.t('basics.deleteDraws'))
Expand Down

0 comments on commit 538acfc

Please sign in to comment.