epam / epam/Indigo

Layout action doesn't work if any shape or text are on Canvas

Open
#2,184 1 comment 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. Add to Canvas some shapes (or text) and corrupted elements
![image](https://github.com/user-attachments/assets/d4cb7e69-cea6-4f9b-8357-f143dbccc772)
2. Click on layout action

**Expected behavior**
- Chemical elements are fixed, the reaction is aligned relative to the arrow, 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**
Shape and reaction elements are in the center of Canvas, but reaction elements aren't aligned, size of elements is reduced
![image](https://github.com/user-attachments/assets/7ebe4ae4-7698-42bb-8d00-9063a199fc69)

**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**
- It works the same with multi-step reaction without shapes or text, elements are not fixed and centered after Layout
![image](https://github.com/user-attachments/assets/564c60ba-4307-4895-95f7-0443f228907c)
- Detected during preview tests for Image feature - https://github.com/epam/Indigo/issues/2144. but the issue isn't introduced after Image changes. **The fix should be verified for images, shapes and text as well**.
- Pay attention that Clean Up works in this case if no elements are selected.

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.