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

feat: restrict zoomed image goes out of canvas #762

Closed
wants to merge 2 commits into from

Conversation

Elli-Jeon
Copy link

Please check if the PR fulfills these requirements

  • It's submitted to right branch according to our branching model
  • It's right issue type on title
  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added/updated (for bug fixes/features)
  • It does not introduce a breaking change or has description for the breaking change

Description

Good day!

problem

  • image goes out of canvas and blank space appears when image zoomed and moved by hand mode

ezgif com-gif-maker

if user download the image, blank space also comes out there, too.

enhancement

  • prevent the image move by restricting hand move action

ezgif com-gif-maker (1)

reference

  • Instagram

ezgif com-gif-maker

Thank you

Thank you for your contribution to TOAST UI product. 🎉 😘 ✨

@Elli-Jeon Elli-Jeon changed the title feat: restrict zoomed image go out of canvas feat: restrict zoomed image goes out of canvas Apr 22, 2022
Copy link
Contributor

@lja1018 lja1018 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

Comment on lines 585 to 595
if (vpt[4] >= 0) {
vpt[4] = 0;
} else if (vpt[4] < canvasWidth - canvasWidth * zoomLevel) {
vpt[4] = canvasWidth - canvasWidth * zoomLevel;
}

if (vpt[5] >= 0) {
vpt[5] = 0;
} else if (vpt[5] < canvasHeight - canvasHeight * zoomLevel) {
vpt[5] = canvasHeight - canvasHeight * zoomLevel;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't you use util/clamp?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! i changed it

@stale
Copy link

stale bot commented Jun 12, 2022

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!

@stale stale bot added the inactive label Jun 12, 2022
@stale
Copy link

stale bot commented Jul 10, 2022

This issue will be closed due to inactivity. Thanks for your contribution!

@stale stale bot closed this Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants