Skip to content

Commit

Permalink
Backmerge: #4154 - Cannot select bonds when we add molecule with addF…
Browse files Browse the repository at this point in the history
…ragment, setMolecule or Paste from clipboard
  • Loading branch information
ilya-asiyuk-epam committed Mar 7, 2024
1 parent 671fbb7 commit 8161036
Show file tree
Hide file tree
Showing 74 changed files with 11 additions and 14 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 0 additions & 11 deletions ketcher-autotests/tests/utils/files/readFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ export async function openFileAndAddToCanvas(
export async function openFileAndAddToCanvasAsNewProject(
filename: string,
page: Page,
xOffsetFromCenter?: number,
yOffsetFromCenter?: number,
) {
await selectTopPanelButton(TopPanelButton.Open, page);
await openFile(filename, page);
Expand All @@ -95,15 +93,6 @@ export async function openFileAndAddToCanvasAsNewProject(
await waitForLoad(page, async () => {
await pressButton(page, 'Open as New Project');
});

if (
typeof xOffsetFromCenter === 'number' &&
typeof yOffsetFromCenter === 'number'
) {
await clickOnTheCanvas(page, xOffsetFromCenter, yOffsetFromCenter);
} else {
await clickInTheMiddleOfTheScreen(page);
}
}

export async function filteredFile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class CanvasLoad extends BaseOperation {
const oldStruct = restruct.molecule;
restruct.clearVisels(); // TODO: What is it?
if (this.data.struct) {
restruct.render.setMolecule(this.data.struct);
restruct.render.setMolecule(this.data.struct, true);
}

this.data.struct = oldStruct;
Expand Down
12 changes: 10 additions & 2 deletions packages/ketcher-core/src/application/render/raphaelRender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,19 @@ export class Render {
this.scrollbar.update();
}

setMolecule(struct: Struct) {
setMolecule(struct: Struct, forceUpdateWithTimeout = false) {
this.paper.clear();
this.ctab = new ReStruct(struct, this);
this.options.offset = new Vec2();
this.update(false);
// need to use force update with timeout to have ability select bonds in case of usage:
// addFragment, setMolecule or "Paste from clipboard" with "Open as New Project" button
if (forceUpdateWithTimeout) {
setTimeout(() => {
this.update(true);
}, 0);
} else {
this.update(false);
}
}

update(force = false, viewSz: Vec2 | null = null) {
Expand Down

0 comments on commit 8161036

Please sign in to comment.