mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Let line have an extent
This commit is contained in:
parent
2b26e08128
commit
6260878245
@ -96,7 +96,8 @@ impl Layout for LineNode {
|
||||
.zip(regions.base)
|
||||
.map(|(l, b)| l.relative_to(b));
|
||||
|
||||
let target = regions.expand.select(regions.first, Size::zero());
|
||||
let size = origin.max(origin + delta).max(Size::zero());
|
||||
let target = regions.expand.select(regions.first, size);
|
||||
|
||||
let mut frame = Frame::new(target);
|
||||
let shape = Geometry::Line(delta.to_point()).stroked(stroke);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.9 KiB |
@ -1,17 +1,16 @@
|
||||
// Test lines
|
||||
// Test lines.
|
||||
|
||||
---
|
||||
// Default line.
|
||||
#line()
|
||||
#set page(height: 60pt)
|
||||
#box({
|
||||
set line(stroke: 0.75pt)
|
||||
place(line(end: (0.4em, 0pt)))
|
||||
place(line(start: (0pt, 0.4em), end: (0pt, 0pt)))
|
||||
line(end: (0.6em, 0.6em))
|
||||
})
|
||||
Hello #line()!
|
||||
|
||||
---
|
||||
// Test the `end` argument.
|
||||
#{
|
||||
line(end: (10pt, 0pt))
|
||||
line(start: (0pt, 10pt), end: (0pt, 0pt))
|
||||
line(end: (15pt, 15pt))
|
||||
}
|
||||
#v(.5cm)
|
||||
#line(end: (70%, 50%))
|
||||
|
||||
---
|
||||
// Test the angle argument and positioning.
|
||||
@ -19,20 +18,21 @@
|
||||
#set page(fill: rgb("0B1026"))
|
||||
#set line(stroke: white)
|
||||
|
||||
#let star(width, ..args) = box(width: width, height: width)[
|
||||
#let star(size, ..args) = box(width: size, height: size)[
|
||||
#set text(spacing: 0%)
|
||||
#set line(..args)
|
||||
#set align(left)
|
||||
#line(length: +30%, start: (09.0%, 02%))
|
||||
#line(length: +30%, start: (38.7%, 02%), angle: -72deg)
|
||||
#line(length: +30%, start: (57.5%, 02%), angle: 252deg)
|
||||
#line(length: +30%, start: (57.3%, 02%))
|
||||
#line(length: -30%, start: (88.0%, 02%), angle: -36deg)
|
||||
#line(length: +30%, start: (73.3%, 48%), angle: 252deg)
|
||||
#line(length: -30%, start: (73.5%, 48%), angle: 36deg)
|
||||
#line(length: +30%, start: (25.4%, 48%), angle: -36deg)
|
||||
#line(length: +30%, start: (25.6%, 48%), angle: -72deg)
|
||||
#line(length: +32%, start: (8.50%, 02%), angle: 34deg)
|
||||
#v(30%)
|
||||
#place(line(length: +30%, start: (09.0%, 02%)))
|
||||
#place(line(length: +30%, start: (38.7%, 02%), angle: -72deg))
|
||||
#place(line(length: +30%, start: (57.5%, 02%), angle: 252deg))
|
||||
#place(line(length: +30%, start: (57.3%, 02%)))
|
||||
#place(line(length: -30%, start: (88.0%, 02%), angle: -36deg))
|
||||
#place(line(length: +30%, start: (73.3%, 48%), angle: 252deg))
|
||||
#place(line(length: -30%, start: (73.5%, 48%), angle: 36deg))
|
||||
#place(line(length: +30%, start: (25.4%, 48%), angle: -36deg))
|
||||
#place(line(length: +30%, start: (25.6%, 48%), angle: -72deg))
|
||||
#place(line(length: +32%, start: (8.50%, 02%), angle: 34deg))
|
||||
]
|
||||
|
||||
#align(center, grid(
|
||||
|
Loading…
x
Reference in New Issue
Block a user