Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 'use strict'; | 1 'use strict'; |
2 /** | 2 /** |
3 * Provides the main app class. | 3 * Provides the main app class. |
4 * | 4 * |
5 * @module views | 5 * @module views |
6 */ | 6 */ |
7 | 7 |
8 YUI.add('juju-view-environment', function(Y) { | 8 YUI.add('juju-view-environment', function(Y) { |
9 | 9 |
10 var views = Y.namespace('juju.views'), | 10 var views = Y.namespace('juju.views'), |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 | 312 |
313 // Bind visualization resizing on window resize. | 313 // Bind visualization resizing on window resize. |
314 Y.on('windowresize', function() { | 314 Y.on('windowresize', function() { |
315 self.setSizesFromViewport(); | 315 self.setSizesFromViewport(); |
316 }); | 316 }); |
317 | 317 |
318 this.vis = vis; | 318 this.vis = vis; |
319 this.tree = d3.layout.pack() | 319 this.tree = d3.layout.pack() |
320 .size([width, height]) | 320 .size([width, height]) |
321 .value(function(d) { | 321 .value(function(d) { |
322 return d.unit_count === 0 ? 1 : d.unit_count; | 322 return Math.max(d.unit_count, 1); |
323 }) | 323 }) |
bac
2012/11/20 14:50:48
maybe this would be more readable:
min(1, d.unit_
matthew.scott
2012/11/20 15:59:08
Thanks! Did Math.max(d.unit_count, 1); (since we w
| |
324 .padding(300); | 324 .padding(300); |
325 | 325 |
326 this.updateCanvas(); | 326 this.updateCanvas(); |
327 }, | 327 }, |
328 | 328 |
329 /* | 329 /* |
330 * Attach view to target, if target is an ancestor of the view | 330 * Attach view to target, if target is an ancestor of the view |
331 * this is a no-oop. | 331 * this is a no-oop. |
332 * | 332 * |
333 */ | 333 */ |
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1812 'd3', | 1812 'd3', |
1813 'base-build', | 1813 'base-build', |
1814 'handlebars-base', | 1814 'handlebars-base', |
1815 'node', | 1815 'node', |
1816 'svg-layouts', | 1816 'svg-layouts', |
1817 'event-resize', | 1817 'event-resize', |
1818 'slider', | 1818 'slider', |
1819 'slider-base', | 1819 'slider-base', |
1820 'view'] | 1820 'view'] |
1821 }); | 1821 }); |
LEFT | RIGHT |