fix
This commit is contained in:
@@ -60,43 +60,7 @@ export const CanvasLayer: React.FC<CanvasLayerProps> = ({
|
||||
ctx.drawImage(img, 0, 0, width, height);
|
||||
ctx.restore();
|
||||
|
||||
// Render vector ops on top
|
||||
if (vectorOps && vectorOps.length > 0) {
|
||||
ctx.save();
|
||||
ctx.translate(0, height);
|
||||
ctx.scale(1, -1);
|
||||
ctx.strokeStyle = 'rgba(255, 0, 0, 0.5)';
|
||||
ctx.fillStyle = 'rgba(0, 0, 255, 0.2)';
|
||||
ctx.lineWidth = 1;
|
||||
|
||||
ctx.beginPath();
|
||||
for (const op of vectorOps) {
|
||||
if (op.op === 'm' && op.args && op.args.length === 2) {
|
||||
ctx.moveTo(op.args[0], op.args[1]);
|
||||
} else if (op.op === 'l' && op.args && op.args.length === 2) {
|
||||
ctx.lineTo(op.args[0], op.args[1]);
|
||||
} else if (op.op === 'c' && op.args && op.args.length === 6) {
|
||||
ctx.bezierCurveTo(op.args[0], op.args[1], op.args[2], op.args[3], op.args[4], op.args[5]);
|
||||
} else if (op.op === 're' && op.args && op.args.length === 4) {
|
||||
ctx.rect(op.args[0], op.args[1], op.args[2], op.args[3]);
|
||||
} else if (op.op === 'h') {
|
||||
ctx.closePath();
|
||||
} else if (op.op === 'S' || op.op === 's') {
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
} else if (op.op === 'f' || op.op === 'F') {
|
||||
ctx.fill();
|
||||
ctx.beginPath();
|
||||
} else if (op.op === 'B' || op.op === 'b') {
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
ctx.beginPath();
|
||||
} else if (op.op === 'n') {
|
||||
ctx.beginPath();
|
||||
}
|
||||
}
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
onRenderComplete?.(pageIndex);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user