Article | 70001312 |
Type | Wish |
Product | Engine |
Version | 7014 |
Date Added | 4/2/2018 12:00:00 AM |
Fixed | 7.7015.0.2 (4/3/2018 12:00:00 AM) |
Submitted by | Luca Mancusi |
Summary
Is it possible to export events that fire when user clicks on the ViewCube? I would like to do certain zooms when user click on specific views.
Solution
A new event OnViewCubeClick of vdDocument was added in version 7015.0.2. This events works only in ViewCube is visible and when clicking the ViewCube and not when draging it.
Example 1 (doesn't allow to view from below) :
doc.OnViewCubeClick += new vdDocument.ViewCubeClickEventHandler(doc_OnViewCubeClick); void doc_OnViewCubeClick(object sender, IViewCubeClickArgs args) { vdDocument doc = sender as vdDocument;//in case you need this //see below about args properties Vector v = args.PickVector; //allow only to change the view, looking from the top of the model. if (v.z <= 0) args.Cancel = true; }Example 2 (does a zoom-out when clicked) :
doc.OnViewCubeClick += new vdDocument.ViewCubeClickEventHandler(doc_OnViewCubeClick); void doc_OnViewCubeClick(object sender, IViewCubeClickArgs args) { vdView cubeview = args.DefaultCalculatedView; cubeview.ViewSize = cubeview.ViewSize * 3.0d; // make also a zoom-out }IViewCubeClickArgs contains the following properties
vdViewCube sender : the The vdDocument.ViewCube object
int PickId :Defines the position id where the user pick. See PickVector to get the viewdir for the pick id.
CubePickItemTypeFlag PickItemType : Returns the view cube item type that the user click.It can be Cude or Compass
IvdRenderingView Renderview : Returns the active rendering view where the viewcube is reference to.Usually a vdLayout or a vdViewport.
Vector PickVector :Returns the ViewDir for the selected PickId.Default implemantion uses this vector to change the WorldToView matrix for the active view.
vdView DefaultCalculatedView :A vdView filled with default implemation WorldToView , ViewCenter and ViewSize for the active view, depend on PickVector. User can make extra changes to this vdView and overwite the default zoom implementation.
bool Cancel :Set this as true in order not to run the default VectorDraw code.