[SSE] Bug 43429

This commit is contained in:
Julia Svinareva 2019-11-08 17:13:38 +03:00
parent a2f181711c
commit 5a82917bf4

View file

@ -103,6 +103,8 @@ define([
var me = this, var me = this,
length = me.bar.tabs.length, length = me.bar.tabs.length,
barBounds = me.bar.$bar.get(0).getBoundingClientRect(); barBounds = me.bar.$bar.get(0).getBoundingClientRect();
me.leftBorder = barBounds.left;
me.rightBorder = barBounds.right;
if (barBounds) { if (barBounds) {
me.bounds = []; me.bounds = [];
@ -324,19 +326,30 @@ define([
function dragMove (event) { function dragMove (event) {
if (!_.isUndefined(me.drag)) { if (!_.isUndefined(me.drag)) {
me.drag.moveX = event.clientX*Common.Utils.zoom(); me.drag.moveX = event.clientX*Common.Utils.zoom();
if (me.drag.moveX < me.tabBarRight && me.drag.moveX > me.tabBarLeft) { if (me.drag.moveX < me.leftBorder) {
me.scrollLeft -= 20;
me.bar.$bar.scrollLeft(me.scrollLeft);
me.calculateBounds();
} else if (me.drag.moveX < me.tabBarRight && me.drag.moveX > me.tabBarLeft) {
var name = $(event.target).parent().data('label'), var name = $(event.target).parent().data('label'),
currentTab = _.findIndex(bar.tabs, {label: name}); currentTab = _.findIndex(bar.tabs, {label: name});
if (currentTab !== -1 && (me.bounds[currentTab].left - me.scrollLeft >= me.tabBarLeft)) { if (currentTab === -1) {
bar.$el.find('li.mousemove').removeClass('mousemove right');
me.drag.place = undefined;
} else if (me.bounds[currentTab].left - me.scrollLeft >= me.tabBarLeft) {
me.drag.place = currentTab; me.drag.place = currentTab;
$(event.target).parent().parent().find('li.mousemove').removeClass('mousemove right'); $(event.target).parent().parent().find('li.mousemove').removeClass('mousemove right');
$(event.target).parent().addClass('mousemove'); $(event.target).parent().addClass('mousemove');
} }
} else if ((me.drag.moveX > me.lastTabRight - me.scrollLeft) && (me.tabBarRight >= me.lastTabRight - me.scrollLeft)) { //move to end of list, right border of the right tab is visible } else if (me.drag.moveX > me.lastTabRight && Math.abs(me.tabBarRight - me.bounds[me.bar.tabs.length - 1].right) < 1) { //move to end of list, right border of the right tab is visible
bar.$el.find('li.mousemove').removeClass('mousemove right'); bar.$el.find('li.mousemove').removeClass('mousemove right');
bar.tabs[bar.tabs.length - 1].$el.addClass('mousemove right'); bar.tabs[bar.tabs.length - 1].$el.addClass('mousemove right');
me.drag.place = bar.tabs.length; me.drag.place = bar.tabs.length;
} } else if (me.drag.moveX - me.rightBorder > 3) {
me.scrollLeft += 20;
me.bar.$bar.scrollLeft(me.scrollLeft);
me.calculateBounds();
}
} }
} }
if (!_.isUndefined(bar) && !_.isUndefined(tabs) && bar.tabs.length > 1) { if (!_.isUndefined(bar) && !_.isUndefined(tabs) && bar.tabs.length > 1) {