Article | 60002102 |
Type | Wish |
Product | WebJS |
Version | 6026 |
Date Added | 12/18/2013 12:00:00 AM |
Fixed | (12/18/2013 12:00:00 AM) |
Submitted by |
Summary
I need to draw simple objects (rectangles, circles etc.) fast in the web library. Using redraw() takes too much time for the "highlight effect" I want to accomplish.
Solution
New function ActionDrawEntities() has been added to the vdWeb library. Using this function, objects can be temporarily drawn on the library's drawing area fast, independent of the Document entites' number. Using this function, someone
can perform highlight, tooltip and such operations.
Example
var vdcanvas = vdmanager.vdrawObject('canvas');
//By passing null we clear any draws we have executed before.
vdcanvas.ActionDrawEntities(null);
var vddoc = vdcanvas.GetDocument();
if (!vddoc) return;
if (box) {
var bmin = vdgeo.newpoint(box[0], box[1], box[2]);
var bmax = vdgeo.newpoint(box[3], box[4], box[5]);
var vdobj = {};
vdobj._t = vdConst.vdRect_code;
vdobj.LineType = vddoc.ActiveLineType;
vdobj.Layer = vddoc.ActiveLayer;
vdobj.PenColor = vddoc.ActivePenColor;
vdobj.PenColor.SystemColor = [50, 50, 200, 150];
vdobj.HatchProperties = {};
vdobj.HatchProperties.FillColor = {};
vdobj.InsertionPoint = bmin;
vdobj.Rotation = 0.0;
vdobj.Width = bmax[0] - bmin[0];
vdobj.Height = bmax[1] - bmin[1];
//Any type of vdraw entity can be passed in this array. If it is created correctly, it will be drawn.
vdcanvas.ActionDrawEntities([vdobj]);
}
else
vdcanvas.ActionDrawEntities(null);