|
@@ -4140,7 +4140,43 @@ $(document).ready(() => {
|
|
|
updateData.pos_name = data.pos_name;
|
|
|
updateData.im_type = data.im_type;
|
|
|
}
|
|
|
- if (items.length > 0) {
|
|
|
+ if (items.length === 1) {
|
|
|
+ const itemInfo = [];
|
|
|
+ for (const item of items) {
|
|
|
+ const itemData = {
|
|
|
+ src: $('img', item).attr('src'),
|
|
|
+ left: item.style.left,
|
|
|
+ top: item.style.top,
|
|
|
+ width: item.style.width,
|
|
|
+ height: item.style.height,
|
|
|
+ };
|
|
|
+ itemInfo.push(itemData);
|
|
|
+ }
|
|
|
+ // 获取合并好的图片数据
|
|
|
+ const canvas = document.createElement('canvas');
|
|
|
+ const view = $('.img-view')[0];
|
|
|
+ const b = items[0];
|
|
|
+ const pos = $(b).position();
|
|
|
+ const img = $('img', b)[0];
|
|
|
+ canvas.height = Math.max(view.clientHeight, Math.ceil(pos.top + img.naturalHeight));
|
|
|
+ canvas.width = Math.max(view.clientWidth, Math.ceil(pos.left + img.naturalWidth));
|
|
|
+ const ctx = canvas.getContext('2d');
|
|
|
+ ctx.fillStyle = '#ffffff';
|
|
|
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
|
+ ctx.drawImage(img, pos.left, pos.top);
|
|
|
+
|
|
|
+ updateData.img = canvas.toDataURL('image/png');
|
|
|
+ updateData.imgInfo = itemInfo;
|
|
|
+ self.updateImageData = updateData;
|
|
|
+ $('#calc-img').attr('src', updateData.img);
|
|
|
+ $('#calc-remark').html(img_remark);
|
|
|
+ $('#view-calc-img').attr('src', updateData.img);
|
|
|
+ $('#show-calc-img').attr('src', updateData.img);
|
|
|
+ $('#show-calc-remark').html((img_remark ? '<td colspan="2">'+ img_remark +'</td>' : ''));
|
|
|
+ $('#view-calc-remark').text(img_remark);
|
|
|
+
|
|
|
+ $('#edit-img').modal('hide');
|
|
|
+ } else if (items.length > 0) {
|
|
|
const itemInfo = [];
|
|
|
for (const item of items) {
|
|
|
const itemData = {
|