Merge lp:~makyo/juju-gui/center-on-load into lp:juju-gui/experimental

Proposed by Madison Scott-Clary
Status: Merged
Merged at revision: 998
Proposed branch: lp:~makyo/juju-gui/center-on-load
Merge into: lp:juju-gui/experimental
Diff against target: 63 lines (+14/-4)
3 files modified
app/views/topology/viewport.js (+1/-0)
test/test_service_module.js (+2/-2)
test/test_viewport_module.js (+11/-2)
To merge this branch: bzr merge lp:~makyo/juju-gui/center-on-load
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+183606@code.launchpad.net

Description of the change

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://codereview.appspot.com/13334046/

To post a comment you must log in.
Revision history for this message
Madison Scott-Clary (makyo) wrote :
Download full text (3.3 KiB)

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:
   A [revision details]
   M app/views/topology/viewport.js
   M test/test_service_module.js
   M test/test_viewport_module.js

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
=== 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.

Index: test/test_viewport_module.js
=== modified file 'test/test_viewport_module.js'
--- test/test_viewport_module.js 2013-05-17 14:51:05 +0000
+++ test/test_viewport_module.js 2013-09-03 09:41:49 +0000
@@ -94,7 +94,8 @@
  });

  describe('views.ViewportModule.setAllTheDimensions', function() {
- var views, Y, testUtils, view, width, height, canvas, svg, topo,
zoomPlane;
+ var views, Y, testUtils, view, width, height, canvas, svg, topo,
zoomPlane,
+ eventFired;
    before(function(done) {
      Y = YUI(GlobalConfig).use(['node', 'juju-views', 'juju-tests-utils'],
          function(Y) {
@@ -108,7 +109,12 @@
      height = Math.floor(Math.random() * 1000);
      width = Math.floor(Math.random() * 1000);
      // Build test doubles that record height and width settings.
- topo = {vis: {}};
+ topo = {
+ vis: {},
+ fire: function(evt) {
+ eventFired = evt;
+ }
+ };
      topo.set = testUtils.setter(topo);
      topo.vis.attr = testUtils.setter(topo.vis);
      view = new views.ViewportModule();
@@ -153,4 +159,7 @@
      assert.equal(topo.vis.height, height);
    });

+ it('should center canvas', function() {
+ assert.equal(eventFired, 'panToCenter');
+ });
  });

Index: app/views/topology/viewport.js
=== modified file 'app/views/topology/viewport.js'
--- app/views/topology/viewport.js 2013-06-05 16:58:11 +0000
+++ app/views/topology/viewport.js 2013-09-03 09:32:59 +0000
@@ -93,...

Read more...

Revision history for this message
Richard Harding (rharding) wrote :

LGTM QA's ok in chrome, need IE QA.

https://codereview.appspot.com/13334046/

Revision history for this message
Madison Scott-Clary (makyo) wrote :
Revision history for this message
Madison Scott-Clary (makyo) wrote :

*** Submitted:

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.

R=rharding
CC=
https://codereview.appspot.com/13334046

https://codereview.appspot.com/13334046/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'app/views/topology/viewport.js'
2--- app/views/topology/viewport.js 2013-06-05 16:58:11 +0000
3+++ app/views/topology/viewport.js 2013-09-03 09:45:39 +0000
4@@ -93,6 +93,7 @@
5 height: dimensions.height + 'px'});
6 // Reset the scale parameters
7 topo.set('size', [dimensions.width, dimensions.height]);
8+ topo.fire('panToCenter');
9 },
10
11 /**
12
13=== modified file 'test/test_service_module.js'
14--- test/test_service_module.js 2013-08-09 17:58:47 +0000
15+++ test/test_service_module.js 2013-09-03 09:45:39 +0000
16@@ -393,9 +393,9 @@
17 var eventHandle = Y.on('initiateDeploy', function(charm, ghostAttributes) {
18 eventHandle.detach();
19 // After the translation and calculations the above x and y coords should
20- // place the element at 305, 157
21+ // place the element at 320, 392
22 assert.deepEqual(ghostAttributes, {
23- coordinates: [305, 157],
24+ coordinates: [320, 392],
25 icon: src
26 });
27 // Make sure that the drag and drop was properly prevented.
28
29=== modified file 'test/test_viewport_module.js'
30--- test/test_viewport_module.js 2013-05-17 14:51:05 +0000
31+++ test/test_viewport_module.js 2013-09-03 09:45:39 +0000
32@@ -94,7 +94,8 @@
33 });
34
35 describe('views.ViewportModule.setAllTheDimensions', function() {
36- var views, Y, testUtils, view, width, height, canvas, svg, topo, zoomPlane;
37+ var views, Y, testUtils, view, width, height, canvas, svg, topo, zoomPlane,
38+ eventFired;
39 before(function(done) {
40 Y = YUI(GlobalConfig).use(['node', 'juju-views', 'juju-tests-utils'],
41 function(Y) {
42@@ -108,7 +109,12 @@
43 height = Math.floor(Math.random() * 1000);
44 width = Math.floor(Math.random() * 1000);
45 // Build test doubles that record height and width settings.
46- topo = {vis: {}};
47+ topo = {
48+ vis: {},
49+ fire: function(evt) {
50+ eventFired = evt;
51+ }
52+ };
53 topo.set = testUtils.setter(topo);
54 topo.vis.attr = testUtils.setter(topo.vis);
55 view = new views.ViewportModule();
56@@ -153,4 +159,7 @@
57 assert.equal(topo.vis.height, height);
58 });
59
60+ it('should center canvas', function() {
61+ assert.equal(eventFired, 'panToCenter');
62+ });
63 });

Subscribers

People subscribed via source and target branches