summaryrefslogtreecommitdiff
path: root/src/client/view/graph_view.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-04-06 17:50:54 +0300
committerAlon Levy <alon@pobox.com>2015-04-06 17:50:54 +0300
commit2560ce1acb0ecb910cc8f9045b0019f04cbf63d8 (patch)
tree418750f7f4ca567fc3722a9f1aad12a5d72047ae /src/client/view/graph_view.js
parent938e1ba26bf27c6bb8055baff5c1082a8a20d760 (diff)
client: return zoom buttons, make zoom conserve center point
Diffstat (limited to 'src/client/view/graph_view.js')
-rw-r--r--src/client/view/graph_view.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 9bafc620..f6be8ebf 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -828,8 +828,14 @@ function GraphView(spec) {
}
gv.__set_scale_translate = set_scale_translate;
- var scale__absolute = function (scale) {
- set_scale_translate(scale, zoom_obj.translate());
+ var scale__absolute = function (new_scale) {
+ var t = zoom_obj.translate(),
+ s = zoom_obj.scale(),
+ ds = new_scale - s,
+ w = window.innerWidth,
+ h = window.innerHeight;
+
+ set_scale_translate(new_scale, [t[0] - ds * w / 2, t[1] - ds * h / 2]);
}
gv.scale__absolute = scale__absolute;