Ejemplo n.º 1
0
        private void HandleMotionEvent(object o, Clutter.MotionArgs args)
        {
            if ((args.Event.State & Clutter.ModifierType.Button1Mask) != 0)
            {
                float drag_x; float drag_y;
                args.Event.GetCoords(out drag_x, out drag_y);
                if (!dragging)
                {
                    if (Math.Abs(drag_x0 - drag_x) > 2 && Math.Abs(drag_y0 - drag_y) > 2)
                    {
                        start_index = CoverManager.TargetIndex;
                        Clutter.Global.GrabPointer(Stage);
                        dragging = true;
                    }
                }
                else
                {
                    if ((args.Event.State & Clutter.ModifierType.ControlMask) != 0)
                    {
                        if (!dragging)
                        {
                            Clutter.Global.GrabPointer(Stage);
                        }
                        ViewportAngleY += (float)(mouse_x - ((MotionEvent)args.Event).X) * rotSens;
                        ViewportAngleX += (float)(mouse_y - ((MotionEvent)args.Event).Y) * rotSens;
                    }
                    else
                    {
                        CoverManager.TargetIndex = start_index + (int)((drag_x0 - drag_x) * drag_sens);
                    }
                }
            }
            else
            {
                if (dragging)
                {
                    Clutter.Global.UngrabPointer();
                }
                dragging = false;
            }
            mouse_x = ((MotionEvent)Clutter.Event.GetEvent(args.Event.Handle)).X;
            mouse_y = ((MotionEvent)Clutter.Event.GetEvent(args.Event.Handle)).Y;

            args.RetVal = dragging;
        }
Ejemplo n.º 2
0
        protected void HandleMotionEvent(object o, Clutter.MotionArgs args)
        {
            float x1; float y1;

            args.Event.GetCoords(out x1, out y1);

            float tx; float ty;

            GetTransformedPosition(out tx, out ty);

            if (x1 <= tx + Width && x1 >= tx && (args.Event.State & ModifierType.Button1Mask) != 0 && (button.State & 2) != 0)
            {
                float deltaX = (x1 - mouseX);
                SetValueSilently(posval + (deltaX / (width - height)));
            }
            mouseX      = x1;
            args.RetVal = true;
        }