This commit is contained in:
parent
9900a4801a
commit
11f72ed309
2 changed files with 26 additions and 14 deletions
16
.github/workflows/deploy.yml
vendored
16
.github/workflows/deploy.yml
vendored
|
@ -33,17 +33,17 @@ jobs:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v2
|
- uses: https://code.forgejo.org/actions/checkout@v2
|
||||||
name: Checkout Files
|
name: Checkout Files
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: ${{ matrix.node-version }}
|
||||||
cache: 'npm'
|
cache: 'pnpm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: pnpm install
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Upload Build
|
- name: Upload Build
|
||||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||||
|
|
24
src/main.js
24
src/main.js
|
@ -135,8 +135,8 @@ function mouseAction() {
|
||||||
|
|
||||||
const DOMpointer = document.getElementById("pointer")
|
const DOMpointer = document.getElementById("pointer")
|
||||||
|
|
||||||
DOMpointer.style.left = mouseBody.position[0] * SCALE + "px"
|
DOMpointer.style.left = mouseBody.interpolatedPosition[0] * SCALE + "px"
|
||||||
DOMpointer.style.top = -mouseBody.position[1] * SCALE + "px"
|
DOMpointer.style.top = -mouseBody.interpolatedPosition[1] * SCALE + "px"
|
||||||
|
|
||||||
// if (mouseEvent.button == 2) {
|
// if (mouseEvent.button == 2) {
|
||||||
// mouseBody.position = [mouseEvent.clientX / SCALE, mouseEvent.clientY / SCALE]
|
// mouseBody.position = [mouseEvent.clientX / SCALE, mouseEvent.clientY / SCALE]
|
||||||
|
@ -163,15 +163,27 @@ function resizeWindow() {
|
||||||
// console.log(delta)
|
// console.log(delta)
|
||||||
bodies.forEach(element => {
|
bodies.forEach(element => {
|
||||||
element.physics.wakeUp()
|
element.physics.wakeUp()
|
||||||
|
|
||||||
|
var rect = element.dom.getBoundingClientRect();
|
||||||
|
|
||||||
|
element.physics.shapes[0].width = rect.width / SCALE
|
||||||
|
|
||||||
|
element.physics.shapes[0].height = rect.height / SCALE
|
||||||
|
|
||||||
|
if (delta.top !== 0 || delta.left !== 0) {
|
||||||
|
element.physics.applyForce([delta.top/SCALE, delta.left/SCALE], element.physics.position)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const height = window.innerHeight;
|
|
||||||
|
|
||||||
const adjustment = Math.round(-height - planeBottomBody.position[1]*SCALE)
|
const adjustmentBottom = Math.round(-window.innerHeight - planeBottomBody.position[1]*SCALE)
|
||||||
|
|
||||||
console.log(adjustment/SCALE)
|
const adjustmentRight = Math.round(window.innerWidth - planeRightBody.position[0]*SCALE)
|
||||||
|
|
||||||
|
// console.log(adjustment/SCALE)
|
||||||
|
|
||||||
planeBottomBody.velocity = [0, -Math.max(-adjustment/SCALE * 30, -20)]
|
planeBottomBody.velocity = [0, -Math.max(-adjustmentBottom/SCALE * 30, -20)]
|
||||||
|
planeRightBody.velocity = [Math.min(adjustmentRight/SCALE * 30, 20), 0]
|
||||||
|
|
||||||
currentWindowSize = {
|
currentWindowSize = {
|
||||||
x: window.screenLeft,
|
x: window.screenLeft,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue