GetSelection() public method

public GetSelection ( Point point, double precision, bool inMotion = false ) : Selection
point Point
precision double
inMotion bool
return LongoMatch.Core.Store.Drawables.Selection
Exemplo n.º 1
0
        public override void ClickPressed(Point point, ButtonModifier modif)
        {
            Selection selection = null;

            if (ButtonClickPressed(point, modif, subPlayers, subInjury,
                                   homeButton, awayButton))
            {
                return;
            }

            if (!SubstitutionMode && SelectionMode != MultiSelectionMode.Multiple)
            {
                if (SelectionMode == MultiSelectionMode.Single || modif == ButtonModifier.None)
                {
                    ResetSelection();
                }
            }

            point     = Utils.ToUserCoords(point, offset, scaleX, scaleY);
            selection = homeBench.GetSelection(point, 0, false);
            if (selection == null)
            {
                selection = awayBench.GetSelection(point, 0, false);
                if (selection == null)
                {
                    selection = field.GetSelection(point, 0, false);
                }
            }
            if (selection != null)
            {
                clickedPlayer = selection.Drawable as PlayerObject;
                if (SubstitutionMode && substitutionPlayer != null &&
                    clickedPlayer.Team != substitutionPlayer.Team)
                {
                    clickedPlayer = null;
                }
                else
                {
                    (selection.Drawable as ICanvasObject).ClickPressed(point, modif);
                }
            }
            else
            {
                clickedPlayer = null;
            }
        }
Exemplo n.º 2
0
        public override void ClickPressed(Point point, ButtonModifier modif)
        {
            Selection selection = null;

            modifier = ButtonModifier.None;
            if (ButtonClickPressed(point, modif, subPlayers, subInjury,
                                   homeButton, awayButton))
            {
                return;
            }

            // FIXME: this is very awkward, click events should be forwarded to the child views
            point     = VASDrawing.Utils.ToUserCoords(point, offset, scaleX, scaleY);
            selection = homeBench.GetSelection(point, 0, false);
            if (selection == null)
            {
                selection = awayBench.GetSelection(point, 0, false);
                if (selection == null)
                {
                    selection = field.GetSelection(point, 0, false);
                    if (selection != null)
                    {
                        point = VASDrawing.Utils.ToUserCoords(point, field.Position, 1, 1);
                    }
                }
                else
                {
                    point = VASDrawing.Utils.ToUserCoords(point, awayBench.Position, 1, 1);
                }
            }
            else
            {
                point = VASDrawing.Utils.ToUserCoords(point, homeBench.Position, 1, 1);
            }
            if (selection != null)
            {
                clickedPlayer = selection.Drawable as LMPlayerView;
                modifier      = modif;
                (selection.Drawable as ICanvasObject).ClickPressed(point, modif);
            }
            else
            {
                clickedPlayer = null;
            }
        }