Example #1
0
        static void PointerUpGlobally(MouseEvent e)
        {
            PointerUtils.PageXYToStageXY(e.PageX, e.PageY, out int x, out int y);

            if (isPointerDown && pointerUpLocally == false)
            {
                EventManager.Dispatch(new PointerUpSignal
                {
                    AltKey    = e.AltKey,
                    CtrlKey   = e.CtrlKey,
                    ShiftKey  = e.ShiftKey,
                    AnchoredX = originalClickX <x?originalClickX : x,
                                                AnchoredY = originalClickY <y?originalClickY : y,
                                                                            ViewportX = x> originalClickX?x : originalClickX,
                                                ViewportY = y> originalClickY ? y : originalClickY,
                    MouseButton  = clickButton,
                    OriginalX    = originalClickX,
                    OriginalY    = originalClickY,
                    ActualX      = x,
                    ActualY      = y,
                    ActualButton = e.Button,
                });
            }

            if (isPointerDown)
            {
                e.PreventDefault();
                isPointerDown = false;
            }
        }
Example #2
0
        void LoopDisplay_MouseUp(MouseEvent e)
        {
            e.PreventDefault();
            e.StopPropagation();

            clicking = false;
        }
Example #3
0
 void LoopDisplay_MouseDown(MouseEvent e)
 {
     e.PreventDefault();
     e.StopPropagation();
     clicking = true;
     OnMouseButtonDown(e);
 }
        void onDocumentMouseDown(Event arg)
        {
            if (!IsActive)
            {
                return;
            }

            MouseEvent e = arg.As <MouseEvent>();

            e.PreventDefault();

            THREE.Vector3 vector = new THREE.Vector3(mouse.x, mouse.y, 0.5).unproject(camera);

            var raycaster = new THREE.Raycaster(camera.position, vector.sub(camera.position).normalize());

            THREE.Intersection[] intersects = raycaster.intersectObjects(allObjects);

            if (intersects.Length > 0)
            {
                THREE.Intersection interSec = intersects[0];
                THREE.Mesh         m        = interSec.Object as THREE.Mesh;

                if (m != null)
                {
                    controls.enabled = false;
                    selected         = m;
                    intersects       = raycaster.intersectObject(plane);
                    offset.copy(interSec.point).sub(plane.position);
                    Container.Style.Cursor = Cursor.Move;
                }
            }
        }
        static private void OnClickMainMenu(MouseEvent e)
        {
            e.PreventDefault();
            jQuery target    = new jQuery(e.Target);
            string popupName = target.Attr("data-popup");

            PopupManager.Instance.OpenPopupBelow(popupName, (HTMLElement)target.Get(0));
        }
Example #6
0
        internal void OnMouseButtonDown(MouseEvent e)
        {
            if (e.Button != 0)
            {
                e.PreventDefault();
                e.StopPropagation();
            }
            var bounds = displayHost.GetBoundingClientRect();

            OnMouseButtonDown(e.ClientX - bounds.Left, e.ClientY - bounds.Top, e.Button != 0, e.ShiftKey, e.CtrlKey);
        }
Example #7
0
        public void OnMouseMove(MouseEvent e)
        {
            Point position = new Point(e.PageX, e.PageY);

            mouseMoveHandled = ProcessMouseEvent(new RawMouseEventArgs(position, GetTimestamp()));

            if (mouseDownHandled || mouseMoveHandled || MouseDevice.CaptureTarget != null)
            {
                e.PreventDefault();
            }
        }
Example #8
0
        public void OnMouseUp(MouseEvent e)
        {
            Point       position = new Point(e.PageX, e.PageY);
            MouseButton button   = converter.ConvertBackMouseButton(e.Button);

            mouseUpHandled = ProcessMouseEvent(new RawMouseButtonEventArgs(button, MouseButtonState.Released, position, GetTimestamp()));

            if (mouseDownHandled || mouseMoveHandled || mouseUpHandled || MouseDevice.CaptureTarget != null)
            {
                e.PreventDefault();
            }
        }
        void onDocumentMouseMove(Event arg)
        {
            if (!IsActive)
            {
                return;
            }

            MouseEvent e = arg.As <MouseEvent>();

            e.PreventDefault();

            SetMousePos(e);
            raycaster.setFromCamera(mouse, camera);


            THREE.Intersection[] intersects;

            if (selected != null)
            {
                intersects = raycaster.intersectObject(plane);
                selected.position.copy(intersects[0].point.sub(offset));
                return;
            }

            intersects = raycaster.intersectObjects(allObjects);

            if (intersects.Length > 0)
            {
                THREE.Intersection i = intersects[0];
                THREE.Mesh         m = i.Object as THREE.Mesh;

                if (m != null && m != intersected)
                {
                    intersected = m;
                    plane.position.copy(intersected.position);
                    plane.lookAt(camera.position);
                }
                Container.Style.Cursor = Cursor.Pointer;
            }
            else
            {
                intersected            = null;
                Container.Style.Cursor = Cursor.Auto;
            }
        }
