question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why DisplayObject or Container doesn't have `anchor` property?

See original GitHub issue

Sometimes I need to have a container centered, while do not want to use specific width/height value.

But I find that PIXI#Container (or DisplayObject in fact) doesn’t have anchor, so how can i make it centered without width/height ?

or, is it possible to write a .setPosition(w, h) method, whose w/h ranges between 0-1 ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
themoonratcommented, Nov 11, 2016

“anchor” is a concept for textures only; Containers and Display Objects do not have textures so do not have this property. Instead, you can use the property “pivot”, which works on pixel values rather than percentages.

Example: https://pixijs.github.io/examples/#/basics/container-pivot.js

1reaction
ivanpopelyshevcommented, Dec 5, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

C# Anchor property doesn't seem to work - Stack Overflow
For example, I have two buttons in bottom right corner of a form - they are on the form, no containers or anything...
Read more >
How to dock and anchor controls - Windows Forms .NET
Anchor a control​​ A control is anchored to an edge by setting its Anchor property to one or more values. Certain controls, such...
Read more >
PIXI.Container - PixiJS API Documentation
Container is a general-purpose display object that holds children. ... Sets the default value for the container property sortableChildren .
Read more >
Screen Components: Anchor Bar and Anchor Target
The Anchor Bar is set to use a Scrolling Container, but no container with the specified ID exists in the Workspace. In such...
Read more >
Object Page Floorplan | SAP Fiori Design Guidelines
The object page floorplan is used to display and categorize all ... An object page with only one section doesn't have an anchor...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found