diff --git a/src/commons/sideContent/content/SideContentCseMachine.tsx b/src/commons/sideContent/content/SideContentCseMachine.tsx index 9d2f2631ac..9c68222460 100644 --- a/src/commons/sideContent/content/SideContentCseMachine.tsx +++ b/src/commons/sideContent/content/SideContentCseMachine.tsx @@ -210,14 +210,19 @@ class SideContentCseMachineBase extends Component { this.handleResize(); } if (prevProps.needCseUpdate && !this.props.needCseUpdate) { - CseMachine.resetArrowOriginFilters(); + const preservedStep = Math.max(this.state.value, 0); this.setState({ arrowFilterOpen: false }); - this.stepFirst(); + if (this.isJava()) { JavaCseMachine.clearCse(); } else { CseMachine.clearCse(); } + + // Re-run the stepper at the preserved step so the display remains at the + // same step after editor update while still refreshing the CSE internals. + this.sliderShift(preservedStep); + this.sliderRelease(preservedStep); } } diff --git a/src/features/cseMachine/CseMachine.tsx b/src/features/cseMachine/CseMachine.tsx index 887d33c4f6..6d14dce791 100644 --- a/src/features/cseMachine/CseMachine.tsx +++ b/src/features/cseMachine/CseMachine.tsx @@ -465,7 +465,6 @@ export default class CseMachine { } static clearCse() { - CseMachine.resetArrowOriginFilters(); if (this.setVis) { this.setVis(undefined); CseMachine.environmentTree = undefined; diff --git a/src/features/cseMachine/CseMachineLayout.tsx b/src/features/cseMachine/CseMachineLayout.tsx index 449afd2342..a08a1242d6 100644 --- a/src/features/cseMachine/CseMachineLayout.tsx +++ b/src/features/cseMachine/CseMachineLayout.tsx @@ -922,6 +922,12 @@ export class Layout { const currentWidth = frame.width(); frame.reassignWidth(Math.max(currentWidth, fixedWidth)); } + + // get predetermined y coordinate + if (cache.framesY.has(id)) { + const fixedY = Layout.getGhostFrameY(id)!; + frame.reassignCoordinatesY(fixedY); + } }); }); } diff --git a/src/pages/playground/Playground.tsx b/src/pages/playground/Playground.tsx index 516a0ea53d..52241b050a 100644 --- a/src/pages/playground/Playground.tsx +++ b/src/pages/playground/Playground.tsx @@ -424,7 +424,12 @@ const Playground: React.FC = props => { const autorunButtonHandlers = useMemo(() => { return { handleEditorEval: () => { + const wasCenterAligned = CseMachine.getCenterAlignment(); CseMachine.clearCachedLayouts(); + if (wasCenterAligned) { + CseMachine.toggleCenterAlignment(); + } + // reset stepper before evaluation dispatch(WorkspaceActions.updateCurrentStep(-1, workspaceLocation)); dispatch(WorkspaceActions.updateStepsTotal(0, workspaceLocation)); @@ -438,7 +443,7 @@ const Playground: React.FC = props => { dispatch(WorkspaceActions.evalEditor(workspaceLocation)); CseMachine.setClearDeadFrames(false); - if (CseMachine.getCenterAlignment()) { + if (wasCenterAligned) { CseMachine.toggleCenterAlignment(); } },