core icon indicating copy to clipboard operation
core copied to clipboard

Is there any way to get the computed height and width of a TextClip or RichTextClip?

Open kasralodgy opened this issue 10 months ago • 2 comments

Take this code as an example:

const sdfdsf = new core.RichTextClip({
  text: 'Sweaty Staredown',
  x: 500,
  y: 500,
  styles: [{
    start: 3,
    style: {
      
    }
  }],
})
console.log("sdfdsf.width", sdfdsf.width)
await composition.add(sdfdsf)

What is printed on the dev console is actually the composition's width instead of the text clip's computed width. Though I know Clips differ from Sources (in which I can use width and height of a video source for example), but I wanted to know is there any way to do this on texts?

kasralodgy avatar Feb 20 '25 18:02 kasralodgy

You need to add the clip to the composition first before the width can be accessed

k9p5 avatar Feb 21 '25 12:02 k9p5