| Article | 70000126 |
| Type | Wish |
| Product | WebJS |
| Date Added | 10/21/2014 12:00:00 AM |
| Fixed | (11/10/2014 12:00:00 AM) |
| Submitted by | Dave Cooke |
Summary
New AddImage method in javascript library.
Solution
A new command was added to the javascript library in version 7001. Using this command the user can add images in the library's active document and display it in the drawing area.
AddImage()
The function takes the following parameters- name: This is a string that will be saved as the image's name in the images collection. This needs to be unique for the whole collection. If the name already exists, the existing image definition will be used for the command.
- image: This is a string that provides the images definition. This could be either a url or a Base64 string.
- position: This is a three dimension array that defines where the new image will be places. It is expected to be in world coordinates.
- imageScale: This is a float point number that defines the scale of the image displayed. If set 1, the biggest dimension will be 1 drawing unit.
- rotation: This is a float point number that defines the rotation of the image in degrees.
- redraw: This is a boolean value that defines whether the image will be drawn right after the command or not.
function AddImage()
{
vdmanager.AttachCanvas('canvas', 380, 480);
var vdcanvas = vdmanager.vdrawObject('canvas');
var name = "Image01";
var position = [0, 0, 0];
var imageScale = 5.5;
var rotation = 0;
var redraw = true;
vdcanvas.AddImage(name, image, position, imageScale, rotation, redraw);
}
