|
1594 | 1594 | function _alignHintPosition(position, hint, element) {
|
1595 | 1595 | // get/calculate offset of target element
|
1596 | 1596 | var offset = _getOffset.call(this, element);
|
| 1597 | + var iconWidth = 20; |
| 1598 | + var iconHeight = 20; |
1597 | 1599 |
|
1598 | 1600 | // align the hint element
|
1599 | 1601 | switch (position) {
|
|
1603 | 1605 | hint.style.top = offset.top + 'px';
|
1604 | 1606 | break;
|
1605 | 1607 | case 'top-right':
|
1606 |
| - hint.style.left = (offset.left + offset.width) + 'px'; |
| 1608 | + hint.style.left = (offset.left + offset.width - iconWidth) + 'px'; |
1607 | 1609 | hint.style.top = offset.top + 'px';
|
1608 | 1610 | break;
|
1609 | 1611 | case 'bottom-left':
|
1610 | 1612 | hint.style.left = offset.left + 'px';
|
1611 |
| - hint.style.top = (offset.top + offset.height) + 'px'; |
| 1613 | + hint.style.top = (offset.top + offset.height - iconHeight) + 'px'; |
1612 | 1614 | break;
|
1613 | 1615 | case 'bottom-right':
|
1614 |
| - hint.style.left = (offset.left + offset.width) + 'px'; |
1615 |
| - hint.style.top = (offset.top + offset.height) + 'px'; |
| 1616 | + hint.style.left = (offset.left + offset.width - iconWidth) + 'px'; |
| 1617 | + hint.style.top = (offset.top + offset.height - iconHeight) + 'px'; |
| 1618 | + break; |
| 1619 | + case 'middle-left': |
| 1620 | + hint.style.left = offset.left + 'px'; |
| 1621 | + hint.style.top = (offset.top + (offset.height - iconHeight) / 2) + 'px'; |
| 1622 | + break; |
| 1623 | + case 'middle-right': |
| 1624 | + hint.style.left = (offset.left + offset.width - iconWidth) + 'px'; |
| 1625 | + hint.style.top = (offset.top + (offset.height - iconHeight) / 2) + 'px'; |
| 1626 | + break; |
| 1627 | + case 'middle-middle': |
| 1628 | + hint.style.left = (offset.left + (offset.width - iconWidth) / 2) + 'px'; |
| 1629 | + hint.style.top = (offset.top + (offset.height - iconHeight) / 2) + 'px'; |
1616 | 1630 | break;
|
1617 | 1631 | case 'bottom-middle':
|
1618 |
| - hint.style.left = (offset.left + (offset.width / 2)) + 'px'; |
1619 |
| - hint.style.top = (offset.top + offset.height) + 'px'; |
| 1632 | + hint.style.left = (offset.left + (offset.width - iconWidth) / 2) + 'px'; |
| 1633 | + hint.style.top = (offset.top + offset.height - iconHeight) + 'px'; |
1620 | 1634 | break;
|
1621 | 1635 | case 'top-middle':
|
1622 |
| - hint.style.left = (offset.left + (offset.width / 2)) + 'px'; |
| 1636 | + hint.style.left = (offset.left + (offset.width - iconWidth) / 2) + 'px'; |
1623 | 1637 | hint.style.top = offset.top + 'px';
|
1624 | 1638 | break;
|
1625 | 1639 | }
|
|
0 commit comments