Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: ⏬ Install dependencies
run: yarn install --frozen-lockfile
- name: ✨ Lint
run: yarn lint
- name: 🦾 Build Lib
run: yarn build
56 changes: 56 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch, "v5-gh-pages"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
build:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: ⏬ Install dependencies
run: yarn install --frozen-lockfile
- name: 🦾 Build Lib and Docs
run: yarn prepublishOnly
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './docs/dist'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn pre-commit
5 changes: 5 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"src/**/*.+(ts)": [
"eslint . --fix"
]
}
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
*.log
.nyc_output
*.iml
.idea
.DS_Store
compile
js
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ With your support, I can make pixi-viewport even better! Please consider making
<img src="https://opencollective.com/pixi-viewport/donate/[email protected]?color=blue" width=300 style="margin-top: 0.5rem; display: block"/>
</a>

## v5+
Moves pixi-viewport to pixi.js v7 (thanks [@cuire](https://github.com/cuire)!).

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`.

```js
const viewport = new Viewport({ events: renderer.events });

// or
// const viewport = new Viewport({ events: app.renderer.events });
```

## v4.30.0+
This project was migrated to Typescript (thanks [@ShukantPal](https://github.com/ShukantPal)!). All functionality should be the same. The live Example has been updated.

Expand Down Expand Up @@ -40,7 +52,7 @@ const viewport = new Viewport({
worldWidth: 1000,
worldHeight: 1000,

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

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

PRs are more than welcome!

## v4.30.0+
This project was migrated to Typescript (thanks [@sukantpal](https://github.com/SukantPal)!). All functionality should be the same. The live Example has been updated.

## Other Libraries
If you liked pixi-viewport, please try my other open source libraries:
* [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)
Expand All @@ -129,4 +138,4 @@ If you liked pixi-viewport, please try my other open source libraries:

## license
MIT License
(c) 2021 [YOPEY YOPEY LLC](https://yopeyopey.com/) by David Figatner ([email protected])
(c) 2023 [YOPEY YOPEY LLC](https://yopeyopey.com/) by David Figatner ([email protected])
44 changes: 0 additions & 44 deletions api-extractor.json

This file was deleted.

4 changes: 2 additions & 2 deletions docs/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
{
name: 'viewport.min.js',
type: 'script',
content: await load('viewport.min.js'),
content: await load('pixi_viewport.umd.cjs'),
}
],
links: [{
name: 'PIXI',
url: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/6.0.2/browser/pixi.js',
url: 'https://cdnjs.cloudflare.com/ajax/libs/pixi.js/7.1.2/pixi.min.js',
}],
console: false,
})
Expand Down
2 changes: 1 addition & 1 deletion docs/public/sample/viewport.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function create(renderer) {
// forceHitArea: null, // change the default hitArea from world size to a new value
// noTicker: false, // set this if you want to manually call update() function on each frame
// ticker: PIXI.Ticker.shared, // use this PIXI.ticker for updates
interaction: renderer.plugins.interaction, // InteractionManager, available from instantiated WebGLRenderer/CanvasRenderer.plugins.interaction - used to calculate pointer position relative to canvas location on screen
events: renderer.events, // Events - used to calculate pointer position relative to canvas location on screen
// divWheel: null, // div to attach the wheel event (uses document.body as default)
// disableOnContextMenu: false, // remove oncontextmenu=() => {} from the divWheel element
})
Expand Down
2 changes: 1 addition & 1 deletion docs/src/code.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let _fps, _application, _viewport, _object, _stars = [], domEase
function viewport() {
_viewport = _application.stage.addChild(new Viewport(
{
interaction: _application.renderer.plugins.interaction,
events: _application.renderer.events,
passiveWheel: false,
stopPropagation: true
}))
Expand Down
Loading