Skip to content

Commit b1199bb

Browse files
authored
Merge pull request #428 from cuire/v5
✨✨✨ V5 ✨✨✨
2 parents 50b452f + 9eab62c commit b1199bb

File tree

20 files changed

+577
-3908
lines changed

20 files changed

+577
-3908
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: '16'
17+
- name: ⏬ Install dependencies
18+
run: yarn install --frozen-lockfile
19+
- name: ✨ Lint
20+
run: yarn lint
21+
- name: 🦾 Build Lib
22+
run: yarn build

.github/workflows/gh-pages.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: [$default-branch, "v5-gh-pages"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow one concurrent deployment
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: true
22+
23+
jobs:
24+
# Single deploy job since we're just deploying
25+
build:
26+
environment:
27+
name: github-pages
28+
url: ${{ steps.deployment.outputs.page_url }}
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- name: Setup Node
34+
uses: actions/setup-node@v3
35+
with:
36+
node-version: "16"
37+
- name: ⏬ Install dependencies
38+
run: yarn install --frozen-lockfile
39+
- name: 🦾 Build Lib and Docs
40+
run: yarn prepublishOnly
41+
- name: Setup Pages
42+
uses: actions/configure-pages@v3
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v1
45+
with:
46+
path: './docs/dist'
47+
deploy:
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
needs: build
53+
steps:
54+
- name: Deploy to GitHub Pages
55+
id: deployment
56+
uses: actions/deploy-pages@v1

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn pre-commit

.lintstagedrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"src/**/*.+(ts)": [
3+
"eslint . --fix"
4+
]
5+
}

.npmignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
*.log
3+
.nyc_output
4+
*.iml
5+
.idea
6+
.DS_Store
7+
compile
8+
js

README.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ With your support, I can make pixi-viewport even better! Please consider making
1111
<img src="https://opencollective.com/pixi-viewport/donate/[email protected]?color=blue" width=300 style="margin-top: 0.5rem; display: block"/>
1212
</a>
1313

14+
## v5+
15+
Moves pixi-viewport to pixi.js v7 (thanks [@cuire](https://github.com/cuire)!).
16+
17+
NOTE: there is a breaking change since pixi-viewport moved to pixi's new event system. `options.interaction` is removed and you need pass `options.events` to the viewport for it to work properly. The events object can be found at pixi's `renderer.events` or `app.renderer.events`.
18+
19+
```js
20+
const viewport = new Viewport({ events: renderer.events });
21+
22+
// or
23+
// const viewport = new Viewport({ events: app.renderer.events });
24+
```
25+
1426
## v4.30.0+
1527
This project was migrated to Typescript (thanks [@ShukantPal](https://github.com/ShukantPal)!). All functionality should be the same. The live Example has been updated.
1628

@@ -40,7 +52,7 @@ const viewport = new Viewport({
4052
worldWidth: 1000,
4153
worldHeight: 1000,
4254

43-
interaction: app.renderer.plugins.interaction // the interaction module is important for wheel to work properly when renderer.view is placed or scaled
55+
events: app.renderer.events // the interaction module is important for wheel to work properly when renderer.view is placed or scaled
4456
})
4557

4658
// add the viewport to the stage
@@ -118,9 +130,6 @@ viewport.plugins.add('name', plugin, index)
118130

119131
PRs are more than welcome!
120132

121-
## v4.30.0+
122-
This project was migrated to Typescript (thanks [@sukantpal](https://github.com/SukantPal)!). All functionality should be the same. The live Example has been updated.
123-
124133
## Other Libraries
125134
If you liked pixi-viewport, please try my other open source libraries:
126135
* [pixi-scrollbox](https://github.com/davidfig/pixi-scrollbox) - pixi.js scrollbox: a masked box that can scroll vertically or horizontally with scrollbars (uses pixi-viewport)
@@ -129,4 +138,4 @@ If you liked pixi-viewport, please try my other open source libraries:
129138

130139
## license
131140
MIT License
132-
(c) 2021 [YOPEY YOPEY LLC](https://yopeyopey.com/) by David Figatner ([email protected])
141+
(c) 2023 [YOPEY YOPEY LLC](https://yopeyopey.com/) by David Figatner ([email protected])

api-extractor.json

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
{
4747
name: 'viewport.min.js',
4848
type: 'script',
49-
content: await load('viewport.min.js'),
49+
content: await load('pixi_viewport.umd.cjs'),
5050
}
5151
],
5252
links: [{
5353
name: 'PIXI',
54-
url: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/6.0.2/browser/pixi.js',
54+
url: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.1.2/pixi.min.js',
5555
}],
5656
console: false,
5757
})

docs/public/sample/viewport.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function create(renderer) {
2727
// forceHitArea: null, // change the default hitArea from world size to a new value
2828
// noTicker: false, // set this if you want to manually call update() function on each frame
2929
// ticker: PIXI.Ticker.shared, // use this PIXI.ticker for updates
30-
interaction: renderer.plugins.interaction, // InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer position relative to canvas location on screen
30+
events: renderer.events, // Events - used to calculate pointer position relative to canvas location on screen
3131
// divWheel: null, // div to attach the wheel event (uses document.body as default)
3232
// disableOnContextMenu: false, // remove oncontextmenu=() => {} from the divWheel element
3333
})

0 commit comments

Comments
 (0)