Merge lp:~frankban/juju-gui/preserve-zoom into lp:juju-gui/experimental
| Status: | Merged |
|---|---|
| Merged at revision: | 189 |
| Proposed branch: | lp:~frankban/juju-gui/preserve-zoom |
| Merge into: | lp:juju-gui/experimental |
| Diff against target: |
78 lines (+30/-5) 1 file modified
app/views/environment.js (+30/-5) |
| To merge this branch: | bzr merge lp:~frankban/juju-gui/preserve-zoom |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Juju GUI Hackers | 2012-10-17 | Pending | |
|
Review via email:
|
|||
Description of the Change
Preserve zoom settings in the environment view.
The zoom scale and translate are preserved after a scene redraw
(e.g. when adding/removing relations, destroying services,
navigating to the service view and back to the front page).
| Francesco Banconi (frankban) wrote : | # |
| Madison Scott-Clary (makyo) wrote : | # |
Trainee review by Matthew. Looks good to me and works well. Thanks for
the catch on double-clicking a service causing a zoom! One minor about
a comment below, and as always, wait for the blessed review.
https:/
File app/views/
https:/
app/views/
by copying the event array
Minor: I know the above line was there before, but maybe it deserves a
comment as well, possibly just merged with this comment.
- 191. By Francesco Banconi on 2012-10-17
-
Added comment where we store the value of scale.
| Francesco Banconi (frankban) wrote : | # |
Please take a look.
| Francesco Banconi (frankban) wrote : | # |
Thanks for the review Matthew.
https:/
File app/views/
https:/
app/views/
by copying the event array
On 2012/10/17 14:11:34, matthew.scott wrote:
> Minor: I know the above line was there before, but maybe it deserves a
comment
> as well, possibly just merged with this comment.
Done.
| Benjamin Saller (bcsaller) wrote : | # |
LGTM with the minor noted.
Thanks
https:/
File app/views/
https:/
app/views/
.on("dblclick.
behavior.
- 192. By Francesco Banconi on 2012-10-17
-
Disable zoom everywhere on dblclick.
- 193. By Francesco Banconi on 2012-10-17
-
Lint.
| Francesco Banconi (frankban) wrote : | # |
Please take a look.
| Francesco Banconi (frankban) wrote : | # |
Thanks Ben.
https:/
File app/views/
https:/
app/views/
On 2012/10/17 14:35:11, benjamin.saller wrote:
> .on("dblclick.
behavior.
Done.
| Francesco Banconi (frankban) wrote : | # |
*** Submitted:
Preserve zoom settings in the environment view.
The zoom scale and translate are preserved after a scene redraw
(e.g. when adding/removing relations, destroying services,
navigating to the service view and back to the front page).
R=matthew.scott, benjamin.saller
CC=
https:/
| Kapil Thangavelu (hazmat) wrote : | # |
The dbl click causing zoom, is actually a nice effect that would be nice to
preserve as a transition .. Transient though without perm zoom changes.
Part of the feel of going into a svc details is meant to be zoom into focus
on this service.
On Wednesday, October 17, 2012, Francesco Banconi wrote:
> Thanks Ben.
>
>
> https:/
> File app/views/
>
>
> https:/
> app/views/
> On 2012/10/17 14:35:11, benjamin.saller wrote:
> > .on("dblclick.
> behavior.
>
> Done.
>
> https:/
>
> --
> https:/
> Your team Juju GUI Hackers is requested to review the proposed merge of
> lp:~frankban/juju-gui/preserve-zoom into lp:juju-gui.
>


Reviewers: mp+130087_ code.launchpad. net,
Message:
Please take a look.
Description:
Preserve zoom settings in the environment view.
The zoom scale and translate are preserved after a scene redraw
(e.g. when adding/removing relations, destroying services,
navigating to the service view and back to the front page).
https:/ /code.launchpad .net/~frankban/ juju-gui/ preserve- zoom/+merge/ 130087
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/6720048/
Affected files: environment. js
A [revision details]
M app/views/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision:
<email address hidden>
Index: app/views/ environment. js environment. js' environment. js 2012-10-15 19:22:40 +0000 environment. js 2012-10-17 10:43:51 +0000
.y(this. yscale)
.scaleExtent ([0.25, 2.0])
.on( 'zoom', function() { sourceEvent; nt.target) .ancestor( '.service' )) {
// Keep the slider up to date with the scale on other sorts
// of zoom interactions
var s = self.slider;
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -237,6 +237,13 @@
+ var sourceEvent = d3.event.
+ // Avoid spurious zooming if the event is a double click
inside
+ // a service box.
+ if (sourceEvent.type === 'dblclick' &&
+ Y.one(sourceEve
+ return;
+ }
@@ -386,7 +393,7 @@
},
/*
updateData: function() {
renderSlider : function() {
slider. render( '#slider- parent' );
slider. after(' valueChange' , function(evt) {
.setAttribute ('x', -width / 2);
- * Sync view models with curent db.models.
+ * Sync view models with current db.models.
*/
//model data
@@ -872,14 +879,17 @@
});
},
- var self = this;
+ var self = this,
+ value = 100,
+ currentScale = this.get('scale');
// Build a slider to control zoom level
- // TODO once we have a stored value in view models, use that
- // for the value property, but for now, zoom to 100%
+ if (currentScale) {
+ value = currentScale * 100;
+ }
var slider = new Y.Slider({
min: 25,
max: 200,
- value: 100
+ value: value
});
@@ -949,6 +959,22 @@
});
+ // Preserve zoom when the scene is updated. 'translate' ); translate( )) { translate( currentTranslat e);
+ var changed = false,
+ currentScale = this.get('scale'),
+ currentTranslate = this.get(
+ if (currentTranslate && currentTranslate !==
this.zoom.
+ this.zoom.
+ changed = true;
+ }
+ if (currentScale && currentScale !== this.z...