Jump to content

Drawing borders around objects


Chromical
 Share

Recommended Posts

I'm trying to draw borders around objects, currently sprites for best performance. Nothing too fancy, just some rectangular one colored sprites.

Currently I'm trying to have two extra containers with unfilled rects, the size of the sprites for the borders (two containers, because there's borders that have priority over the regular borders, in case they overlap), which works fine until I start to zoom, then borders naturally get thicker, the further I zoom in. I already found this thread, which seems to be the solution for my problem:

But I can't access the myGraphicsObject.geometry.graphicsData in TypeScript. .geometry exists, but .graphicsData does not. Have there been any changes to the object structure? We're currently on 6.0.1 and the thread seems to be covering version 5 and earlier.

Or is there a better solution to having a border that's always 1px on screen, independent of the zoom factor?

Thanks a lot

Link to comment
Share on other sites

But I can't access the myGraphicsObject.geometry.graphicsData in TypeScript

"as any"
 solves everything. If you see that typings lack something - make an issue or PR to pixijs github repo

is there a better solution to having a border that's always 1px on screen, independent of the zoom factor?

if its smoothed - special shaders is better solutions but its hard and nobody implemented Graphics fully with it

if its just 1px aliased - nativeLine, there's a param in pixi LineStyle

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...