diff options
| author | Alon Levy <alon@pobox.com> | 2015-02-27 08:19:20 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-02-27 08:19:20 +0200 |
| commit | 269c78e33b4025efb328f629b00db8079e7f995f (patch) | |
| tree | fd498a8e6b00c564f8c31b1468c7d961c8672f07 /src/client/view | |
| parent | bc7988b7e210bb91b38406bf201bff24edb73e55 (diff) | |
client: bubble: fix resize missing initial value
Diffstat (limited to 'src/client/view')
| -rw-r--r-- | src/client/view/bubble.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/client/view/bubble.js b/src/client/view/bubble.js index dff59eae..02f5a73a 100644 --- a/src/client/view/bubble.js +++ b/src/client/view/bubble.js @@ -5,10 +5,12 @@ function Bubble(raw_parent, radius) { var circle = document.createElementNS(xmlns, 'circle'); var setTransformToCenter = function (elem) { - var width = $(document.body).innerWidth(); - var height = $(document.body).innerHeight(); - - elem.setAttribute('transform', 'translate(' + width / 2 + ',' + height / 2 + ')'); + var width = $(document.body).innerWidth(), + height = $(document.body).innerHeight(), + bx = width / 2, + by = height / 2; + console.log("setting bubble at " + bx + ", " + by); + elem.setAttribute('transform', 'translate(' + bx + ',' + by + ')'); } g.appendChild(circle); @@ -18,7 +20,7 @@ function Bubble(raw_parent, radius) { circle.id = 'bubble'; // reset bubble on radius change and window resize - Bacon.combineWith(function (r, _) { return r; }, radius, $(window).asEventStream('resize')).onValue( + Bacon.combineWith(function (r, _) { return r; }, radius, $(window).asEventStream('resize').toProperty(0)).onValue( function (r) { setTransformToCenter(g); circle.setAttribute("r", r); |
