, S = Record , S = Record<
this.setState({
loading: false,
} as any);
- this.handleResizeImage();
+ // 图片初次加载,计算 zoom,zoom 改变不需要通过回调透出
+ // When the image is loaded for the first time, zoom is calculated, and zoom changes do not need to be exposed through callbacks.
+ this.handleResizeImage(false);
}
const { src, onLoad } = this.getProps();
onLoad && onLoad(src);
@@ -100,7 +102,7 @@ export default class PreviewImageFoundation , S = Record<
onError && onError(src);
}
- handleResizeImage = () => {
+ handleResizeImage = (notify: boolean = true) => {
const horizontal = !this._isImageVertical();
const { currZoom } = this.getStates();
const imgWidth = horizontal ? this.originImageWidth : this.originImageHeight;
@@ -120,7 +122,7 @@ export default class PreviewImageFoundation , S = Record<
if (currZoom === _zoom) {
this.calculatePreviewImage(_zoom, null);
} else {
- onZoom(_zoom);
+ onZoom(_zoom, notify);
}
}
}
diff --git a/packages/semi-foundation/image/previewInnerFoundation.ts b/packages/semi-foundation/image/previewInnerFoundation.ts
index d27f193314..8f524c4154 100644
--- a/packages/semi-foundation/image/previewInnerFoundation.ts
+++ b/packages/semi-foundation/image/previewInnerFoundation.ts
@@ -166,7 +166,6 @@ export default class PreviewInnerFoundation , S = Record<
direction,
rotation: 0,
} as any);
- this._adapter.notifyRotateChange(0);
}
handleDownload = () => {
@@ -199,10 +198,10 @@ export default class PreviewInnerFoundation , S = Record<
this._adapter.notifyRotateChange(newRotation);
}
- handleZoomImage = (newZoom: number) => {
+ handleZoomImage = (newZoom: number, notify: boolean = true) => {
const { zoom } = this.getStates();
if (zoom !== newZoom) {
- this._adapter.notifyZoom(newZoom, newZoom > zoom);
+ notify && this._adapter.notifyZoom(newZoom, newZoom > zoom);
this.setState({
zoom: newZoom,
} as any);
diff --git a/packages/semi-ui/image/previewInner.tsx b/packages/semi-ui/image/previewInner.tsx
index 3a57455775..de85f67610 100644
--- a/packages/semi-ui/image/previewInner.tsx
+++ b/packages/semi-ui/image/previewInner.tsx
@@ -285,8 +285,8 @@ export default class PreviewInner extends BaseComponent
-
-
- 跳转的key:
-
- scroll align:
-
-
-
- {this.state.gData.length ? (
-
+
+
+ 跳转的key:
+
+ scroll align:
+
+
+
+ {this.state.gData.length ? (
+
+
showLine
+
+ 单选
+ 多选
+ 单选
+ 默认配置
+
+
+ filter
+
+
+ autoFocus
+
+
+ clickToHide
+
+
+ 多选
+ 默认配置
+
+
+ filter
+
+ clickToHide
+
+
+
+
+