Skip to content

Commit

Permalink
fix(checkbox): checked padding
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Apr 2, 2024
1 parent c92efa0 commit 8b58ad1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/checkbox/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ function draw(rc: RoughSVG, svg: SVGSVGElement) {
svg.appendChild(rectangle)
}
if (internalChecked) {
// actual padding: [checkedPadding / 2, checkedPadding, checkedPadding * 3 / 2, checkedPadding]
const checkedPadding = padding + 2
const checkedStrokeWidth = getLengthProperty(svg, '--r-checkbox-checked-width') ?? 0
const linearPath = rc.linearPath([
[padding, height / 2],
[width / 2, height - padding],
[width - padding, padding],
[checkedPadding, checkedPadding / 2 + (height - checkedPadding * 2) * 2 / 3],
[checkedPadding + (width - checkedPadding * 2) / 3, height - checkedPadding * 3 / 2],
[width - checkedPadding, checkedPadding / 2 + (height - checkedPadding * 2) / 3],
], {
stroke: 'var(--r-checkbox-checked-color)',
strokeWidth: checkedStrokeWidth,
Expand Down

0 comments on commit 8b58ad1

Please sign in to comment.