Merge lp://staging/~bcsaller/juju-gui/scrollwheel into lp://staging/juju-gui/experimental
Proposed by
Benjamin Saller
Status: | Merged | ||||
---|---|---|---|---|---|
Merged at revision: | 321 | ||||
Proposed branch: | lp://staging/~bcsaller/juju-gui/scrollwheel | ||||
Merge into: | lp://staging/juju-gui/experimental | ||||
Diff against target: |
57 lines (+20/-5) 3 files modified
app/app.js (+2/-0) app/views/topology/panzoom.js (+13/-2) app/views/topology/topology.js (+5/-3) |
||||
To merge this branch: | bzr merge lp://staging/~bcsaller/juju-gui/scrollwheel | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju GUI Hackers | Pending | ||
Review via email:
|
Description of the change
Restore Mouse Wheel In PanZoom
The default zoom behavior bound to mouse wheel was doing scaled translation
that didn't play well with the rest of the pan/zoom math. This overrides the
default behavior and fires a standard YUI zoom synthetic event. We are then
able to manually apply the delta and manage scale/translate ourselves.
To post a comment you must log in.
Reviewers: mp+143003_ code.launchpad. net,
Message:
Please take a look.
Description:
Restore Mouse Wheel In PanZoom
The default zoom behavior bound to mouse wheel was doing scaled
translation
that didn't play well with the rest of the pan/zoom math. This overrides
the
default behavior and fires a standard YUI zoom synthetic event. We are
then
able to manually apply the delta and manage scale/translate ourselves.
https:/ /code.launchpad .net/~bcsaller/ juju-gui/ scrollwheel/ +merge/ 143003
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/7099046/
Affected files: topology/ panzoom. js topology/ topology. js
A [revision details]
M app/views/login.js
M app/views/
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/login.js login.js'
env.failedAuthe ntication ? 'Unknown user or password.' : ''),
help_ text: this.get( 'help_text' ) 'container' ).one(' input[type= password] ').focus( );
=== modified file 'app/views/
--- app/views/login.js 2013-01-09 21:28:04 +0000
+++ app/views/login.js 2013-01-11 23:51:26 +0000
@@ -71,6 +71,7 @@
}));
+ this.get(
return this;
}
Index: app/views/ topology/ panzoom. js topology/ panzoom. js' topology/ panzoom. js 2013-01-09 16:59:19 +0000 topology/ panzoom. js 2013-01-11 23:51:26 +0000 evt.scale) ); d3.event) ; tion(); ult(); 'translate' ); _set('value' , this.toSlider( evt.scale) );
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -84,8 +84,23 @@
if (!this.slider) {
return;
}
- slider.set('value', this.toSlider(
- this.rescale(
+
+ // If this is a scroll wheel event translate
+ // delta and apply to scale.
+ if (evt.sourceEvent) {
+ // If we have a wrapped event facade extract the raw data,
+ // this is needed to properly handle wheel delta events below.
+ evt.stopPropoga
+ evt.preventDefa
+ evt = evt.sourceEvent;
+ }
+ if (evt.type === 'mousewheel') {
+ var delta = (evt.wheelDelta > 0) ? 0.1 : -0.1;
+ evt.scale = (topo.get('scale') + delta);
+ evt.translate = topo.get(
+ }
+ slider.
+ this.rescale(evt);
},
/*
Index: app/views/ topology/ topology. js topology/ topology. js' topology/ topology. js 2013-01-09 17:21:35 +0000 topology/ topology. js 2013-01-11 23:51:26 +0000
.attr(' width', width)
.attr(' height' , height)
.call(this. zoom) .zoom', null) roll.zoom' , null) zoom', null); zoom', null) roll', function(evt) {
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -94,9 +94,11 @@
- .on('mousewheel
- .on('DOMMouseSc
- .on('dblclick.
+ .on('dblclick.
+ .on('DOMMouseSc
+ ...