From a343a7aa0a159b40161a4336bd72861a6d368a88 Mon Sep 17 00:00:00 2001 From: Maxim Kadushkin Date: Mon, 30 Jan 2017 18:10:11 +0300 Subject: [PATCH] [SSE mobile] fixed context menu for android --- .../mobile/app/view/DocumentHolder.js | 18 ++++++++++-------- .../mobile/app/view/Statusbar.js | 9 +++++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js b/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js index d62813031..6d03ff7b6 100644 --- a/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/mobile/app/view/DocumentHolder.js @@ -43,6 +43,7 @@ define([ 'jquery', 'underscore', 'backbone' + , 'common/mobile/utils/utils' ], function ($, _, Backbone) { 'use strict'; @@ -87,9 +88,8 @@ define([ '<% }); %>' ].join('')); - $('#' + _anchorId) - .css('left', posX) - .css('top', posY); + var $target = $('#' + _anchorId) + .css({left: posX, top: posY}); uiApp.closeModal('.document-menu.modal-in'); @@ -103,18 +103,20 @@ define([ ''+ ''+ ''; - uiApp.popover(popoverHTML, $('#' + _anchorId)); + var popover = uiApp.popover(popoverHTML, $target); + + if (Common.SharedSettings.get('android')) { + Common.Utils.androidMenuTop($(popover), $target); + } $('.modal-overlay').removeClass('modal-overlay-visible'); $('.document-menu li').single('click', _.buffered(function(e) { - var $target = $(e.currentTarget), - eventName = $target.data('event'); + var $el = $(e.currentTarget), + eventName = $el.data('event'); this.fireEvent('contextmenu:click', [this, eventName]); }, 100, this)); - - // console.log('Show menu at position:', posX, posY); }, hideMenu: function () { diff --git a/apps/spreadsheeteditor/mobile/app/view/Statusbar.js b/apps/spreadsheeteditor/mobile/app/view/Statusbar.js index 7a23e190e..abe5f2273 100644 --- a/apps/spreadsheeteditor/mobile/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/mobile/app/view/Statusbar.js @@ -41,6 +41,7 @@ define([ 'core', 'underscore' + , 'common/mobile/utils/utils' ], function(template){ 'use strict'; @@ -176,10 +177,14 @@ define([ ''+ ''; - uiApp.popover(popoverHTML, model.get('el')); + var $target = model.get('el'); + var popover = uiApp.popover(popoverHTML, $target); + + if (Common.SharedSettings.get('android')) { + Common.Utils.androidMenuTop($(popover), $target); + } $('.modal-overlay').removeClass('modal-overlay-visible'); - $('.document-menu li').single('click', _.buffered(function(e) { uiApp.closeModal('.document-menu.modal-in');