Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Txt Nodes can't tranform position when they're placed inside another Txt node #1132

Open
IntangibleMatter opened this issue Nov 13, 2024 · 1 comment
Labels
a-2d Relates to the 2d package b-enhancement New feature or request c-accepted The issue is ready to be worked on

Comments

@IntangibleMatter
Copy link

Describe the bug
When a Txt node is set as a child of another node (Txt is known to have this issue, there may be others but I haven't tested enough), its position will not update if modified.

To Reproduce

export default makeScene2D(function* (view) {
  const text = createRef<Txt>();
  const text_split = createRefArray<Txt>();
  view.add(
    <BTxt
      ref={text}
      fontSize={150}
      textAlign={"center"}
      position={[0, 0]}
    >
      {"This is a test".split(" ").map((word) => (
        <Txt
          ref={text_split}
          text={word + " "}
          opacity={0}
          y={16}
          scale={[0.6, 1.5]}
          offsetY={1}
        />
      ))}
    </BTxt>,
  );
  yield* sequence(
    0.1,
    ...text_split.map((word) =>
      any(
        word.opacity(1, 0.12), // works
        word.scale([1, 1], 0.12), // works
        word.position.y(0, 0.12), // doesn't change anything
        word.offset.y(0, 0.12), // doesn't change anything
      ),
    ),
  );
});

Expected behavior

The text should be able to change its position or offset, but it doesn't

Package versions:
Click on the version in the bottom right corner to copy the versions

  • core: 3.17.0
  • two: 3.17.1
  • ui: 3.17.0
  • vitePlugin: 3.17.0

Additional context

This makes it nearly impossible to animate "nice text transitions" like those seen commonly in games for dialogue.

@IntangibleMatter IntangibleMatter added the b-bug Something isn't working label Nov 13, 2024
@aarthificial aarthificial added b-enhancement New feature or request c-accepted The issue is ready to be worked on a-2d Relates to the 2d package and removed b-bug Something isn't working labels Feb 8, 2025
@aarthificial aarthificial removed their assignment Feb 8, 2025
@aarthificial
Copy link
Contributor

With the current layout system, if the layout is enabled it will take control over the position of a node (Txt has the layout enabled by default)
This is more of a limitation so I'm changing this from a bug to enhancement but it would be nice to have a way to additionally "offset" the position inside of the layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-2d Relates to the 2d package b-enhancement New feature or request c-accepted The issue is ready to be worked on
Projects
None yet
Development

No branches or pull requests

2 participants