From 2c902a6d52b2ffb3a1322f99b350a9f1826989d3 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Fri, 8 Mar 2019 14:09:55 +0100
Subject: [PATCH] OO-3953: block right click in the drawing interaction

---
 .../static/js/jquery/openolat/jquery.paint.js  | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/main/webapp/static/js/jquery/openolat/jquery.paint.js b/src/main/webapp/static/js/jquery/openolat/jquery.paint.js
index a096170dd7b..64fd39139ff 100644
--- a/src/main/webapp/static/js/jquery/openolat/jquery.paint.js
+++ b/src/main/webapp/static/js/jquery/openolat/jquery.paint.js
@@ -141,7 +141,7 @@
 		undo_arr.push(empty_canv); //NEWTHING
 		
 		jQuery(tmp_canvas).on('mousedown touchstart', function(e) {
-			if(isDoubleTouch(e)) {
+			if(isDoubleTouch(e) || isRightClick(e)) {
 				return;
 			}
 			
@@ -476,10 +476,24 @@
 			}
 			return false;
 		}
+		
+		function isRightClick(e) {
+			try {
+				console.log(e);
+				if(!(typeof e == "undefined")
+						&& !(typeof e.which == "undefined")
+						&& (e.which == 2 || e.which == 3)) {
+					return true;
+				}
+			} catch(ex) {
+				if(window.console) console.log(ex);
+			}
+			return false;
+		}
 
 		function onPaint(e) {
 			if(!(typeof e == "undefined")) {
-				if(isDoubleTouch(e)) {
+				if(isDoubleTouch(e) || isRightClick(e)) {
 					return;
 				}
 				e.preventDefault();
-- 
GitLab