Skip to content

Commit 7b2f870

Browse files
#696 Info Tool Hotkeys (#697)
1 parent 0bdfc05 commit 7b2f870

File tree

3 files changed

+97
-30
lines changed

3 files changed

+97
-30
lines changed

src/essence/Ancillary/Description.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,12 @@ const Description = {
180180
})
181181

182182
document.addEventListener('keydown', function (event) {
183-
if (event.key === 'ArrowLeft') {
184-
Description.navPrevious()
185-
} else if (event.key === 'ArrowRight') {
186-
Description.navNext()
183+
if (!event.ctrlKey && !event.shiftKey) {
184+
if (event.key === 'ArrowLeft') {
185+
Description.navPrevious()
186+
} else if (event.key === 'ArrowRight') {
187+
Description.navNext()
188+
}
187189
}
188190
})
189191

@@ -1227,13 +1229,13 @@ const Description = {
12271229
})
12281230
if (Description.tippyPrevious == null)
12291231
Description.tippyPrevious = tippy('#mainDescNavBarPrevious', {
1230-
content: 'Previous Feature',
1232+
content: 'Previous Feature (Arrow-Left)',
12311233
placement: 'bottom',
12321234
theme: 'blue',
12331235
})
12341236
if (Description.tippyNext == null)
12351237
Description.tippyNext = tippy('#mainDescNavBarNext', {
1236-
content: 'Next Feature',
1238+
content: 'Next Feature (Arrow-Right)',
12371239
placement: 'bottom',
12381240
theme: 'blue',
12391241
})

