70001897 Override the draw of the default axis cursor

Article 70001897
Type Wish
Product WebJS
Version 8006
Date Added 1/8/2021 12:00:00 AM
Fixed 9.9001.0.1 (1/8/2021 12:00:00 AM)
Submitted by VectorDraw Team


Override the draw of the default axis cursor


In version 8007.0.1 a new event vdDrawCursor of vdcanvas control added
Represents a user define function of type that will be called during the default cursor (cross) drawn.
The ovverride function returns true in order to cancel the default draw of the cursor
Example: display world coordinates of the current cursor position

vdcanvas.vdDrawCursor = _vdDrawCursor;
function _vdDrawCursor(action) {
var ptcur = action.CurrentPoint; //get the current mouse location in world Coordinate system
var txt = vdcanvas.AddText("", 1, ptcur, vdConst.VdConstHorJust_VdTextHorLeft, vdConst.VdConstVerJust_VdTextVerTop, 0.0, false, {});
txt.BackGroundMask = true;
txt.BackGroundMaskColor = vdConst.colorFromString("0,0,127,127");
txt.BackgroundMaskBorder = true;
txt.BackGroundMaskBorderColor = vdConst.colorFromString("127,127,127,255");
txt.PenColor = vdConst.colorFromString("255,255,255,255");
var pixelsize = vdcanvas.GetPixelSize();
txt.InsertionPoint = vdcanvas.WorldToView(ptcur);
txt.Height = pixelsize * 10;
txt.TextString = "x=" + ptcur[0].toFixed(2) + "\ny=" + ptcur[1].toFixed(2) + "\nz=" + ptcur[2].toFixed(2);

Send comments on this topic.