tdf#122572: Make the context toolbar show up more reliably
It seems that the _onPress function is sometimes called multiple times in succession and then the toolbar got first added but immediately removed again. Ugly hack to fix that. But note that in this branch, copy/paste seems to be broken in the iOS app at the moment anyway. Apparently the code that makes it use the system pasteboard is missing, or does not get called. Reviewed-on: https://gerrit.libreoffice.org/77574 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com> (cherry picked from commit c2956383b9f353ffa98ae4a3c8e21769d3f334db) Change-Id: Id4f1569670e599a2b37afc9ae5d91f31661f72e2 Reviewed-on: https://gerrit.libreoffice.org/77789 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
This commit is contained in:
parent
232fdf5dcb
commit
5d4f845aec
1 changed files with 6 additions and 1 deletions
|
@ -21,6 +21,7 @@ L.Map.TouchGesture = L.Handler.extend({
|
|||
|
||||
if (window.ThisIsTheiOSApp && !this._toolbar) {
|
||||
this._toolbar = L.control.contextToolbar();
|
||||
this._toolbarAdded = 0;
|
||||
}
|
||||
|
||||
if (!this._hammer) {
|
||||
|
@ -157,10 +158,14 @@ L.Map.TouchGesture = L.Handler.extend({
|
|||
mousePos = this._map._docLayer._latLngToTwips(latlng);
|
||||
|
||||
if (window.ThisIsTheiOSApp) {
|
||||
// console.log('==> ' + e.timeStamp);
|
||||
if (!this._toolbar._map && this._map._docLayer.containsSelection(latlng)) {
|
||||
this._toolbar._pos = containerPoint;
|
||||
// console.log('==> Adding context toolbar ' + e.timeStamp);
|
||||
this._toolbar.addTo(this._map);
|
||||
} else {
|
||||
this._toolbarAdded = e.timeStamp;
|
||||
} else if (this._toolbarAdded && e.timeStamp - this._toolbarAdded >= 1000) {
|
||||
// console.log('==> Removing context toolbar ' + e.timeStamp);
|
||||
this._toolbar.remove();
|
||||
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
|
||||
// send right click to trigger context menus
|
||||
|
|
Loading…
Reference in a new issue