|
@@ -326,7 +326,7 @@ export class CanvasPhotoEditor {
|
|
|
this.canvas.style.cursor = 'grab'
|
|
this.canvas.style.cursor = 'grab'
|
|
|
if(this.dragPageData.drawing){//鼠标释放左键时,移动页面到指定位置)
|
|
if(this.dragPageData.drawing){//鼠标释放左键时,移动页面到指定位置)
|
|
|
// 末尾必须加分号!!!
|
|
// 末尾必须加分号!!!
|
|
|
- let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex)
|
|
|
|
|
|
|
+ let newPagelist = this.moveItem(this.pages, this.dragPageData.index, this.dragPageData.movedIndex-1)
|
|
|
this.pages = newPagelist;
|
|
this.pages = newPagelist;
|
|
|
this.drawAllPages()
|
|
this.drawAllPages()
|
|
|
}
|
|
}
|
|
@@ -1037,17 +1037,22 @@ export class CanvasPhotoEditor {
|
|
|
|
|
|
|
|
insertBlankPage(direction) {
|
|
insertBlankPage(direction) {
|
|
|
//direction true 右边 false 左边
|
|
//direction true 右边 false 左边
|
|
|
|
|
+ console.log(this.selectedPageIndex, direction, 'selectedPageIndex')
|
|
|
const layout = this.getItemSize()
|
|
const layout = this.getItemSize()
|
|
|
// if (this.selectedPageIndex === -1) return this.pages
|
|
// if (this.selectedPageIndex === -1) return this.pages
|
|
|
const newPages = [...this.pages]
|
|
const newPages = [...this.pages]
|
|
|
- const PageIndex = direction ? this.selectedPageIndex + 1 : this.selectedPageIndex;
|
|
|
|
|
- newPages.splice(PageIndex, 0, {
|
|
|
|
|
|
|
+ // const PageIndex = direction ? this.selectedPageIndex + 1 : this.selectedPageIndex;
|
|
|
|
|
+ // newPages.splice(PageIndex, 0, {
|
|
|
|
|
+ // list: [],
|
|
|
|
|
+ // layoutMode: this.layoutMode, //页码布局类型
|
|
|
|
|
+ // coordinate: [], //坐标信息
|
|
|
|
|
+ // })
|
|
|
|
|
+ this.pages = [...newPages, {
|
|
|
list: [],
|
|
list: [],
|
|
|
layoutMode: this.layoutMode, //页码布局类型
|
|
layoutMode: this.layoutMode, //页码布局类型
|
|
|
coordinate: [], //坐标信息
|
|
coordinate: [], //坐标信息
|
|
|
- })
|
|
|
|
|
- this.pages = newPages
|
|
|
|
|
- if (!direction) this.selectedPageIndex++
|
|
|
|
|
|
|
+ }]
|
|
|
|
|
+ // if (!direction) this.selectedPageIndex++
|
|
|
this.resetPosition()
|
|
this.resetPosition()
|
|
|
return this.pages
|
|
return this.pages
|
|
|
}
|
|
}
|