From ed38397631844a6c45e3a9ac848148c38c98bf0a Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Thu, 21 Sep 2023 13:17:44 +0200 Subject: [PATCH] Removed types definitions --- .gitignore | 1 + client/plugins/controltips/index.js | 293 ---------------------------- client/tsconfig.json | 4 +- 3 files changed, 2 insertions(+), 296 deletions(-) delete mode 100644 client/plugins/controltips/index.js diff --git a/.gitignore b/.gitignore index f58d9ee8..c331ffb4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ node_modules /client/public/javascripts/bundle.js !client/bin /client/public/plugins +/client/plugins/controltips/index.js diff --git a/client/plugins/controltips/index.js b/client/plugins/controltips/index.js deleted file mode 100644 index 6874f995..00000000 --- a/client/plugins/controltips/index.js +++ /dev/null @@ -1,293 +0,0 @@ -(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i { - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - __classPrivateFieldGet(this, _ControlTipsPlugin_shortcutManager, "f").onKeyUp(() => { - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("airbaseMouseover", (ev) => { - __classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, true, "f"); - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("airbaseMouseout", (ev) => { - __classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, false, "f"); - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("unitDeselection", (ev) => { - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("unitMouseover", (ev) => { - __classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, true, "f"); - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("unitMouseout", (ev) => { - __classPrivateFieldSet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, false, "f"); - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("unitSelection", (ev) => { - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - document.addEventListener("mapVisibilityOptionsChanged", () => { - this.toggle(!__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getMap().getVisibilityOptions()[SHOW_CONTROL_TIPS]); - }); - document.addEventListener("mouseover", (ev) => { - if (ev.target instanceof HTMLElement) { - __classPrivateFieldSet(this, _ControlTipsPlugin_mouseoverElement, ev.target, "f"); - } - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - }); - __classPrivateFieldGet(this, _ControlTipsPlugin_instances, "m", _ControlTipsPlugin_updateTips).call(this); - __classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getMap().addVisibilityOption(SHOW_CONTROL_TIPS, true); - return true; - } - getElement() { - return __classPrivateFieldGet(this, _ControlTipsPlugin_element, "f"); - } - toggle(bool) { - this.getElement().classList.toggle("hide", bool); - } -} -exports.ControlTipsPlugin = ControlTipsPlugin; -_ControlTipsPlugin_element = new WeakMap(), _ControlTipsPlugin_app = new WeakMap(), _ControlTipsPlugin_shortcutManager = new WeakMap(), _ControlTipsPlugin_cursorIsHoveringOverUnit = new WeakMap(), _ControlTipsPlugin_cursorIsHoveringOverAirbase = new WeakMap(), _ControlTipsPlugin_mouseoverElement = new WeakMap(), _ControlTipsPlugin_instances = new WeakSet(), _ControlTipsPlugin_updateTips = function _ControlTipsPlugin_updateTips() { - const combos = [ - { - "keys": [], - "tips": [ - { - "key": `SHIFT`, - "action": `Box select`, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false, - "showIfUnitSelected": false - }, - { - "key": `Mouse1`, - "action": `Deselect`, - "showIfUnitSelected": true - }, - { - "key": `Mouse1+drag`, - "action": `Move map`, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false, - "showIfUnitSelected": false - }, - { - "key": `Mouse2`, - "action": `Spawn menu`, - "showIfUnitSelected": false, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false - }, - { - "key": `Mouse2`, - "action": `Quick options`, - "showIfUnitSelected": false, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": true - }, - { - "key": `Mouse2`, - "action": `Airbase menu`, - "showIfUnitSelected": false, - "showIfHoveringOverAirbase": true, - "showIfHoveringOverUnit": false - }, - { - "key": `Mouse2`, - "action": `Set first waypoint`, - "showIfHoveringOverAirbase": false, - "showIfUnitSelected": true, - "unitsMustBeControlled": true - }, - { - "key": "CTRL+Mouse2", - "action": "Add waypoint", - "showIfUnitSelected": true, - "showIfHoveringOverAirbase": false, - "unitsMustBeControlled": true - }, - { - "key": `Mouse2 (hold)`, - "action": `Point operations`, - "showIfUnitSelected": true, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false, - "unitsMustBeControlled": true - }, - { - "key": "CTRL", - "action": " Pin tool", - "showIfUnitSelected": false, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false, - "unitsMustBeControlled": true - }, - { - "key": "CTRL+Mouse2", - "action": " Airbase menu", - "showIfUnitSelected": true, - "showIfHoveringOverAirbase": true, - "unitsMustBeControlled": true - }, - { - "key": `Delete`, - "action": `Delete unit`, - "showIfHoveringOverAirbase": false, - "showIfUnitSelected": true - }, - { - "key": `mouse1`, - "action": "Toggle Blue/Red", - "mouseoverSelector": "#coalition-switch .ol-switch-fill" - }, - { - "key": `mouse2`, - "action": "Set Neutral", - "mouseoverSelector": "#coalition-switch .ol-switch-fill" - } - ] - }, - { - "keys": ["ControlLeft"], - "tips": [ - { - "key": `Mouse1`, - "action": "Toggle pin", - "showIfUnitSelected": false, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": false - }, - { - "key": `Mouse1`, - "action": "Toggle selection", - "showIfUnitSelected": true, - "showIfHoveringOverAirbase": false, - "showIfHoveringOverUnit": true - }, - { - "key": `Mouse2`, - "action": `Add waypoint`, - "showIfHoveringOverAirbase": false, - "showIfUnitSelected": true, - "unitsMustBeControlled": true - }, - { - "key": `Mouse2`, - "action": `Airbase menu`, - "showIfHoveringOverAirbase": true, - "showIfUnitSelected": true, - "unitsMustBeControlled": true - } - ] - }, - { - "keys": ["ShiftLeft"], - "tips": [ - { - "key": `mouse1+drag`, - "action": "Box select" - } - ] - } - ]; - const currentCombo = combos.find((combo) => __classPrivateFieldGet(this, _ControlTipsPlugin_shortcutManager, "f").keyComboMatches(combo.keys)) || combos[0]; - const element = this.getElement(); - element.innerHTML = ""; - let numSelectedUnits = 0; - let unitSelectionContainsControlled = false; - if (__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getUnitsManager()) { - let selectedUnits = Object.values(__classPrivateFieldGet(this, _ControlTipsPlugin_app, "f").getUnitsManager().getSelectedUnits()); - numSelectedUnits = selectedUnits.length; - unitSelectionContainsControlled = selectedUnits.some((unit) => unit.getControlled()); - } - const tipsIncludesActiveMouseover = (currentCombo.tips.some((tip) => { - if (!tip.mouseoverSelector) { - return false; - } - if (__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f") instanceof HTMLElement === false) { - return false; - } - if (!__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f").matches(tip.mouseoverSelector)) { - return false; - } - return true; - })); - currentCombo.tips.filter((tip) => { - if (numSelectedUnits > 0) { - if (tip.showIfUnitSelected === false) { - return false; - } - if (tip.unitsMustBeControlled === true && unitSelectionContainsControlled === false) { - return false; - } - } - if (numSelectedUnits === 0 && tip.showIfUnitSelected === true) { - return false; - } - if (typeof tip.showIfHoveringOverAirbase === "boolean") { - if (tip.showIfHoveringOverAirbase !== __classPrivateFieldGet(this, _ControlTipsPlugin_cursorIsHoveringOverAirbase, "f")) { - return false; - } - } - if (typeof tip.showIfHoveringOverUnit === "boolean") { - if (tip.showIfHoveringOverUnit !== __classPrivateFieldGet(this, _ControlTipsPlugin_cursorIsHoveringOverUnit, "f")) { - return false; - } - } - if (tipsIncludesActiveMouseover && typeof tip.mouseoverSelector !== "string" && !__classPrivateFieldGet(this, _ControlTipsPlugin_mouseoverElement, "f").matches(tip.mouseoverSelector)) { - return false; - } - if (!tipsIncludesActiveMouseover && typeof tip.mouseoverSelector === "string") { - return false; - } - return true; - }).forEach((tip) => { - element.innerHTML += `
${tip.key}${tip.action}
`; - }); -}; - -},{}],2:[function(require,module,exports){ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const controltipsplugin_1 = require("./controltipsplugin"); -globalThis.getOlympusPlugin = () => { - return new controltipsplugin_1.ControlTipsPlugin(); -}; - -},{"./controltipsplugin":1}]},{},[2]); diff --git a/client/tsconfig.json b/client/tsconfig.json index 63da637e..fdfb377f 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -36,9 +36,7 @@ "leaflet", "geojson", "node", - "formatcoords", - "olympus", - "dom" + "formatcoords" ], /* Specify type package names to be included without being referenced in a source file. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */