Index: polymer_1.2.3/bower_components/iron-fit-behavior/iron-fit-behavior.html |
diff --git a/polymer_1.0.4/bower_components/iron-fit-behavior/iron-fit-behavior.html b/polymer_1.2.3/bower_components/iron-fit-behavior/iron-fit-behavior.html |
similarity index 90% |
copy from polymer_1.0.4/bower_components/iron-fit-behavior/iron-fit-behavior.html |
copy to polymer_1.2.3/bower_components/iron-fit-behavior/iron-fit-behavior.html |
index 887b7dbe48416027d26c253f2ee4b014269392bb..d21740f3e6ffab2561d8205f88e3c2c4999f96e2 100644 |
--- a/polymer_1.0.4/bower_components/iron-fit-behavior/iron-fit-behavior.html |
+++ b/polymer_1.2.3/bower_components/iron-fit-behavior/iron-fit-behavior.html |
@@ -91,6 +91,26 @@ CSS properties | Action |
return fitHeight; |
}, |
+ get _fitLeft() { |
+ var fitLeft; |
+ if (this.fitInto === window) { |
+ fitLeft = 0; |
+ } else { |
+ fitLeft = this.fitInto.getBoundingClientRect().left; |
+ } |
+ return fitLeft; |
+ }, |
+ |
+ get _fitTop() { |
+ var fitTop; |
+ if (this.fitInto === window) { |
+ fitTop = 0; |
+ } else { |
+ fitTop = this.fitInto.getBoundingClientRect().top; |
+ } |
+ return fitTop; |
+ }, |
+ |
attached: function() { |
if (this.autoFitOnAttach) { |
if (window.getComputedStyle(this).display === 'none') { |
@@ -187,6 +207,10 @@ CSS properties | Action |
if (!this._fitInfo.positionedBy.horizontally) { |
this.style.left = '0px'; |
} |
+ if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy.horizontally) { |
+ // need position:fixed to properly size the element |
+ this.style.position = 'fixed'; |
+ } |
// need border-box for margin/padding |
this.sizingTarget.style.boxSizing = 'border-box'; |
// constrain the width and height if not already set |
@@ -220,12 +244,12 @@ CSS properties | Action |
this.style.position = 'fixed'; |
} |
if (!this._fitInfo.positionedBy.vertically) { |
- var top = (this._fitHeight - this.offsetHeight) / 2; |
+ var top = (this._fitHeight - this.offsetHeight) / 2 + this._fitTop; |
top -= this._fitInfo.margin.top; |
this.style.top = top + 'px'; |
} |
if (!this._fitInfo.positionedBy.horizontally) { |
- var left = (this._fitWidth - this.offsetWidth) / 2; |
+ var left = (this._fitWidth - this.offsetWidth) / 2 + this._fitLeft; |
left -= this._fitInfo.margin.left; |
this.style.left = left + 'px'; |
} |