FIX: ensures nothing is triggering rendering loop in after render (#6784)

This commit is contained in:
Joffrey JAFFEUX 2018-12-17 12:15:03 +01:00 committed by GitHub
parent 01cdbd3a13
commit 6ee3900791
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 9 deletions

View File

@ -25,10 +25,6 @@ export default Ember.Component.extend(
"isExpanded", "isExpanded",
"isDisabled", "isDisabled",
"isHidden", "isHidden",
"isAbove",
"isBelow",
"isLeftAligned",
"isRightAligned",
"hasSelection", "hasSelection",
"hasReachedMaximum", "hasReachedMaximum",
"hasReachedMinimum" "hasReachedMinimum"

View File

@ -69,8 +69,10 @@ export default Ember.Mixin.create({
}, },
_adjustPosition() { _adjustPosition() {
this._applyFixedPosition(); if (this.get("isExpanded")) {
this._applyDirection(); this._applyDirection();
}
this._applyFixedPosition();
this._positionWrapper(); this._positionWrapper();
}, },
@ -197,11 +199,15 @@ export default Ember.Mixin.create({
parentWidth - marginToEdge - bodyWidth + this.get("horizontalOffset") > parentWidth - marginToEdge - bodyWidth + this.get("horizontalOffset") >
0; 0;
if (enoughMarginToOppositeEdge) { if (enoughMarginToOppositeEdge) {
this.setProperties({ isLeftAligned: true, isRightAligned: false }); this.$()
.addClass("is-left-aligned")
.removeClass("is-right-aligned");
options.left = this.get("horizontalOffset"); options.left = this.get("horizontalOffset");
options.right = "unset"; options.right = "unset";
} else { } else {
this.setProperties({ isLeftAligned: false, isRightAligned: true }); this.$()
.addClass("is-right-aligned")
.removeClass("is-left-aligned");
options.left = "unset"; options.left = "unset";
options.right = this.get("horizontalOffset"); options.right = this.get("horizontalOffset");
} }
@ -214,10 +220,14 @@ export default Ember.Mixin.create({
const headerHeight = this._computedStyle(this.$header()[0], "height"); const headerHeight = this._computedStyle(this.$header()[0], "height");
if (hasBelowSpace || (!hasBelowSpace && !hasAboveSpace)) { if (hasBelowSpace || (!hasBelowSpace && !hasAboveSpace)) {
this.setProperties({ isBelow: true, isAbove: false }); this.$()
.addClass("is-below")
.removeClass("is-above");
options.top = headerHeight + this.get("verticalOffset"); options.top = headerHeight + this.get("verticalOffset");
} else { } else {
this.setProperties({ isBelow: false, isAbove: true }); this.$()
.addClass("is-above")
.removeClass("is-below");
options.bottom = headerHeight + this.get("verticalOffset"); options.bottom = headerHeight + this.get("verticalOffset");
} }