Browse Source

feat: 长图模式

MinJieLiu 5 years ago
parent
commit
db0b998271
2 changed files with 2 additions and 2 deletions
  1. 1 1
      example/src/index.tsx
  2. 1 1
      src/utils/getSuitableImageSize.ts

+ 1 - 1
example/src/index.tsx

@@ -7,7 +7,7 @@ import { IPhotoSliderProps } from 'react-photo-view/dist/PhotoSlider';
 import photo1 from './1.jpg';
 import photo2 from './2.jpg';
 import photo3 from './3.jpg';
-import photo4 from './4.jpg';
+import photo4 from './4.png';
 import photo5 from './5.jpg';
 import photo6 from './6.png';
 import photo7 from './7.jpg';

+ 1 - 1
src/utils/getSuitableImageSize.ts

@@ -32,7 +32,7 @@ export default function getSuitableImageSize(
     height = autoHeight;
   }
   // 长图模式
-  else if (naturalHeight / naturalWidth > 3) {
+  else if (naturalHeight / naturalWidth >= 3) {
     width = innerWidth;
     height = autoHeight;
     // 默认定位到顶部区域