%%PageItemTitle%%

VectorDraw Web Library

JsPropertiesExtractor Send comments on this topic.
GetUserLine Method
See Also  Example
vdWebLibrary Namespace > vdrawObj Class : GetUserLine Method
statechangeDelegate
A function created using the onStateChangedDelegate as model.
Initiates an action (check BaseActionObj) where the user will create a new line in the component's drawing area.

Syntax

JScript 
public function GetUserLine( 
   statechangeDelegate : onStateChangedDelegate
);

Parameters

statechangeDelegate
A function created using the onStateChangedDelegate as model.

Example

C#Copy Code
  
function CmdGetDistance(canvasId) { 
   var vdcanvas = vdmanager.vdrawObject(canvasId); 
   vdcanvas.GetUserLine(_onActionGetDistanceStateChanged); 

 
function _onActionGetDistanceStateChanged(action, status) { 
    var vdcanvas = action.vdrawOwner(); 
 
    if (status == 'start') { 
        vdcanvas.Prompt('pick first point'); 
    } else if (status == 'count') { 
        vdcanvas.Prompt('pick second point'); 
    } else if (status == 'end') { 
        vdcanvas.Prompt(':'); 
        if (!action.IsCanceled()) { 
           var distance = vdgeo.Distance2D(action.ResValue[0], action.ResValue[1]); 
           vdcanvas.Prompt('Distance = ' + distance.toString()); 
       } 
    } 
}

See Also