Commit 8f936912 authored by Jean Rabreau's avatar Jean Rabreau
Browse files

馃┕remove persistant window event listener from 3dhop

parent ca984f67
......@@ -4163,32 +4163,34 @@ isInstanceLightingEnabled : function (tag) {
return Lighting;
},
init3dhop: function() {
this._isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
resizeCanvas: function() {
if (!this._resizable) return;
window.addEventListener('resize', () => {
if (!this._resizable) return;
const canvas = document.getElementById('draw-canvas')
const hop = document.getElementById('hop__container')
const canvas = document.getElementById('draw-canvas')
const hop = document.getElementById('hop__container')
let width, height;
if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
width = Math.max(document.documentElement.clientWidth, window.innerWidth);
height = window.innerHeight;
}
else {
width = hop.offsetWidth
height = hop.offsetHeight
}
canvas.setAttribute('width', width)
canvas.setAttribute('height', height)
hop.style.width = width
hop.style.height = height
let width, height;
if(document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) {
width = Math.max(document.documentElement.clientWidth, window.innerWidth);
height = window.innerHeight;
}
else {
width = hop.offsetWidth
height = hop.offsetHeight
}
this.ui.postDrawEvent();
},
canvas.setAttribute('width', width)
canvas.setAttribute('height', height)
hop.style.width = width
hop.style.height = height
init3dhop: function() {
this._isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
this.ui.postDrawEvent();
});
window.addEventListener('resize', this.resizeCanvas);
const canvas = document.getElementById('draw-canvas')
const hop = canvas.parentElement
......
......@@ -15984,12 +15984,12 @@ SpiderGL.UserInterface.CanvasHandler = function (gl, handler, options) {
/** @private */
const handleMessage = function (evt) {
if (evt.source != window) return;
if (evt.data == SpiderGL.UserInterface.CanvasHandler._FAST_ANIMATE_MESSAGE_NAME) {
if (evt.source !== window) return;
if (evt.data === SpiderGL.UserInterface.CanvasHandler._FAST_ANIMATE_MESSAGE_NAME) {
evt.stopPropagation();
that._onAnimate();
}
else if (evt.data == SpiderGL.UserInterface.CanvasHandler._FAST_DRAW_MESSAGE_NAME) {
else if (evt.data === SpiderGL.UserInterface.CanvasHandler._FAST_DRAW_MESSAGE_NAME) {
evt.stopPropagation();
that._onDraw();
}
......
......@@ -68,9 +68,12 @@ export default {
this.presenter.init3dhop();
this.setup3dhop()
},
beforeDestroy() {
window.removeEventListener('resize', this.presenter.resizeCanvas)
},
methods: {
followCredits() {
window.open('http://vcg.isti.cnr.it/3dhop/', '_blank')
window.open('https://3dhop.net', '_blank')
},
setup3dhop() {
this.presenter.setScene({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment