Skip to content

Commit

Permalink
fix: requestPointerLock prevented clicks on arrow buttons
Browse files Browse the repository at this point in the history
Mentioned in #118
  • Loading branch information
bfanger committed Apr 27, 2023
1 parent 7f1afcf commit e917f03
Show file tree
Hide file tree
Showing 9 changed files with 407 additions and 354 deletions.
2 changes: 1 addition & 1 deletion apps/chrome-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"format": "prettier --write ."
},
"devDependencies": {
"esbuild": "^0.17.16",
"esbuild": "^0.17.18",
"esbuild-svelte": "^0.7.3",
"pixi-panel": "workspace:*",
"rimraf": "^5.0.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/example-phaser-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
},
"dependencies": {
"phaser": "^3.60.0",
"vite": "^4.2.1"
"vite": "^4.3.3"
}
}
2 changes: 1 addition & 1 deletion apps/example-pixi-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
},
"dependencies": {
"pixi.js": "^7.2.4",
"vite": "^4.2.1"
"vite": "^4.3.3"
}
}
4 changes: 2 additions & 2 deletions apps/firefox-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
},
"devDependencies": {
"concurrently": "^8.0.1",
"esbuild": "^0.17.16",
"esbuild": "^0.17.18",
"esbuild-svelte": "^0.7.3",
"pixi-panel": "workspace:*",
"rimraf": "^5.0.0",
"svelte": "^3.58.0"
},
"dependencies": {
"web-ext": "^7.6.1"
"web-ext": "^7.6.2"
}
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
]
},
"devDependencies": {
"@types/chrome": "^0.0.231",
"@types/chrome": "^0.0.233",
"@types/firefox-webext-browser": "^111.0.1",
"@types/node": "^18.15.11",
"@typescript-eslint/eslint-plugin": "^5.58.0",
"@typescript-eslint/parser": "^5.58.0",
"@types/node": "^18.16.1",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
"concurrently": "^8.0.1",
"eslint": "^8.38.0",
"eslint": "^8.39.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.8.0",
Expand All @@ -47,11 +47,11 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-svelte3": "^4.0.0",
"husky": "^8.0.3",
"lint-staged": "^13.2.1",
"lint-staged": "^13.2.2",
"only-allow": "^1.1.1",
"prettier": "^2.8.7",
"prettier": "^2.8.8",
"prettier-plugin-svelte": "^2.10.0",
"sass": "^1.62.0",
"sass": "^1.62.1",
"svelte": "^3.58.0",
"svelte-check": "^3.2.0",
"svelte-preprocess": "^5.0.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/blender-elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"devDependencies": {
"@histoire/plugin-svelte": "^0.16.1",
"@sveltejs/vite-plugin-svelte": "^2.0.4",
"@sveltejs/vite-plugin-svelte": "^2.1.1",
"histoire": "^0.16.1",
"svelte": "^3.58.0",
"vite": "^4.2.1"
"vite": "^4.3.3"
}
}
36 changes: 17 additions & 19 deletions packages/blender-elements/src/NumberField/NumberField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,7 @@
}
</script>

<div
class="number-field"
class:active
class:focused
data-location={location}
use:numberDrag={{
value,
step,
min,
max,
onChange,
onClick,
onDown,
onUp,
}}
>
<div class="number-field" class:active class:focused data-location={location}>
<input
class="input"
{id}
Expand All @@ -133,9 +118,22 @@
on:blur={onBlur}
/>
{#if !focused && step}
<div class="drag" />
<button class="arrow left" on:click={onStepDown} />
<button class="arrow right" on:click={onStepUp} />
<div
class="drag"
use:numberDrag={{
value,
step,
min,
max,
onChange,
onClick,
onDown,
onUp,
}}
>
<button class="arrow left" on:click={onStepDown} />
<button class="arrow right" on:click={onStepUp} />
</div>
{/if}
</div>

Expand Down
4 changes: 3 additions & 1 deletion packages/blender-elements/src/actions/numberDrag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ export default function numberDrag(el: HTMLElement, config: Config) {
ts: Date.now(),
};
document.addEventListener("mousemove", onMousemove);
requestPointerLock(el);
if (e.target === el) {
requestPointerLock(el);
}
}
}

Expand Down
Loading

0 comments on commit e917f03

Please sign in to comment.