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

修复在初始化的情况下 图片宽高超出时的计算 当不固定宽高时 无需计算相对应的宽高 #723

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/vue-cropper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1828,12 +1828,16 @@ export default {
if (w > axis.x2 - axis.x1) {
// 宽度超标
w = axis.x2 - axis.x1;
h = (w / this.fixedNumber[0]) * this.fixedNumber[1];
if (this.fixed) {
h = (w / this.fixedNumber[0]) * this.fixedNumber[1];
}
}
if (h > axis.y2 - axis.y1) {
// 高度超标
h = axis.y2 - axis.y1;
w = (h / this.fixedNumber[1]) * this.fixedNumber[0];
if (this.fixed) {
w = (h / this.fixedNumber[1]) * this.fixedNumber[0];
}
}
}
// 判断是否大于容器
Expand Down