|
|
@@ -228,8 +228,7 @@ export class CanvasPhotoEditor {
|
|
|
pageIndex: -1,
|
|
|
}
|
|
|
}
|
|
|
- console.log('pageIndex', this.pages, this.selectedPageItem, pageIndex)
|
|
|
- if(oldPageIndex == pageIndex == this.selectedPageIndex == this.selectedPageItem.pageIndex && pageIndex != -1 && this.selectedPageItem.index == -1){
|
|
|
+ if(oldPageIndex == pageIndex && pageIndex == this.selectedPageIndex && pageIndex == this.selectedPageItem.pageIndex && pageIndex != -1 && this.selectedPageItem.index == -1){
|
|
|
if(this.indexingLineList.length){
|
|
|
await this.checkIndexing('修改页面排序将会清除所有标引是否继续?')
|
|
|
this.drawAllPages()
|
|
|
@@ -321,23 +320,25 @@ export class CanvasPhotoEditor {
|
|
|
}
|
|
|
|
|
|
handleMouseUp(e) {
|
|
|
- console.log('handleMouseUp', this.isDragging)
|
|
|
this.isDragging = false
|
|
|
this.canvas.style.cursor = 'grab'
|
|
|
- if(this.dragPageData.drawing){//鼠标释放左键时,移动页面到指定位置)
|
|
|
+ if(this.dragPageData.drawing && this.dragPageData.index != this.dragPageData.movedIndex){//鼠标释放左键时,移动页面到指定位置)
|
|
|
// 末尾必须加分号!!!
|
|
|
- let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex-1)
|
|
|
+ console.log('handleMouseUpdragPageData', this.dragPageData)
|
|
|
+ let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex)
|
|
|
this.pages = newPagelist;
|
|
|
this.drawAllPages()
|
|
|
}
|
|
|
this.dragPageData.drawing = false
|
|
|
this.dragPageData.movedIndex = 0
|
|
|
+ this.dragPageData.index = 0
|
|
|
// 松开鼠标后仅重绘一次,确认最终位置
|
|
|
// this.drawDragPreview()
|
|
|
// 选中页面(仅点击时重绘一次)
|
|
|
console.log('pageIndex', this.indexing, this.indexingNum)
|
|
|
}
|
|
|
moveItem(arr, fromIndex, toIndex) {
|
|
|
+ let newtoIndex = fromIndex < toIndex ? toIndex : toIndex - 1;
|
|
|
const newArr = [...arr]
|
|
|
const item = newArr.splice(fromIndex, 1)[0]
|
|
|
newArr.splice(toIndex, 0, item)
|
|
|
@@ -1092,13 +1093,16 @@ export class CanvasPhotoEditor {
|
|
|
}else{//删除单个图片
|
|
|
newPages.forEach((ele, index) => {
|
|
|
if(index == this.selectedPageIndex){
|
|
|
- ele.list.splice(this.selectedPageItem.index, 1)
|
|
|
+ ele.list[this.selectedPageItem.index] = null
|
|
|
+ // ele.list.splice(this.selectedPageItem.index, 1)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
this.pages = newPages
|
|
|
this.selectedPageIndex = Math.min(this.selectedPageIndex, this.pages.length - 1)
|
|
|
- this.resetPosition()
|
|
|
+ if(this.selectedPageItem.index == -1){
|
|
|
+ this.resetPosition()
|
|
|
+ }
|
|
|
return this.pages
|
|
|
}
|
|
|
|