Ejemplo n.º 1
0
 public static void Drop(ElementEvent evt)
 {
     evt.StopPropagation();
     evt.PreventDefault();
     FileList fl = (FileList)Script.Literal("{0}.dataTransfer.files", evt);
     if (fl.Length > 0)
     {
         SetTextBox(fl[0].Name);
         for(int x = 0; x<fl.Length; x++)
         {
             FileHelper.AddFileToUploadQueue(fl[x]);
         }
     }
 }
Ejemplo n.º 2
0
 public void CanvasOnClick(ElementEvent e)
 {
     e.PreventDefault();
 }
Ejemplo n.º 3
0
 public void CanvasMouseUp(ElementEvent e)
 {
     e.PreventDefault();
 }
Ejemplo n.º 4
0
 public void CanvasMouseMove(ElementEvent e)
 {
     e.PreventDefault();
     Document.Body.Style.Cursor = "default";
 }
Ejemplo n.º 5
0
 public void handleScroll(ElementEvent e)
 {
     e.PreventDefault();
 }
Ejemplo n.º 6
0
        public void OnTouchMove(ElementEvent e)
        {
            //  Document.Title = "touched by an event ";
            TouchEvent ev = (TouchEvent)e;

            if (isPintching)
            {
                PinchMove(ev);
                return;
            }

            ev.PreventDefault();
            ev.StopPropagation();
            if (mouseDown)
            {
                dragging = true;
                double curX = ev.TargetTouches[0].PageX - lastX;

                double curY = ev.TargetTouches[0].PageY - lastY;

                Move(curX, curY);

                lastX = ev.TargetTouches[0].PageX;
                lastY = ev.TargetTouches[0].PageY;
            }
            else
            {
                //todo fix this to use syntheszed touch events.
                if (uiController != null)
                {
                    if (uiController.MouseMove(this, e))
                    {
                        e.PreventDefault();
                        e.StopPropagation();
                        return;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public void OnPointerMove(ElementEvent e)
        {
            PointerEvent pe = (PointerEvent)(object)e;
            int index = 0;

            if (pointerIds[0] == pe.PointerId)
            {
                index = 0;
            }
            else
            {
                if (pointerIds[1] == pe.PointerId)
                {
                    index = 1;
                }
                else
                {
                    // Not interested in a pointer not on our list
                    return;
                }
            }

            if (pointerIds[0] != 0 && pointerIds[1] != 0)
            {
                // Now we know we are zooming...
                if (rect[0] != null)
                {
                    double oldDist = GetDistance(rect[0], rect[1]);
                    rect[index] = Vector2d.Create(e.OffsetX, e.OffsetY);
                    double newDist = GetDistance(rect[0], rect[1]);
                    double ratio = oldDist / newDist;
                    Zoom(ratio);
                }
                e.StopPropagation();
                e.PreventDefault();
            }

            rect[index] = Vector2d.Create(e.OffsetX, e.OffsetY);
        }
Ejemplo n.º 8
0
        public void OnMouseMove(ElementEvent e)
        {
            lastMouseMove = Date.Now;
            hoverTextPoint = Vector2d.Create( Mouse.OffsetX(Canvas, e), Mouse.OffsetY(Canvas, e));
            hoverText = "";

            if (mouseDown)
            {
                e.PreventDefault();
                e.StopPropagation();

                moved = true;
                if (e.CtrlKey)
                {
                    Tilt(Mouse.OffsetX(Canvas, e) - lastX, Mouse.OffsetY(Canvas, e) - lastY);
                }
                else
                {
                    Move(Mouse.OffsetX(Canvas, e) - lastX, Mouse.OffsetY(Canvas, e) - lastY);
                }

                lastX = Mouse.OffsetX(Canvas, e);
                lastY = Mouse.OffsetY(Canvas, e);
            }
            else
            {
                if (uiController != null)
                {
                    if (uiController.MouseMove(this, e))
                    {
                        e.PreventDefault();
                        e.StopPropagation();
                        return;
                    }
                }
            }
        }
Ejemplo n.º 9
0
 public static void NoOpHandler(ElementEvent evt)
 {
     evt.StopPropagation();
     evt.PreventDefault();
 }
Ejemplo n.º 10
0
        public override bool OnKeyDown(ElementEvent e)
        {
            if (e.AltKey) return false;
            if (Focused) {
                if (e.CtrlKey) {
                    if (e.KeyCode == 65) {
                        DragPosition = 0;
                        CursorPosition = Text.Length;
                    } else if (e.KeyCode == 67) {
                        // _H.copy_to_clipboard(this.text.substring(Math.min(this.cursorPosition, this.dragPosition), Math.max(this.cursorPosition, this.dragPosition)));
                    } else if (e.KeyCode == 88) {
                        //  _H.copy_to_clipboard(this.text.substring(Math.min(this.cursorPosition, this.dragPosition), Math.max(this.cursorPosition, this.dragPosition)));

                        Text = Text.Substring(0, Math.Min(CursorPosition, DragPosition)) +
                               Text.Substring(Math.Max(CursorPosition, DragPosition), Text.Length);

                        CursorPosition = Math.Min(CursorPosition, DragPosition);
                        DragPosition = -1;
                    }
                } else if (e.KeyCode == 37) {
                    if (e.ShiftKey) {
                        if (DragPosition == -1)
                            DragPosition = CursorPosition;
                        CursorPosition = Math.Max(CursorPosition - 1, 0);
                    } else {
                        DragPosition = -1;
                        CursorPosition = Math.Max(CursorPosition - 1, 0);
                    }
                } else if (e.KeyCode == 39) {
                    if (e.ShiftKey) {
                        if (DragPosition == -1)
                            DragPosition = CursorPosition;
                        CursorPosition = Math.Min(CursorPosition + 1, Text.Length);
                    } else {
                        DragPosition = -1;
                        CursorPosition = Math.Min(CursorPosition + 1, Text.Length);
                    }
                } else {
                    if (e.KeyCode == 8) {
                        if (DragPosition == -1)
                            Text = Text.Substring(0, CursorPosition - 1) + Text.Substring(CursorPosition, Text.Length);
                        else {
                            Text = Text.Substring(0, Math.Min(CursorPosition, DragPosition)) +
                                   Text.Substring(Math.Max(CursorPosition, DragPosition), Text.Length);
                        }
                        if (DragPosition == -1) {
                            if (CursorPosition > 0)
                                CursorPosition--;
                        } else
                            CursorPosition = Math.Min(CursorPosition, DragPosition);
                    } else if (e.KeyCode == 46) {
                        if (DragPosition == -1)
                            Text = Text.Substring(0, CursorPosition) + Text.Substring(Math.Min(CursorPosition + 1, Text.Length), Text.Length);
                        else {
                            Text = Text.Substring(0, Math.Min(CursorPosition, DragPosition)) +
                                   Text.Substring(Math.Max(CursorPosition, DragPosition), Text.Length);
                        }
                        if (DragPosition == -1) {} else
                            CursorPosition = Math.Min(CursorPosition, DragPosition);
                    } else {
                        var m = (char) e.KeyCode;
                        var t = String.FromCharCode(m);
                        if (DragPosition == -1)
                            Text = Text.Substring(0, CursorPosition) + t + Text.Substring(CursorPosition, Text.Length);
                        else {
                            Text = Text.Substring(0, Math.Min(CursorPosition, DragPosition)) + t +
                                   Text.Substring(Math.Max(CursorPosition, DragPosition), Text.Length);
                        }
                        if (DragPosition == -1)
                            CursorPosition++;
                        else
                            CursorPosition = Math.Max(CursorPosition, DragPosition);
                    }
                    DragPosition = -1;
                }

                if (TextChanged != null)
                    TextChanged();

                e.PreventDefault();
                return true;
            }
            return false;
        }