From ed53079abaa984b2f596a8c47b9ac450ba3754d1 Mon Sep 17 00:00:00 2001 From: mathis Date: Mon, 9 Oct 2023 16:03:27 +0200 Subject: [PATCH] minor bugs & am missing warn --- client/src/server/history.ts | 6 +++++- client/src/ui/lib/editLayer.svelte | 23 +++++++++++++++++------ client/styles/style.scss | 8 +++++++- rules++/rpp | Bin 8771184 -> 8808864 bytes server/src/server.rs | 8 +++++--- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/client/src/server/history.ts b/client/src/server/history.ts index d876d16..c194694 100644 --- a/client/src/server/history.ts +++ b/client/src/server/history.ts @@ -344,9 +344,13 @@ export class History { send(pkt: SendPacket) { if (isRequest(pkt)) { + const rev = reverse(get(map), pkt) + if (rev === null) + return + const pending: Operation = { forward: [pkt.type, pkt.content], - reverse: reverse(get(map), pkt) + reverse: rev, } this.pending.push(pending) diff --git a/client/src/ui/lib/editLayer.svelte b/client/src/ui/lib/editLayer.svelte index 900a707..5b0d0be 100644 --- a/client/src/ui/lib/editLayer.svelte +++ b/client/src/ui/lib/editLayer.svelte @@ -14,7 +14,8 @@ import ImagePicker from './imagePicker.svelte' import AutomapperPicker from './automapper.svelte' // import { automap, parse, type Config as AutomapperConfig } from '../../twmap/automap' - import { ComposedModal, ModalBody, ModalHeader } from 'carbon-components-svelte' + import { ComposedModal, ModalBody, ModalHeader, TooltipIcon } from 'carbon-components-svelte' + import { WarningAlt } from 'carbon-icons-svelte' import { rmap } from '../global' import { bytesToBase64, resIndexToString, stringToResIndex } from '../../server/convert' import { pick, read, sync, _ } from '../../server/util' @@ -73,8 +74,12 @@ } } - function amCfgName(img: string, cfg: number): string { - return $automappers[img + '.rules']?.configs?.at(cfg) ?? 'None' + function amCfgName(img: string, cfg: number | null): string { + if (cfg === null) { + return 'None' + } else { + return $automappers[img + '.rules']?.configs?.at(cfg) ?? `#${cfg} (missing)` + } } let imagePickerOpen = false @@ -238,7 +243,7 @@ apply: () => $rmap.map.images, }]) $: if (layer && layer instanceof TilesLayer) { - syncAmCfg = read($server, layer.automapper.config, { + syncAmCfg = read($server, layer.automapper.config === -1 ? null : layer.automapper.config, { query: 'edit/layer', match: [g, l, { automapper_config: { config: pick } }], }) @@ -336,7 +341,13 @@ @@ -347,7 +358,7 @@ /> - + {/if} {#if layer instanceof TilesLayer || layer instanceof QuadsLayer}