2 Polymer('paper-menu-button-overlay', {
7 * The `relatedTarget` is an element used to position the overlay, for example a
8 * button the user taps to show a menu.
10 * @attribute relatedTarget
16 * The horizontal alignment of the overlay relative to the `relatedTarget`.
19 * @type 'left'|'right'|'center'
26 updateTargetDimensions: function() {
30 this.target
.cachedSize
= t
.getBoundingClientRect();
33 positionTarget: function() {
34 if (this.relatedTarget
) {
36 var rect
= this.relatedTarget
.getBoundingClientRect();
38 if (this.halign
=== 'left') {
39 this.target
.style
.left
= rect
.left
+ 'px';
40 } else if (this.halign
=== 'right') {
41 this.target
.style
.right
= (window
.innerWidth
- rect
.right
) + 'px';
43 this.target
.style
.left
= (rect
.left
- (rect
.width
- this.target
.cachedSize
.width
) / 2) + 'px';
46 if (this.valign
=== 'top') {
47 this.target
.style
.top
= rect
.top
+ 'px';
48 } else if (this.valign
=== 'bottom') {
49 this.target
.style
.top
= rect
.bottom
+ 'px';
51 this.target
.style
.top
= rect
.top
+ 'px';
54 // this.target.style.top = rect.top + 'px';