703
697
picker.one('.picker-expanded').removeClass('active');
707
* Set the visualization size based on the viewport
709
setSizesFromViewport: function() {
710
// This event allows other page components that may unintentionally
711
// affect the page size, such as the charm panel, to get out of the
712
// way before we compute sizes. Note the
713
// "afterPageSizeRecalculation" event at the end of this function.
714
// start with some reasonable defaults
715
console.log('setSizesFromViewPort', this, arguments);
716
var topo = this.get('component'),
717
container = this.get('container'),
719
xscale = topo.xScale,
720
yscale = topo.yScale,
721
svg = container.one('svg'),
722
canvas = container.one('.topology-canvas');
724
topo.fire('beforePageSizeRecalculation');
725
// Get the canvas out of the way so we can calculate the size
726
// correctly (the canvas contains the svg). We want it to be the
727
// smallest size we accept--no smaller or bigger--or else the
728
// presence or absence of scrollbars may affect our calculations
730
canvas.setStyles({height: 600, width: 800});
731
var dimensions = utils.getEffectiveViewportSize(true, 800, 600);
732
// Set the svg sizes.
733
svg.setAttribute('width', dimensions.width)
734
.setAttribute('height', dimensions.height);
736
// Set the internal rect's size.
738
.setAttribute('width', dimensions.width)
739
.setAttribute('height', dimensions.height);
741
.setStyle('height', dimensions.height)
742
.setStyle('width', dimensions.width);
744
// Reset the scale parameters
745
topo.xScale.domain([-dimensions.width / 2, dimensions.width / 2])
746
.range([0, dimensions.width]);
747
topo.yScale.domain([-dimensions.height / 2, dimensions.height / 2])
748
.range([dimensions.height, 0]);
750
topo.set('size', [dimensions.width, dimensions.height]);
751
topo.fire('afterPageSizeRecalculation');
755
* Update the location of the active service panel
757
700
updateServiceMenuLocation: function() {
758
701
var topo = this.get('component'),
759
702
container = this.get('container'),