Skip to content

Commit

Permalink
PR review additions/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Feb 14, 2024
1 parent 0a6526a commit 905b603
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 29 deletions.
7 changes: 5 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
- Open arcs are no longer modified for anchors, invalid border anchors will panic.
- Grids now actually support border anchors.

## Plot
- Fixed annotation bounds calculation
## Libs
### Plot
- The default style of plots changed
- New style keys for enabling/disabling the shared zero tick for "school-book" style plots
- New style keys for specifying the layer of different plot elements (`grid-layer`, `axis-layer`, `background-layer`)

## Misc
- The `hide` function now support an additional `bounds:` parameter to enable canvas bounds adjustment for hidden elements
Expand Down
25 changes: 1 addition & 24 deletions src/draw/grouping.typ
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,6 @@

#import "transformations.typ": move-to

// Returns body if of type array, an
// empty array if body is none or
// the result of body called with ctx if of type
// function. A function result of none will return
// an empty array.
#let resolve-body(ctx, body) = {
assert(body == none or type(body) in (array, function),
message: "Body must be of type array, function or none")

let body = if type(body) == function {
body(ctx)
} else {
body
}

return if body == none {
()
} else {
assert(type(body) == array)
body
}
}

/// Hides an element.
///
/// Hidden elements are not drawn to the canvas, are ignored when calculating bounding boxes and discarded by `merge-path`. All
Expand Down Expand Up @@ -135,7 +112,7 @@
message: "No such element '" + elem + "' in elements " + repr(ctx.nodes.keys()))
named-drawables.push(ctx.nodes.at(elem).drawables)
} else {
for sub in resolve-body(ctx, elem) {
for sub in elem {
let sub-drawables = ()
(ctx: ctx, drawables: sub-drawables, ..) = process.element(ctx, sub)
if sub-drawables != none and sub-drawables != () {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/axes.typ
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
// - right (axis): Right axis
// - top (axis): Top axis
// - name (string): Object name
// - draw-unset (bool): Draw unset axes
// - draw-unset (bool): Draw axes that are set to `none`
// - ..style (any): Style
#let scientific(size: (1, 1),
left: none,
Expand Down
Binary file modified tests/axes/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/axes/test.typ
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

set-style(axes: (
stroke: blue,
padding: .75,
padding: .25,
x: (stroke: red),
y: (stroke: green, tick: (stroke: blue, length: .3))
))
Expand All @@ -31,7 +31,7 @@
angle: -45deg,
anchor: "north-west"), length: -.1))))
axes.scientific(size: (6, 6),
frame: auto,
draw-unset: false,
top: none,
bottom: axes.axis(min: -1, max: 1, ticks: (step: 1, minor-step: auto,
grid: "both", unit: [ units])),
Expand Down
Binary file added tests/group/none/ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/group/none/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions tests/group/none/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *
#import "/tests/helper.typ": *

#test-case({
import draw: *

group({})
})

0 comments on commit 905b603

Please sign in to comment.