@@ -38,6 +38,7 @@ export const InteractiveGraphics = ({
3838} ) => {
3939 const [ activeLayers , setActiveLayers ] = useState < string [ ] | null > ( null )
4040 const [ activeStep , setActiveStep ] = useState < number | null > ( null )
41+ const [ showLastStep , setShowLastStep ] = useState ( true )
4142 const [ size , setSize ] = useState ( { width : 600 , height : 600 } )
4243 const availableLayers : string [ ] = Array . from (
4344 new Set ( [
@@ -93,7 +94,7 @@ export const InteractiveGraphics = ({
9394
9495 const interactiveState : InteractiveState = {
9596 activeLayers : activeLayers ,
96- activeStep : activeStep ,
97+ activeStep : showLastStep ? maxStep : activeStep ,
9798 realToScreen : realToScreen ,
9899 onObjectClicked : onObjectClicked ,
99100 }
@@ -112,10 +113,12 @@ export const InteractiveGraphics = ({
112113 const filterLayerAndStep = ( obj : { layer ?: string ; step ?: number } ) => {
113114 if ( activeLayers && obj . layer && ! activeLayers . includes ( obj . layer ) )
114115 return false
116+
117+ const selectedStep = showLastStep ? maxStep : activeStep
115118 if (
116- activeStep !== null &&
119+ selectedStep !== null &&
117120 obj . step !== undefined &&
118- obj . step !== activeStep
121+ obj . step !== selectedStep
119122 )
120123 return false
121124 return true
@@ -211,6 +214,7 @@ export const InteractiveGraphics = ({
211214 value = { activeStep ?? 0 }
212215 onChange = { ( e ) => {
213216 const value = parseInt ( e . target . value )
217+ setShowLastStep ( false )
214218 setActiveStep ( Number . isNaN ( value ) ? null : value )
215219 } }
216220 disabled = { activeStep === null }
@@ -221,11 +225,24 @@ export const InteractiveGraphics = ({
221225 style = { { marginRight : 4 } }
222226 checked = { activeStep !== null }
223227 onChange = { ( e ) => {
228+ setShowLastStep ( false )
224229 setActiveStep ( e . target . checked ? 0 : null )
225230 } }
226231 />
227232 Filter by step
228233 </ label >
234+ < label >
235+ < input
236+ type = "checkbox"
237+ style = { { marginRight : 4 } }
238+ checked = { showLastStep }
239+ onChange = { ( e ) => {
240+ setShowLastStep ( e . target . checked )
241+ setActiveStep ( null )
242+ } }
243+ />
244+ Show last step
245+ </ label >
229246 { isLimitReached && (
230247 < span style = { { color : "red" , fontSize : "12px" } } >
231248 Display limited to { objectLimit } objects. Received:{ " " }
0 commit comments