tangning 4 godzin temu
rodzic
commit
f7b804f724

+ 5 - 3
src/view/case/photos/canvas-photo-editor.js

@@ -904,6 +904,7 @@ export class CanvasPhotoEditor {
       const layoutModePages = pagePhotos.layoutMode || this.layoutMode
       const layout = this.getItemSize(layoutModePages)
       pagePhotos.coordinate = this.getCoordinate(pageX, layout)
+      console.log('getCoordinate', pagePhotos)
       let newList = this.padArrayLength(pagePhotos.list, layout.count)
       newList.forEach((photoId, itemIndex) => {
         let itemY = layoutModePages === 'single' || layoutModePages === 'landscape'
@@ -1057,9 +1058,9 @@ export class CanvasPhotoEditor {
     let currentPage = {
       list: [],
       layoutMode: this.layoutMode, //页码布局类型
-      coordinate: this.getCoordinate(pageX, layout), //坐标信息
+      // coordinate: this.getCoordinate(pageX, layout), //坐标信息
     }
-    this._pages = this._pages.map(ele =>({...ele, layoutMode: this.layoutMode, coordinate: this.getCoordinate(pageX, layout)}))
+    this._pages = this._pages.map(ele =>({...ele, layoutMode: this.layoutMode, }))//coordinate: this.getCoordinate(pageX, layout)
 
     let list = []
     const newArr = [...newList, ...selectedPhotos]
@@ -1074,7 +1075,7 @@ export class CanvasPhotoEditor {
       }
     })
     if(newPages.length > 0 && newPages.length < this._pages.length){//需要补位
-      newPages = newPages.concat(Array(this._pages.length - newPages.length).fill({...currentPage, list: []}));
+      newPages = newPages.concat(Array(this._pages.length - newPages.length).fill({...currentPage, list: layout.count == 2 ? [null, null] : [null]}));
     }
     this.pages = newPages.length > 0 ? newPages : this._pages
     this.resetPosition()
@@ -1121,6 +1122,7 @@ export class CanvasPhotoEditor {
         layoutMode: direction,
         list: [list[1]],
       }
+      newPages[PageIndex].list = list
       newPages[PageIndex].list.length = 1
       newPages.splice(PageIndex, 0, newPageItem)
     }

+ 4 - 2
src/view/case/photos/index.vue

@@ -199,6 +199,7 @@
 </template>
 
 <script setup>
+import { throttle } from "@/util";
 import {
   ref,
   onMounted,
@@ -507,11 +508,11 @@ const handleAddType = async (type) => {
 };
 // 插入空白页
 // direction: true-右侧 false-左侧
-const insertBlankPage = (direction) => {
+const insertBlankPage = throttle((direction) => {
   if (editor.value) {
     pages.value = editor.value.insertBlankPage(direction);
   }
-};
+}, 100);
 const changeIndexing = async () => {
   indexing.value = !indexing.value;
   await nextTick();
@@ -586,6 +587,7 @@ const handleDrop = async (e) => {
   // 获取拖拽到的页面和位置
   const position = editor.value.getPhotoPositionInPage(e);
   const { pageIndex, itemIndex } = position;
+  console.log("getPhotoPositionInPage", position, );
 
   if (pageIndex === -1 || itemIndex === -1) return;
 

+ 1 - 1
src/view/material/sceneImg.vue

@@ -881,7 +881,7 @@ const handleClick = (a) => {
   } else if (paneName == '照片卷') {
     childrenList.value.src =''
     //照片卷
-    let activeItem = casePhotoList.value[0]
+    let activeItem = casePhotoList.value[0] || {}
     console.log("handleClick", childrenLists,activeItem);
     childrenList.value.src = activeItem.content;
     childrenList.value.item = activeItem;