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

Implementing the saving of the diagram as an image #67

Open
BOCOVO opened this issue Oct 16, 2024 · 0 comments
Open

Implementing the saving of the diagram as an image #67

BOCOVO opened this issue Oct 16, 2024 · 0 comments

Comments

@BOCOVO
Copy link
Owner

BOCOVO commented Oct 16, 2024

Implementing the saving of the diagram as an image

This issue is about saving of the diagram as an image in a file.

The user flow

To implement that, we will add a new button to the toolbar. When the user clicks on this button, the VsCode saving dialog should be open and asks him where to save the file.
When the user selects a location, the image will be saved in the location.

Some documentation

  1. How to open the VsCode saving dialogs
    Here is the documentation : https://code.visualstudio.com/api/references/vscode-api#:~:text=or%20undefined.-,showSaveDialog,-(options%3F
    An usage example : https://github.com/Durandal14/vscode-extension-dbml-viewer/blob/main/src/extension.ts#L118C37-L118C51

  2. How to generate the image
    Since the plugin uses Konva.js we that use the provided method for create image.
    Here is the documentation : https://konvajs.org/api/Konva.Node.html#toImage:~:text=()%3B-,toDataURL(config),-Creates%20a%20composite

    We will keep the image as PNG

    We need to make sure we capture only those parts of the scene that have a drawing.

  3. Some indication about the code


hi @ayushsaini12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant