From e086e49e868fa6d0eb14fb6b4bc06701eeac8e04 Mon Sep 17 00:00:00 2001 From: Christian 'ketura' McCarty Date: Sun, 11 Sep 2022 15:44:14 -0500 Subject: [PATCH] Added right-click as an alternative to shift+click to zoom in-game and in the deckbuilder --- .../main/web/js/gemp-022/deckBuildingUi.js | 14 ++++++++++++-- .../src/main/web/js/gemp-022/gameUi.js | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js index 68b9f7450..2ce99007f 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/deckBuildingUi.js @@ -231,6 +231,15 @@ var GempLotrDeckBuildingUI = Class.extend({ function (event) { return that.clickCardFunction(event); }); + $("body")[0].addEventListener("contextmenu", + function (event) { + if(!that.clickCardFunction(event)) + { + event.preventDefault(); + return false; + } + return true; + }); $("body").mousedown( function (event) { return that.dragStartCardFunction(event); @@ -646,10 +655,11 @@ var GempLotrDeckBuildingUI = Class.extend({ if (tar.hasClass("actionArea")) { var selectedCardElem = tar.closest(".card"); - if (event.which == 1) { + if (event.which >= 1) { if (!this.successfulDrag) { - if (event.shiftKey) { + if (event.shiftKey || event.which > 1) { this.displayCardInfo(selectedCardElem.data("card")); + return false; } else if (selectedCardElem.hasClass("cardInCollection")) { var cardData = selectedCardElem.data("card"); this.selectionFunc(cardData.blueprintId, cardData.zone); diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js index 3fdbe2287..ac5b67a7c 100644 --- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js +++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js @@ -92,6 +92,14 @@ var GempLotrGameUI = Class.extend({ that.chatBox.appendMessage("Refresh the page (press F5) to resume the game, or press back on your browser to get back to the Game Hall.", "warningMessage"); } }); + + // window.onbeforeunload = function(event) { + // var e = e || window.event; + // if (e) { + // e.returnValue = "If you are done with this game, please go to the 'Options' tab and click the 'Concede Game' button first."; + // } + // return message; + // }; $.expr[':'].cardId = function (obj, index, meta, stack) { var cardIds = meta[3].split(","); @@ -397,6 +405,17 @@ var GempLotrGameUI = Class.extend({ function (event) { return that.clickCardFunction(event); }); + var test = $("body"); + $("body")[0].addEventListener("contextmenu", + function (event) { + //event.preventDefault(); + if(!that.clickCardFunction(event)) + { + event.preventDefault(); + return false; + } + return true; + }); $("body").mousedown( function (event) { $("body").bind("mousemove", dragFunc);