Skip to content

Commit 8e18cca

Browse files
committed
v0.8.1
1 parent a82f7ed commit 8e18cca

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hlviewer.js",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"description": "View GoldSrc maps and replays in browser",
55
"keywords": [
66
"hlviewer",

src/PlayerInterface/TimeLine/index.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export function Timeline(props: { game: Game }) {
1818
})
1919
})
2020

21-
let isMouseDown = false
2221
const onMouseDown = (e: MouseEvent & { currentTarget: HTMLButtonElement }) => {
23-
isMouseDown = true
2422
const rects = e.currentTarget.getClientRects()[0]
2523
const progress = 1 - (rects.right - e.pageX) / (rects.right - rects.left)
2624
props.game.player.seekByPercent(progress * 100)
@@ -35,7 +33,6 @@ export function Timeline(props: { game: Game }) {
3533
window.addEventListener(
3634
'mouseup',
3735
() => {
38-
isMouseDown = false
3936
window.removeEventListener('mousemove', onMouseMove)
4037
},
4138
{ once: true }

src/PlayerInterface/VolumeControl/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,19 @@ import './style.css'
55
export function VolumeControl(props: { game: Game }) {
66
const gameState = useGameState()
77

8-
let isMouseDown = false
98
const onMouseDown = (e: MouseEvent & { currentTarget: HTMLDivElement }) => {
10-
isMouseDown = true
119
const rects = e.currentTarget.getClientRects()[0]
1210
const volume = 1 - (rects.right - e.pageX) / (rects.right - rects.left)
1311
props.game.soundSystem.setVolume(volume)
1412

1513
const onMouseMove = (e: MouseEvent) => {
1614
const volume = Math.max(0, Math.min(1 - (rects.right - e.pageX) / (rects.right - rects.left), 1))
17-
if (isMouseDown) {
18-
props.game.soundSystem.setVolume(volume)
19-
}
15+
props.game.soundSystem.setVolume(volume)
2016
}
2117
window.addEventListener('mousemove', onMouseMove)
2218
window.addEventListener(
2319
'mouseup',
2420
() => {
25-
isMouseDown = false
2621
window.removeEventListener('mousemove', onMouseMove)
2722
},
2823
{ once: true }

0 commit comments

Comments
 (0)