Commit 7f6edbcf authored by Big Bad Waffle's avatar Big Bad Waffle

fixes #1164

parent 40c44d39
......@@ -88,7 +88,7 @@ define([
backgroundColor: '0x2d2136'
});
window.onresize = this.onResize.bind(this);
window.addEventListener('resize', this.onResize.bind(this));
$(this.renderer.view)
.appendTo('.canvas-container');
......
......@@ -48,6 +48,8 @@ define([
hoverNode: null,
handlerResize: null,
postRender: function () {
input.init(this.el);
......@@ -69,6 +71,9 @@ define([
display: 'block'
});
this.handlerResize = this.onResize.bind(this);
window.addEventListener('resize', this.handlerResize);
let zoom = window.devicePixelRatio;
this.canvas = this.find('.canvas')[0];
......@@ -107,6 +112,24 @@ define([
}
},
beforeDestroy: function () {
window.removeEventListener('resize', this.handlerResize);
},
onResize: function () {
if (isMobile)
return;
let zoom = window.devicePixelRatio;
this.size.w = this.canvas.width = this.find('.bottom').width() * zoom;
this.size.h = this.canvas.height = this.find('.bottom').height() * zoom;
this.ctx.lineWidth = constants.lineWidth;
this.renderNodes();
},
renderNodes: function () {
if (!this.shown)
return;
......
......@@ -44,7 +44,7 @@
}
.canvas{
width: 100vw;
width: calc(100vw - 10px);
}
}
......
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