Skip to content

Commit

Permalink
#5372 - toggling between flex and sequence modes causes loosing layou…
Browse files Browse the repository at this point in the history
…t info
  • Loading branch information
mnmsvlw committed Oct 27, 2024
1 parent d6ddc42 commit 0f3567f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/ketcher-core/src/application/editor/modes/FlexMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { BaseMode } from 'application/editor/modes/internal';
import { CoreEditor } from '../Editor';
import { Coordinates } from '../internal';
import { Command } from 'domain/entities/Command';
import { RenderersManager } from 'application/render/renderers/RenderersManager';
import { ZoomTool } from '../tools';
import { Vec2 } from 'domain/entities';
export class FlexMode extends BaseMode {
constructor(previousMode?: LayoutMode) {
super('flex-layout-mode', previousMode);
Expand All @@ -19,6 +22,14 @@ export class FlexMode extends BaseMode {

editor.renderersContainer.update(modelChanges);

const drawnEntitiesBoundingBox =
RenderersManager.getRenderedStructuresBbox();
const zoom = ZoomTool.instance;

zoom.scrollTo(
new Vec2(drawnEntitiesBoundingBox.left, drawnEntitiesBoundingBox.top),
);

return command;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class SequenceMode extends BaseMode {

const modelChanges = editor.drawingEntitiesManager.reArrangeChains(
editor.canvas.width.baseVal.value,
true,
false,
false,
);
const zoom = ZoomTool.instance;
Expand Down

0 comments on commit 0f3567f

Please sign in to comment.