diff --git a/src/js/stendhal/action/DebugAction.ts b/src/js/stendhal/action/DebugAction.ts index d1666521df..3d93fc500b 100644 --- a/src/js/stendhal/action/DebugAction.ts +++ b/src/js/stendhal/action/DebugAction.ts @@ -13,14 +13,15 @@ import { singletons } from "../SingletonRepo"; import { ui } from "../ui/UI"; import { UIComponentEnum } from "../ui/UIComponentEnum"; -import { SettingsDialog } from "../ui/dialog/SettingsDialog"; import { FloatingWindow } from "../ui/toolkit/FloatingWindow"; import { SlashAction } from "./SlashAction"; -import { Chat } from "../util/Chat"; import { ShowFloatingWindowComponent } from "../ui/component/ShowFloatingWindowComponent"; import { Panel } from "ui/toolkit/Panel"; +import { Chat } from "../util/Chat"; +import { Debug } from "../util/Debug"; + declare var marauroa: any; declare var stendhal: any; @@ -46,11 +47,10 @@ export class DebugAction extends SlashAction { } else if (params[0] === "log") { Chat.debugLogEnabled = true; } else if (params[0] === "settings") { - SettingsDialog.debugging = !SettingsDialog.debugging; - Chat.log("client", "experimental settings " + (SettingsDialog.debugging ? "enabled" : "disabled")); + Chat.log("client", "Experimental settings " + (Debug.toggle("settings") ? "enabled" + : "disabled")); } else if (params[0] === "touch") { - stendhal.ui.touch.setDebuggingEnabled(!stendhal.ui.touch.isDebuggingEnabled()); - Chat.log("client", "touch debugging " + (stendhal.ui.touch.isDebuggingEnabled() ? "enabled" : "disabled")); + Chat.log("client", "Touch debugging " + (Debug.toggle("touch") ? "enabled" : "disabled")); } return true; } diff --git a/src/js/stendhal/ui/TouchHandler.ts b/src/js/stendhal/ui/TouchHandler.ts index b64a7177fa..6bc38bc897 100644 --- a/src/js/stendhal/ui/TouchHandler.ts +++ b/src/js/stendhal/ui/TouchHandler.ts @@ -36,9 +36,6 @@ export class TouchHandler { /** Number of pixels touch can move before being vetoed as a long touch or double tap. */ private readonly moveThreshold = 16; - /** Property for debugging. */ - private debugging = false; - /** Singleton instance. */ private static instance: TouchHandler; @@ -148,18 +145,4 @@ export class TouchHandler { holding(): boolean { return this.held; } - - /** - * Sets debugging property for touch events. - */ - setDebuggingEnabled(enable: boolean) { - this.debugging = enable; - } - - /** - * Checks if debugging is enabled for touch events. - */ - isDebuggingEnabled(): boolean { - return this.debugging; - } } diff --git a/src/js/stendhal/ui/dialog/SettingsDialog.ts b/src/js/stendhal/ui/dialog/SettingsDialog.ts index daafe7148b..1861c330b5 100644 --- a/src/js/stendhal/ui/dialog/SettingsDialog.ts +++ b/src/js/stendhal/ui/dialog/SettingsDialog.ts @@ -20,10 +20,10 @@ import { TabDialogContentComponent } from "../toolkit/TabDialogContentComponent" import { Layout } from "../../data/enum/Layout"; +import { Debug } from "../../util/Debug"; -export class SettingsDialog extends TabDialogContentComponent { - public static debugging = false; +export class SettingsDialog extends TabDialogContentComponent { public readonly storedStates: {[index: string]: string}; private readonly initialStates: {[index: string]: string}; @@ -108,7 +108,7 @@ export class SettingsDialog extends TabDialogContentComponent { label.innerHTML = ""; label.appendChild(checkbox); label.appendChild(text); - if (!SettingsDialog.debugging) { + if (!Debug.isActive("settings")) { // hide if settings debugging is not enabled checkbox.disabled = true; checkbox.style.setProperty("display", "none");