Example #1
0
        /// <summary>
        /// Handle a mouse-down on bubble's border.
        /// </summary>
        /// <param name="e">Mouse down event.</param>
        private void bubbleMouseDown_(MouseEvent e)
        {
            this.promote_();
            Bubble.unbindDragEvents_();
            if (Core.isRightButton(e))
            {
                // No right-click.
                e.StopPropagation();
                return;
            }
            else if (Core.isTargetInput_(e))
            {
                // When focused on an HTML text input widget, don't trap any events.
                return;
            }
            // Left-click (or middle click)
            Css.setCursor(Css.Cursor.CLOSED);

            this.workspace_.startDrag(e, new goog.math.Coordinate(
                                          this.workspace_.RTL ? -this.relativeLeft_ : this.relativeLeft_,
                                          this.relativeTop_));

            Bubble.onMouseUpWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                                 "mouseup", this, new Action <MouseEvent>(Bubble.bubbleMouseUp_));
            Bubble.onMouseMoveWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                                   "mousemove", this, new Action <MouseEvent>(this.bubbleMouseMove_));
            Core.hideChaff();
            // This event has been handled.  No need to bubble up to the document.
            e.StopPropagation();
        }
Example #2
0
 void LoopDisplay_MouseDown(MouseEvent e)
 {
     e.PreventDefault();
     e.StopPropagation();
     clicking = true;
     OnMouseButtonDown(e);
 }
Example #3
0
        void LoopDisplay_MouseUp(MouseEvent e)
        {
            e.PreventDefault();
            e.StopPropagation();

            clicking = false;
        }
Example #4
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 #5
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();
        }
    public void onCardPress(MouseEvent e)
    {
        e.StopPropagation();
        var dispObj = (DisplayObjectContainer)e.Target;

        dispObj.MouseChildren = !dispObj.MouseChildren;

        if (dispObj.NumChildren > 0)
        {
            var child = dispObj.GetChildAt(0);
            var newScale = dispObj.MouseChildren ? 1f : .65f;
            new Tween(child, "ScaleX", newScale, .2f, Easing.None.EaseNone);
            new Tween(child, "ScaleY", newScale, .2f, Easing.None.EaseNone);
        }
    }
Example #7
0
        /// <summary>
        /// Handle a mouse-down on bubble's resize corner.
        /// </summary>
        /// <param name="e">Mouse down event.</param>
        private void resizeMouseDown_(MouseEvent e)
        {
            this.promote_();
            Bubble.unbindDragEvents_();
            if (Core.isRightButton(e))
            {
                // No right-click.
                e.StopPropagation();
                return;
            }
            // Left-click (or middle click)
            Css.setCursor(Css.Cursor.CLOSED);

            this.workspace_.startDrag(e, new goog.math.Coordinate(
                                          this.workspace_.RTL ? -this.width_ : this.width_, this.height_));

            Bubble.onMouseUpWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                                 "mouseup", null, new Action <MouseEvent>(Bubble.bubbleMouseUp_));
            Bubble.onMouseMoveWrapper_ = Core.bindEventWithChecks_(Document.Instance,
                                                                   "mousemove", this, new Action <MouseEvent>(this.resizeMouseMove_));
            Core.hideChaff();
            // This event has been handled.  No need to bubble up to the document.
            e.StopPropagation();
        }
Example #8
0
    public void onCardPress(MouseEvent e)
    {
        e.StopPropagation();
        var dispObj = (DisplayObjectContainer)e.Target;

        dispObj.MouseChildren = !dispObj.MouseChildren;

        if (dispObj.NumChildren > 0)
        {
            var child    = dispObj.GetChildAt(0);
            var newScale = dispObj.MouseChildren ? 1f : .65f;
            new Tween(child, "ScaleX", newScale, .2f, Easing.None.EaseNone);
            new Tween(child, "ScaleY", newScale, .2f, Easing.None.EaseNone);
        }
    }
    public void onCardReleaseOutside(MouseEvent e)
    {
        e.StopPropagation();

        var dispObj = (DisplayObjectContainer)e.Target;
        do
        {
            Debug.Log ("Fixign card " + dispObj.Name);
            dispObj = dispObj.GetChildAt(0);
            dispObj.MouseChildren = true;
            new Tween(dispObj, "ScaleX", 1f, .1f, Easing.None.EaseNone);
            new Tween(dispObj, "ScaleY", 1f, .1f, Easing.None.EaseNone);
        }
        while(dispObj.NumChildren > 0);
        /*		for (var dispObj = (DisplayObjectContainer)e.Target; dispObj.NumChildren > 0; dispObj = dispObj.GetChildAt(0))
        {
            Debug.Log ("Fixign card " + dispObj.Name);
            dispObj.MouseChildren = true;
            new Tween(dispObj, "ScaleX", 1f, .1f, Easing.None.EaseNone);
            new Tween(dispObj, "ScaleY", 1f, .1f, Easing.None.EaseNone);
        }			 */
    }
Example #10
0
    public void onCardReleaseOutside(MouseEvent e)
    {
        e.StopPropagation();

        var dispObj = (DisplayObjectContainer)e.Target;

        do
        {
            Debug.Log("Fixign card " + dispObj.Name);
            dispObj = dispObj.GetChildAt(0);
            dispObj.MouseChildren = true;
            new Tween(dispObj, "ScaleX", 1f, .1f, Easing.None.EaseNone);
            new Tween(dispObj, "ScaleY", 1f, .1f, Easing.None.EaseNone);
        }while(dispObj.NumChildren > 0);

/*		for (var dispObj = (DisplayObjectContainer)e.Target; dispObj.NumChildren > 0; dispObj = dispObj.GetChildAt(0))
 *              {
 *                      Debug.Log ("Fixign card " + dispObj.Name);
 *                      dispObj.MouseChildren = true;
 *                      new Tween(dispObj, "ScaleX", 1f, .1f, Easing.None.EaseNone);
 *                      new Tween(dispObj, "ScaleY", 1f, .1f, Easing.None.EaseNone);
 *              }			 */
    }