|
|
@@ -36,7 +36,7 @@
|
|
|
<div
|
|
|
v-if="data.image_list[0] && file_url"
|
|
|
class="img-set"
|
|
|
- :style="{ top: `${data.imgData.top - 9}px`, left: `${data.imgData.left}px` }"
|
|
|
+ :style="{ top: `${data.imgData.top}px`, left: `${data.imgData.left}px` }"
|
|
|
>
|
|
|
<div class="dot top-left" @mousedown="dragStart($event, 'nwse-resize', 'top-left')"></div>
|
|
|
<div class="horizontal-line" @mousedown="dragStart($event, 'ns-resize', 'top')"></div>
|
|
|
@@ -100,37 +100,46 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
updateFileList({ file_list, file_id_list, file_info_list }) {
|
|
|
- this.data.image_list = file_list;
|
|
|
- this.data.image_id_list = file_id_list;
|
|
|
- this.data.image_info_list = file_info_list;
|
|
|
- this.data.file_id_list = file_id_list;
|
|
|
- if (file_list.length > 0) {
|
|
|
- const img = new Image();
|
|
|
- img.src = file_list[0].file_url;
|
|
|
- this.file_url = file_list[0].file_url;
|
|
|
- img.onload = () => {
|
|
|
- const { width, height } = img;
|
|
|
+ if (this.property.isSilentPropertyWatch) return;
|
|
|
+ if (JSON.stringify(file_id_list) === JSON.stringify(this.data.file_id_list)) {
|
|
|
+ if (this.data.image_list.length > 0) {
|
|
|
+ const img = new Image();
|
|
|
+ img.src = this.data.image_list[0].file_url;
|
|
|
+ this.file_url = this.data.image_list[0].file_url;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.data.image_list = file_list;
|
|
|
+ this.data.image_id_list = file_id_list;
|
|
|
+ this.data.image_info_list = file_info_list;
|
|
|
+ this.data.file_id_list = file_id_list;
|
|
|
+ if (file_list.length > 0) {
|
|
|
+ const img = new Image();
|
|
|
+ img.src = file_list[0].file_url;
|
|
|
+ this.file_url = file_list[0].file_url;
|
|
|
+ img.onload = () => {
|
|
|
+ const { width, height } = img;
|
|
|
|
|
|
- if (width > this.data.image_width || height > this.data.image_height) {
|
|
|
- const wScale = width / this.data.image_width;
|
|
|
- const hScale = height / this.data.image_height;
|
|
|
- const scale = wScale > hScale ? this.data.image_width / 2 / width : this.data.image_height / 2 / height;
|
|
|
+ if (width > this.data.image_width || height > this.data.image_height) {
|
|
|
+ const wScale = width / this.data.image_width;
|
|
|
+ const hScale = height / this.data.image_height;
|
|
|
+ const scale = wScale > hScale ? this.data.image_width / 2 / width : this.data.image_height / 2 / height;
|
|
|
|
|
|
- this.data.imgData = {
|
|
|
- width: width * scale,
|
|
|
- height: height * scale,
|
|
|
- top: 0,
|
|
|
- left: 0,
|
|
|
- };
|
|
|
- } else {
|
|
|
- this.data.imgData = {
|
|
|
- width,
|
|
|
- height,
|
|
|
- top: 0,
|
|
|
- left: 0,
|
|
|
- };
|
|
|
- }
|
|
|
- };
|
|
|
+ this.data.imgData = {
|
|
|
+ width: width * scale,
|
|
|
+ height: height * scale,
|
|
|
+ top: 0,
|
|
|
+ left: 0,
|
|
|
+ };
|
|
|
+ } else {
|
|
|
+ this.data.imgData = {
|
|
|
+ width,
|
|
|
+ height,
|
|
|
+ top: 0,
|
|
|
+ left: 0,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
|