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.

Container issue with `updateTransform`

See original GitHub issue

Hello, I don’t know if I’m doing things wrong or it’s a bug.

Basic information

  • PixiJS version: 4.4.3

Description

When a class extends PIXI.Container, it’s possible to use the updateTransform hook. But if inside the constructor you modify a PIXI.Container property, it will stop the construction of the object and will call updateTransform.

Thing is, if you read, for example, the same property setted on the constructor, it will create an infinite loop.

Here is a live example: http://codepen.io/lgraziani/pen/aJjwNZ?editors=0011

This is the basic class example:

class BunnyContainer extends PIXI.Container {
  constructor() {
    super();
    
    // PIXI.Container prop
    this.width = 100;

    // It will never reach here
    this.bunny = PIXI.Sprite.fromImage('http://pixijs.github.io/examples/required/assets/basics/bunny.png');
    this.bunny.anchor.x = 0.5;
    this.bunny.anchor.x = 0.5;
    this.bunny.position.y = this.bunny.position.x = 50;
    
    
    this.addChild(this.bunny);
  }
  updateTransform() {
    const bunnyPosition = this.width * 0.1;
    
    // It will never reach here
    this.bunny.position.x = bunyPosition;
  }
}

If is there anything I can help just tell me 😃

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ivanpopelyshevcommented, Mar 26, 2017

spine uses updateTransform to animate some parts so its ok. just dont use “width” property, use some other name

1reaction
andrewstartcommented, Mar 26, 2017

Because updateTransform is intended to prepare the object for rendering, you probably don’t want to be reading or changing the display tree within it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global shipping industry faces a new problem — too many ...
While there was a shortage of containers at the height of the Covid pandemic, the global economy is now facing the opposite problem:...
Read more >
Can't run/start any docker container after update #597 - GitHub
I am not able to start any container after the update. Also a downgrade to 18.09.1 does not work :-( A general Ubuntu...
Read more >
You might encounter issues when using Windows Server ...
You might encounter issues using Windows Server containers if the container host or container image has the February 11, 2020 security update, ...
Read more >
docker container update
docker container update: Update configuration of one or more containers.
Read more >
Why does the current container shortage happen?
What are the reasons for the container shortage? · Cause 1: Reduced number of available containers - The unprecedented reduction of the world...
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