Skip to content

Commit

Permalink
#4526 - In the Text-editing mode, the canvas is not moved to make the…
Browse files Browse the repository at this point in the history
… newly added sequence visible (#6224)

* #4526 - In the Text-editing mode, the canvas is not moved to make the newly added sequence visible

* updated condition for scrolling

* #4526 – Update UI tests

---------

Co-authored-by: Nikita Chistousov <[email protected]>
  • Loading branch information
kostrubin and svvald authored Dec 31, 2024
1 parent 204ba0c commit 256be60
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 0 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.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
clickOnCanvas,
selectZoomInTool,
selectZoomOutTool,
moveMouseAway,
} from '@utils';
import { turnOnMacromoleculesEditor } from '@utils/macromolecules';
import {
Expand Down Expand Up @@ -100,10 +101,12 @@ test.describe('Sequence mode selection for edit mode', () => {
await page.keyboard.press('ArrowRight');
}
await page.keyboard.up('Shift');
await moveMouseAway(page);
await takeEditorScreenshot(page);

await selectFlexLayoutModeTool(page);
await selectSequenceLayoutModeTool(page);

await takeEditorScreenshot(page);
});

Expand All @@ -116,6 +119,7 @@ test.describe('Sequence mode selection for edit mode', () => {
await page.keyboard.press('ArrowLeft');
}
await page.keyboard.up('Shift');
await moveMouseAway(page);
await takeEditorScreenshot(page);

await page.keyboard.press('Backspace');
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.
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.
13 changes: 13 additions & 0 deletions packages/ketcher-core/src/application/editor/modes/SequenceMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,19 @@ export class SequenceMode extends BaseMode {
zoom.scrollTo(firstMonomerPosition);
}

if (this.isEditMode) {
const drawnStructuresElement =
document.querySelector('.drawn-structures');
const isScrollToTheBottomNeeded =
drawnStructuresElement &&
drawnStructuresElement.getBoundingClientRect().bottom >
window.innerHeight;

if (isScrollToTheBottomNeeded) {
zoom.scrollToVerticalBottom();
}
}

modelChanges.merge(command);

return modelChanges;
Expand Down

0 comments on commit 256be60

Please sign in to comment.