VectorDraw Developer Framework
问:动作处于活动状态时如何使用鼠标中键进行平移/span>
答:可以通过使用vdmoudown和vdmouseup事件来执行此操作,因为为此,您必须在要平移时暂停活动操作,然后将其恢复到当前命令。一旦使用鼠标中键进行平移,而不是使用左键完成命令,就可能发生这种情况。在下面,可以看到一个示例。
var vdcanvas = vdmanager.AttachCanvas('canvas'); vdcanvas.vdmousedown = _vdmousedown; //set to the initialize page load vdcanvas.vdmouseup = _vdmouseup; vdcanvas.ActiveAction().PanMouseButton = vdConst.MouseMiddleButton; // set the middle mouse button for panning procedure function _vdmousedown(e) { var code = e.mousebutton; //get the mouse button code if (code === 2)vdcanvas.ActiveAction().Pause(); // middle mouse code is 2 } function _vdmouseup(e) { //resume the action when finishing the panning var code = e.mousebutton; if (code === 2)vdcanvas.ActiveAction().Resume(); }
问:3D中的XYZ坐标轴始终以3D模式显示在屏幕上。在2D模式下,根据平移动作,平移动作结束后XYZ坐标轴可能会隐藏并重绘。这些轴是否可以像3D一样在2D模式下工作/span>
答:在平移过程中,我们有意让Wire2D模式这样工作,以提高绘制速度。在这种情况下(2D模式),VDF不重绘整个屏幕,而只是重绘一小部分,以便在2D模式下更快地绘制。你可以通过使用onScroll事件来绕过这一点,比如。
private void Form1_Load(object sender, EventArgs e){ ........ vdFramedControl.BaseControl.ActiveDocument.OnScroll += ActiveDocument_OnScroll; ........}private void ActiveDocument_OnScroll(object sender, ref double cx, ref double cy, ref bool cancel){ cancel = true; VectorDraw.Render.vdRender render = sender as VectorDraw.Render.vdRender; if (render.PerspectiveMod == VectorDraw.Render.vdRender.VdConstPerspectiveMod.PerspectON) { VectorDraw.Geometry.Matrix m = new VectorDraw.Geometry.Matrix(); m.TranslateMatrix(-cx, -cy, 0.0d); vdFramedControl.BaseControl.ActiveDocument.World2ViewMatrix *= m; } else { vdFramedControl.BaseControl.ActiveDocument.ViewCenter += new gPoint(cx, cy); } bool doRedrawNow = render.BreakOnMessage != VectorDraw.WinMessages.MessageManager.BreakMessageMethod.None; render.Invalidate(doRedrawNow);}
使用这个事件和上面的代码,XYZ坐标轴将像3D一样呈现在2D中。
以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。
热门文章推荐:
-
如何排除GroundSurface对象的三角形区域/span>
-
复杂自定义对象的入门指南
=======================================================
如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!