fix initial scale/translate algorithm

This commit is contained in:
Devin Howard 2016-12-18 16:14:39 -05:00
parent 7af5972765
commit e30d05f71d

View file

@ -173,13 +173,13 @@ const Visualize = {
} }
const queryParams = Util.queryParams() const queryParams = Util.queryParams()
if (typeof queryParams.scale === 'string') { const scale = parseFloat(queryParams.scale) || 1.0
const scale = parseFloat(queryParams.scale) || 0
self.mGraph.canvas.scale(scale, scale)
}
if (typeof queryParams.translate === 'string') { if (typeof queryParams.translate === 'string') {
const [x, y] = queryParams.translate.split(',').map(n => parseFloat(n) || 0) const [x, y] = queryParams.translate.split(',').map(n => parseFloat(n) || 0)
self.mGraph.canvas.translate(x, y) self.mGraph.canvas.translate(x / scale, y / scale)
}
if (typeof queryParams.scale === 'string') {
self.mGraph.canvas.scale(scale, scale)
} }
function runAnimation() { function runAnimation() {