FIX: makes more resilient select-kit positioning (#6776)

This commit is contained in:
Joffrey JAFFEUX 2018-12-15 16:23:23 +01:00 committed by GitHub
parent 6213e020e6
commit d803dfc14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -64,6 +64,10 @@ export default Ember.Mixin.create({
},
@on("didRender")
_schedulePositionRendering() {
Ember.run.debounce(this, this._adjustPosition, 50, true);
},
_adjustPosition() {
this._applyFixedPosition();
this._applyDirection();
@ -205,9 +209,10 @@ export default Ember.Mixin.create({
const fullHeight =
this.get("verticalOffset") + bodyHeight + componentHeight;
const hasBelowSpace = $(window).height() - offsetBottom - fullHeight > 0;
const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight > 0;
const hasBelowSpace = $(window).height() - offsetBottom - fullHeight >= -1;
const hasAboveSpace = offsetTop - fullHeight - discourseHeaderHeight >= -1;
const headerHeight = this._computedStyle(this.$header()[0], "height");
if (hasBelowSpace || (!hasBelowSpace && !hasAboveSpace)) {
this.setProperties({ isBelow: true, isAbove: false });
options.top = headerHeight + this.get("verticalOffset");