diff --git a/factors/smooth-corners.js b/factors/smooth-corners.js index 53dd029..cb21401 100644 --- a/factors/smooth-corners.js +++ b/factors/smooth-corners.js @@ -4,19 +4,23 @@ class SmoothCorners { } paint(ctx, geom, properties) { - const radius = parseFloat(properties.get('--smooth-radius')) || 20; - const width = geom.width; - const height = geom.height; + try { + const radius = parseFloat(properties.get('--smooth-radius')) || 20; + const width = geom.width; + const height = geom.height; - ctx.fillStyle = 'black'; - ctx.beginPath(); - ctx.moveTo(radius, 0); - ctx.arcTo(width, 0, width, height, radius); - ctx.arcTo(width, height, 0, height, radius); - ctx.arcTo(0, height, 0, 0, radius); - ctx.arcTo(0, 0, width, 0, radius); - ctx.closePath(); - ctx.fill(); + ctx.fillStyle = 'black'; + ctx.beginPath(); + ctx.moveTo(radius, 0); + ctx.arcTo(width, 0, width, height, radius); + ctx.arcTo(width, height, 0, height, radius); + ctx.arcTo(0, height, 0, 0, radius); + ctx.arcTo(0, 0, width, 0, radius); + ctx.closePath(); + ctx.fill(); + } catch (error) { + console.error('SmoothCorners Paint API Error:', error); + } } }