LEADTOOLS JavaScript (Leadtools.Annotations.Automation)
LEAD Technologies, Inc

Draw Event

Example 
Occurs when an AnnObject is being drawn.
Syntax
add_draw(function(sender, e))
remove_draw(function(sender, e))

Remarks

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.

Example

This 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() == Leadtools.Annotations.Core.AnnObject.lineObjectId &&
         e.get_operationStatus() == Leadtools.Annotations.Core.AnnDesignerOperationStatus.start) {
         alert("Canceling line...");
         e.set_cancel(true);
      }
   });
},
Event Data
Parameter Type Description
sender 'var' The source of the event.
e AnnDrawDesignerEventArgs The event data.
See Also

Reference

AnnAutomation Object
AnnAutomation Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.