/// <returns>true, if the selection should continue in the background of the bar.</returns>
        public bool MouseDown(MouseEventArgs e, Size parentControlSize, Vector2 clickPos)
        {
            _selectionMode = SelectionMode.None;
            _overallDelta  = 0;

            // check if the mouse click was in the bar area
            RectangleF barArea       = getBarArea(parentControlSize);
            RectangleF selectionArea = barArea;

            selectionArea.Inflate(10.0f, _selectionMaxPixelDistanceForMove * 0.8f);
            if (!selectionArea.Contains(e.Location))
            {
                return(true);
            }

            switch (e.Button)
            {
            case MouseButtons.Left:
                // check if the mouse click was on one of the two sliders
                float distanceToSelectedLimit0 = Math.Abs(e.Y - ToVisualY(barArea, _selectedLimit0));
                float distanceToSelectedLimit1 = Math.Abs(e.Y - ToVisualY(barArea, _selectedLimit1));
                if (distanceToSelectedLimit0 < distanceToSelectedLimit1)
                {
                    if (distanceToSelectedLimit0 < _selectionMaxPixelDistanceForMove)
                    {
                        _selectionMode = SelectionMode.SelectedLimit0;
                    }
                }
                else
                {
                    if (distanceToSelectedLimit1 < _selectionMaxPixelDistanceForMove)
                    {
                        _selectionMode = SelectionMode.SelectedLimit1;
                    }
                }

                // check if a the click happend on a room
                if (barArea.Contains(e.Location) && _selectionMode == SelectionMode.None)
                {
                    for (int groupIndex = 0; groupIndex < GroupCount; ++groupIndex)
                    {
                        RectangleF groupArea = groupGetArea(barArea, groupIndex);
                        if (groupArea.Contains(e.Location))
                        {
                            _groupMouseClicked = groupIndex;

                            float mouseDepth = FromVisualY(barArea, e.Y);
                            List <List <RelevantRoom> > roomSequences = groupBuildRoomSequences(clickPos, groupIndex);
                            float sequenceWidth = groupArea.Width / roomSequences.Count;
                            for (int i = 0; i < roomSequences.Count; ++i)
                            {
                                float posX0 = groupArea.X + sequenceWidth * i;
                                float posX1 = groupArea.X + sequenceWidth * (i + 1);
                                if (e.X >= posX0 && e.X <= posX1)
                                {
                                    for (int j = roomSequences[i].Count - 1; j >= 0; --j)
                                    {
                                        if (mouseDepth <= roomSequences[i][j].MaxDepth && mouseDepth >= roomSequences[i][j].MinDepth)
                                        {
                                            _roomMouseClicked = roomSequences[i][j].Room;
                                            _roomMouseOffset  = mouseDepth - _roomMouseClicked.Position.Y;

                                            // If multiple rooms are selected, don't reset selection.
                                            if (_editor.SelectedRooms.Count <= 1 || !_editor.SelectedRooms.Contains(_roomMouseClicked))
                                            {
                                                SelectedRoom?.Invoke(new[] { _roomMouseClicked });
                                            }

                                            InvalidateParent?.Invoke();
                                            _selectionMode = SelectionMode.RoomMove;
                                            return(false);
                                        }
                                    }
                                }
                            }
                            break;
                        }
                    }

                    selectionArea.Y      = ToVisualY(barArea, Math.Max(_selectedLimit0, _selectedLimit1));
                    selectionArea.Height = Math.Abs(ToVisualY(barArea, _selectedLimit0) - ToVisualY(barArea, _selectedLimit1));

                    if (selectionArea.Contains(e.Location))
                    {
                        _barMouseOffset = distanceToSelectedLimit0;
                        _selectionMode  = SelectionMode.SelectedLimitBoth;
                    }
                }
                break;

            case MouseButtons.Middle:
            case MouseButtons.XButton1:
            case MouseButtons.XButton2:
                for (int groupIndex = 0; groupIndex < DepthProbes.Count; ++groupIndex)
                {
                    RectangleF groupArea = groupGetArea(barArea, groupIndex);
                    if (groupArea.Contains(e.Location))
                    {
                        DepthProbes.RemoveAt(groupIndex);
                        InvalidateParent?.Invoke();
                        break;
                    }
                }
                break;
            }

            return(false);
        }