Przeglądaj źródła

Resize renderer instead of reinitializing on size change.

pull/63/head
Matthew Petroff 9 lat temu
rodzic
commit
d76b9f9709
2 zmienionych plików z 14 dodań i 3 usunięć
  1. +11
    -0
      src/js/libpannellum.js
  2. +3
    -3
      src/js/pannellum.js

+ 11
- 0
src/js/libpannellum.js Wyświetl plik

@@ -347,6 +347,17 @@ function Renderer(container, image, imageType, video) {
}
};

this.resize = function() {
this.canvas.width = this.container.offsetWidth;
this.canvas.height = this.container.offsetHeight;
if (gl) {
gl.viewport(0, 0, this.canvas.width, this.canvas.height);
if (this.imageType != 'multires') {
gl.uniform1f(program.aspectRatio, this.canvas.width / this.canvas.height);
}
}
}

this.render = function(pitch, yaw, hfov, returnImage) {
var focal, i, s;


+ 3
- 3
src/js/pannellum.js Wyświetl plik

@@ -828,8 +828,9 @@ function keyRepeat() {
}

function onDocumentResize() {
// Reset panorama renderer
renderInit();
// Resize panorama renderer
renderer.resize();
animateInit();
// Kludge to deal with WebKit regression: https://bugs.webkit.org/show_bug.cgi?id=93525
onFullScreenChange();
@@ -1353,7 +1354,6 @@ function onFullScreenChange() {
controls.fullscreen.classList.remove('fullscreentoggle_button_active');
fullscreenActive = false;
}
animateInit();
}

function zoomIn() {


Ładowanie…
Anuluj
Zapisz