@@ -40,6 +40,7 @@ const LAYER_CLASS = 'jp-gis-layer';
4040const LAYER_TITLE_CLASS = 'jp-gis-layerTitle' ;
4141const LAYER_ICON_CLASS = 'jp-gis-layerIcon' ;
4242const LAYER_TEXT_CLASS = 'jp-gis-layerText data-jgis-keybinding' ;
43+ const LAYER_SLIDE_NUMBER_CLASS = 'jp-gis-layerSlideNumber' ;
4344
4445interface IBodyProps {
4546 model : IJupyterGISModel ;
@@ -416,6 +417,7 @@ const LayerGroupComponent: React.FC<ILayerGroupProps> = props => {
416417 * Properties of the layer component.
417418 */
418419interface ILayerProps {
420+ // ! todo this should never be undefined, like it's not possible in the parent, it will never be undef here
419421 gisModel : IJupyterGISModel | undefined ;
420422 layerId : string ;
421423 onClick : ( { type, item } : ILeftPanelClickHandlerParams ) => void ;
@@ -556,6 +558,22 @@ const LayerComponent: React.FC<ILayerProps> = props => {
556558 gisModel ?. centerOnPosition ( layerId ) ;
557559 } ;
558560
561+ const getSlideNumber = ( ) => {
562+ if ( ! gisModel ) {
563+ return ;
564+ }
565+
566+ const { story } = gisModel . getSelectedStory ( ) ;
567+
568+ if ( ! story ?. landmarks ) {
569+ return ;
570+ }
571+
572+ const slideNum = story . landmarks . indexOf ( layerId ) + 1 ;
573+
574+ return slideNum ;
575+ } ;
576+
559577 return (
560578 < div
561579 className = { `${ LAYER_ITEM_CLASS } ${ LAYER_CLASS } ${ selected ? ' jp-mod-selected' : '' } ` }
@@ -589,18 +607,24 @@ const LayerComponent: React.FC<ILayerProps> = props => {
589607 </ Button >
590608 ) }
591609
592- { /* Visibility toggle */ }
593- < Button
594- title = { layer . visible ? 'Hide layer' : 'Show layer' }
595- onClick = { toggleVisibility }
596- minimal
597- >
598- < LabIcon . resolveReact
599- icon = { layer . visible ? visibilityIcon : nonVisibilityIcon }
600- className = { `${ LAYER_ICON_CLASS } ${ layer . visible ? '' : ' jp-gis-mod-hidden' } ` }
601- tag = "span"
602- />
603- </ Button >
610+ { /* Visibility toggle for normal layers, Slide number for landmarks */ }
611+ { layer . type === 'LandmarkLayer' ? (
612+ < span className = { LAYER_SLIDE_NUMBER_CLASS } title = "Slide number" >
613+ { getSlideNumber ( ) }
614+ </ span >
615+ ) : (
616+ < Button
617+ title = { layer . visible ? 'Hide layer' : 'Show layer' }
618+ onClick = { toggleVisibility }
619+ minimal
620+ >
621+ < LabIcon . resolveReact
622+ icon = { layer . visible ? visibilityIcon : nonVisibilityIcon }
623+ className = { `${ LAYER_ICON_CLASS } ${ layer . visible ? '' : ' jp-gis-mod-hidden' } ` }
624+ tag = "span"
625+ />
626+ </ Button >
627+ ) }
604628
605629 { icons . has ( layer . type ) && (
606630 < LabIcon . resolveReact
0 commit comments