From 2918d0725e5cae8b2350ebb14759fd176e2d6a5e Mon Sep 17 00:00:00 2001 From: David Benson Date: Wed, 16 Jan 2013 06:40:54 +0000 Subject: [PATCH] Fixes zoomToRect function Fixes zoomToRect function --- javascript/src/js/view/mxGraph.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/javascript/src/js/view/mxGraph.js b/javascript/src/js/view/mxGraph.js index 7c90f9b37..c7b71e0db 100755 --- a/javascript/src/js/view/mxGraph.js +++ b/javascript/src/js/view/mxGraph.js @@ -6742,14 +6742,15 @@ mxGraph.prototype.zoomToRect = function(rect) } var scale = this.container.clientWidth / rect.width; + var newScale = this.view.scale * scale; if (!mxUtils.hasScrollbars(this.container)) { - this.view.scaleAndTranslate(scale, -rect.x, -rect.y); + this.view.scaleAndTranslate(newScale, (this.view.translate.x - rect.x / this.view.scale), (this.view.translate.y - rect.y / this.view.scale)); } else { - this.view.setScale(scale); + this.view.setScale(newScale); this.container.scrollLeft = Math.round(rect.x * scale); this.container.scrollTop = Math.round(rect.y * scale); }