mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
Fix positioning
This commit is contained in:
@ -357,7 +357,7 @@ define([
|
||||
$selected = $list.find('> li.selected');
|
||||
|
||||
if ($selected.length) {
|
||||
var itemTop = $selected.position().top,
|
||||
var itemTop = Common.Utils.getPosition($selected).top,
|
||||
itemHeight = $selected.outerHeight(),
|
||||
listHeight = $list.outerHeight();
|
||||
|
||||
@ -514,7 +514,7 @@ define([
|
||||
if (this.scroller) {
|
||||
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
|
||||
var $list = $(this.el).find('ul');
|
||||
var itemTop = item.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item).top,
|
||||
itemHeight = item.outerHeight(),
|
||||
listHeight = $list.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -745,7 +745,7 @@ define([
|
||||
itemNode.addClass('selected');
|
||||
itemNode.find('a').attr('aria-checked', true);
|
||||
|
||||
var itemTop = itemNode.position().top,
|
||||
var itemTop = Common.Utils.getPosition(itemNode).top,
|
||||
menuTop = menuEl.scrollTop();
|
||||
|
||||
if (itemTop != 0)
|
||||
|
||||
@ -369,7 +369,7 @@ define([
|
||||
}
|
||||
|
||||
if (this.resize.type == 'vertical')
|
||||
value -= panel.position().top;
|
||||
value -= Common.Utils.getPosition(panel).top;
|
||||
// if (this.resize.type == 'horizontal')
|
||||
// value -= panel.position().left;
|
||||
|
||||
@ -427,7 +427,7 @@ define([
|
||||
}
|
||||
|
||||
// if (resize.type == 'vertical')
|
||||
value -= panel.position().top;
|
||||
value -= Common.Utils.getPosition(panel).top;
|
||||
// if (resize.type == 'horizontal')
|
||||
// value -= panel.position().left;
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ define([
|
||||
div = (idx>=0 && this.dataViewItems.length>idx) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id'));
|
||||
if (div.length<=0) return;
|
||||
|
||||
var div_top = div.position().top,
|
||||
var div_top = Common.Utils.getPosition(div).top,
|
||||
div_height = div.outerHeight(),
|
||||
div_first = this.dataViewItems[0].el,
|
||||
div_first_top = div_first ? div_first.offsetTop : 0,
|
||||
|
||||
@ -410,7 +410,7 @@ define([
|
||||
|
||||
var $selected = menuRoot.find('> li .checked');
|
||||
if ($selected.length) {
|
||||
var itemTop = $selected.position().top,
|
||||
var itemTop = Common.Utils.getPosition($selected).top,
|
||||
itemHeight = $selected.outerHeight(),
|
||||
listHeight = menuRoot.outerHeight();
|
||||
if (!!this.options.scrollToCheckedItem && (itemTop < 0 || itemTop + itemHeight > listHeight)) {
|
||||
@ -516,7 +516,7 @@ define([
|
||||
var item = itemCandidate.cmpEl.find('a');
|
||||
if (this.scroller) {
|
||||
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
|
||||
var itemTop = item.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item).top,
|
||||
itemHeight = item.outerHeight(),
|
||||
listHeight = this.menuRoot.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
@ -1034,7 +1034,7 @@ define([
|
||||
var menuRoot = this.menuRoot,
|
||||
$selected = menuRoot.find('> li .checked');
|
||||
if ($selected.length) {
|
||||
var itemTop = $selected.position().top,
|
||||
var itemTop = Common.Utils.getPosition($selected).top,
|
||||
itemHeight = $selected.outerHeight(),
|
||||
listHeight = menuRoot.outerHeight();
|
||||
if (!!this.options.scrollToCheckedItem && (itemTop < 0 || itemTop + itemHeight > listHeight)) {
|
||||
@ -1127,7 +1127,7 @@ define([
|
||||
var item = itemCandidate.el;
|
||||
if (this.scroller) {
|
||||
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
|
||||
var itemTop = item.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item).top,
|
||||
itemHeight = item.outerHeight(),
|
||||
listHeight = this.menuRoot.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -588,7 +588,7 @@ define([
|
||||
setMoreButton: function(tab, panel) {
|
||||
var me = this;
|
||||
if (!btnsMore[tab]) {
|
||||
var top = panel.position().top;
|
||||
var top = Common.Utils.getPosition(panel).top;
|
||||
var box = $('<div class="more-box" style="top:'+ top +'px;">' +
|
||||
'<div class="separator long" style="position: relative;display: table-cell;"></div>' +
|
||||
'<div class="group" style=""><span class="btn-slot text x-huge slot-btn-more"></span></div>' +
|
||||
|
||||
@ -519,7 +519,7 @@ define([
|
||||
if (this.$bar.find('.separator-item').length === 0) {
|
||||
this.$bar.append('<li class="separator-item"><span></span></li>');
|
||||
}
|
||||
this.$bar.scrollLeft(this.$bar.scrollLeft() + (tab.position().left + parseInt(tab.css('width')) - this.$bar.width()) + (this.$bar.width() > 400 ? 20 : 5));
|
||||
this.$bar.scrollLeft(this.$bar.scrollLeft() + (Common.Utils.getPosition(tab).left + parseInt(tab.css('width')) - this.$bar.width()) + (this.$bar.width() > 400 ? 20 : 5));
|
||||
this.checkInvisible(suppress);
|
||||
} else {
|
||||
if (!this.isTabVisible(this.tabs.length - 1) && this.$bar.find('.separator-item').length === 0) {
|
||||
@ -530,7 +530,7 @@ define([
|
||||
if (index == 'forward') {
|
||||
for (var i = 0; i < this.tabs.length; i++) {
|
||||
tab = this.tabs[i].$el;
|
||||
right = tab.position().left + parseInt(tab.css('width'));
|
||||
right = Common.Utils.getPosition(tab).left + parseInt(tab.css('width'));
|
||||
|
||||
if (right > rightbound) {
|
||||
this.$bar.scrollLeft(this.$bar.scrollLeft() + (right - rightbound) + (this.$bar.width() > 400 ? 20 : 5));
|
||||
@ -541,7 +541,7 @@ define([
|
||||
} else if (index == 'backward') {
|
||||
for (i = this.tabs.length; i-- > 0; ) {
|
||||
tab = this.tabs[i].$el;
|
||||
left = tab.position().left;
|
||||
left = Common.Utils.getPosition(tab).left;
|
||||
|
||||
if (left < 0) {
|
||||
this.$bar.scrollLeft(this.$bar.scrollLeft() + left - 26);
|
||||
@ -551,7 +551,7 @@ define([
|
||||
}
|
||||
} else if (typeof index == 'number') {
|
||||
tab = this.tabs[index].$el;
|
||||
left = tab.position().left;
|
||||
left = Common.Utils.getPosition(tab).left;
|
||||
right = left + parseInt(tab.css('width'));
|
||||
|
||||
if (left < 0) {
|
||||
|
||||
@ -515,7 +515,7 @@ define([
|
||||
if (!options.dontshow) body.css('padding-bottom', '10px');
|
||||
|
||||
if (options.maxwidth && options.width=='auto') {
|
||||
var width = !Common.UI.isRTL() ? (text.position().left + text.width() + parseInt(text_cnt.css('padding-right'))) :
|
||||
var width = !Common.UI.isRTL() ? (Common.Utils.getPosition(text).left + text.width() + parseInt(text_cnt.css('padding-right'))) :
|
||||
(parseInt(text_cnt.css('padding-right')) + icon_width + text.width() + parseInt(text_cnt.css('padding-left')));
|
||||
if (width > options.maxwidth)
|
||||
options.width = options.maxwidth;
|
||||
@ -525,7 +525,7 @@ define([
|
||||
body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height')));
|
||||
var span_el = check.find('span');
|
||||
var width = !Common.UI.isRTL() ?
|
||||
(Math.max(text.width(), span_el.length>0 ? span_el.position().left + span_el.width() : 0) + text.position().left + parseInt(text_cnt.css('padding-right'))) :
|
||||
(Math.max(text.width(), span_el.length>0 ? Common.Utils.getPosition(span_el).left + span_el.width() : 0) + Common.Utils.getPosition(text).left + parseInt(text_cnt.css('padding-right'))) :
|
||||
(parseInt(text_cnt.css('padding-right')) + icon_width + parseInt(text_cnt.css('padding-left')) +
|
||||
(Math.max(text.width(), check.length>0 ? $(check).find('.checkbox-indeterminate').outerWidth(true) : 0)));
|
||||
window.setSize(width, parseInt(body.css('height')) + parseInt(header.css('height')));
|
||||
|
||||
@ -72,7 +72,7 @@ function onDropDownKeyDown(e) {
|
||||
function checkFocusedItem(cmp, item) {
|
||||
var innerHeight = cmp.innerHeight(),
|
||||
padding = (innerHeight - cmp.height())/2,
|
||||
pos = item.position().top,
|
||||
pos = Common.Utils.getPosition(item).top,
|
||||
itemHeight = item.outerHeight();
|
||||
if (pos<0)
|
||||
cmp.scrollTop(cmp.scrollTop() + pos - padding);
|
||||
|
||||
@ -315,7 +315,7 @@ define([
|
||||
if (index !== -1) {
|
||||
var item = this.resultItems[index].$el,
|
||||
itemHeight = item.outerHeight(),
|
||||
itemTop = item.position().top,
|
||||
itemTop = Common.Utils.getPosition(item).top,
|
||||
container = this.view.$resultsContainer,
|
||||
containerHeight = container.outerHeight(),
|
||||
containerTop = container.scrollTop();
|
||||
|
||||
@ -608,7 +608,7 @@ define([
|
||||
panel.show(opts);
|
||||
|
||||
if (this.scroller) {
|
||||
var itemTop = item.$el.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item.$el).top,
|
||||
itemHeight = item.$el.outerHeight(),
|
||||
listHeight = this.$el.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -315,7 +315,7 @@ define([
|
||||
if (index !== -1) {
|
||||
var item = this.resultItems[index].$el,
|
||||
itemHeight = item.outerHeight(),
|
||||
itemTop = item.position().top,
|
||||
itemTop = Common.Utils.getPosition(item).top,
|
||||
container = this.view.$resultsContainer,
|
||||
containerHeight = container.outerHeight(),
|
||||
containerTop = container.scrollTop();
|
||||
|
||||
@ -585,7 +585,7 @@ define([
|
||||
panel.show(opts);
|
||||
|
||||
if (this.scroller) {
|
||||
var itemTop = item.$el.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item.$el).top,
|
||||
itemHeight = item.$el.outerHeight(),
|
||||
listHeight = this.$el.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -281,7 +281,7 @@ define([
|
||||
if (index !== -1) {
|
||||
var item = this.resultItems[index].$el,
|
||||
itemHeight = item.outerHeight(),
|
||||
itemTop = item.position().top,
|
||||
itemTop = Common.Utils.getPosition(item).top,
|
||||
container = this.view.$resultsContainer,
|
||||
containerHeight = container.outerHeight(),
|
||||
containerTop = container.scrollTop();
|
||||
|
||||
@ -600,7 +600,7 @@ define([
|
||||
panel.show(opts);
|
||||
|
||||
if (this.scroller) {
|
||||
var itemTop = item.$el.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item.$el).top,
|
||||
itemHeight = item.$el.outerHeight(),
|
||||
listHeight = this.$el.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -419,7 +419,7 @@ define([
|
||||
if (index !== -1) {
|
||||
var item = this.resultItems[index].$el,
|
||||
itemHeight = item.outerHeight(),
|
||||
itemTop = item.position().top,
|
||||
itemTop = Common.Utils.getPosition(item).top,
|
||||
container = this.view.$resultsContainer.find('.search-items'),
|
||||
containerHeight = container.outerHeight(),
|
||||
containerTop = container.scrollTop();
|
||||
|
||||
@ -586,7 +586,7 @@ define([
|
||||
panel.show(opts);
|
||||
|
||||
if (this.scroller) {
|
||||
var itemTop = item.$el.position().top,
|
||||
var itemTop = Common.Utils.getPosition(item.$el).top,
|
||||
itemHeight = item.$el.outerHeight(),
|
||||
listHeight = this.$el.outerHeight();
|
||||
if (itemTop < 0 || itemTop + itemHeight > listHeight) {
|
||||
|
||||
@ -244,7 +244,7 @@ define([
|
||||
|
||||
// scroll
|
||||
var heightListView = item.$el.parent().height(),
|
||||
positionTopItem = item.$el.position().top,
|
||||
positionTopItem = Common.Utils.getPosition(item.$el).top,
|
||||
heightItem = item.$el.outerHeight(),
|
||||
scrollTop = item.$el.parent().scrollTop();
|
||||
if (positionTopItem < heightItem && scrollTop > 0) {
|
||||
|
||||
Reference in New Issue
Block a user