src/essence/Basics/UserInterface_/BottomBar.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,36 @@ let BottomBar = {
405405
`</li>`,
406406
`</ul>`,
407407
`</div>`,
408+
`<div class='mainHotkeysModalSection'>`,
409+
`<div class='mainHotkeysModalSectionTitle'>Info</div>`,
410+
`<ul class='mainHotkeysModalSectionOptions'>`,
411+
`<li class='mainHotkeysModalSectionSubtitle'>Navigate</li>`,
412+
`<li>`,
413+
`<div>Next (Ordered) Feature (Top-Bar)</div>`,
414+
`<div>Arrow-Right</div>`,
415+
`</li>`,
416+
`<li>`,
417+
`<div>Previous (Ordered) Feature (Top-Bar)</div>`,
418+
`<div>Arrow-Left</div>`,
419+
`</li>`,
420+
`<li>`,
421+
`<div>Next (Overlapping) Feature</div>`,
422+
`<div>SHIFT + Arrow-Right</div>`,
423+
`</li>`,
424+
`<li>`,
425+
`<div>Previous (Overlapping) Feature</div>`,
426+
`<div>SHIFT + Arrow-Left</div>`,
427+
`</li>`,
428+
`<li>`,
429+
`<div>Next (Associated) Feature</div>`,
430+
`<div>CTRL/CMD + Arrow-Right</div>`,
431+
`</li>`,
432+
`<li>`,
433+
`<div>Previous (Associated) Feature</div>`,
434+
`<div>CTRL/CMD + Arrow-Left</div>`,
435+
`</li>`,
436+
`</ul>`,
437+
`</div>`,
408438
`<div class='mainHotkeysModalSection'>`,
409439
`<div class='mainHotkeysModalSectionTitle'>Map</div>`,
410440
`<ul class='mainHotkeysModalSectionOptions'>`,

src/essence/Tools/Info/InfoTool.js

Lines changed: 59 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,17 @@ var InfoTool = {
169169
tools.html(markup)
170170

171171
tippy('#infoToolSelected', {
172-
content: 'Select An Overlapping Feature',
172+
content: 'Select An Overlapping Feature (Shift + ⇆)',
173173
placement: 'right',
174174
theme: 'blue',
175175
})
176176
tippy('#infoToolSelectedGeoDataset', {
177-
content: 'Select An Associated Dataset',
177+
content: 'Select An Associated Dataset (Ctrl/Cmd + ⇆)',
178178
placement: 'right',
179179
theme: 'blue',
180180
})
181181
tippy('#infoToolSelectedDataset', {
182-
content: 'Select An Associated Dataset',
182+
content: 'Select An Associated Dataset (Ctrl/Cmd + ⇆)',
183183
placement: 'right',
184184
theme: 'blue',
185185
})
@@ -263,26 +263,7 @@ var InfoTool = {
263263
)
264264
)
265265
Dropy.init($('#infoToolSelectedDropdown'), function (idx) {
266-
let e = JSON.parse(JSON.stringify(InfoTool.initialEvent))
267-
MetadataCapturer.populateMetadata(
268-
InfoTool.featureLayers[idx] || InfoTool.currentLayer,
269-
() => {
270-
Kinds.use(
271-
L_.layers.data[InfoTool.currentLayerName]?.kind || null,
272-
Map_,
273-
InfoTool.info[idx],
274-
InfoTool.featureLayers[idx] || InfoTool.currentLayer,
275-
InfoTool.currentLayerName,
276-
null,
277-
e,
278-
{ idx: idx },
279-
InfoTool.info,
280-
InfoTool.featureLayers[idx]
281-
? InfoTool.featureLayers
282-
: null
283-
)
284-
}
285-
)
266+
InfoTool.selectedDropdownChange(idx)
286267
})
287268

288269
InfoTool.createInfo()
@@ -686,6 +667,56 @@ var InfoTool = {
686667
$('#infoToolFilter').css('display', 'none')
687668
$('#infoToolNoneSelected').css('display', 'block')
688669
},
670+
selectedDropdownChange: function (idx) {
671+
let e = JSON.parse(JSON.stringify(InfoTool.initialEvent))
672+
MetadataCapturer.populateMetadata(
673+
InfoTool.featureLayers[idx] || InfoTool.currentLayer,
674+
() => {
675+
Kinds.use(
676+
L_.layers.data[InfoTool.currentLayerName]?.kind || null,
677+
Map_,
678+
InfoTool.info[idx],
679+
InfoTool.featureLayers[idx] || InfoTool.currentLayer,
680+
InfoTool.currentLayerName,
681+
null,
682+
e,
683+
{ idx: idx },
684+
InfoTool.info,
685+
InfoTool.featureLayers[idx] ? InfoTool.featureLayers : null
686+
)
687+
}
688+
)
689+
},
690+
hotKeyEvents: function (event) {
691+
if (event.shiftKey && !event.ctrlKey && !event.metaKey) {
692+
// Shift
693+
// Nav Overlap
694+
if (event.key === 'ArrowLeft') {
695+
if (InfoTool.activeFeatureI > 0)
696+
InfoTool.selectedDropdownChange(InfoTool.activeFeatureI - 1)
697+
} else if (event.key === 'ArrowRight') {
698+
if (InfoTool.activeFeatureI < InfoTool.info.length - 1)
699+
InfoTool.selectedDropdownChange(InfoTool.activeFeatureI + 1)
700+
}
701+
} else if ((event.ctrlKey || event.metaKey) && !event.shiftKey) {
702+
// Ctrl/Cmd
703+
if (InfoTool.hasDataset) {
704+
// Nav Dataset
705+
if (event.key === 'ArrowLeft') {
706+
$('#infoToolSelectedDatasetLeft').trigger('click')
707+
} else if (event.key === 'ArrowRight') {
708+
$('#infoToolSelectedDatasetRight').trigger('click')
709+
}
710+
} else if (InfoTool.hasGeoDatasetMetadata) {
711+
// Nav Geodataset
712+
if (event.key === 'ArrowLeft') {
713+
$('#infoToolSelectedGeoDatasetLeft').trigger('click')
714+
} else if (event.key === 'ArrowRight') {
715+
$('#infoToolSelectedGeoDatasetRight').trigger('click')
716+
}
717+
}
718+
}
719+
},
689720
}
690721

691722
//
@@ -709,9 +740,13 @@ function interfaceWithMMGIS() {
709740
InfoTool.featureLayers
710741
)
711742

743+
document.addEventListener('keydown', InfoTool.hotKeyEvents)
744+
712745
//Share everything. Don't take things that aren't yours.
713746
// Put things back where you found them.
714-
function separateFromMMGIS() {}
747+
function separateFromMMGIS() {
748+
document.removeEventListener('keydown', InfoTool.hotKeyEvents)
749+
}
715750
}
716751

717752
//Other functions

0 commit comments

Comments
 (0)