enhance(view):调整宽高的计算取整,消除可能存在的黑线。

This commit is contained in:
徐涛 2023-03-21 13:55:56 +08:00
parent 3e6b89ab39
commit 2fc2bd7185

View File

@ -20,7 +20,7 @@ export const ContinuationView: FC = () => {
}, },
[files] [files]
); );
const maxImageWidth = useMemo(() => viewWidth * (zoom / 100), [viewWidth, zoom]); const maxImageWidth = useMemo(() => Math.floor(viewWidth * (zoom / 100)), [viewWidth, zoom]);
useEffect(() => { useEffect(() => {
ebus?.addListener('navigate_offset', ({ filename }) => { ebus?.addListener('navigate_offset', ({ filename }) => {
@ -59,7 +59,7 @@ export const ContinuationView: FC = () => {
justifyContent: 'center', justifyContent: 'center',
alignItems: 'flex-start', alignItems: 'flex-start',
width: '100%', width: '100%',
height: files[index].height * (maxImageWidth / files[index].width) height: Math.round(files[index].height * (maxImageWidth / files[index].width))
}} }}
> >
<img src={files[index].path} style={{ width: maxImageWidth }} /> <img src={files[index].path} style={{ width: maxImageWidth }} />