|
|
@@ -300,6 +300,10 @@ export class CanvasPhotoEditor {
|
|
|
const rect = this.canvas.getBoundingClientRect()
|
|
|
const mouseX = (e.clientX - rect.left - this.drawOffsetX) / this.scale
|
|
|
const mouseY = (e.clientY - rect.top - this.drawOffsetY) / this.scale
|
|
|
+ if(this.dragPageData.drawing && this.indexingLineList.length){
|
|
|
+ await this.clearLineThrottle()
|
|
|
+ return
|
|
|
+ }
|
|
|
if (this.indexing && drawing) {
|
|
|
const PhotoIndex = this.getPhotoPositionInPage(e)
|
|
|
console.log('PhotoIndex', PhotoIndex, this.tempArrow)
|
|
|
@@ -312,7 +316,6 @@ export class CanvasPhotoEditor {
|
|
|
this.dragPageData.end = { x: mouseX, y: mouseY }
|
|
|
let newEndIndex = endIndex<-1?-1:endIndex>this.pages.length-1?this.pages.length:endIndex
|
|
|
if(newEndIndex != this.dragPageData.movedIndex){
|
|
|
- await this.handleClearLine()
|
|
|
this.dragPageData.movedIndex = newEndIndex
|
|
|
this.drawAllPages()
|
|
|
}
|
|
|
@@ -330,16 +333,13 @@ export class CanvasPhotoEditor {
|
|
|
// 【关键】通过Canvas临时绘制偏移效果(替代重绘),避免拖拽时画面静止
|
|
|
this.drawAllPages()
|
|
|
}
|
|
|
- handleClearLine(){
|
|
|
- throttle(async ()=>{
|
|
|
- if(this.indexingLineList.length){
|
|
|
- await this.checkIndexing('修改页面排序将会清除所有标引是否继续?')
|
|
|
- this.drawAllPages()
|
|
|
- return
|
|
|
- }
|
|
|
- }, 2000)
|
|
|
-
|
|
|
- }
|
|
|
+ // 先把节流函数定义在外面(关键!)
|
|
|
+ clearLineThrottle = throttle(async () => {
|
|
|
+ if (this.indexingLineList.length) {
|
|
|
+ await this.checkIndexing('修改页面排序将会清除所有标引是否继续?')
|
|
|
+ this.drawAllPages()
|
|
|
+ }
|
|
|
+ }, 1000, {leading: true, trailing: false})
|
|
|
|
|
|
async handleMouseUp(e) {
|
|
|
this.isDragging = false
|
|
|
@@ -351,6 +351,7 @@ export class CanvasPhotoEditor {
|
|
|
this.pages = newPagelist;
|
|
|
this.dragPageData.drawing = false//退出page编辑模式
|
|
|
this.dragPageData.movedIndex = -1
|
|
|
+ this.saveHistory()
|
|
|
this.drawAllPages()
|
|
|
}
|
|
|
this.dragPageData.drawing = false
|
|
|
@@ -1084,8 +1085,8 @@ export class CanvasPhotoEditor {
|
|
|
layoutMode: this.layoutMode, //页码布局类型
|
|
|
// coordinate: this.getCoordinate(pageX, layout), //坐标信息
|
|
|
}
|
|
|
- this._pages = this._pages.map(ele =>({...ele, layoutMode: this.layoutMode, }))//coordinate: this.getCoordinate(pageX, layout)
|
|
|
if(selectedPhotos.length == 0){
|
|
|
+ this._pages = this._pages.map(ele =>({...ele, layoutMode: this.layoutMode, }))//coordinate: this.getCoordinate(pageX, layout)
|
|
|
let list = []
|
|
|
const newArr = [...newList, ...selectedPhotos]
|
|
|
newArr.forEach((photoId, photoIndex) => {
|