mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Deformed stroke for some length values fix (#3860)
This commit is contained in:
parent
e5f79c8ef9
commit
cc46267be3
@ -1108,7 +1108,7 @@ impl ControlPoints {
|
||||
+ 2.0 * (o.y - c_i.y).to_raw() * (c_i.y - c_o.y).to_raw();
|
||||
let c = (c_i.x - c_o.x).to_raw().powi(2) + (c_i.y - c_o.y).to_raw().powi(2)
|
||||
- r.to_raw().powi(2);
|
||||
let t = (-b + (b * b - 4.0 * a * c).sqrt()) / (2.0 * a);
|
||||
let t = (-b + (b * b - 4.0 * a * c).max(0.0).sqrt()) / (2.0 * a);
|
||||
c_i + t * (o - c_i)
|
||||
}
|
||||
|
||||
|
BIN
tests/ref/bugs/3700-deformed-stroke.png
Normal file
BIN
tests/ref/bugs/3700-deformed-stroke.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 144 B |
11
tests/typ/bugs/3700-deformed-stroke.typ
Normal file
11
tests/typ/bugs/3700-deformed-stroke.typ
Normal file
@ -0,0 +1,11 @@
|
||||
// Test shape fill & stroke for specific values that used to make the stroke
|
||||
// deformed.
|
||||
// https://github.com/typst/typst/issues/3700
|
||||
|
||||
---
|
||||
#rect(
|
||||
radius: 1mm,
|
||||
width: 100%,
|
||||
height: 10pt,
|
||||
stroke: (left: rgb("46b3c2") + 16.0mm),
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user