diff --git a/src/js/renderer.js b/src/js/renderer.js index dc485ac..5d3bf35 100644 --- a/src/js/renderer.js +++ b/src/js/renderer.js @@ -33,8 +33,9 @@ class Renderer { var minmax = this.getMinMaxDistance(); this.target_zoom = Math.min(this.config.max_zoom_factor, this.getZoom(minmax.min_x, minmax.max_x + 4, minmax.min_y + 2, minmax.max_y + 2.5)); this.zoom += 0.1 * (this.target_zoom - this.zoom); - this.translate_x += 0.1 * (1.5 - minmax.min_x - this.translate_x); - this.translate_y += 0.3 * (minmax.min_y * this.zoom + 280 - this.translate_y); + this.translate_x += 0.1 * ((1.5 - minmax.min_x) - this.translate_x); + this.translate_y += 0.3 * ((minmax.max_y + 1.5) * this.zoom - this.translate_y); + console.log(this.translate_y) this.ctx.translate(this.translate_x * this.zoom, this.translate_y); this.ctx.scale(this.zoom, -this.zoom); @@ -87,8 +88,6 @@ class Renderer { this.ctx.lineWidth = 1 / this.zoom; // left legs and arms first - - this.ctx.lineWidth = walker.left_leg.frictionJoint.maxForce ? 4 / this.zoom : 1 / this.zoom; this.drawRect(walker.left_leg.foot); this.ctx.lineWidth = 1 / this.zoom;