示例#1
0
 public void ResetViewport()
 {
     Document.HasLoadedHtml = false;
     Document.HasRendered   = false;
     Size                 = default(LiteHtmlSize);
     ScrollOffset         = default(LiteHtmlPoint);
     _desiredSize         = default(LiteHtmlSize);
     _desiredScrollOffset = default(LiteHtmlPoint);
     _hasCustomViewport   = false;
 }
示例#2
0
        // custom viewport is used for offsetting/scrolling the canvas on this view
        public bool SetViewport(LiteHtmlPoint scrollOffset, LiteHtmlSize size)
        {
            _hasCustomViewport   = true;
            _desiredScrollOffset = scrollOffset;
            _desiredSize         = size;

            if (!Document.HasLoadedHtml)
            {
                return(false);
            }

            return(CheckViewportChange());
        }
示例#3
0
        // If true then a redraw is needed
        public bool CheckViewportChange(bool forceRender = false)
        {
            if (forceRender ||
                (int)Size.Width != (int)_desiredSize.Width ||
                (int)Size.Height != (int)_desiredSize.Height)
            {
                Size         = _desiredSize;
                ScrollOffset = _desiredScrollOffset;
                Document.OnMediaChanged();
                Render();
                return(true);
            }

            if ((int)ScrollOffset.Y != (int)_desiredScrollOffset.Y || (int)ScrollOffset.X != (int)_desiredScrollOffset.X)
            {
                ScrollOffset = _desiredScrollOffset;
                return(true);
            }

            return(false);
        }