18 lines
599 B
TypeScript
18 lines
599 B
TypeScript
import { PAPER_SIZE } from './constant';
|
|
|
|
export function setCanvasSize(canvas: Canvas, paperSize: PaperSize) {
|
|
const sizeObj = PAPER_SIZE[paperSize];
|
|
// const { pixelRatio: dpr, windowWidth, windowHeight } = wx.getWindowInfo();
|
|
// const printWidth = A4.width;
|
|
// const printHeight = A4.height;
|
|
// @ts-ignore
|
|
// const originWidth = canvas._width || windowWidth;
|
|
// // @ts-ignore
|
|
// const originHeight = canvas._height || windowHeight;
|
|
|
|
canvas.width = sizeObj.width;
|
|
canvas.height = sizeObj.height;
|
|
console.log('canvas----:', canvas);
|
|
return canvas;
|
|
}
|