Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master zhaoyun #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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 example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const App = () => {
hintOnStartup
hintText="Drag to view"
/>

<button onClick={() => tridiRef.current.prev()}>Prev</button>
<button onClick={() => tridiRef.current.next()}>Next</button>
<button onClick={() => tridiRef.current.toggleAutoplay(!isAutoPlayRunning)}>
Expand Down
8 changes: 8 additions & 0 deletions src/assets/icons/drag.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/move.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 3 additions & 7 deletions src/assets/icons/next.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions src/assets/icons/pause.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions src/assets/icons/play.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 0 additions & 8 deletions src/assets/icons/previous.svg

This file was deleted.

8 changes: 3 additions & 5 deletions src/assets/icons/stop.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 3 additions & 5 deletions src/assets/icons/target.svg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/zoomIn.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/zoomOut.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 47 additions & 6 deletions src/components/ControlBar/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import React from 'react';
import styles from './styles.module.css';

import TargetIcon from '../../assets/icons/target.svg';
import StopIcon from '../../assets/icons/stop.svg';
import NextIcon from '../../assets/icons/next.svg';
import PrevIcon from '../../assets/icons/previous.svg';
import PauseIcon from '../../assets/icons/pause.svg';
import PlayIcon from '../../assets/icons/play.svg';
import ZoomInIcon from '../../assets/icons/zoomIn.svg';
import ZoomOutIcon from '../../assets/icons/zoomOut.svg';
import MoveIcon from '../../assets/icons/move.svg';

const ControlBar = ({
isPlaying,
isRecording,
isMoveing,
setIsPlaying,
setIsRecording,
onPlay,
onPause,
onNext,
onPrev,
onRecordStart,
onRecordStop
onRecordStop,
onZoomout,
onZoomin,
onStartMoveing,
onStopMoveing,
hideRecord
}) => {
const playHandler = () => {
setIsPlaying(true);
Expand All @@ -39,17 +48,25 @@ const ControlBar = ({
onRecordStop();
};

const moveStartHandler = () => {
onStartMoveing();
};

const moveStopHandler = () => {
onStopMoveing();
};

return (
<div
className={`tridi-control-bar ${styles['tridi-control-bar']}`}
onClick={(e) => e.stopPropagation()}
>
{!isRecording && (
{!hideRecord && !isRecording && (
<a className={`${styles['tridi-control-button']}`} onClick={recordStartHandler}>
<TargetIcon />
</a>
)}
{isRecording && (
{!hideRecord && isRecording && (
<a className={`${styles['tridi-control-button']}`} onClick={recordStopHandler}>
<StopIcon />
</a>
Expand All @@ -64,12 +81,36 @@ const ControlBar = ({
<PauseIcon />
</a>
)}
<a className={`${styles['tridi-control-button']}`} onClick={onPrev}>
<PrevIcon />
<a
className={`${styles['tridi-control-button']}`}
style={{ transform: 'rotate(180deg)' }}
onClick={onPrev}
>
<NextIcon />
</a>

<a className={`${styles['tridi-control-button']}`} onClick={onNext}>
<NextIcon />
</a>

<a className={`${styles['tridi-control-button']}`} onClick={onZoomout}>
<ZoomOutIcon />
</a>

<a className={`${styles['tridi-control-button']}`} onClick={onZoomin}>
<ZoomInIcon />
</a>

{!isMoveing && (
<a className={`${styles['tridi-control-button']}`} onClick={moveStartHandler}>
<MoveIcon />
</a>
)}
{isMoveing && (
<a className={`${styles['tridi-control-button']}`} onClick={moveStopHandler}>
<StopIcon />
</a>
)}
</div>
);
};
Expand Down
Loading