From 4884332154ac7d9e4ec00a3ba0626305b5cb6cbd Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 7 Nov 2017 14:42:51 +0300 Subject: [PATCH] [SSE] For Bug 36231. --- .../main/app/controller/DocumentHolder.js | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index 21f5f6f290..3fbbba6dcf 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -1778,13 +1778,29 @@ define([ }); (menu.items.length>0) && menu.items[0].setChecked(true, true); } - if (coord.asc_getX()<0 || coord.asc_getY()<0) { - if (pasteContainer.is(':visible')) pasteContainer.hide(); - } else { - var showPoint = [coord.asc_getX() + coord.asc_getWidth() + 3, coord.asc_getY() + coord.asc_getHeight() + 3]; - pasteContainer.css({left: showPoint[0], top : showPoint[1]}); - pasteContainer.show(); - } + + var rightBottom = coord[0], + leftTop = coord[1], + width = me.tooltips.coauth.bodyWidth - me.tooltips.coauth.XY[0] - me.tooltips.coauth.rightMenuWidth - 15, + height = me.tooltips.coauth.apiHeight - 15, // height - scrollbar height + showPoint = [], + btnSize = [31, 20]; + + var right = rightBottom.asc_getX() + rightBottom.asc_getWidth() + 3 + btnSize[0], + bottom = rightBottom.asc_getY() + rightBottom.asc_getHeight() + 3 + btnSize[1]; + + if (right > width) { + showPoint[0] = leftTop.asc_getX(); + if (bottom > height) + showPoint[0] -= (btnSize[0]+3); + if (showPoint[0]<0) showPoint[0] = width - 3 - btnSize[0]; + } else + showPoint[0] = right - btnSize[0]; + + showPoint[1] = (bottom > height) ? height - 3 - btnSize[1] : bottom - btnSize[1]; + + pasteContainer.css({left: showPoint[0], top : showPoint[1]}); + pasteContainer.show(); }, onHideSpecialPasteOptions: function() {