epam / epam/Indigo

Position of Shapes and Text are changed after Layout action

Open
#2,191 0 comments 0 reactions 0 assignees View on GitHub
Layout Priority: Medium Reactions
Dominant language
C++
Stars
406
Forks
134
Avg merge
2d 11h
Merged PRs (30d)
24

Description

**Steps to Reproduce**
1. Open from KET file one corrupted elements with shapes and text:
[defect.zip](https://github.com/user-attachments/files/16512478/defect.zip)
2. Add to Canvas:
![image](https://github.com/user-attachments/assets/0ddefcd5-58f2-4640-8ecc-22370767347f)
3. Click on Layout action

**Expected behavior**
- Chemical elements are fixed and aligned, shapes and text are moved according to position of new center of mass of chemical elements
- What should be done: Calculate center of mass of chemical elements (red cross). Layout is applied. Chemical elements are fixed and aligned. Simple objects are moved according to new center of mass of chemistry objects (blue cross).
There is an example with different objects from @vanoprenko:
![image](https://github.com/user-attachments/assets/16bbb540-e75c-4d70-aba8-ff6511c0d97d)

**Actual behavior**
- Elements are fixed, but the elements are moved to the top left and shapes/text are moved to the bottom right and size of shapes is reduced
![image](https://github.com/user-attachments/assets/465f7738-02eb-4180-a836-052948dff186)

4. If the user clicks on Layout one more time or more

**Expected behavior**
- Elements and objects are on the same place

**Actual Behavior**
- Elements and shapes/text are shifted from each other even more (size of shapes is reduced more):
![image](https://github.com/user-attachments/assets/1731cd1d-9694-4af9-b9f7-043b7ec01ea3)

**Environment details:**
- Ketcher [Version 2.24.0-rc.3] Build at 2024-08-20; 13:16:59
- Indigo Version 1.23.0-rc.2.0-g6a2a7526a-wasm32-wasm-clang-19.0.0
- OS: Windows 11 Enterprise
- Browser: Chrome, Version 127.0.6533.100 (Official Build) (64-bit)

**Action item**:
- Need to automate this case after the fix.

**Additional context**
- Detected during preview tests for Image feature - https://github.com/epam/Indigo/issues/2144. This issue is reproducible for images as well, but the issue isn't introduced after Image changes. **The fix should be verified for images, shapes and text as well**.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.