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

Change positions for glyphs. #15

Open
paul-fedotov opened this issue Feb 2, 2017 · 2 comments
Open

Change positions for glyphs. #15

paul-fedotov opened this issue Feb 2, 2017 · 2 comments

Comments

@paul-fedotov
Copy link

Hello, I try to render text and I need to position it like a table. When I manually change the coordinates of the glyphs they don't change their position (don't rerender), but I can see in debugger that the coordinates have been changed successfully.

Best regards, Paul.

var geom = createText({
  text: '12345...N',
  lineHeight: 30,
  font: font, 
  width: 1200
});

var material = new THREE.RawShaderMaterial(SDFShader({
  map: texture,
  side: THREE.DoubleSide,
  transparent: true,
  color: 'rgb(0, 0, 0)'
}));

var text = new THREE.Mesh( geom, material );

geom.visibleGlyphs.forEach(function (glyph) {
  glyph.position[0] = newX;
  glyph.position[1] = newY;
});

geom.update();
@mattdesl
Copy link
Contributor

mattdesl commented Feb 2, 2017

You probably need to update the position attribute:

geom.getAttribute('position').needsUpdate = true;

😄

@paul-fedotov
Copy link
Author

Hello. Thank you for your reply. Unfortunately this does not help. Let me show what i'm trying to do

This is how i want my table to look

screenshot_2

In this example i've created seperate text objects for each cell.

This is how it looks for me when i try to use one text object and change the coordinates of the glyphs manualy to match the cell layout.

screenshot_3

The coordinates change is applied (i can see it in debugger) but the glyphs don't move.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants