Skip to content

Commit 73fc023

Browse files
committed
fixed crop out of outline
1 parent 2a23386 commit 73fc023

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/lib/resize.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export default function resize(e, el, container, coor, ratio) {
3232
CSSObj.width = (coor.w + resetX - coor.x);
3333
CSSObj.height = elOffsetWidth * ratioRemainder;
3434
if (dotBoxW > dotBoxH) {
35-
if (elOffsetWidth >= dotBoxH) {
35+
if (elOffsetWidth > dotBoxH) {
3636
CSSObj.height = dotBoxH;
3737
CSSObj.width = dotBoxH * ratio;
3838
}
3939
} else if (dotBoxW < dotBoxH) {
40-
if (elOffsetWidth >= dotBoxW) {
40+
if (elOffsetWidth > dotBoxW) {
4141
CSSObj.width = dotBoxW;
4242
CSSObj.height = dotBoxW * ratioRemainder;
4343
}
@@ -50,16 +50,16 @@ export default function resize(e, el, container, coor, ratio) {
5050
CSSObj.width = parseInt(el.style.height) * ratio;
5151
// 限制拖拉的范围在图片内
5252
if (dotBoxW > dotBoxH) {
53-
if (elOffsetHeight >= dotBoxH) {
53+
if (elOffsetHeight > dotBoxH) {
5454
CSSObj.height = dotBoxH;
5555
CSSObj.width = dotBoxH * ratio;
5656
}
5757
} else if (dotBoxW < dotBoxH) {
58-
if (elOffsetWidth >= dotBoxW) {
58+
if (elOffsetWidth > dotBoxW) {
5959
CSSObj.width = dotBoxW;
6060
CSSObj.height = dotBoxW * ratioRemainder;
6161
}
62-
} else if (elOffsetWidth >= dotBoxW) {
62+
} else if (elOffsetWidth > dotBoxW) {
6363
CSSObj.width = dotBoxW;
6464
CSSObj.height = dotBoxW * ratioRemainder;
6565
}
@@ -71,16 +71,16 @@ export default function resize(e, el, container, coor, ratio) {
7171
CSSObj.height = el.style.width;
7272
// limit the crop box area
7373
if (dotBoxW > dotBoxH) {
74-
if (elOffsetHeight >= dotBoxH) {
74+
if (elOffsetHeight > dotBoxH) {
7575
CSSObj.height = dotBoxH;
7676
CSSObj.width = dotBoxH;
7777
}
7878
} else if (dotBoxW < dotBoxH) {
79-
if (elOffsetWidth >= dotBoxW) {
79+
if (elOffsetWidth > dotBoxW) {
8080
CSSObj.width = dotBoxW;
8181
CSSObj.height = dotBoxW;
8282
}
83-
} else if (elOffsetWidth >= dotBoxW) {
83+
} else if (elOffsetWidth > dotBoxW) {
8484
CSSObj.width = el.style.height = dotBoxW;
8585
}
8686
}

src/vue-core-image-upload.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="g-core-image-upload-btn">
3-
{{text}}
3+
<slot>{{text}}</slot>
44
<form class="g-core-image-upload-form" v-show="!hasImage" method="post" enctype="multipart/form-data" action="/api2/common_user/cropHeadUrl" style="display: block; cursor: pointer; position: absolute; left: 0px; top: 0px; width: 1242px; height: 61px; opacity: 0; margin: 0px; padding: 0px; overflow: hidden;">
55
<input v-bind:disabled="uploading" v-bind:id="'g-core-upload-input-' + formID" v-bind:name="name" v-bind:multiple="multiple" type="file" v-bind:accept="inputAccept" v-on:change="change" style="width: 100%; height: 100%;">
66
</form>
@@ -14,11 +14,11 @@
1414
<resize-bar v-if="resize" :min-progress="image.minProgress" ref="resizeBar" @resize="resizeImage"></resize-bar>
1515
<p class="btn-groups" v-if="crop">
1616
<button type="button" v-on:click="doCrop" class="btn btn-upload">{{cropBtn.ok}}</button>
17-
<button type="button" v-on:click="cancel()" class="btn btn-cancel">{{cropBtn.cancel}}</button>
17+
<button type="button" v-on:click="cancel" class="btn btn-cancel">{{cropBtn.cancel}}</button>
1818
</p>
1919
<p class="btn-groups" v-if="resize">
2020
<button type="button" v-on:click="doResize" class="btn btn-upload">{{ResizeBtn.ok}}</button>
21-
<button type="button" v-on:click="cancel()" class="btn btn-cancel">{{ResizeBtn.cancel}}</button>
21+
<button type="button" v-on:click="cancel" class="btn btn-cancel">{{ResizeBtn.cancel}}</button>
2222
</p>
2323
</div>
2424
</div>

0 commit comments

Comments
 (0)