Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions js/SelectionViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -75,3 +90,5 @@ function SelectionViewModel(svgViewModel, materialViewModel, selectionGroup) {
}
}
}


24 changes: 20 additions & 4 deletions jscut.html
Original file line number Diff line number Diff line change
Expand Up @@ -504,13 +504,29 @@ <h3 class="panel-title">
<div class="form-horizontal">
<table class="table">
<tr>
<td><label for="inputSelMinNumSegments">Minimum Segments</label>
<td><input type="number" id="inputSelMinNumSegments" data-bind="value: selMinNumSegments" placeholder="Segments">
<td><label for="inputSelMinNumSegments">Minimum Segments</label></td>
<td><input type="number" id="inputSelMinNumSegments" data-bind="value: selMinNumSegments" placeholder="Segments"></td>
</tr>
<tr>
<td><label for="inputSelMinSegmentLength">Minimum Segment Length (<span data-bind="text: selMinSegmentLength.units()"></span>)</label>
<td><input type="number" step="any" id="inputSelMinSegmentLength" data-bind="value: selMinSegmentLength" placeholder="Length">
<td>
<label for="inputSelMinSegmentLength">
Minimum Segment Length (<span data-bind="text: selMinSegmentLength.units()"></span>)
</label>
</td>
<td><input type="number" step="any" id="inputSelMinSegmentLength" data-bind="value: selMinSegmentLength" placeholder="Length"></td>
</tr>
</table>
</div>

<!-- Bouton Select All -->
<div class="form-group">
<div class="col-sm-12">
<button type="button" class="btn btn-default" data-bind="click: selectAll">
Select All
</button>
</div>
</div>

</div>
</div>
</div>
Expand Down