Пример #1
0
        public static void AddPoint(int playerIndex, int roundNumber, int points, int totalPoints)
        {
            var currentPanel  = jQuery.Select("div[" + DiceView.PlayerPanelAttribute + "=" + playerIndex + "]");
            var scrollElement = currentPanel.Find(".panel-body");
            var newItem       = new jQuery("<li>").AddClass("list-group-item low-pad")
                                .Attr(DiceView.PlayerPointsRoundAttribute, roundNumber)
                                .Text(points);

            currentPanel.Find("[" + DiceView.PlayerScoreBoardAttribute + "]").Append(newItem);

            // scroll to element
            scrollElement.ScrollTop(scrollElement.ScrollTop() + newItem.Position().Top
                                    - scrollElement.Height() + newItem.Height());

            currentPanel.Find("[" + DiceView.PlayerPanelFooterAttribute + "]").Text("Total: " + totalPoints);
        }
Пример #2
0
        public void Render()
        {
            var left = coordinate.Left - textarea.ScrollLeft();
            var top  = coordinate.Top - textarea.ScrollTop();

            if (0 <= left && left <= textarea.Width() &&
                0 <= top && top <= textarea.Height())
            {
                element
                .Show()
                .Css("left", coordinate.Left - textarea.ScrollLeft())
                .Css("top", coordinate.Top - textarea.ScrollTop())
                .Css("height", coordinate.Height);
            }
            else
            {
                element.Hide();
            }
        }