fix
This commit is contained in:
@@ -298,41 +298,19 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
let submit = ()=>{
|
let submit = ()=>{
|
||||||
const newCanvas = document.createElement('canvas');
|
const newCanvas = document.createElement('canvas');
|
||||||
let exportCanvas = new fabric.Canvas(newCanvas, {
|
newCanvas.width = canvasImgData.width;
|
||||||
width: canvasImgData.width,
|
newCanvas.height = canvasImgData.height;
|
||||||
height:canvasImgData.height,
|
const newCtx = newCanvas.getContext('2d');
|
||||||
isDrawingMode: false, // 开启绘图模式
|
newCtx.drawImage(
|
||||||
});
|
canvas,
|
||||||
fabric.Image.fromURL(canvas.toDataURL('png'), function(img) {
|
0, 0,
|
||||||
img.scaleToWidth(exportCanvas.width);
|
canvas.width,
|
||||||
img.scaleToHeight(exportCanvas.height);
|
canvas.height,
|
||||||
img.set({
|
0, 0,
|
||||||
scaleX: exportCanvas.width / img.width,
|
newCanvas.width,
|
||||||
scaleY: exportCanvas.height / img.height
|
newCanvas.height
|
||||||
});
|
);
|
||||||
exportCanvas.setBackgroundImage(img, exportCanvas.renderAll.bind(exportCanvas));
|
emit('submitLiquefaction',newCanvas.toDataURL('image/png'))
|
||||||
let data = exportCanvas.toDataURL({
|
|
||||||
format: "png", // 导出格式为 PNG
|
|
||||||
quality: 1, // 图片质量为 1(最高质量)
|
|
||||||
});
|
|
||||||
},{ crossOrigin: "Anonymous" });
|
|
||||||
|
|
||||||
|
|
||||||
// newCanvas.width = canvasImgData.width;
|
|
||||||
// newCanvas.height = canvasImgData.height;
|
|
||||||
// const newCtx = newCanvas.getContext('2d');
|
|
||||||
// newCtx.drawImage(
|
|
||||||
// canvas,
|
|
||||||
// 0, 0,
|
|
||||||
// canvas.width,
|
|
||||||
// canvas.height,
|
|
||||||
// 0, 0,
|
|
||||||
// newCanvas.width,
|
|
||||||
// newCanvas.height
|
|
||||||
// );
|
|
||||||
// console.log(exportCanvas.toDataURL('jpg'));
|
|
||||||
|
|
||||||
emit('submitLiquefaction',canvas.toDataURL('image/png'))
|
|
||||||
cancelDsign()
|
cancelDsign()
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user