|
@@ -348,10 +348,10 @@ export class CanvasPhotoEditor {
|
|
|
console.log('pageIndex', this.indexing, this.indexingNum)
|
|
console.log('pageIndex', this.indexing, this.indexingNum)
|
|
|
}
|
|
}
|
|
|
moveItem(arr, fromIndex, toIndex) {
|
|
moveItem(arr, fromIndex, toIndex) {
|
|
|
- let newtoIndex = fromIndex < toIndex ? toIndex : toIndex - 1;
|
|
|
|
|
|
|
+ let newtoIndex = fromIndex < toIndex ? toIndex-1 : toIndex;
|
|
|
const newArr = [...arr]
|
|
const newArr = [...arr]
|
|
|
const item = newArr.splice(fromIndex, 1)[0]
|
|
const item = newArr.splice(fromIndex, 1)[0]
|
|
|
- newArr.splice(toIndex, 0, item)
|
|
|
|
|
|
|
+ newArr.splice(newtoIndex, 0, item)
|
|
|
return newArr
|
|
return newArr
|
|
|
}
|
|
}
|
|
|
handleMouseLeave() {
|
|
handleMouseLeave() {
|
|
@@ -949,6 +949,15 @@ export class CanvasPhotoEditor {
|
|
|
* @param {Object} layout - 布局配置,包含宽高和位置信息
|
|
* @param {Object} layout - 布局配置,包含宽高和位置信息
|
|
|
* @param {string} photoId - 图片ID
|
|
* @param {string} photoId - 图片ID
|
|
|
*/
|
|
*/
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 在指定位置绘制单张照片
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param {CanvasRenderingContext2D} ctx - Canvas 2D 绘图上下文
|
|
|
|
|
+ * @param {number} pageX - 页面起始 X 坐标
|
|
|
|
|
+ * @param {number} itemY - 项目起始 Y 坐标
|
|
|
|
|
+ * @param {Object} layout - 布局配置对象,包含 x、y、width、height 等属性
|
|
|
|
|
+ * @param {string} photoId - 照片的唯一标识 ID
|
|
|
|
|
+ */
|
|
|
renderSinglePhoto(ctx, pageX, itemY, layout, photoId) {
|
|
renderSinglePhoto(ctx, pageX, itemY, layout, photoId) {
|
|
|
const photo = this.photos.find(p => p.id === photoId)
|
|
const photo = this.photos.find(p => p.id === photoId)
|
|
|
// if (!photo) return
|
|
// if (!photo) return
|
|
@@ -1060,6 +1069,9 @@ export class CanvasPhotoEditor {
|
|
|
newPages.push({...currentPage, list: list, })
|
|
newPages.push({...currentPage, list: list, })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ if(newPages.length > 0 && newPages.length != this._pages.length){//需要补位
|
|
|
|
|
+ newPages = newPages.concat(Array(4 - newPages.length).fill({...currentPage, list: []}));
|
|
|
|
|
+ }
|
|
|
this.pages = newPages.length > 0 ? newPages : this._pages
|
|
this.pages = newPages.length > 0 ? newPages : this._pages
|
|
|
this.resetPosition()
|
|
this.resetPosition()
|
|
|
return this.pages
|
|
return this.pages
|