Example #10
0
 /// <summary>
 /// Start a dragging operation.
 /// Called when scrollbar handle is clicked.
 /// </summary>
 /// <param name="e">Mouse down event.</param>
 private void onMouseDownHandle_(MouseEvent e)
 {
     this.cleanUp_();
     if (Core.isRightButton(e))
     {
         // Right-click.
         // Scrollbars have no context menu.
         e.StopPropagation();
         return;
     }
     // Look up the current translation and record it.
     this.startDragHandle = this.handlePosition_;
     // Record the current mouse position.
     this.startDragMouse         = this.horizontal_ ? e.ClientX : e.ClientY;
     Scrollbar.onMouseUpWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                             "mouseup", this, new Action <Event>(this.onMouseUpHandle_));
     Scrollbar.onMouseMoveWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                               "mousemove", this, new Action <MouseEvent>(this.onMouseMoveHandle_));
     e.StopPropagation();
     e.PreventDefault();
 }
        void onDocumentMouseUp(Event arg)
        {
            if (!IsActive)
            {
                return;
            }

            MouseEvent e = arg.As <MouseEvent>();

            e.PreventDefault();

            controls.enabled = true;

            if (intersected != null)
            {
                plane.position.copy(intersected.position);
                selected = null;
            }

            Container.Style.Cursor = Cursor.Auto;
        }
Example #12
0
        /// <summary>
        /// Scroll by one pageful.
        /// Called when scrollbar background is clicked.
        /// </summary>
        /// <param name="e">Mouse down event.</param>
        private void onMouseDownBar_(MouseEvent e)
        {
            Touch.clearTouchIdentifier();              // This is really a click.
            this.cleanUp_();
            if (Core.isRightButton(e))
            {
                // Right-click.
                // Scrollbars have no context menu.
                e.StopPropagation();
                return;
            }
            var mouseXY = Core.mouseToSvg(e, this.workspace_.getParentSvg(),
                                          this.workspace_.getInverseScreenCTM());
            var mouseLocation = this.horizontal_ ? mouseXY.x : mouseXY.y;

            var handleXY       = Core.getSvgXY_(this.svgHandle_, this.workspace_);
            var handleStart    = this.horizontal_ ? handleXY.x : handleXY.y;
            var handlePosition = this.handlePosition_;

            var pageLength = this.handleLength_ * 0.95;

            if (mouseLocation <= handleStart)
            {
                // Decrease the scrollbar's value by a page.
                handlePosition -= pageLength;
            }
            else if (mouseLocation >= handleStart + this.handleLength_)
            {
                // Increase the scrollbar's value by a page.
                handlePosition += pageLength;
            }

            this.setHandlePosition(this.constrainHandle_(handlePosition));

            this.onScroll_();
            e.StopPropagation();
            e.PreventDefault();
        }
Example #13
0
        static void PointerDown(MouseEvent e)
        {
            e.PreventDefault();
            ElementsManager.Viewport.Focus();
            PointerUtils.PageXYToStageXY(e.PageX, e.PageY, out int x, out int y);

            if (isPointerDown == false)
            {
                pointerUpLocally = false;
                isPointerDown    = true;
                originalClickX   = x;
                originalClickY   = y;
                clickButton      = e.Button;
                EventManager.Dispatch(new PointerDownSignal
                {
                    AltKey      = e.AltKey,
                    CtrlKey     = e.CtrlKey,
                    ShiftKey    = e.ShiftKey,
                    ViewportX   = originalClickX,
                    ViewportY   = originalClickY,
                    MouseButton = clickButton,
                });
            }
        }
Example #14
0
 private void OnClickTabHeader(MouseEvent e)
 {
     e.PreventDefault();
     GetPage(new jQuery(e.Target).Attr("data-pageid")).Show();
 }