|
|
@@ -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; |
|
|
|