Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
Improve CanvasRenderer support and fix filter imports (#22)
Browse files Browse the repository at this point in the history
* Fix import syntax for filter packages

* Register InteractionManager also for CanvasRenderer

* Avoid duplicate class imports for CanvasRenderer plugins
  • Loading branch information
frederic-schwarz authored Jul 9, 2020
1 parent 44d168e commit 3eb065c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CodeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ function rendererPlugin(rendererName:string, {name, rendererPlugin, canvasPlugin
`${rendererName}.registerPlugin('${apiName}', ${namespace}.${className})`
];
}
// avoid duplicate class imports for CanvasRenderer plugins
else if (rendererName === 'CanvasRenderer' && rendererPlugin && rendererPlugin[1] === className) {
return [
`${rendererName}.registerPlugin('${apiName}', ${className})`
];
}
else {
return [
`import { ${className} } from '${name}'`,
Expand Down Expand Up @@ -113,7 +119,7 @@ export function createBundleCode(packages:string[]) {
filters.forEach(pkg => {
const imports = pkg.filter.join(', ');
filterNames.push(imports);
lines.push(`import { ${imports} } from '${pkg.name}' }`);
lines.push(`import { ${imports} } from '${pkg.name}'`);
});
lines.push(`export const filters = {\n ${filterNames.join(',\n ')}\n}`);
}
Expand Down
1 change: 1 addition & 0 deletions src/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
{
"name": "@pixi/interaction",
"rendererPlugin": ["interaction", "InteractionManager"],
"canvasPlugin": ["interaction", "InteractionManager"],
"dependencies": ["@pixi/display"]
},
{
Expand Down

0 comments on commit 3eb065c

Please sign in to comment.