From 7b44daa58436b2e5f8fad19972ae1494ede3782c Mon Sep 17 00:00:00 2001 From: ctrichet Date: Mon, 2 Mar 2026 11:00:07 +0100 Subject: [PATCH] Adding Select All shapes button and associated method --- js/SelectionViewModel.js | 17 +++++++++++++++++ jscut.html | 24 ++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/js/SelectionViewModel.js b/js/SelectionViewModel.js index 94d63e0..46f2026 100755 --- a/js/SelectionViewModel.js +++ b/js/SelectionViewModel.js @@ -51,6 +51,21 @@ function SelectionViewModel(svgViewModel, materialViewModel, selectionGroup) { return selectionGroup.selectAll("path"); } + self.selectAll = function () { + self.clearSelection(); + + console.log("Select All triggered"); + + var paths = contentGroup.selectAll("path"); + + paths.forEach(function (elem) { + var snapElem = Snap(elem); + self.clickOnSvg(snapElem); + }); + + console.log("Final number of selected paths:", self.selNumSelected()); + }; + self.clearSelection = function () { selectionGroup.selectAll("path").remove(); self.selNumSelected(0); @@ -75,3 +90,5 @@ function SelectionViewModel(svgViewModel, materialViewModel, selectionGroup) { } } } + + diff --git a/jscut.html b/jscut.html index 621c49c..91b8804 100644 --- a/jscut.html +++ b/jscut.html @@ -504,13 +504,29 @@

- + + - + +
- +
- + + +
+ + +
+
+ +
+
+