Jump to content

Drawing a line is not being displayed


zlobul
 Share

Recommended Posts

Its not a bug. I'm pasting the answer here as well :

This is working as intended. The issue here is this line: line.position.set(200,100) and your element being detached (not added to any tree).

The API generateTexture uses getLocalBounds for determining the region to render. If you are using a detached element like in your cases, you have a few options:

Remove setting the position

// line.position.set(200,100)
let texture = app.renderer.generateTexture(line)

Add the line, then remove it

app.stage.addChild(line);
let texture = app.renderer.generateTexture(line);
app.stage.removeChild(line);

Manually provide the region

let texture = app.renderer.generateTexture(line, undefined, undefined, line.getBounds());
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...