Skip to content

Commit cd0553c

Browse files
committed
feat: show toggle of showsExitButton
1 parent 5c13b8f commit cd0553c

4 files changed

Lines changed: 32 additions & 8 deletions

File tree

editor/editor.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,21 @@ function KeyHandler({ on }: Context) {
773773
}
774774

775775
/** Cell information panel on the right */
776-
function InfoPanel({ subscribe, query }: Context<HTMLElement>) {
776+
function InfoPanel({ subscribe, query, on }: Context<HTMLElement>) {
777+
// Map-wide config toggles.
778+
const exitToggle = query<HTMLInputElement>(".js-shows-exit-button input")
779+
if (exitToggle) {
780+
exitToggle.checked = fieldBlock.config.showsExitButton
781+
on("change", ".js-shows-exit-button input", () => {
782+
editBlock((b) => {
783+
b.config.showsExitButton = exitToggle.checked
784+
})
785+
})
786+
subscribe(signals.fieldBlock, (b) => {
787+
exitToggle.checked = b.config.showsExitButton
788+
})
789+
}
790+
777791
subscribe(signals.gridIndex, ({ i, j }) => {
778792
const infoContent = query(".info-content")
779793
if (!infoContent) return

editor/extension.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ function resolveCustomTextEditor(
164164
</div>
165165
<div class="js-info-panel fixed right-0 top-0 h-full w-48 bg-neutral-900/90 text-neutral-100 pointer-events-none">
166166
<div class="info-content text-xs font-mono">
167+
<div class="py-1 px-2 bg-white/50 text-black">Map</div>
168+
<div class="px-2 py-1">
169+
<label class="js-shows-exit-button pointer-events-auto inline-flex items-center gap-1 cursor-pointer">
170+
<input type="checkbox" />
171+
showsExitButton
172+
</label>
173+
</div>
167174
<div class="py-1 px-2 bg-white/50 text-black">Grid</div>
168175
<div class="px-2 py-1">
169176
(i, j): <span class="grid-index text-blue-500"></span>

static/map/block_-10000.-10000.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"i": -10000,
33
"j": -10000,
4-
"config": {
5-
"showsExitButton": false
6-
},
74
"catalogs": [
85
"../catalog/base.json",
96
"../catalog/title.json"
107
],
8+
"config": {
9+
"showsExitButton": false
10+
},
1111
"actors": [],
1212
"items": [],
1313
"props": [
@@ -282,4 +282,4 @@
282282
"00000000000000000033000000000000000000000001000000000000000000000000000000000000000000000010000000330000000001100000000010010000000100100110000010001101001010100000033333000000000110001100000011000001",
283283
"00000000000000000033000000000000000000000001000000000000000000000000000000000000000000000010000000330000000000100001010010011010101001000100000111010001011011110000033333000000001100000000101100111100"
284284
]
285-
}
285+
}

static/map/block_-200.-200.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"catalogs": [
55
"../catalog/base.json"
66
],
7+
"config": {
8+
"showsExitButton": true
9+
},
710
"actors": [
811
{
912
"i": -107,
@@ -4126,8 +4129,8 @@
41264129
"00010010000000110100000001133300000000101010001010000001100000101010101010110100100101000000001101111000100000001101100001101110011100111000011101001100000100001001100001001010010100110001133010001010",
41274130
"00000110100001000000000001333310010001110010000100000001110110111110110010011011011000100110010100110011111000010001000010000010000111010000000000000100000101011010110100010010101001001010033000100011",
41284131
"11000100001010110000000000333301001100000000100010000101000000101000000010000101010000100110100001111000001011011001010000110001001001010111001000001111000001000000001000110010011111010111033000010000",
4129-
"00010000000010110100000000333300000110101000001000000000100000011110000101000010000111101000001100010000100101110000000001100001101000100011100000000011000000100001010001110011101001000100033000001010",
4130-
"11110100000100001000000000333300000010101000100030000011100001101110011010000000000000000100110010100000001000011011101001010110001101000010000000110011010000000000100001000100000110010110133101100010",
4132+
"00010000000010110100000000333300000110100000001000000000100000011110000101000010000111101000001100010000100101110000000001100001101000100011100000000011000000100001010001110011101001000100033000001010",
4133+
"11110100000100001000000000333300000010100000100030000011100001101110011010000000000000000100110010100000001000011011101001010110001101000010000000110011010000000000100001000100000110010110133101100010",
41314134
"01111010001000000000000000333333333333333333333331000000001100000000000111001110000001001111001000011110000000110100110100000000010000101000010000001001100110100010100001100110010000100101033001100110",
41324135
"00000000001000110000000000333333333333333333333330000000011011110001000001001010001000001001011001000101101000100101100000010001010000000101001001100100100010001001000001000000000010000001133100010010",
41334136
"00000111000101000010000001333300000000000103333331000011000011000000110000010111100100010000001000001010100010000001011001110001000000010100101010101100101011000000000000010000111001001010133000010100",
@@ -4267,4 +4270,4 @@
42674270
"00000000000000000002211113312222000000000000000000000000000000000000010000001001000000001010100101000000000000000001333331000000000000100110000010001101001010100000111001001000000110001100000111010000",
42684271
"00000000000000000000022213310000000000000000000000000000000000000000000001010010001000000000110101000000000000000001333331000000001001000100000111010001011011110111000010001100001100000000100222010001"
42694272
]
4270-
}
4273+
}

0 commit comments

Comments
 (0)