[SSE mobile] fixed context menu for android

This commit is contained in:
Maxim Kadushkin 2017-01-30 18:10:11 +03:00
parent e6bb8d54ca
commit a343a7aa0a
2 changed files with 17 additions and 10 deletions

View file

@ -43,6 +43,7 @@ define([
'jquery', 'jquery',
'underscore', 'underscore',
'backbone' 'backbone'
, 'common/mobile/utils/utils'
], function ($, _, Backbone) { ], function ($, _, Backbone) {
'use strict'; 'use strict';
@ -87,9 +88,8 @@ define([
'<% }); %>' '<% }); %>'
].join('')); ].join(''));
$('#' + _anchorId) var $target = $('#' + _anchorId)
.css('left', posX) .css({left: posX, top: posY});
.css('top', posY);
uiApp.closeModal('.document-menu.modal-in'); uiApp.closeModal('.document-menu.modal-in');
@ -103,18 +103,20 @@ define([
'</div>'+ '</div>'+
'</div>'+ '</div>'+
'</div>'; '</div>';
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'); $('.modal-overlay').removeClass('modal-overlay-visible');
$('.document-menu li').single('click', _.buffered(function(e) { $('.document-menu li').single('click', _.buffered(function(e) {
var $target = $(e.currentTarget), var $el = $(e.currentTarget),
eventName = $target.data('event'); eventName = $el.data('event');
this.fireEvent('contextmenu:click', [this, eventName]); this.fireEvent('contextmenu:click', [this, eventName]);
}, 100, this)); }, 100, this));
// console.log('Show menu at position:', posX, posY);
}, },
hideMenu: function () { hideMenu: function () {

View file

@ -41,6 +41,7 @@
define([ define([
'core', 'core',
'underscore' 'underscore'
, 'common/mobile/utils/utils'
], ],
function(template){ function(template){
'use strict'; 'use strict';
@ -176,10 +177,14 @@ define([
'</div>'+ '</div>'+
'</div>'; '</div>';
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'); $('.modal-overlay').removeClass('modal-overlay-visible');
$('.document-menu li').single('click', _.buffered(function(e) { $('.document-menu li').single('click', _.buffered(function(e) {
uiApp.closeModal('.document-menu.modal-in'); uiApp.closeModal('.document-menu.modal-in');