IEnumerator <Ctrl.IOperation> DragPlane(Graphics.IView view, MouseEventArgs e) { var plane = this.GetQuadPlanes()[_highlightIndex]; var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range(-sphere.Radius, sphere.Radius); var z0 = range.ParamToValue(this.Position); var eyeshot1 = view.Camera.GetEyeshotLine(e.Location); var y1 = GetIntersection(plane, eyeshot1).y; var up = new Ctrl.LButtonUp(view.Events); up.MouseMove += (ss, ee) => { var eyeshot2 = view.Camera.GetEyeshotLine(ee.Location); var z = z0 + GetIntersection(plane, eyeshot2).y - y1; this.Position = range.ValueToParam(z); view.Invalidate(); }; yield return(up); view.Invalidate(); }
IEnumerator<Ctrl.IOperation> DragPlane( Graphics.IView view, MouseEventArgs e ) { var plane = this.GetQuadPlanes()[_highlightIndex]; var sphere = _docviews.WorldDocumentScene.BoundingSphere; var range = new Hisui.Geom.Range( -sphere.Radius, sphere.Radius ); var z0 = range.ParamToValue( this.Position ); var eyeshot1 = view.Camera.GetEyeshotLine( e.Location ); var y1 = GetIntersection( plane, eyeshot1 ).y; var up = new Ctrl.LButtonUp( view.Events ); up.MouseMove += ( ss, ee ) => { var eyeshot2 = view.Camera.GetEyeshotLine( ee.Location ); var z = z0 + GetIntersection( plane, eyeshot2 ).y - y1; this.Position = range.ValueToParam( z ); view.Invalidate(); }; yield return up; view.Invalidate(); }