Skip to content

Commit

Permalink
#5969 - Load from file having only micro structures on macro canvas c…
Browse files Browse the repository at this point in the history
…auses unnecessary zoom up to 200% and shift molecule to top left angle (#6057)
  • Loading branch information
rrodionov91 authored Dec 4, 2024
1 parent b8a338e commit dd41632
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/ketcher-core/src/application/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ export class CoreEditor {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window._ketcher_isAutozoomDisabled ||
!this.isCurrentModeWithAutozoom()
!this.isCurrentModeWithAutozoom() ||
!this.drawingEntitiesManager.hasMonomers
) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ export class DrawingEntitiesManager {
return this.allEntities.length !== 0;
}

public get hasMonomers() {
const monomers = [...this.monomers.values()].filter(
(monomer) =>
!monomer.monomerItem.props.isMicromoleculeFragment ||
isMonomerSgroupWithAttachmentPoints(monomer),
);

return monomers.length !== 0;
}

public get allBondsToMonomers() {
return [
...(this.polymerBonds as Map<number, PolymerBond>),
Expand Down

0 comments on commit dd41632

Please sign in to comment.