ruler: workaround adding a tab-stop on mobile

On mobile, don't show a menu, but add the tab-stop immediately
when long-press event is sent.

Change-Id: Iedd019a40a891d57467d333239b9cb79317cda2d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93547
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
This commit is contained in:
Tomaž Vajngerl 2020-05-06 09:32:18 +02:00 committed by Andras Timar
parent 8ad6a05000
commit 73a62f1898

View file

@ -533,17 +533,21 @@ L.Control.Ruler = L.Control.extend({
_onTabstopContainerLongPress: function(event) {
var pointX = event.center.x - event.target.getBoundingClientRect().left;
this.currentPositionInTwips = this._map._docLayer._pixelsToTwips({x: pointX, y:0}).x;
$.contextMenu({
selector: '.loleaflet-ruler-tabstopcontainer',
className: 'loleaflet-font',
items: {
inserttabstop: {
name: _('Insert tabstop'),
callback: (this._insertTabstop).bind(this)
if (window.mode.isMobile() || window.mode.isTablet()) {
this._insertTabstop();
}
else {
$.contextMenu({
selector: '.loleaflet-ruler-tabstopcontainer',
className: 'loleaflet-font',
items: {
inserttabstop: {
name: _('Insert tabstop'),
callback: (this._insertTabstop).bind(this)
}
}
}
});
});
}
},
_insertTabstop: function() {