Esempio n. 1
0
        private void OnButtonPressed(object sender, MouseButtonEventArgs msg)
        {
            if (msg.Button == MouseButton.Left)
            {
                IsLeftMouseButtonPress = true;
                if(DispatchPressed(msg.Current.Position.X, msg.Current.Position.Y))
                {
                    return;
                }

                Point p = CozyTiledPositionHelper.ConvertPositionToTiledPosition(CurrentPosition.ToVector2(), NodeContentSize);
                if(Status == S_Add)
                {
                    if (Judge(p))
                    {
                        TempTiles[p] = CurrentTiledId;
                    }
                }
                else if(Status == S_Remove)
                {
                    RemoveTiled(p);
                }
            }
            else if (msg.Button == MouseButton.Right)
            {
                if (CommandHistory.Instance.CanUndo())
                {
                    TiledCommandUndo(this, null);
                }
            }
        }
Esempio n. 2
0
        private void OnButtonReleased(object sender, MouseButtonEventArgs msg)
        {
            if (msg.Button == MouseButton.Left)
            {
                IsLeftMouseButtonPress = false;
                if (DispatchReleased(msg.Current.Position.X, msg.Current.Position.Y))
                {
                    return;
                }

                AddMultiTiled();
                TempTiles.Clear();
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Raises the ButtonTripleClicked event. This is done automatically by a correctly configured component,
 /// but this is exposed publicly to allow programmatic button triple-click events to occur.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void OnButtonTripleClicked(object sender, MouseButtonEventArgs args)
 {
     if (ButtonTripleClicked != null) { ButtonTripleClicked(sender, args); }
 }
Esempio n. 4
0
 /// <summary>
 /// Raises the ButtonPressed event. This is done automatically by a correctly configured component,
 /// but this is exposed publicly to allow programmatic button press events to occur.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void OnButtonPressed(object sender, MouseButtonEventArgs args)
 {
     if (ButtonPressed != null) { ButtonPressed(sender, args); }
 }
Esempio n. 5
0
        /// <summary>
        /// Raises the ButtonClicked event. This is done automatically by a correctly configured component,
        /// but this is exposed publicly to allow programmatic button click events to occur.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void OnButtonClicked(object sender, MouseButtonEventArgs args)
        {
            // If this click is within the right time and position of the last double click, raise
            // a triple-click event as well.
            TimeSpan lastDoubleClick = lastDoubleClicks[args.Button].Time;
            if ((args.Time - lastDoubleClick).TotalMilliseconds < DoubleClickTime &&
                DistanceBetween(args.Current, lastDoubleClicks[args.Button].Current) < DoubleClickMaxMove)
            {
                OnButtonTripleClicked(sender, args);
            }

            // If this click is within the right time and position of the last click, raise a
            // double-click event as well.
            TimeSpan lastClick = lastClicks[args.Button].Time;
            if ((args.Time - lastClick).TotalMilliseconds < DoubleClickTime &&
                DistanceBetween(args.Current, lastClicks[args.Button].Current) < DoubleClickMaxMove)
            {
                OnButtonDoubleClicked(sender, args);
                lastDoubleClicks[args.Button] = args;
            }

            lastClicks[args.Button] = args;
            if (ButtonClicked != null) { ButtonClicked(sender, args); }
        }