@@ -8531,7 +8531,6 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
85318531 w.HTMLGL.context = this;
85328532
85338533 this.createStage(); //Creating stage before showing it
8534- console.log('context updated position');
85358534 this.updateScrollPosition(); //Initialize scroll position for first time
85368535 this.initListeners();
85378536 this.elementResolver = new w.HTMLGL.GLElementResolver(this);
@@ -8589,7 +8588,7 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
85898588 w.HTMLGL.scrollX = scrollOffset.left;
85908589 w.HTMLGL.scrollY = scrollOffset.top;
85918590
8592- this.stage.changed = true ;
8591+ this.markStageAsChanged() ;
85938592 }
85948593
85958594 p.createViewer = function () {
@@ -8612,7 +8611,8 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
86128611
86138612 this.renderer.resize(width, height);
86148613 this.updateTextures();
8615- this.stage.changed = true;
8614+
8615+ this.markStageAsChanged();
86168616 }
86178617
86188618 p.createStage = function () {
@@ -8621,11 +8621,10 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
86218621 this.stage.addChild(w.HTMLGL.document);
86228622 }
86238623
8624+ //Avoiding function.bind() for performance and memory consuming reasons
86248625 p.redrawStage = function () {
8625- requestAnimFrame(this.redrawStage.bind(this));
8626-
8627- if (this.stage.changed) {
8628- this.renderer.render(this.stage);
8626+ if (w.HTMLGL.stage.changed) {
8627+ w.HTMLGL.renderer.render(w.HTMLGL.stage);
86298628 w.HTMLGL.stage.changed = false;
86308629 }
86318630 }
@@ -8649,6 +8648,7 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
86498648 //We would like to rerender if something changed, otherwise stand by
86508649 p.markStageAsChanged = function () {
86518650 if (w.HTMLGL.stage && !w.HTMLGL.stage.changed) {
8651+ requestAnimFrame(this.redrawStage);
86528652 w.HTMLGL.stage.changed = true;
86538653 }
86548654 }
0 commit comments