|
@@ -1251,6 +1251,7 @@ export class CanvasPhotoEditor {
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ // this.saveHistory()
|
|
|
this.pages = newPages
|
|
this.pages = newPages
|
|
|
this.selectedPageIndex = Math.min(this.selectedPageIndex, this.pages.length - 1)
|
|
this.selectedPageIndex = Math.min(this.selectedPageIndex, this.pages.length - 1)
|
|
|
if(this.selectedPageItem.index == -1){
|
|
if(this.selectedPageItem.index == -1){
|
|
@@ -1396,6 +1397,7 @@ export class CanvasPhotoEditor {
|
|
|
indexingLineList: [...this.indexingLineList], // 保存标引线信息,以便恢复时使用
|
|
indexingLineList: [...this.indexingLineList], // 保存标引线信息,以便恢复时使用
|
|
|
});
|
|
});
|
|
|
this.currentIndex++;
|
|
this.currentIndex++;
|
|
|
|
|
+ console.log("saveHistory", this.history, this.currentIndex);
|
|
|
if (this.history.length > 5) {
|
|
if (this.history.length > 5) {
|
|
|
this.history.shift(); // 删除最早的一条
|
|
this.history.shift(); // 删除最早的一条
|
|
|
// this.currentIndex--;
|
|
// this.currentIndex--;
|
|
@@ -1679,7 +1681,7 @@ exportPagesAsImages(paperType = "a4", name, fileType = 'pdf') {
|
|
|
const pageCanvas = document.createElement("canvas");
|
|
const pageCanvas = document.createElement("canvas");
|
|
|
let pageWidth = this.pageWidth
|
|
let pageWidth = this.pageWidth
|
|
|
if(paperType === "four"){
|
|
if(paperType === "four"){
|
|
|
- pageWidth = pageWidth / (724/840)
|
|
|
|
|
|
|
+ pageWidth = pageWidth * (724/840)
|
|
|
}
|
|
}
|
|
|
pageCanvas.width = pageWidth * DPR * (paperType === "a3" ? 2 : paperType === "a4" ? 1 : 4);
|
|
pageCanvas.width = pageWidth * DPR * (paperType === "a3" ? 2 : paperType === "a4" ? 1 : 4);
|
|
|
pageCanvas.height = this.pageHeight * DPR * 1;
|
|
pageCanvas.height = this.pageHeight * DPR * 1;
|
|
@@ -1733,10 +1735,14 @@ exportPagesAsImages(paperType = "a4", name, fileType = 'pdf') {
|
|
|
ctx.clip();
|
|
ctx.clip();
|
|
|
|
|
|
|
|
const s = Math.min(coord.width / img.width, coord.height / img.height);
|
|
const s = Math.min(coord.width / img.width, coord.height / img.height);
|
|
|
- const w = img.width * s;
|
|
|
|
|
|
|
+ let w = img.width * s;
|
|
|
const h = img.height * s;
|
|
const h = img.height * s;
|
|
|
- const x = coord.x + (coord.width - w) / 2;
|
|
|
|
|
|
|
+ let x = coord.x + (coord.width - w) / 2;
|
|
|
const y = coord.y + (coord.height - h) / 2;
|
|
const y = coord.y + (coord.height - h) / 2;
|
|
|
|
|
+ if(paperType == 'four'){
|
|
|
|
|
+ w = w / (724/840)
|
|
|
|
|
+ x = x * (724/840)
|
|
|
|
|
+ }
|
|
|
ctx.drawImage(img, x, y, w, h);
|
|
ctx.drawImage(img, x, y, w, h);
|
|
|
ctx.restore();
|
|
ctx.restore();
|
|
|
}
|
|
}
|
|
@@ -1786,7 +1792,7 @@ exportPagesAsImages(paperType = "a4", name, fileType = 'pdf') {
|
|
|
ctx.lineJoin = 'round';
|
|
ctx.lineJoin = 'round';
|
|
|
|
|
|
|
|
// 页面全局偏移(核心修正)
|
|
// 页面全局偏移(核心修正)
|
|
|
- const pageOffsetX = pageIndex * (pageWidth + this.pageMargin);
|
|
|
|
|
|
|
+ const pageOffsetX = pageIndex * (this.pageWidth + this.pageMargin);
|
|
|
|
|
|
|
|
// 绘制连线
|
|
// 绘制连线
|
|
|
ctx.beginPath();
|
|
ctx.beginPath();
|