aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/MenuItem.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/MenuItem.mjs')
-rw-r--r--src/MenuItem.mjs46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index d580cb3..0fea539 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -81,9 +81,9 @@ export const pickMapItem = ({ utils }) =>
81 onclick: () => { 81 onclick: () => {
82 map.classList.add('focus') 82 map.classList.add('focus')
83 map.scrollIntoView({ behavior: 'smooth' }) 83 map.scrollIntoView({ behavior: 'smooth' })
84 } 84 },
85 }) 85 }),
86 ) 86 ),
87 }) 87 })
88 88
89/** 89/**
@@ -118,10 +118,10 @@ export const pickBlockItem = ({ blocks, utils }) =>
118 // UX: remove menu after user select/deselect blocks 118 // UX: remove menu after user select/deselect blocks
119 const submenu = e.target.closest('.sub-menu') 119 const submenu = e.target.closest('.sub-menu')
120 submenu.onmouseleave = () => { submenu.closest('.menu').style.display = 'none' } 120 submenu.onmouseleave = () => { submenu.closest('.menu').style.display = 'none' }
121 } 121 },
122 }) 122 })
123 } 123 },
124 ) 124 ),
125 }) 125 })
126 126
127/** 127/**
@@ -138,14 +138,14 @@ export const pickLayoutItem = ({ container, layouts }) =>
138 layout => 138 layout =>
139 new Item({ 139 new Item({
140 text: layout.name, 140 text: layout.name,
141 onclick: () => container.setAttribute('data-layout', layout.name) 141 onclick: () => container.setAttribute('data-layout', layout.name),
142 }) 142 }),
143 ), 143 ),
144 new Item({ 144 new Item({
145 innerHTML: '<a href="https://github.com/outdoorsafetylab/dumbymap#layouts" class="external" style="display: block; padding: 0.5rem;">More...</a>', 145 innerHTML: '<a href="https://github.com/outdoorsafetylab/dumbymap#layouts" class="external" style="display: block; padding: 0.5rem;">More...</a>',
146 style: 'padding: 0;' 146 style: 'padding: 0;',
147 }) 147 }),
148 ] 148 ],
149 }) 149 })
150 150
151/** 151/**
@@ -174,7 +174,7 @@ export const addGeoLink = ({ utils }, range) =>
174 range.deleteContents() 174 range.deleteContents()
175 range.insertNode(anchor) 175 range.insertNode(anchor)
176 } 176 }
177 } 177 },
178 }) 178 })
179 179
180/** 180/**
@@ -195,7 +195,7 @@ export class Suggestion extends Item {
195 195
196 this.onmouseover = () => { 196 this.onmouseover = () => {
197 Array.from(this.parentElement?.children)?.forEach(s => 197 Array.from(this.parentElement?.children)?.forEach(s =>
198 s.classList.remove('focus') 198 s.classList.remove('focus'),
199 ) 199 )
200 this.classList.add('focus') 200 this.classList.add('focus')
201 } 201 }
@@ -244,12 +244,12 @@ export const renderResults = ({ modal, modalContent }, map) =>
244 success: 'green', 244 success: 'green',
245 fail: 'red', 245 fail: 'red',
246 skip: 'black', 246 skip: 'black',
247 stop: 'chocolate' 247 stop: 'chocolate',
248 }[result.state] ?? 'black' 248 }[result.state] ?? 'black'
249 printObject( 249 printObject(
250 result, 250 result,
251 modalContent, 251 modalContent,
252 `${result.func.name} <span style='float: right;'><span style='display: inline-block; width: 100px; color: ${color};'>${result.state}</span></span>` 252 `${result.func.name} <span style='float: right;'><span style='display: inline-block; width: 100px; color: ${color};'>${result.state}</span></span>`,
253 ) 253 )
254 } 254 }
255 255
@@ -258,7 +258,7 @@ export const renderResults = ({ modal, modalContent }, map) =>
258 prepareHeading.textContent = 'Prepare Steps' 258 prepareHeading.textContent = 'Prepare Steps'
259 modalContent.appendChild(prepareHeading) 259 modalContent.appendChild(prepareHeading)
260 const prepareSteps = map.renderer.results.filter( 260 const prepareSteps = map.renderer.results.filter(
261 r => r.type === 'prepare' 261 r => r.type === 'prepare',
262 ) 262 )
263 prepareSteps.forEach(printDetails) 263 prepareSteps.forEach(printDetails)
264 264
@@ -268,7 +268,7 @@ export const renderResults = ({ modal, modalContent }, map) =>
268 modalContent.appendChild(renderHeading) 268 modalContent.appendChild(renderHeading)
269 const renderSteps = map.renderer.results.filter(r => r.type === 'render') 269 const renderSteps = map.renderer.results.filter(r => r.type === 'render')
270 renderSteps.forEach(printDetails) 270 renderSteps.forEach(printDetails)
271 } 271 },
272 }) 272 })
273 273
274/** 274/**
@@ -326,7 +326,7 @@ function printObject (obj, parentElement, name = null) {
326export const toggleBlockFocus = block => 326export const toggleBlockFocus = block =>
327 new Item({ 327 new Item({
328 text: 'Toggle Focus', 328 text: 'Toggle Focus',
329 onclick: () => block.classList.toggle('focus') 329 onclick: () => block.classList.toggle('focus'),
330 }) 330 })
331 331
332/** 332/**
@@ -337,7 +337,7 @@ export const toggleBlockFocus = block =>
337export const toggleMapFocus = map => 337export const toggleMapFocus = map =>
338 new Item({ 338 new Item({
339 text: 'Toggle Focus', 339 text: 'Toggle Focus',
340 onclick: () => map.classList.toggle('focus') 340 onclick: () => map.classList.toggle('focus'),
341 }) 341 })
342 342
343/** 343/**
@@ -354,7 +354,7 @@ export const getCoordinatesByPixels = (map, xy) =>
354 const xyString = `[${x.toFixed(7)}, ${y.toFixed(7)}]` 354 const xyString = `[${x.toFixed(7)}, ${y.toFixed(7)}]`
355 navigator.clipboard.writeText(xyString) 355 navigator.clipboard.writeText(xyString)
356 window.alert(`${xyString} copied to clipboard`) 356 window.alert(`${xyString} copied to clipboard`)
357 } 357 },
358 }) 358 })
359 359
360/** 360/**
@@ -365,7 +365,7 @@ export const getCoordinatesByPixels = (map, xy) =>
365export const restoreCamera = map => 365export const restoreCamera = map =>
366 new Item({ 366 new Item({
367 text: 'Restore Camera', 367 text: 'Restore Camera',
368 onclick: () => map.renderer.restoreCamera() 368 onclick: () => map.renderer.restoreCamera(),
369 }) 369 })
370 370
371/** 371/**
@@ -387,6 +387,6 @@ export const addRefLink = (cm, refLinks) =>
387 } else { 387 } else {
388 cm.replaceSelection(`[${selection}][${refLink.ref}]`) 388 cm.replaceSelection(`[${selection}][${refLink.ref}]`)
389 } 389 }
390 } 390 },
391 })) 391 })),
392 }) 392 })