Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit

Permalink
chore: Update to support v8
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Dec 19, 2024
1 parent 500c8fc commit 5841537
Show file tree
Hide file tree
Showing 8 changed files with 11,022 additions and 19,288 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/build.yml → .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
name: Build CI
name: Automation
on:
push:
branches: [ '**' ]
tags: [ '**' ]
branches: ['**']
tags: ['**']
release:
types: [ 'created' ]
types: ['created']
pull_request:
branches: [ '**' ]
branches: ['**']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install npm
run: npm install -g npm@8
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build
Expand Down
47 changes: 28 additions & 19 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,34 @@
</head>
<body>
<h1>Rectangle Helpers</h1>
<script src="https://pixijs.download/dev/pixi.min.js"></script>
<script src="../dist/pixi-rectangle-helpers.js"></script>
<script>
const app = new PIXI.Application({ background: '#999' });
document.body.appendChild(app.view);

const shape = new PIXI.Sprite(PIXI.Texture.WHITE);
shape.scale.set(10);
shape.x = (app.screen.width - shape.width) / 2;
shape.y = (app.screen.height - shape.height) / 2;

shape.interactive = true;
shape.cursor = 'pointer';
shape.onclick = () => {
const bounds = shape.getBounds();
// Expand the bounds by 10 pixels!
Object.assign(shape, bounds.expand(10));
};
app.stage.addChild(shape);
<script type="importmap">
{
"imports": {
"pixi.js": "https://cdn.jsdelivr.net/npm/pixi.js@8/dist/pixi.mjs",
"@pixi/rectangle-helpers": "../dist/pixi-rectangle-helpers.mjs"
}
}
</script>
<script type="module">
import { Application, Texture, Sprite, Rectangle } from 'pixi.js';
import '@pixi/rectangle-helpers';
const app = new Application();
await app.init({ background: '#999' });
document.body.appendChild(app.canvas);
app.stage.addChild(new Sprite({
texture: Texture.WHITE,
width: 100,
height: 100,
x: (app.screen.width - 100) / 2,
y: (app.screen.height - 100) / 2,
eventMode: 'static',
cursor: 'pointer',
onclick: (event) => {
const { rectangle } = event.target.getBounds();
// Expand the bounds by 10 pixels!
Object.assign(event.target, rectangle.expand(10));
}
}));
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* PixiJS uses a special global type object called GlobalMixins
* this can be used to add methods to existing PixiJS classes.
*/
declare namespace GlobalMixins {
declare namespace PixiMixins {
interface Rectangle {
expand(amount: number): this;
}
Expand Down
Loading

0 comments on commit 5841537

Please sign in to comment.