File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
webtool/frontend/src/components Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,23 @@ type ConfigAndSimulateProps = {
2424 startImmediately ?: boolean ,
2525} & ComponentProps < "div" >
2626
27+ /**
28+ * AnyLogic capture mouse wheel and trackpad scroll.
29+ * In our case we want to scroll the page like normal.
30+ */
31+ function reEnableScroll ( ) {
32+ const anyLogicElement = document . querySelector ( `#${ anylogicElementId } #svg-container` )
33+ if ( ! anyLogicElement ) {
34+ console . error ( "Could not find AnyLogic element to re-enable scroll." )
35+ return
36+ }
37+
38+ // @ts -expect-error I don't know why this doesn't type check
39+ anyLogicElement . addEventListener ( "wheel" , ( e : WheelEvent ) => {
40+ window . scrollBy ( e . deltaX , e . deltaY )
41+ } )
42+ }
43+
2744export const ConfigureAndSimulate : FunctionComponent < ConfigAndSimulateProps > = ( {
2845 initialPilot,
2946 startImmediately = Boolean ( initialPilot ) ,
@@ -58,6 +75,7 @@ export const ConfigureAndSimulate: FunctionComponent<ConfigAndSimulateProps> = (
5875 const sessionId = await savePilot ( pilot )
5976 setShowSimulation ( true )
6077 const newSimulation = await startSimulation ( anylogicElementId , sessionId )
78+ reEnableScroll ( )
6179 setSimulation ( newSimulation )
6280 await newSimulation . waitForCompletion ( )
6381 forceUpdate ( )
You can’t perform that action at this time.
0 commit comments