-
-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { type Application as PixiApplication } from 'pixi.js'; | ||
import { roots } from '../../src/core/roots'; | ||
import { type Root } from '../../src/typedefs/Root'; | ||
|
||
export function getAppRoot(app: PixiApplication) | ||
{ | ||
let root: Root | undefined; | ||
|
||
for (const oRoot of roots.values()) | ||
{ | ||
if (oRoot.applicationState.app === app) | ||
{ | ||
root = oRoot; | ||
break; | ||
} | ||
} | ||
|
||
return root; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { type Application as PixiApplication } from 'pixi.js'; | ||
import { getAppRoot } from './getAppRoot'; | ||
|
||
export function isAppMounted(app: PixiApplication) | ||
{ | ||
if (app.stage === null) | ||
{ | ||
return false; | ||
} | ||
|
||
if (app.renderer === null) | ||
{ | ||
return false; | ||
} | ||
|
||
if (typeof getAppRoot(app) === 'undefined') | ||
{ | ||
return false; | ||
} | ||
|
||
return true; | ||
} |