From 7bf3819492f50d41977383ff06d1830c2c43caa4 Mon Sep 17 00:00:00 2001 From: Jason Park Date: Fri, 20 May 2016 03:34:45 -0500 Subject: [PATCH] add dp --- css/stylesheet.css | 1 + js/module/array2d.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/css/stylesheet.css b/css/stylesheet.css index fc7c419..a1e9683 100644 --- a/css/stylesheet.css +++ b/css/stylesheet.css @@ -136,6 +136,7 @@ section { bottom: 50%; left: 0; right: 0; + overflow: scroll; } .tab_container { diff --git a/js/module/array2d.js b/js/module/array2d.js index 3606bee..3939de0 100644 --- a/js/module/array2d.js +++ b/js/module/array2d.js @@ -163,8 +163,18 @@ Array2DTracer.prototype.refresh = function () { Tracer.prototype.refresh.call(this); var $parent = $table.parent(); - $table.css('margin-top', $parent.height() / 2 - $table.height() / 2); - $table.css('margin-left', $parent.width() / 2 - $table.width() / 2); + var top = $parent.height() / 2 - $table.height() / 2; + var left = $parent.width() / 2 - $table.width() / 2; + if (top < 0) { + $table.css('margin-top', 0); + $parent.scrollTop(-top); + } + else $table.css('margin-top', top); + if (left < 0) { + $table.css('margin-left', 0); + $parent.scrollLeft(-left); + } + else $table.css('margin-left', left); }; // Override -- GitLab