Merge pull request #2556 from aignatov-bio/ai-sci-4515-fix-smart-annotation-position

Fix smart annotation position for horizontal scroll [SCI-4515]
This commit is contained in:
aignatov-bio 2020-05-14 13:18:57 +02:00 committed by GitHub
commit 99e1affa73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -381,8 +381,15 @@ var SmartAnnotation = (function() {
function init() {
$(field)
.on("reposition.atwho", function(event, flag, query) {
if (query.$inputor.offset().left > $(window).width()) {
query.$el.find('.atwho-view').css('left', (flag.left + $(window).scrollLeft()) + 'px');
let inputFieldLeft = query.$inputor.offset().left;
if (inputFieldLeft > $(window).width()) {
let leftPosition;
if (inputFieldLeft < flag.left + $(window).scrollLeft()) {
leftPosition = inputFieldLeft;
} else {
leftPosition = flag.left + $(window).scrollLeft();
}
query.$el.find('.atwho-view').css('left', leftPosition + 'px');
}
if ($('.repository-show').length) {
query.$el.find('.atwho-view').css('top', flag.top + 'px');