Article | 70002442 |
Type | HowTo |
Product | WebJS |
Version | 10 |
Date Added | 11/23/2023 12:00:00 AM |
Fixed | 10.1005.0.3 (11/23/2023 12:00:00 AM) |
Submitted by | Sefa |
Summary
When I click with the mouse , I want to select one object at a time. For example there is a selected object, I want to leave it and select the one I clicked last.
Solution
It can be done by overwiting vdcanvas.vdSelectionModified event as follow
//filter the selection for move copy rotate etc commands vdcanvas.vdSelectionModified = selectionmodified; function selectionmodified(eventargs) { //clear hilighted of previous selected entities for (var i = 0; i < eventargs.action.customData.length; i++) { eventargs.action.customData[i].selected = false; } vdcanvas.ActionDrawEntities(eventargs.action.customData, true); //select the first entity item in the selected collection eventargs.selectedItem.selected = true; eventargs.action.customData = [eventargs.selectedItem]; //cancel no other item selected only the first one eventargs.cancel = true; }