From a0e2bf8803fdf06a648cb08ffeffb363fb0eac1d Mon Sep 17 00:00:00 2001 From: Lucas Dower Date: Sat, 9 Apr 2022 00:25:54 +0100 Subject: [PATCH] Fixed #44, no longer enable non-existent UI --- src/ui/layout.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/layout.ts b/src/ui/layout.ts index bf04f0c..2fe36a4 100644 --- a/src/ui/layout.ts +++ b/src/ui/layout.ts @@ -387,8 +387,11 @@ export class UI { } public enable(action: Action) { - LOG('enabling', action); + if (action >= Action.MAX) { + return; + } + LOG('enabling', action); // TODO: Remove once Simplify has been implemented if (action === Action.Simplify) { action = Action.Voxelise; @@ -409,6 +412,10 @@ export class UI { } public disable(action: Action) { + if (action < 0) { + return; + } + for (let i = action; i < Action.MAX; ++i) { const group = this._getActionGroup(i); LOG('disabling', group.label);