@ericchen1990/pano-view 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/README.zh-CN.md +2 -2
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -810,10 +810,11 @@ xml/VR/frame-render events.
|
|
|
810
810
|
|
|
811
811
|
## PanoContextMenu
|
|
812
812
|
|
|
813
|
-
`PanoViewer`
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
813
|
+
`PanoViewer` always suppresses the browser's native context menu on the
|
|
814
|
+
viewer (canvas, chrome, and other overlays). It also mounts a default
|
|
815
|
+
context menu on right-click. Default items: **Reset view** and **Enter
|
|
816
|
+
fullscreen** / **Exit fullscreen** (label and icon follow the current
|
|
817
|
+
fullscreen state), with a separator between them.
|
|
817
818
|
|
|
818
819
|
```tsx
|
|
819
820
|
<PanoViewer style={{ height: 560 }}>
|
|
@@ -821,7 +822,8 @@ separator between them.
|
|
|
821
822
|
</PanoViewer>
|
|
822
823
|
```
|
|
823
824
|
|
|
824
|
-
Disable the default menu (
|
|
825
|
+
Disable the default menu (the native browser menu stays suppressed; mount
|
|
826
|
+
your own `PanoContextMenu` if you still want a custom menu):
|
|
825
827
|
|
|
826
828
|
```tsx
|
|
827
829
|
<PanoViewer contextMenu={false}>
|
package/README.zh-CN.md
CHANGED
|
@@ -678,7 +678,7 @@ import {
|
|
|
678
678
|
|
|
679
679
|
## PanoContextMenu
|
|
680
680
|
|
|
681
|
-
`PanoViewer`
|
|
681
|
+
`PanoViewer` 会始终屏蔽浏览器原生右键菜单(画布、chrome 及其他 overlay 均生效),并挂载默认右键菜单。默认项:**Reset view** 与 **Enter fullscreen** / **Exit fullscreen**(文案与图标随全屏状态变化),中间有分隔线。
|
|
682
682
|
|
|
683
683
|
```tsx
|
|
684
684
|
<PanoViewer style={{ height: 560 }}>
|
|
@@ -686,7 +686,7 @@ import {
|
|
|
686
686
|
</PanoViewer>
|
|
687
687
|
```
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
关闭默认菜单(浏览器原生菜单仍会被屏蔽;若仍需自定义菜单,请自行挂载 `PanoContextMenu`):
|
|
690
690
|
|
|
691
691
|
```tsx
|
|
692
692
|
<PanoViewer contextMenu={false}>
|
package/dist/index.cjs
CHANGED
|
@@ -4601,6 +4601,19 @@ var PanoViewer = (0, import_react22.forwardRef)(
|
|
|
4601
4601
|
syncFullscreen();
|
|
4602
4602
|
return subscribeFullscreenChange(syncFullscreen);
|
|
4603
4603
|
}, []);
|
|
4604
|
+
(0, import_react22.useEffect)(() => {
|
|
4605
|
+
const root = rootRef.current;
|
|
4606
|
+
if (!root) {
|
|
4607
|
+
return;
|
|
4608
|
+
}
|
|
4609
|
+
const suppressNativeContextMenu = (event) => {
|
|
4610
|
+
event.preventDefault();
|
|
4611
|
+
};
|
|
4612
|
+
root.addEventListener("contextmenu", suppressNativeContextMenu, true);
|
|
4613
|
+
return () => {
|
|
4614
|
+
root.removeEventListener("contextmenu", suppressNativeContextMenu, true);
|
|
4615
|
+
};
|
|
4616
|
+
}, []);
|
|
4604
4617
|
const contextMenuActions = (0, import_react22.useMemo)(
|
|
4605
4618
|
() => ({
|
|
4606
4619
|
reset: () => {
|