|
@@ -7,7 +7,7 @@ import SelectBox from '../SelectBox';
|
|
|
import Divider from '../Divider';
|
|
|
import { scaleCheck } from '../../helpers/utility';
|
|
|
|
|
|
-import { Container, ToggleButton } from './styled';
|
|
|
+import { Container } from './styled';
|
|
|
import dataset from './data';
|
|
|
|
|
|
type Props = {
|
|
@@ -19,10 +19,10 @@ type Props = {
|
|
|
handleCounterclockwiseRotation: () => void;
|
|
|
handleZoomIn: () => void;
|
|
|
handleZoomOut: () => void;
|
|
|
+ handleMouseOver: () => void;
|
|
|
scale: number;
|
|
|
viewport: ViewportType;
|
|
|
displayMode: string;
|
|
|
- toggleDisplayMode: (state: string) => void;
|
|
|
handleHandClick: () => void;
|
|
|
hidden: boolean;
|
|
|
};
|
|
@@ -36,19 +36,17 @@ const Toolbar: React.FC<Props> = ({
|
|
|
handleCounterclockwiseRotation,
|
|
|
handleZoomIn,
|
|
|
handleZoomOut,
|
|
|
+ handleMouseOver,
|
|
|
scale,
|
|
|
viewport,
|
|
|
displayMode,
|
|
|
- toggleDisplayMode,
|
|
|
handleHandClick,
|
|
|
hidden,
|
|
|
}: Props) => {
|
|
|
const { t } = useTranslation('toolbar');
|
|
|
const data = dataset(t);
|
|
|
|
|
|
- const handleScaleSelect = async (
|
|
|
- selected: SelectOptionType
|
|
|
- ): Promise<any> => {
|
|
|
+ const handleScaleSelect = (selected: SelectOptionType) => {
|
|
|
if (selected.child === 'fit') {
|
|
|
const screenWidth = window.document.body.offsetWidth - 288;
|
|
|
const originPdfWidth = viewport.width / scale;
|
|
@@ -60,67 +58,44 @@ const Toolbar: React.FC<Props> = ({
|
|
|
};
|
|
|
|
|
|
return (
|
|
|
- <>
|
|
|
- <Container hidden={hidden} displayMode={displayMode}>
|
|
|
- <Pagination
|
|
|
- totalPage={totalPage}
|
|
|
- currentPage={currentPage}
|
|
|
- onChange={setCurrentPage}
|
|
|
- />
|
|
|
- <Divider />
|
|
|
- <Icon
|
|
|
- glyph="hand"
|
|
|
- style={{ width: '30px' }}
|
|
|
- onClick={handleHandClick}
|
|
|
- />
|
|
|
- <Icon
|
|
|
- glyph="zoom-in"
|
|
|
- style={{ width: '30px' }}
|
|
|
- onClick={handleZoomIn}
|
|
|
- />
|
|
|
- <Icon
|
|
|
- glyph="zoom-out"
|
|
|
- style={{ width: '30px' }}
|
|
|
- onClick={handleZoomOut}
|
|
|
- />
|
|
|
- <SelectBox
|
|
|
- options={data.scaleOptions}
|
|
|
- style={{ width: '94px' }}
|
|
|
- useInput
|
|
|
- isDivide
|
|
|
- onChange={handleScaleSelect}
|
|
|
- defaultValue={`${Math.round(scale * 100)} %`}
|
|
|
- />
|
|
|
- <Divider />
|
|
|
- <Icon
|
|
|
- glyph="rotate-left"
|
|
|
- style={{ width: '30px' }}
|
|
|
- onClick={handleCounterclockwiseRotation}
|
|
|
- />
|
|
|
- <Icon
|
|
|
- glyph="rotate-right"
|
|
|
- style={{ width: '30px' }}
|
|
|
- onClick={handleClockwiseRotation}
|
|
|
- />
|
|
|
- </Container>
|
|
|
- <ToggleButton>
|
|
|
- {displayMode === 'normal' ? (
|
|
|
- <Icon
|
|
|
- glyph="tool-close"
|
|
|
- onClick={(): void => {
|
|
|
- toggleDisplayMode('full');
|
|
|
- }}
|
|
|
- />
|
|
|
- ) : (
|
|
|
- <Icon
|
|
|
- glyph="tool-open"
|
|
|
- onClick={(): void => {
|
|
|
- toggleDisplayMode('normal');
|
|
|
- }}
|
|
|
- />
|
|
|
- )}
|
|
|
- </ToggleButton>
|
|
|
- </>
|
|
|
+ <Container
|
|
|
+ onMouseOver={handleMouseOver}
|
|
|
+ hidden={hidden}
|
|
|
+ displayMode={displayMode}
|
|
|
+ >
|
|
|
+ <Pagination
|
|
|
+ totalPage={totalPage}
|
|
|
+ currentPage={currentPage}
|
|
|
+ onChange={setCurrentPage}
|
|
|
+ />
|
|
|
+ <Divider />
|
|
|
+ <Icon glyph="hand" style={{ width: '30px' }} onClick={handleHandClick} />
|
|
|
+ <Icon glyph="zoom-in" style={{ width: '30px' }} onClick={handleZoomIn} />
|
|
|
+ <Icon
|
|
|
+ glyph="zoom-out"
|
|
|
+ style={{ width: '30px' }}
|
|
|
+ onClick={handleZoomOut}
|
|
|
+ />
|
|
|
+ <SelectBox
|
|
|
+ options={data.scaleOptions}
|
|
|
+ style={{ width: '94px' }}
|
|
|
+ useInput
|
|
|
+ isDivide
|
|
|
+ onChange={handleScaleSelect}
|
|
|
+ defaultValue={`${Math.round(scale * 100)} %`}
|
|
|
+ />
|
|
|
+ <Divider />
|
|
|
+ <Icon
|
|
|
+ glyph="rotate-left"
|
|
|
+ style={{ width: '30px' }}
|
|
|
+ onClick={handleCounterclockwiseRotation}
|
|
|
+ />
|
|
|
+ <Icon
|
|
|
+ glyph="rotate-right"
|
|
|
+ style={{ width: '30px' }}
|
|
|
+ onClick={handleClockwiseRotation}
|
|
|
+ />
|
|
|
+ </Container>
|
|
|
);
|
|
|
};
|
|
|
|