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

How to center the image. #1223

Closed
ycxj opened this issue Sep 22, 2022 · 9 comments
Closed

How to center the image. #1223

ycxj opened this issue Sep 22, 2022 · 9 comments
Labels
question Further information is requested
Milestone

Comments

@ycxj
Copy link

ycxj commented Sep 22, 2022

Hello, excuse me, I would like to ask you how to center the picture on the canvas.
Before:
image

app.getActiveLayerGroup().fitToContainer({ x: 1000, y: 500 });
app.getActiveLayerGroup().draw();
After:
image

I wanted the image to be centered and as big as possible to cover the canvas.
It looks like this.
image

What should I do to achieve this effect?

@ivmartel ivmartel added the question Further information is requested label Sep 26, 2022
@ivmartel ivmartel added this to the 0.32.0 milestone Sep 26, 2022
@ivmartel
Copy link
Owner

Hi, which version of dwv are you using? I think it should work with the latest code, check out the demo viewer of the tests.

@ycxj
Copy link
Author

ycxj commented Sep 28, 2022

Hi, I am using version 0.30.8

@ivmartel
Copy link
Owner

v0.31 has got some changes regarding the use of the canvas and its centering. You can try it with the latest beta (0.31.0-beta.14).

@ycxj
Copy link
Author

ycxj commented Oct 10, 2022

Thank you very much. Changing to the latest version has solved this problem

@ivmartel ivmartel modified the milestones: 0.32.0, 0.31.0 Oct 10, 2022
@ivmartel
Copy link
Owner

Nice! If you are happy, can you close the issue please?

@ycxj
Copy link
Author

ycxj commented Oct 10, 2022

I'm having another problem. When I call onResize when my window size changes, the console reports an exception (dwv-0.31.0-beta.14)
微信截图_20221010153233

@ivmartel
Copy link
Owner

Good catch, can you create another issue please for this one?

@ycxj
Copy link
Author

ycxj commented Oct 10, 2022

Ok, I'll create a new issue

@ivmartel
Copy link
Owner

I fixed #1233. Closing this one, feel free to comment if you need.

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

No branches or pull requests

2 participants