@@ -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