Esempio n. 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;
 }
Esempio n. 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());
        }
Esempio n. 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);
        }