The dimensions of the canvas default to 800x600px, and so on smaller
screens, centering the services in the environment centered them beneath
the charm store. This centers them *after* the sizes are calculated,
which centers them in the center of the screen itself.
Index: test/test_service_module.js
=== modified file 'test/test_service_module.js'
--- test/test_service_module.js 2013-08-09 17:58:47 +0000
+++ test/test_service_module.js 2013-09-03 09:41:49 +0000
@@ -393,9 +393,9 @@
var eventHandle = Y.on('initiateDeploy', function(charm,
ghostAttributes) { eventHandle.detach();
// After the translation and calculations the above x and y coords
should
- // place the element at 305, 157
+ // place the element at 320, 392 assert.deepEqual(ghostAttributes, {
- coordinates: [305, 157],
+ coordinates: [320, 392],
icon: src
});
// Make sure that the drag and drop was properly prevented.
Reviewers: mp+183606_ code.launchpad. net,
Message:
Please take a look.
Description:
Zoom to center on dimensions set
The dimensions of the canvas default to 800x600px, and so on smaller
screens, centering the services in the environment centered them beneath
the charm store. This centers them *after* the sizes are calculated,
which centers them in the center of the screen itself.
https:/ /code.launchpad .net/~makyo/ juju-gui/ center- on-load/ +merge/ 183606
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/13334046/
Affected files: topology/ viewport. js service_ module. js viewport_ module. js
A [revision details]
M app/views/
M test/test_
M test/test_
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: test/test_ service_ module. js service_ module. js' service_ module. js 2013-08-09 17:58:47 +0000 service_ module. js 2013-09-03 09:41:49 +0000 eploy', function(charm,
eventHandle. detach( );
assert. deepEqual( ghostAttributes , {
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -393,9 +393,9 @@
var eventHandle = Y.on('initiateD
ghostAttributes) {
// After the translation and calculations the above x and y coords
should
- // place the element at 305, 157
+ // place the element at 320, 392
- coordinates: [305, 157],
+ coordinates: [320, 392],
icon: src
});
// Make sure that the drag and drop was properly prevented.
Index: test/test_ viewport_ module. js viewport_ module. js' viewport_ module. js 2013-05-17 14:51:05 +0000 viewport_ module. js 2013-09-03 09:41:49 +0000
=== modified file 'test/test_
--- test/test_
+++ test/test_
@@ -94,7 +94,8 @@
});
describe( 'views. ViewportModule. setAllTheDimens ions', function() { function( done) { g).use( ['node' , 'juju-views', 'juju-tests- utils'] ,
function( Y) { Math.random( ) * 1000); Math.random( ) * 1000); setter( topo); setter( topo.vis) ; odule() ; equal(topo. vis.height, height);
- var views, Y, testUtils, view, width, height, canvas, svg, topo,
zoomPlane;
+ var views, Y, testUtils, view, width, height, canvas, svg, topo,
zoomPlane,
+ eventFired;
before(
Y = YUI(GlobalConfi
@@ -108,7 +109,12 @@
height = Math.floor(
width = Math.floor(
// Build test doubles that record height and width settings.
- topo = {vis: {}};
+ topo = {
+ vis: {},
+ fire: function(evt) {
+ eventFired = evt;
+ }
+ };
topo.set = testUtils.
topo.vis.attr = testUtils.
view = new views.ViewportM
@@ -153,4 +159,7 @@
assert.
});
+ it('should center canvas', function() { equal(eventFire d, 'panToCenter');
+ assert.
+ });
});
Index: app/views/ topology/ viewport. js topology/ viewport. js' topology/ viewport. js 2013-06-05 16:58:11 +0000 topology/ viewport. js 2013-09-03 09:32:59 +0000
topo.set( 'size', [dimensions.width, dimensions. height] ); 'panToCenter' );
=== modified file 'app/views/
--- app/views/
+++ app/views/
@@ -93,6 +93,7 @@
height: dimensions.height + 'px'});
// Reset the scale parameters
+ topo.fire(
},
/**