Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View only mode #4965

Closed
yauhen-karmyzau opened this issue Jul 2, 2024 · 3 comments · Fixed by #5467
Closed

View only mode #4965

yauhen-karmyzau opened this issue Jul 2, 2024 · 3 comments · Fixed by #5467
Assignees
Labels
MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes Test Cases Written Test cases has been written for that issue

Comments

@yauhen-karmyzau
Copy link
Collaborator

yauhen-karmyzau commented Jul 2, 2024

As an Application Administrator, I want the ability to configure Ketcher into a view-only mode so that I can control user interactions and limit modifications to the chemical structures. The view-only mode should be configurable from settings on load and by Ketcher API in runtime.

Acceptance Criteria:

  1. An Application Administrator should be able to configure Ketcher into a view-only mode from settings before web app load.

  2. The Application Administrator should also be able to switch Ketcher into and out of view-only mode in runtime using the Ketcher API.

  3. In view-only mode, all editing tools should be disabled including hotkeys, preventing users from modifying the chemical structures.

  4. The following tools and functions should be enabled:

    1. Open, Save, Copy group
      image
    2. Hand and Selection tools
      Image
    3. Check Structure, Calculated Values, 3D Viewer
      Image
      Image
  5. "Add to Canvas" button should be disabled in the "Open structure" dialog window and "Open as New Project" must be highlighted as default.
    image

  6. When the user is using Ketcher and has any tool selected, switching to View Only mode will automatically reset the selected tool to "Rectangle Selection."

  7. To turn on/turn off option use this command in console with true and false flag: ketcher.editor.options({ viewOnlyMode: true })

  8. Hotkeys whitelist:

Shortcut Action
Mod+o Open…
Mod+s Save As…
Mod+c Copy
Mod+Shift+f Copy Image
Mod+m Copy as MOL
Mod+Shift+k Copy as KET
Mod+a Select All
Mod+Shift+a Deselect All
Alt+s Check structure
Alt+c Calculate values
Mod+h Hand tool
Escape only switch to Selection Rotate between by Shift+Tab: Lasso Selection, Rectangle Selection, Fragment Selection
Mod+_, Mod+- Zoom Out
Mod+=, Mod++ Zoom In
Mod+Shift+0 Zoom 100%
?, &, Shift+/ Help
@yauhen-karmyzau yauhen-karmyzau transferred this issue from epam/Indigo Jul 2, 2024
@yauhen-karmyzau yauhen-karmyzau added this to the Ketcher 2.25.0-rc.1 milestone Jul 16, 2024
@yauhen-karmyzau yauhen-karmyzau added the MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes label Jul 16, 2024
@daniil-sloboda daniil-sloboda self-assigned this Sep 9, 2024
daniil-sloboda added a commit that referenced this issue Sep 10, 2024
@Zhirnoff Zhirnoff added the Test Cases Written Test cases has been written for that issue label Sep 11, 2024
@daniil-sloboda
Copy link
Collaborator

daniil-sloboda commented Sep 11, 2024

  • Right click on any element should not display context menu
  • Selection tool should not allow to move or resize elements, only select them
  • Whenever view mode is triggered tool should reset to selection
  • Rotation is blocked
  • Any edit is blocked

To turn view only mode on\off use the following api call (from code or web console)
window.ketcher.editor.setOptions(JSON.stringify({ viewOnlyMode: true })) to turn on and to turn off replace true with false

P.S. do not use options method because currently it leads to unexpected behavior

@Zhirnoff
Copy link
Collaborator

Tested.
Desktop:

  • OS: Windows 11
  • Browser Chrome
  • Version 128.0.6613.120 (Official Build) (64-bit)

Ketcher version
[Version 2.25.0-rc.1]
Indigo version
[Version 1.24.0-rc.1]

  1. Currently, there are issues with selecting structures using the Fragment tool (it’s not working).

  2. Some hotkeys are not functioning (see screenshot). Mod+d Select descriptors not working also in prod version at all.
    I change description in ticket about Escape hotkey because we change it behaviour in Change esc behaviour logic for selection tool #2127
    2024-09-11_15h42_13

  3. After disabling View Only mode, it’s impossible to select all structures and move them together to a new place on the canvas.

2024-09-11_16h27_25.mp4
  1. Through 3D View, it’s possible to change the structure's position on the canvas (we need to decide whether to completely remove the 3D Viewer or block the Apply button in it).
  2. Full screen, Help, and About buttons are blocked in View Only mode (is it necessary to block them?).
  3. Also, after enabling View Only mode via API, the structure shifts to the center of the canvas. This requires further investigation (a bug will be logged).

rrodionov91 pushed a commit that referenced this issue Sep 23, 2024
* #4965 - Implemented view only mode

* #4965 - Updated config types

* #4965 - added new option to hotkeys test mock

* #4965 - fixed tool reset on view only enabling

* #4965 - implemented view only selection, fixed right click and zoom

* #4965 - removed linter ignore after constructor changed to useful

* #4965 - added help, about and fullscreen to allowlist

* #4965 - updated selectable tools in view only mode

* #4965 - update editor after view only mode turned off
@Zhirnoff
Copy link
Collaborator

Zhirnoff commented Oct 8, 2024

Tested.
2024-10-08_16h08_23

Desktop:

  • OS: Windows 11
  • Browser Chrome
  • Version 128.0.6613.120 (Official Build) (64-bit)

Ketcher version
[Version 2.26.0-rc.1]
Indigo version
[Version 1.25.0-rc.1]

Guch1g0v pushed a commit that referenced this issue Oct 17, 2024
* #4965 - Implemented view only mode

* #4965 - Updated config types

* #4965 - added new option to hotkeys test mock

* #4965 - fixed tool reset on view only enabling

* #4965 - implemented view only selection, fixed right click and zoom

* #4965 - removed linter ignore after constructor changed to useful

* #4965 - added help, about and fullscreen to allowlist

* #4965 - updated selectable tools in view only mode

* #4965 - update editor after view only mode turned off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MMPK Scope for Pathway reactions, View-only mode, Static images, Custom buttons and Ketcher API changes Test Cases Written Test cases has been written for that issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants