Skip to content

place() / move() inside locate() shifts the returned position #1833

@raphCode

Description

@raphCode

Description

I discovered that using place() inside a call to locate() changes the position that is reported.
Minimal Repro:

#locate(loc => {
  //[text] // try uncommenting this
  place(right + bottom, circle())  // try commenting this line out
  [#loc.position()]
})

This reports coordinates which lie in the bottom right corner of the page.
I do not expect this behavior:
According to my understanding, locate() should capture the position at the time of the call, which is in the top left corner.

The problem only happens when the first content-creating call is place() or move().
Any subsequent place()/move() calls do not have an effect. Also placing text content first solves the problem.

Reproduction URL

No response

Operating system

Web app

Typst version

  • I am using the latest version of Typst

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingintrospectionRelated to the introspection categorylayoutRelated to the layout category, which is about composing, positioning, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions