Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Hello when using children on path for example the text on arc demo. Can the path information of individual characters be accessed? I've tried my best to break them apart or access internal arrays but haven't had any luck. I'm specifically looking for location and bounding box
Thanks
https://maker.js.org/playground/?script=text-on-path

You must be logged in to vote

Yes, you can get characters of a Text model by their index. I've added this to the end of the function:

This gets the first character by [0] , gets its bounding box, then creates a rectangle of it:

  const m = makerjs.measure.modelExtents(this.models.topText.models[0]);
  const bbox = new makerjs.models.Rectangle(m);
  this.models.bbox = bbox;

Replies: 1 comment · 2 replies

Comment options

Yes, you can get characters of a Text model by their index. I've added this to the end of the function:

This gets the first character by [0] , gets its bounding box, then creates a rectangle of it:

  const m = makerjs.measure.modelExtents(this.models.topText.models[0]);
  const bbox = new makerjs.models.Rectangle(m);
  this.models.bbox = bbox;

image

You must be logged in to vote
2 replies
@mcdonaldzachary
Comment options

I would have never guessed that's how you get those arrayed items. Thank you so much I'll give that a try . I'm sure it'll work great

@danmarshall
Comment options

That's good feedback, there should be more documentation for the Text model.

Answer selected by mcdonaldzachary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.