From 16dbfea134df7b6678d90d1ccdd03d51f3a9d792 Mon Sep 17 00:00:00 2001 From: Vince Date: Fri, 14 Jun 2013 13:18:26 +0200 Subject: [PATCH] Fix contextmenu right click (active only above drawing canvas) --- js/controller/DrawingController.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/controller/DrawingController.js b/js/controller/DrawingController.js index bfd1acfa..c1284ff1 100644 --- a/js/controller/DrawingController.js +++ b/js/controller/DrawingController.js @@ -71,7 +71,7 @@ body.mouseup($.proxy(this.onMouseup_, this)); // Deactivate right click: - //body.contextmenu(this.onCanvasContextMenu_); + body.contextmenu(this.onCanvasContextMenu_); }; @@ -217,10 +217,13 @@ * @private */ ns.DrawingController.prototype.onCanvasContextMenu_ = function (event) { - event.preventDefault(); - event.stopPropagation(); - event.cancelBubble = true; - return false; + if ($(event.target).closest('#drawing-canvas-container').length) { + // Deactivate right click on drawing canvas only. + event.preventDefault(); + event.stopPropagation(); + event.cancelBubble = true; + return false; + } }; ns.DrawingController.prototype.render = function () {