Skip to content

Commit

Permalink
#4977 - System doesn't show side chain bonds if chain loaded directly…
Browse files Browse the repository at this point in the history
… to Snake-mode canvas

- added snake layout operation after opening file if snake mode turned on
  • Loading branch information
rrodionov91 committed Jul 6, 2024
1 parent 5e5c6ab commit ba98a17
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import {
EditorHistory,
SequenceMode,
macromoleculesFilesInputFormats,
ModeTypes,
SnakeMode,
} from 'ketcher-core';
import { IndigoProvider } from 'ketcher-react';
import { RequiredModalProps } from '../modalContainer';
Expand Down Expand Up @@ -137,14 +139,23 @@ const addToCanvas = ({
);
const editorHistory = new EditorHistory(editor);
const isSequenceMode = editor.mode instanceof SequenceMode;
const isSnakeMode = editor.mode instanceof SnakeMode;

editor.renderersContainer.update(modelChanges);
editorHistory.update(modelChanges);

if (isSequenceMode) {
modelChanges.setUndoOperationReverse();
editor.events.selectMode.dispatch({
mode: 'sequence-layout-mode',
mode: ModeTypes.sequence,
mergeWithLatestHistoryCommand: true,
});
}

if (isSnakeMode) {
modelChanges.setUndoOperationReverse();
editor.events.selectMode.dispatch({
mode: ModeTypes.snake,
mergeWithLatestHistoryCommand: true,
});
}
Expand Down

0 comments on commit ba98a17

Please sign in to comment.