Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        IEnumerator <Ctrl.IOperation> DragCompass(int x0, int y0)
        {
            Cursor.Current = Cursors.SizeAll;
            Geom.Point2i   pos0 = _pos;
            Ctrl.MouseMove drag = new Ctrl.MouseMove(_view.Events);
            while (true)
            {
                yield return(drag);

                if (drag.EventArgs.Button != MouseButtons.Left)
                {
                    yield break;
                }
                _pos.x = pos0.x + (drag.EventArgs.X - x0);
                _pos.y = pos0.y + (drag.EventArgs.Y - y0);
                this.FixPos();
                _view.Invalidate();
            }
        }