Skip to content

Commit 9e8117e

Browse files
committed
Address review: scope perspective flag and quote near
1 parent 28d3b1e commit 9e8117e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/draw/projection.typ

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@
167167
(ctx => {
168168
let transform = ctx.transform
169169
let perspective-mode = type(projection-matrix) == function
170+
let previous-perspective-mode = ctx.at("_perspective-projection", default: false)
170171
if perspective-mode {
171-
ctx.shared-state.insert("_perspective-projection", true)
172+
ctx._perspective-projection = true
172173
}
173174
ctx.transform = view-matrix
174175

@@ -189,7 +190,7 @@
189190

190191
ctx.transform = transform
191192
if perspective-mode {
192-
ctx.shared-state.insert("_perspective-projection", false)
193+
ctx._perspective-projection = previous-perspective-mode
193194
}
194195
if not reset-transform {
195196
drawables = drawable.apply-transform(ctx.transform, drawables)
@@ -317,7 +318,7 @@
317318
/// Coordinates are transformed by a view matrix and then projected with
318319
/// perspective division:
319320
/// $x' = (d_"ref" * x) / w$ and $y' = (d_"ref" * y) / w$,
320-
/// where $w = max(-z, near)$ in view space.
321+
/// where $w = max(-z, "near")$ in view space.
321322
///
322323
/// By default this uses the same isometric camera angles as `ortho`, but with
323324
/// perspective foreshortening.

src/mark.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@
358358
let distance = (0, 0)
359359
let snap-to = (none, none)
360360
let drawables = ()
361-
let perspective-mode = ctx.shared-state.at("_perspective-projection", default: false)
361+
let perspective-mode = ctx.at("_perspective-projection", default: false)
362362

363363
if style == none {
364364
style = (start: none, end: none, symbol: none)

0 commit comments

Comments
 (0)