FIX: Docking of old widget regressed
This commit is contained in:
parent
b37e14fc62
commit
321a11fe41
|
@ -118,25 +118,24 @@ export default Ember.Component.extend({
|
||||||
|
|
||||||
_dock() {
|
_dock() {
|
||||||
const maximumOffset = $('#topic-footer-buttons').offset(),
|
const maximumOffset = $('#topic-footer-buttons').offset(),
|
||||||
composerHeight = $('#reply-control').height() || 0,
|
composerHeight = $('#reply-control').height() || 0,
|
||||||
$topicProgressWrapper = this.$(),
|
$topicProgressWrapper = this.$(),
|
||||||
style = $topicProgressWrapper.attr('style') || '',
|
offset = window.pageYOffset || $('html').scrollTop();
|
||||||
offset = window.pageYOffset || $('html').scrollTop();
|
|
||||||
|
|
||||||
let isDocked = false;
|
let isDocked = false;
|
||||||
if (maximumOffset) {
|
if (maximumOffset) {
|
||||||
const threshold = maximumOffset.top,
|
const threshold = maximumOffset.top,
|
||||||
windowHeight = $(window).height(),
|
windowHeight = $(window).height(),
|
||||||
topicProgressHeight = $('#topic-progress').height();
|
topicProgressHeight = $('#topic-progress').height();
|
||||||
|
|
||||||
isDocked = offset >= threshold - windowHeight + topicProgressHeight + composerHeight;
|
isDocked = offset >= threshold - windowHeight + topicProgressHeight + composerHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const dockPos = $(document).height() - $('#topic-bottom').offset().top;
|
||||||
|
|
||||||
if (composerHeight > 0) {
|
if (composerHeight > 0) {
|
||||||
if (isDocked) {
|
if (isDocked) {
|
||||||
if (style.indexOf('bottom') >= 0) {
|
$topicProgressWrapper.css('bottom', dockPos);
|
||||||
$topicProgressWrapper.css('bottom', '');
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const height = composerHeight + "px";
|
const height = composerHeight + "px";
|
||||||
if ($topicProgressWrapper.css('bottom') !== height) {
|
if ($topicProgressWrapper.css('bottom') !== height) {
|
||||||
|
@ -144,9 +143,7 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (style.indexOf('bottom') >= 0) {
|
$topicProgressWrapper.css('bottom', isDocked ? dockPos : '');
|
||||||
$topicProgressWrapper.css('bottom', '');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this.set('docked', isDocked);
|
this.set('docked', isDocked);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue