Skip to content

Implementing the saving of the diagram as an image #67

Open
@BOCOVO

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions