(canvas, scale)
| 895 | } |
| 896 | |
| 897 | drawExportGrid(canvas, scale) { |
| 898 | const ctx = canvas.getContext('2d'); |
| 899 | |
| 900 | ctx.strokeStyle = 'rgba(0, 0, 0, 0.3)'; |
| 901 | ctx.lineWidth = 1; |
| 902 | |
| 903 | // 垂直线 |
| 904 | for (let x = 0; x < canvas.width; x += scale) { |
| 905 | ctx.beginPath(); |
| 906 | ctx.moveTo(x + 0.5, 0); |
| 907 | ctx.lineTo(x + 0.5, canvas.height); |
| 908 | ctx.stroke(); |
| 909 | } |
| 910 | |
| 911 | // 水平线 |
| 912 | for (let y = 0; y < canvas.height; y += scale) { |
| 913 | ctx.beginPath(); |
| 914 | ctx.moveTo(0, y + 0.5); |
| 915 | ctx.lineTo(canvas.width, y + 0.5); |
| 916 | ctx.stroke(); |
| 917 | } |
| 918 | } |
| 919 | |
| 920 | applyZoom(zoom) { |
| 921 | const zoomSlider = document.getElementById('previewZoom'); |
no outgoing calls
no test coverage detected