70002383 Event delegate to be fire before an entity added to scriptcommand selection

Article 70002383
Type Wish
Product WebJS
Version 1003
Date Added 7/19/2023 12:00:00 AM
Fixed 10.1004.0.6 (7/21/2023 12:00:00 AM)
Submitted by Dariusz Johanik

Summary

Event delegate to be fire before an entity added to scriptcommand selection

Solution

In version 1004.0.6 A new event ActiveSelectionModify was added to vdcanvas.scriptCommand object
Represents a user define function of type that will be called for every entity added or remove to the vdcanvas.scriptCommand.ActiveSelection

Example :Begin a Move command for all vdLine entities in the drawing
vdcanvas.scriptCommand.ActiveSelectionModify = function (args) {
if (args.action == 0) {//if it is in adding mode and item is not vdLine then it is not added to selection
if (args.item && args.vdraw.Fig_codeToString(args.item._t) !== "vdLine") args.cancel = true;
}
}
vdcanvas.scriptCommand.parseCommands(["select all"]);
vdcanvas.scriptCommand.move(null, null,function (vdraw) { vdraw.scriptCommand.ActiveSelectionModify = null;});//clear the event

Send comments on this topic.