Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var minimumHeight = 350,
- minimumWidth = 550,
- wnd = $(window),
- body = $('body'),
- verticalSplit = $('#verticalSplit'),
- unitSelectionContainer = $('#unitSelectionContainer'),
- mapContainer = $('#mapContainer').
- unitPickerContainer = $('#unitPickerContainer'),
- selectedUnits = $('#selectedUnits'),
- map = $('#map'),
- clock = $('#clock'),
- // save some lookups and assume top/right/bottom/left margins are the same
- bodyMargin = parseInt(body.css('margin-left'), 10),
- // innerWidth/Height doesn't work in IE, width()/height() doesn't include scrollbars in Chrome
- bodyWidth,
- bodyHeight,
- selectedUnitsHeight,
- mapWidth,
- toolbar,
- toolbarLeft,
- mapTop;
- console.log(unitPickerContainer);
- console.log(unitPickerContainer.height);
- // innerWidth/Height doesn't work in IE, width()/height() doesn't include scrollbars in Chrome
- bodyWidth = (wnd.attr('innerWidth') || wnd.width()) - (bodyMargin * 2);
- bodyHeight = (wnd.attr('innerHeight') || wnd.height()) - (bodyMargin * 2),
- // constrain the width of the layout
- bodyWidth = (bodyWidth < minimumWidth) ? minimumWidth : bodyWidth;
- body.width(bodyWidth);
- // constrain the height of the layout, taking the clock into account
- bodyHeight = (bodyHeight < minimumHeight) ? minimumHeight : bodyHeight;
- bodyHeight = ((clock.is(':visible') === true) ? bodyHeight - clock.outerHeight(true) : bodyHeight);
- // IE7 fix (doesn't harm other browsers, so no conditional)
- bodyHeight -= 2;
- verticalSplit.height(bodyHeight);
- mapContainer.height(bodyHeight);
- unitSelectionContainer.height(bodyHeight);
- // the the unit picker minus the selected groups bucket should do the same
- selectedUnitsHeight = selectedUnits.outerHeight(true);
- console.log(unitPickerContainer);
- console.log(unitPickerContainer.height);
- unitPickerContainer.height(bodyHeight - selectedUnitsHeight - 1 /* extra pixel from unitPicker border-bottom */);
- unitSelectionContainer.width($('#verticalSplit > .splitter-bar-vertical').position().left);
- unitPickerContainer.width(unitSelectionContainer.width());
- selectedUnits.width(unitSelectionContainer.width());
- // the map should fill out the available space
- map.height(bodyHeight - 2 /* 2px for borders? */);
- mapWidth = body.width() - /*$('#separator').width() - $('#separator').position().left*/ + 3;
- map.width(mapWidth);
- // position the menu relative to the map
- toolbar = $('#toolbar');
- toolbarLeft = (bodyWidth - toolbar.width() - bodyMargin * 3);
- mapTop = map.position().top;
- toolbar.offset({ top: mapTop, left: toolbarLeft });
- // dynamically set top/bottom borders on the unit picker
- unitPickerContainer.trigger('scroll');
- }
Add Comment
Please, Sign In to add comment