Skip to content

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

Closed

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

Activity

  1. added
    bug
    on Aug 1, 2023
  2. added
    layout
    on Sep 4, 2023
  3. added
    needs-investigation
    on Nov 14, 2023
  4. added
    introspection
    and removed on Nov 24, 2023
  5. changed the title [-]place() / move() inside locate() shifts the returned position[/-] [+]`place()` / `move()` inside `locate()` shifts the returned position[/+] on Jul 16, 2024
  6. removed
    needs-investigation
    on Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugintrospectionlayout

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions