Beispiel #1
0
        /**
         * タッチイベント処理
         * リストの末尾(手前に表示されている)から順に処理する
         * @param vt
         * @return true:再描画
         */
        public bool touchEvent(ViewTouch vt, out UDrawable hoverObj)
        {
            UDrawManager manager = UDrawManager.getInstance();
            bool         ret     = false;
            bool         isHover;

            hoverObj = null;

            // 手前に表示されたものから処理したいのでリストを逆順で処理する
            list.Reverse();
            foreach (UDrawable obj in list)
            {
                if (!obj.isShow)
                {
                    continue;
                }
                PointF offset = obj.getDrawOffset();

                if (obj.touchEvent(vt, offset, out isHover))
                {
                    if (isHover)
                    {
                        hoverObj = obj;
                    }
                    ret = true;
                    break;
                }
            }
            list.Reverse();     // 逆順を元に戻す
            return(ret);
        }
Beispiel #2
0
        /**
         * タッチ処理
         * @param vt
         * @return
         */
        override public bool touchEvent(ViewTouch vt, PointF offset, out bool isHover)
        {
            isHover = false;
            // 領域内をマウスダウンしたらtrueを返す
            if (checkInside(vt.args.Location))
            {
                switch (vt.MEvent)
                {
                case MouseEvent.Down:
                    pressed = true;
                    break;

                case MouseEvent.Click:
                    // クリック時の処理
                    if (callback != null)
                    {
                        callback(this);
                    }
                    return(true);

                case MouseEvent.Move:
                    // ホバー時の処理
                    isHover = true;
                    return(true);
                }
                return(true);
            }
            else
            {
                pressed = false;
            }
            return(false);
        }
        /**
         * タッチ処理
         * @param vt
         * @return
         */
        override public bool touchEvent(ViewTouch vt, PointF offset, out bool isHover)
        {
            isHover = false;
            // 領域内をマウスダウンしたらtrueを返す
            if (checkInside(vt.args.Location))
            {
                switch (vt.MEvent)
                {
                case MouseEvent.Click:
                    // クリック時の処理
                    System.Console.WriteLine("touch UDrawRectangle:" + name);
                    this.startAnimation(100);
                    return(true);

                case MouseEvent.Move:
                    // ホバー時の処理
                    isHover = true;
                    return(true);
                }


                return(true);
            }
            return(false);
        }
 private bool touchMove(ViewTouch vt)
 {
     //if (isDraging)
     //{
     //    float move = (type == ScrollBarType.Vertical) ? vt.getMoveY() : vt.getMoveX();
     //    barMove(move);
     //    return true;
     //}
     return(false);
 }
Beispiel #5
0
        public override bool touchEvent(ViewTouch vt, PointF offset, out bool isHover)
        {
            isHover = false;
            // 領域内をマウスダウンしたらtrueを返す
            switch (vt.MEvent)
            {
            case MouseEvent.Click:
                // クリック時の処理
                if (UDrawUtility.checkInside(vt.args.Location, rect1))
                {
                    Console.WriteLine("1");
                    return(true);
                }
                else if (UDrawUtility.checkInside(vt.args.Location, rect2))
                {
                    Console.WriteLine("2");
                    return(true);
                }
                else if (UDrawUtility.checkInside(vt.args.Location, rect3))
                {
                    Console.WriteLine("3");
                    return(true);
                }
                break;

            case MouseEvent.Move:
                // ホバー時の処理
                if (UDrawUtility.checkInside(vt.args.Location, rect1))
                {
                    isHover = true;
                    hoverNo = 1;
                    return(true);
                }
                else if (UDrawUtility.checkInside(vt.args.Location, rect2))
                {
                    isHover = true;
                    hoverNo = 2;
                    return(true);
                }
                else if (UDrawUtility.checkInside(vt.args.Location, rect3))
                {
                    isHover = true;
                    hoverNo = 3;
                    return(true);
                }
                else
                {
                    isHover = false;
                    hoverNo = 0;
                }
                break;
            }
            return(false);
        }
 override public bool touchEvent(ViewTouch vt, PointF offset, out bool isHover)
 {
     if (vt.MEvent == MouseEvent.Move)
     {
         if (checkInside(vt.args.Location))
         {
             isHover = true;
             return(true);
         }
     }
     isHover = false;
     return(false);
 }
Beispiel #7
0
        /**
         * タッチアップイベント処理
         * @param vt
         * @return
         */
        public bool touchUpEvent(ViewTouch vt)
        {
            bool isRedraw = false;

            foreach (UDrawable obj in list)
            {
                if (obj.touchUpEvent(vt))
                {
                    isRedraw = true;
                }
            }
            return(isRedraw);
        }
Beispiel #8
0
        private void Initialize()
        {
            // treeのノードを開く
            treeView1.ExpandAll();

            drawMode = EDrawMode.Draw1;

            ULog.init();

            vt = new ViewTouch();

            drawManager = new UDrawManager();
            drawManager.init();
        }
Beispiel #9
0
        /**
         * タッチイベント処理
         * 描画優先度の高い順に処理を行う
         * @param vt
         * @return true:再描画
         */
        public bool touchEvent(ViewTouch vt)
        {
            SortedDictionary <int, DrawList> lists = mDrawList;

            // 1つ前のフレームのホバーオブジェクトを開放する
            UDrawable oldHoverObj = hoverObj;

            if (hoverObj != null)
            {
                hoverObj.IsHover = false;
                hoverObj         = null;
            }

            //if (vt.MEvent == MouseEvent.Down)
            {
                UDrawable _hoverObj;
                foreach (DrawList list in lists.Values)
                {
                    if (list.touchEvent(vt, out _hoverObj))
                    {
                        // その他のタッチイベントはtrueが返った時点で打ち切り
                        if (_hoverObj != null)
                        {
                            hoverObj         = _hoverObj;
                            hoverObj.IsHover = true;
                        }

                        return(true);
                    }
                }
            }
            if (oldHoverObj != hoverObj)
            {
                return(true);
            }

            return(false);
        }
        /**
         * タッチ系の処理
         * @param tv
         * @return
         */
        public bool touchEvent(ViewTouch tv, PointF offset)
        {
            switch (tv.MEvent)
            {
            case MouseEvent.Down:
                if (touchDown(tv, offset))
                {
                    return(true);
                }
                break;

            case MouseEvent.Move:
                if (touchMove(tv))
                {
                    return(true);
                }
                break;

            case MouseEvent.Up:
                touchUp();
                break;
            }
            return(false);
        }
        /**
         * スクロールバーのタッチ処理
         * @param vt
         * @return true:バーがスクロールした
         */
        private bool touchDown(ViewTouch vt, PointF offset)
        {
            // スペース部分をタッチしたら1画面分スクロール
            //float ex = vt.touchX - offset.X;
            //float ey = vt.touchY - offset.Y;

            //RectangleF rect;
            //if (type == ScrollBarType.Vertical)
            //{
            //    rect = new RectangleF(pos.X - TOUCH_MARGIN, pos.Y,
            //                pos.X + bgWidth + TOUCH_MARGIN, pos.Y + bgLength);
            //    if (rect.Left <= ex && ex < rect.Right &&
            //            rect.Top <= ey && ey < rect.Bottom)
            //    {
            //        if (ey < barPos)
            //        {
            //            // 上にスクロール
            //            //ULog.print(TAG, "Scroll Up");
            //            scrollUp();
            //            return true;
            //        }
            //        else if (ey > pos.Y + barPos + barLength)
            //        {
            //            // 下にスクロール
            //            //ULog.print(TAG, "Scroll Down");
            //            scrollDown();
            //            return true;
            //        }
            //        else
            //        {
            //            // バー
            //            //ULog.print(TAG, "Drag Start");
            //            isDraging = true;
            //            return true;
            //        }
            //    }
            //}
            //else
            //{
            //    rect = new RectangleF(pos.X, pos.Y - TOUCH_MARGIN,
            //            pos.X + bgLength, pos.Y + bgWidth);

            //    if (rect.Left <= ex && ex < rect.Right &&
            //            rect.Top <= ey && ey < rect.Bottom)
            //    {
            //        if (ex < barPos)
            //        {
            //            // 上にスクロール
            //            ULog.print(TAG, "Scroll Up");
            //            scrollUp();
            //            return true;
            //        }
            //        else if (ex > pos.X + barPos + barLength)
            //        {
            //            // 下にスクロール
            //            ULog.print(TAG, "Scroll Down");
            //            scrollDown();
            //            return true;
            //        }
            //        else
            //        {
            //            // バー
            //            ULog.print(TAG, "Drag Start");
            //            isDraging = true;
            //            return true;
            //        }
            //    }
            //}
            return(false);
        }
Beispiel #12
0
 /**
  * タッチ処理
  * @param vt
  * @return
  */
 public bool touchEvent(ViewTouch vt, out bool isHover)
 {
     return(this.touchEvent(vt, PointF.Empty, out isHover));
 }
Beispiel #13
0
 /**
  * タッチ処理
  * @param vt
  * @param offset
  * @param isHover  ホバーならtureを返す
  * @return
  */
 virtual public bool touchEvent(ViewTouch vt, PointF offset, out bool isHover)
 {
     isHover = false;
     return(false);
 }
Beispiel #14
0
 /**
  * タッチアップ処理
  * @param vt
  * @return
  */
 virtual public bool touchUpEvent(ViewTouch vt)
 {
     return(false);
 }