Article | 70001065 |
Type | Wish |
Product | WebJS |
Version | 7010 |
Date Added | 4/22/2017 12:00:00 AM |
Fixed | 7.7011.0.4 (4/25/2017 12:00:00 AM) |
Submitted by | Brendan Fry |
Summary
Action parse to accept values from a keybord input and finish the action
Solution
A new property vdrawObj.ActiveAction().parse("") that parses the passed command string and finish the action, was added in version 7011.0.4
For example user can pass a text input from a textbox in the following form
1. x,y,z coordinate values separate values by ',' symbol vdcanvas.ActiveAction().parse('5.5,2.1,0.5'); 2. distance < angle polar values distance is a double value in drawing units angle is a double value in degrees separate values by '<' symbol vdcanvas.ActiveAction().parse('7.8<45.0'); 3. Xoffset,Yoffset relative values vdcanvas.ActiveAction().parse('@2.5,3.7'); NOTE: A prefix '@' is needed Example for how to use: We create in HTML a textbox and a button like below. input type="text" id="parseStr" style="width: 70px" input type="button" onclick="parseString()" style="width: 70px" align="center" value="Parse" And then in script we call the function which fires when we click the button.
function parseString() { var str = document.getElementById('parseStr').value; vdcanvas.ActiveAction().parse(str); }
When for example we begin a user line vdcanvas.scriptCommand.line(),before we click for the first or the second point of the line we can click the "Parse" button and use the user's coordinates for first and second point. So now for example we can create a line from (-1,2) to (3,4)