Explorar o código

docs[krpano]: 增加属性注释

chenlei hai 1 ano
pai
achega
ef431843e1

+ 1 - 1
packages/docs/docs/krpano/hotspot/index.md

@@ -1,6 +1,6 @@
 ## 示例
 
-支持 `html`,但是在 vr 视角中会丢失图片
+支持 `html`,但是在 vr 视角下仅支持文本和文本样式
 
 ```tsx
 import React, { useState, useMemo } from "react";

+ 1 - 2
packages/krpano/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@dage/krpano",
-  "version": "2.1.1",
+  "version": "2.1.2",
   "description": "krpano sdk",
   "module": "build/index.js",
   "main": "build/index.js",
@@ -30,7 +30,6 @@
   },
   "license": "MIT",
   "dependencies": {
-    "@dage/hooks": "workspace:^",
     "escape-html": "^1.0.3"
   }
 }

+ 11 - 0
packages/krpano/src/components/HotSpot.tsx

@@ -24,7 +24,13 @@ export interface HotspotProps {
   maskChildren?: boolean;
   zOrder?: string;
   style?: string;
+  /**
+   * 水平方向
+   */
   ath?: number;
+  /**
+   * 垂直方向
+   */
   atv?: number;
   edge?: string;
   zoom?: boolean;
@@ -42,6 +48,11 @@ export interface HotspotProps {
   rotate?: number;
   alpha?: number;
   bg?: boolean;
+  bgcolor?: string;
+  bgalpha?: number;
+  bgborder?: number;
+  bgbordermode?: "outside" | "inside";
+  bgborderblend?: boolean;
   onOver?: EventCallback;
   onHover?: EventCallback;
   onOut?: EventCallback;

+ 3 - 1
packages/krpano/src/components/Krpano.tsx

@@ -16,6 +16,7 @@ export interface KrpanoProps extends Omit<IKrpanoConfig, "onready" | "target"> {
    * webvr.xml 地址,需遵循同源策略
    */
   webvrUrl?: string;
+  webvrConfig?: Record<string, unknown>;
   onReady?: (renderer: KrpanoActionProxy) => void;
 }
 
@@ -26,6 +27,7 @@ export const Krpano: React.FC<KrpanoProps> = ({
   currentScene,
   target = "krpano",
   webvrUrl,
+  webvrConfig,
   onReady,
   ...rest
 }) => {
@@ -98,7 +100,7 @@ export const Krpano: React.FC<KrpanoProps> = ({
   return (
     <KrpanoRendererContext.Provider value={renderer}>
       <CurrentSceneContext.Provider value={currentScene || null}>
-        {webvrUrl && <WebVR url={webvrUrl} />}
+        {webvrUrl && <WebVR url={webvrUrl} {...webvrConfig} />}
 
         <div id={target} className={className} style={style}>
           {renderer ? children : null}

+ 10 - 4
packages/krpano/src/components/WebVR/index.tsx

@@ -1,8 +1,9 @@
-import { FC } from "react";
+import { FC, memo } from "react";
 import { Include, Plugin } from "..";
 
 export interface WebVRProps {
   url: string;
+  [key: string]: unknown;
 }
 
 const WEBVR_CONFIG = {
@@ -15,11 +16,16 @@ const WEBVR_CONFIG = {
   mobilevr_fake_support: true,
 };
 
-export const WebVR: FC<WebVRProps> = ({ url }) => {
+export const WebVR: FC<WebVRProps> = memo(({ url, ...attrs }) => {
   return (
     <>
       <Include url={url} />
-      <Plugin attribute={WEBVR_CONFIG} />
+      <Plugin
+        attribute={{
+          ...WEBVR_CONFIG,
+          ...attrs,
+        }}
+      />
     </>
   );
-};
+});

+ 1 - 1
packages/krpano/src/utils.tsx

@@ -4,7 +4,7 @@ import { XMLMeta } from "./types";
 import ReactDOMServer from "react-dom/server";
 
 /**
- * @see https://krpano.com/docu/actions/?version=119pr13
+ * @see https://krpano.com/docu/actions
  */
 type FuncName =
   | "addplugin"

+ 0 - 3
pnpm-lock.yaml

@@ -325,9 +325,6 @@ importers:
 
   packages/krpano:
     dependencies:
-      '@dage/hooks':
-        specifier: workspace:^
-        version: link:../hooks
       escape-html:
         specifier: ^1.0.3
         version: registry.npmmirror.com/escape-html@1.0.3