summaryrefslogtreecommitdiff
path: root/src/client/view/graph_view.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/view/graph_view.js')
-rw-r--r--src/client/view/graph_view.js19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/client/view/graph_view.js b/src/client/view/graph_view.js
index 3d39c03f..d723188b 100644
--- a/src/client/view/graph_view.js
+++ b/src/client/view/graph_view.js
@@ -88,10 +88,10 @@ function GraphView(spec) {
vis,
deliverables,
// FIXME - want to use parent_element
- w = $(document.body).innerWidth(),
- h = $(document.body).innerHeight(),
- cx = w / 2,
- cy = h / 2,
+ w,
+ h,
+ cx,
+ cy,
// FIXME take filter names from index.html or both from graph db
filter_states = {'interest':null, 'skill':null, 'club':null, 'person':null, 'third-internship-proposal':null},
filter_state_names = ['interest', 'skill', 'club', 'person', 'third-internship-proposal'];
@@ -104,6 +104,17 @@ function GraphView(spec) {
(temporary || svgInput !== undefined),
"missing spec variable");
+ function update_window_size() {
+ w = $(document.body).innerWidth();
+ h = $(document.body).innerHeight();
+ cx = w / 2;
+ cy = h / 2;
+ }
+
+ // update view whenever screen is resized
+ $(window).asEventStream('resize').map(update_window_size).onValue(function () { update_view(false); });
+ update_window_size();
+
function read_checkboxes() {
var checkboxes = $('#menu__type-filter label input').map(
function (i, checkbox){