Skip to content

Commit

Permalink
#3830 – Aromatizing/Dearomatizing changes molecula position (#3837)
Browse files Browse the repository at this point in the history
* #3830 – Aromatizing/Dearomatizing changes molecula position

* #3830 – fixing CI tests
  • Loading branch information
Nitvex authored Jan 8, 2024
1 parent 0d31614 commit 2c9945a
Show file tree
Hide file tree
Showing 84 changed files with 40 additions and 36 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.
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,9 @@ test.describe('Indigo Tools - Calculate CIP Tool', () => {
Description: New stereobond is added to the Chain structure.
*/
await openFileAndAddToCanvas('chain-with-stereo-bonds.mol', page);
await selectTopPanelButton(TopPanelButton.Calculate, page);
await delay(DELAY_IN_SECONDS.TWO);
await waitForSpinnerFinishedWork(page, async () => {
await selectTopPanelButton(TopPanelButton.Calculate, page);
});
await selectNestedTool(page, BondTool.UP);
const point = await getBondByIndex(page, { type: BondType.SINGLE }, 5);
await page.mouse.click(point.x, point.y);
Expand Down
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.
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@
{
"label": "C",
"location": [
11.775473354321095,
-8.187600977368211,
12.101912830334278,
-7.750100691265916,
0
]
},
{
"label": "C",
"location": [
12.641368581131388,
-8.68759904432894,
12.967808057144572,
-8.250098758226644,
0
]
},
{
"label": "C",
"location": [
13.507464079537838,
-8.187600977368211,
13.833903555551021,
-7.750100691265916,
0
],
"cip": "R",
Expand All @@ -40,8 +40,8 @@
{
"label": "C",
"location": [
14.373459442146208,
-8.68759904432894,
14.699898918159391,
-8.250098758226644,
0
],
"cip": "S",
Expand All @@ -50,40 +50,40 @@
{
"label": "C",
"location": [
15.23945480475458,
-8.187600977368211,
15.565894280767763,
-7.750100691265916,
0
]
},
{
"label": "C",
"location": [
16.105551256835295,
-8.68759904432894,
16.43199073284848,
-8.250098758226644,
0
]
},
{
"label": "C",
"location": [
16.97164580156748,
-8.187600977368211,
17.29808527758066,
-7.750100691265916,
0
]
},
{
"label": "C",
"location": [
13.507464079537838,
-7.187506614997213,
13.833903555551021,
-6.750006328894918,
0
]
},
{
"label": "C",
"location": [
14.373459442146208,
-9.687493135103784,
14.699898918159391,
-9.249992849001488,
0
]
}
Expand Down Expand Up @@ -147,11 +147,6 @@
],
"stereo": 6
}
],
"stereoFlagPosition": {
"x": 16.97164580156748,
"y": 6.187506614997213,
"z": 0
}
]
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

Ketcher 10152310222D 1 1.00000 0.00000 0
Ketcher 1 52414 52D 1 1.00000 0.00000 0

9 8 0 0 0 0 0 0 0 0999 V2000
12.1019 -7.7501 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

-INDIGO-10152310232D
-INDIGO-01052414052D

0 0 0 0 0 0 0 0 0 0 0 V3000
M V30 BEGIN CTAB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type FloatingToolsParams = {
export interface Editor {
isDitrty: () => boolean;
setOrigin: () => void;
struct: (struct?: Struct) => Struct;
struct: (struct?: Struct, needToCenterStruct?: boolean) => Struct;
structToAddFragment: (struct: Struct) => Struct;
subscribe: (eventName: string, handler: (data?: any) => any) => any;
unsubscribe: (eventName: string, subscriber: any) => void;
Expand Down
13 changes: 9 additions & 4 deletions packages/ketcher-react/src/script/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,27 @@ class Editor implements KetcherEditor {
this.struct(undefined);
}

renderAndRecoordinateStruct(struct: Struct) {
renderAndRecoordinateStruct(struct: Struct, needToCenterStruct = true) {
const action = fromNewCanvas(this.render.ctab, struct);
this.update(action);
this.centerStruct();
if (needToCenterStruct) {
this.centerStruct();
}
return this.render.ctab.molecule;
}

struct(value?: Struct): Struct {
struct(value?: Struct, needToCenterStruct = true): Struct {
if (arguments.length === 0) {
return this.render.ctab.molecule;
}

this.selection(null);
const struct = value || new Struct();

const molecule = this.renderAndRecoordinateStruct(struct);
const molecule = this.renderAndRecoordinateStruct(
struct,
needToCenterStruct,
);

this.hoverIcon.create();
return molecule;
Expand Down
1 change: 1 addition & 0 deletions packages/ketcher-react/src/script/ui/state/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export function serverTransform(method, data, struct) {
load(loadedStruct, {
rescale: method === 'layout',
reactionRelayout: method === 'clean',
method,
}),
);
})
Expand Down
8 changes: 5 additions & 3 deletions packages/ketcher-react/src/script/ui/state/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function load(struct: Struct, options?) {
const server = state.server;
const errorHandler = editor.errorHandler;
options = options || {};
let { isPaste, ...otherOptions } = options;
let { isPaste, method, ...otherOptions } = options;
otherOptions = {
...otherOptions,
'dearomatize-on-load': editor.options()['dearomatize-on-load'],
Expand Down Expand Up @@ -170,11 +170,13 @@ export function load(struct: Struct, options?) {
dispatch(onAction({ tool: 'paste', opts: parsedStruct }));
}
} else {
editor.struct(parsedStruct);
editor.struct(parsedStruct, method === 'layout');
}

editor.zoomAccordingContent(parsedStruct);
if (!isPaste) {

const isIndigoFunctionCalled = !!method;
if (!isPaste && !isIndigoFunctionCalled) {
editor.centerStruct();
}

Expand Down

0 comments on commit 2c9945a

Please sign in to comment.