MCPcopy Create free account
hub / github.com/32comic/image2pixel-web / drawExportGrid

Method drawExportGrid

pixelizer.js:897–918  ·  view source on GitHub ↗
(canvas, scale)

Source from the content-addressed store, hash-verified

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');

Callers 2

exportPNGMethod · 0.95
printResultMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected