Skip to content

Commit

Permalink
FadeTilesRenderer: Fix fade events not firing correctly (#495)
Browse files Browse the repository at this point in the history
* Fix fade events not firing correctly

* Comments
  • Loading branch information
gkjohnson committed Mar 1, 2024
1 parent 70f981d commit 70c3268
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion example/fadingTiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,6 @@ function render() {

renderer.render( scene, camera );

params.fadingGroundTiles = groundTiles._fadeGroup.children.length + ' tiles';
params.fadingGroundTiles = groundTiles.fadingTiles + ' tiles';

}
8 changes: 7 additions & 1 deletion example/src/FadeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,13 @@ export class FadeManager {

} );

if ( fadeOut === 1.0 || fadeOut >= fadeIn ) {
// Check if the fade in and fade out animations are complete
const fadeOutComplete = fadeOut === 1 || fadeOut === 0;
const fadeInComplete = fadeIn === 1 || fadeIn === 0;

// If they are or the fade out animation is further along than the
// fade in animation then mark the fade as completed for this tile
if ( ( fadeOutComplete && fadeInComplete ) || fadeOut >= fadeIn ) {

this.completeFade( object );

Expand Down
6 changes: 6 additions & 0 deletions example/src/FadeTilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ export const FadeTilesRendererMixin = base => class extends base {

}

get fadingTiles() {

return this._fadeManager.fadeCount;

}

constructor( ...args ) {

super( ...args );
Expand Down

0 comments on commit 70c3268

Please sign in to comment.