This module provides functions to manipulate the drawing selection.
Methods
(static) clear()
Clears all the selected strokes and contours for all drawings and arts.
Example
Drawing.selection.clear();
(static) get(args)
Returns the list of selected strokes in a drawing.
Example
var settings = Tools.getToolSettings();
if (!settings.currentDrawing) return;
var config = {
drawing : settings.currentDrawing,
art : settings.activeArt
};
var selectedStrokes = Drawing.selection.get(config);
// This is the returned value of nothing is selected on the current drawing
selectedStrokes = {
"selectedLayers":[],
"selectedStrokes":[],
"drawing":{"drawingId":"12","elementId":1,"projectId":"08ec7adaf99ab5ba","isValid":true},
"art":2};
// The same run with one stroke selected
selectedStrokes = {
"selectedLayers":[0],
"selectedStrokes":[{"stroke":true,"strokeIndex":0,"layer":0}],
"drawing":{"drawingId":"12","elementId":1,"projectId":"08ec7adaf99ab757","isValid":true},
"art":2};
// The same run with one contour selected
selectedStrokes = {
"selectedLayers":[0],
"selectedStrokes":[{"leftShader":true,"strokeIndex":0,"layer":1}],
"drawing":{"drawingId":"12","elementId":1,"projectId":"08ec7adaf99abd4f","isValid":true},"art":2};
Parameters:
Name |
Type |
Description |
args |
Object
|
Dictionary of arguments
Properties
Name |
Type |
Description |
drawing |
Object
|
Drawing descriptor |
art |
Object
|
art index |
|
(static) set(args)
Example
var config = {
drawing : { node : "Top/Drawing", frame : 1 },
art : 2, // 0 = underlay, 1 = color art, 2 = line art, 3 = overlay
{selectedStrokes:[{ stroke:true, strokeIndex:2, layer:0}]
};
Drawing.selection.set(config);
Parameters:
Name |
Type |
Description |
args |
Object
|
Dictionary of arguments
Properties
Name |
Type |
Description |
drawing |
Object
|
Drawing descriptor |
art |
Object
|
art index |
selectedStrokes |
Array.<Object>
|
List of selected strokes descriptor |
|