Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(select): positioning when to close to bottom or right
Browse files Browse the repository at this point in the history
closes #1652, references #1743
  • Loading branch information
rschmukler committed Mar 2, 2015
1 parent 8afc08d commit cf78ba9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/select/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ function SelectProvider($$interimElementProvider) {
left: parentNode.scrollLeft + SELECT_EDGE_MARGIN,
top: parentNode.scrollTop + SELECT_EDGE_MARGIN,
bottom: parentRect.height + parentNode.scrollTop - SELECT_EDGE_MARGIN,
right: parentRect.width - parentNode.scrollLeft - SELECT_EDGE_MARGIN
right: parentRect.width - SELECT_EDGE_MARGIN
},
spaceAvailable = {
top: targetRect.top - bounds.top,
Expand All @@ -729,6 +729,7 @@ function SelectProvider($$interimElementProvider) {
optionNodes = selectNode.getElementsByTagName('md-option'),
optgroupNodes = selectNode.getElementsByTagName('md-optgroup');


var centeredNode;
// If a selected node, center around that
if (selectedNode) {
Expand Down Expand Up @@ -814,8 +815,9 @@ function SelectProvider($$interimElementProvider) {
}

// Keep left and top within the window
containerNode.style.left = clamp(bounds.left, left, bounds.right) + 'px';
containerNode.style.top = clamp(bounds.top, top, bounds.bottom) + 'px';
var containerRect = containerNode.getBoundingClientRect();
containerNode.style.left = clamp(bounds.left, left, bounds.right - containerRect.width) + 'px';
containerNode.style.top = clamp(bounds.top, top, bounds.bottom - containerRect.height) + 'px';
selectNode.style[$mdConstant.CSS.TRANSFORM_ORIGIN] = transformOrigin;

selectNode.style[$mdConstant.CSS.TRANSFORM] = 'scale(' +
Expand Down

0 comments on commit cf78ba9

Please sign in to comment.