Esempio n. 1
0
        public void Mainloop(float deltatime)
        {
            OnMainLoopBegin?.Invoke(this, EventArgs.Empty);
            if (Closed)
            {
                return;
            }

            if (CreatedFrame)
            {
                CreatedFrame = false;
            }
            if (_browserReadyFrame)
            {
                OnBrowserReady?.Invoke(this, EventArgs.Empty);
                CreatedFrame       = true;
                _browserReadyFrame = false;
            }

            if (Browser == null)
            {
                return;
            }

            if (LoadedFrame)
            {
                LoadedFrame     = false;
                IsDocumentReady = true;
            }
            Loading = Browser.IsLoading;
            if (_loadedFrame)
            {
                LoadedFrame  = true;
                _loadedFrame = false;
            }

            if (_invalidateAccFrame)
            {
                _newAccFrameReady.Clear();
            }

            if (!TextureSettings.Equals(_prevTextureSettings))
            {
                UpdateSize();
            }

            //if (BrowserSettings.ZoomLevel != Browser.Host.ZoomLevel)
            //{
            //    Browser.Host.ZoomLevel = Math.Abs(BrowserSettings.ZoomLevel) <= 0.0001 ? 0.0001 : BrowserSettings.ZoomLevel;
            //    //Browser.Host.ZoomLevel = BrowserSettings.ZoomLevel;
            //}

            Browser.Host.ZoomLevel = BrowserSettings.ZoomLevel;

            if (DocumentSizeBaseSelector != null)
            {
                DocumentSizeBaseSelector.Selector = BrowserSettings.DocumentSizeElementSelector;
            }

            if (LivePageActive != BrowserSettings.UseLivePage)
            {
                ExecuteJavascript(BrowserSettings.UseLivePage ? Globals.LivePageLoader : Globals.LivePageUnloader);
                LivePageActive = BrowserSettings.UseLivePage;
            }

            SubmittedTouches.Clear();

            if (Enabled)
            {
                try
                {
                    Operations?.InvokeRecursive(this);
                }
                catch (Exception e)
                {
                    LogError(e);
                }

                if (InitSettings.FrameRequestFromVvvv && AllowFrameRequest)
                {
                    Browser.Host.SendExternalBeginFrame();
                }
            }

            ProcessTouches();

            _prevTextureSettings = TextureSettings;
            _prevBrowserSettings = BrowserSettings;

            OnMainLoopEnd?.Invoke((object)this, EventArgs.Empty);
        }