forked from oct16/TimeCat
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add redux and fix player error
- Loading branch information
Showing
20 changed files
with
348 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import { DBPromise, Redux } from '@WebReplay/utils' | ||
import { DBPromise, ProgressTypes, PlayerTypes, reduxStore } from '@WebReplay/utils' | ||
import { Container } from './container' | ||
import { Panel } from './panel' | ||
|
||
export async function replay() { | ||
const indexDB = await DBPromise | ||
const { width, height, vNode, data } = await indexDB.getData() | ||
|
||
const box = new Container({ vNode, width, height }) | ||
new Panel(box.container, data) | ||
const c = new Container({ vNode, width, height }) | ||
new Panel(c.container, data) | ||
|
||
Redux.dispatch({ | ||
type: 'PLAY', | ||
reduxStore.dispatch({ | ||
type: ProgressTypes.INFO, | ||
data: { | ||
speed: 1 | ||
frame: 0, | ||
curTime: data[0].time, | ||
startTime: data[0].time, | ||
endTime: data[data.length - 1].time, | ||
length: data.length | ||
} | ||
}) | ||
|
||
reduxStore.dispatch({ | ||
type: PlayerTypes.SPEED, | ||
data: { speed: 1 } | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export class Pointer { | ||
export class PointerComponent { | ||
x = 0 | ||
y = 0 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ProgressState } from '@WebReplay/utils' | ||
|
||
export class ProgressComponent { | ||
progress: HTMLElement | ||
thumb: HTMLElement | ||
slider: HTMLElement | ||
speed: number | ||
rafId: number | ||
|
||
progressState: ProgressState | ||
|
||
totalDistance = 0 | ||
constructor(c: HTMLElement) { | ||
this.progress = c.querySelector('.wr-progress')! as HTMLElement | ||
this.thumb = this.progress.querySelector('.wr-thumb') as HTMLElement | ||
this.slider = this.progress.querySelector('.wr-slider-bar') as HTMLElement | ||
} | ||
|
||
updateProgress(percentage: number) { | ||
this.thumb.style.left = percentage - 0.5 + '%' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.