Fixes bug in FF, exception on right click in timeline

(cherry picked from commit 860f424)
pull/5856/head
Roman Roelofsen 7 years ago
parent d89a3bb0c4
commit 6b751b3ed4
  1. 14
      frontend/app/components/context-menus/context-menu.service.ts

@ -38,6 +38,10 @@ export class ContextMenuService {
private active_menu:ContextMenu|null;
private repositionCurrentElement:Function|null;
// RR: Ugly flag to avoid bug in Firefox:
// right-click immediately triggered $window.click -> close() event
private tempDisableGlobalClose = false;
constructor(public $window:ng.IWindowService,
public $injector:ng.auto.IInjectorService,
public $q:ng.IQService,
@ -56,7 +60,11 @@ export class ContextMenuService {
Mousetrap.bind('escape', () => this.close());
// Listen to any click and close the active context menu
jQuery($window).click(() => this.close());
jQuery($window).click(() => {
if (!this.tempDisableGlobalClose) {
this.close();
}
});
}
@ -76,6 +84,8 @@ export class ContextMenuService {
}
public activate(contextMenuName:string, event:Event, locals:Object, positionArgs?:any) {
this.tempDisableGlobalClose = true;
let deferred = this.$q.defer();
let target = jQuery(event.target);
let contextMenu:ContextMenu = <ContextMenu> this.$injector.get(contextMenuName);
@ -103,6 +113,8 @@ export class ContextMenuService {
this.repositionCurrentElement!();
menuElement.css('visibility', 'visible');
deferred.resolve(menuElement);
this.tempDisableGlobalClose = false;
});
});

Loading…
Cancel
Save