Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Auto resize canvas on svg icon resize #267

Closed
wp-kitten opened this issue Jul 17, 2018 · 2 comments
Closed

Auto resize canvas on svg icon resize #267

wp-kitten opened this issue Jul 17, 2018 · 2 comments

Comments

@wp-kitten
Copy link

Hello!

How can I make the canvas auto resize when I resize the svg image?

Right now, when I load a svg image using

svgEditor.loadFromString(locale.svg_icon);

the canvas will auto resize to the width and height of the loaded svg image.

When I resize the svg image the canvas will preserve its initial width and height and when I save the image, then I only get the visible part that exist in the canvas width and height, and I want the whole resized svg image.

Note that I have set:

// Default configuration options
const curConfig = {
  show_outside_canvas: false,
  selectNew: true,
  dimensions: [640, 480]
};

in svgedit/editor/svgcanvas.js

If I'd have:

// Default configuration options
const curConfig = {
  show_outside_canvas: true,
  selectNew: true,
  dimensions: [640, 480]
};

and I resize the image and move it outside the canvas, then upon save (if the image is not inside the canvas) I will get an empty image.

Please help

@brettz9
Copy link
Contributor

brettz9 commented Jul 26, 2018

show_outside_canvas only impacts where it is shown in the UI or not (btw, you may find http://svg-edit.github.io/svgedit/releases/svg-edit-3.0.0-rc.1/docs/jsdoc/index.html of help in digging through the code; in this case, the config is explained at http://svg-edit.github.io/svgedit/releases/svg-edit-3.0.0-rc.1/docs/jsdoc/module-SVGEditor.Config.html ).

If you want to ensure everything you have visible is in the saved document, you should go to "Document Properties" and for "Select predefined:", choose "Fit to content".

If you are looking for a feature to automatically do this resizing, I can change this issue label to an enhancement.

@wp-kitten
Copy link
Author

Hello, Brett

Thank you for your response, much appreciated!

To be honest, I would very much appreciate it if you would change the label to "Feature Request" because I really hate messing up with someone else's code, especially when there might be future updates to it.

For now, manually changing the canvas size will have to do though..

Thanks again!

@SVG-Edit SVG-Edit locked and limited conversation to collaborators Jun 26, 2022
@jfhenon jfhenon converted this issue into discussion #794 Jun 26, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

2 participants