Occurs when an AnnObject is being drawn.
Object.defineProperty(AnnAutomation.prototype,'draw',
get: function(),
set: function(value)
)
function draw.add(function(sender, e));
function draw.remove(function(sender, e));
draw: void;
When an object is being drawn, the automation object will hook the object draw designer's AnnDrawDesigner.Draw to this event. Therefore, instead of hooking and unhooking to the various designers draw events, you can simply subscribe to this event once.
The following example will show how to stop drawing new line objects.
Start with the AnnAutomationManager example, remove all the code inside the example function (search for the // TODO: add example code here comment) and insert the following code:
Click the example button then try to draw a line object.
example: function SiteLibrary_DefaultPage$example() {
var _this = this;
// Hook to the automation's Draw event
this._automation.add_draw(function(sender, e) {
// e is of type AnnDrawDesignerEventArgs
// Check if we are drawing a line and we just started, if so, cancel it
if(_this._automation.get_manager().get_currentObjectId() == lt.Annotations.Core.AnnObject.lineObjectId &&
e.get_operationStatus() == lt.Annotations.Core.AnnDesignerOperationStatus.start) {
alert("Canceling line...");
e.set_cancel(true);
}
});
},
Parameter | Type | Description |
---|---|---|
sender | var | The source of the event. |
e | AnnDrawDesignerEventArgs | The event data. |