summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/view/bubble.js10
-rw-r--r--src/client/view/graph_view.js19
2 files changed, 21 insertions, 8 deletions
diff --git a/src/client/view/bubble.js b/src/client/view/bubble.js
index 70dc5d09..dff59eae 100644
--- a/src/client/view/bubble.js
+++ b/src/client/view/bubble.js
@@ -17,10 +17,12 @@ function Bubble(raw_parent, radius) {
circle.className.baseVal = 'circle bubble';
circle.id = 'bubble';
- radius.onValue(function (r) {
- setTransformToCenter(g);
- circle.setAttribute("r", r);
- })
+ // reset bubble on radius change and window resize
+ Bacon.combineWith(function (r, _) { return r; }, radius, $(window).asEventStream('resize')).onValue(
+ function (r) {
+ setTransformToCenter(g);
+ circle.setAttribute("r", r);
+ });
}
return {
Bubble:Bubble
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){