Skip to content

Commit

Permalink
fix: Properties when not using __PIXI_APP__
Browse files Browse the repository at this point in the history
`let mode` was declared outside the injected code. Fixes #117

Also added _lastObjectRendered as  scene fallback, making the `globalThis.__PIXI_STAGE__ = yourContainer;` also optional in Pixi v5.x
  • Loading branch information
Bob Fanger committed Apr 18, 2023
1 parent e108d0a commit 7f1afcf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion apps/chrome-extension/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "PixiJS Devtools",
"description": "Debug games and apps written with PixiJS",
"version": "2.6.0",
"version": "2.6.1",
"devtools_page": "pixi-devtools.html",
"icons": {
"16": "icon.png",
Expand Down
2 changes: 1 addition & 1 deletion apps/firefox-extension/src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "PixiJS Devtools",
"description": "Debug games and apps written with PixiJS",
"version": "2.6.0",
"version": "2.6.1",
"devtools_page": "pixi-devtools.html",
"icons": {
"48": "icon.png",
Expand Down
9 changes: 6 additions & 3 deletions packages/pixi-panel/src/pixi-devtools/pixiDevtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ type EventDetail = {
activate: UniversalNode | undefined;
};

let mode: "PIXI" | "PHASER" | undefined;
export default function pixiDevtools() {
const eventTarget = new EventTarget();
const win = window as any;

let mode: "PIXI" | "PHASER" | undefined;

function getGlobal(varname: string) {
if (win[varname]) {
return win[varname];
Expand Down Expand Up @@ -57,11 +58,13 @@ export default function pixiDevtools() {
}
const renderer = getGlobal("__PIXI_RENDERER__");
if (renderer) {
return renderer.lastObjectRendered;
// eslint-disable-next-line no-underscore-dangle
return renderer.lastObjectRendered ?? renderer._lastObjectRendered;
}
const patched = getGlobal("__PATCHED_RENDERER__");
if (patched) {
return patched.lastObjectRendered;
// eslint-disable-next-line no-underscore-dangle
return patched.lastObjectRendered ?? patched._lastObjectRendered;
}
return undefined;
},
Expand Down

0 comments on commit 7f1afcf

Please sign in to comment.