ebta-workflow-prod 4.0.20 → 4.0.22
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.
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -33,13 +33,23 @@ interface Viewer360Props extends FormElementProps<string> {
|
|
|
33
33
|
* @param props The props that will be provided by the Workflow runtime.
|
|
34
34
|
*/
|
|
35
35
|
function Viewer360(props: Viewer360Props): React.ReactElement {
|
|
36
|
-
const { setting, value
|
|
37
|
-
|
|
36
|
+
const { setting, value, pitch, yaw, hfov, minHfov, haov, vaov, raiseEvent } = props;
|
|
37
|
+
|
|
38
|
+
const handleHotspotClick = (evt: MouseEvent, args: { id: string; pitch: number; yaw: number }) => {
|
|
39
|
+
raiseEvent("clicked", JSON.stringify({ args }))
|
|
40
|
+
};
|
|
38
41
|
|
|
39
42
|
// Copy SVG assets to consumer's public folder and reference them
|
|
40
43
|
React.useEffect(() => {
|
|
41
44
|
// Ensure pannellum CSS has correct asset paths
|
|
42
45
|
const customCSS = `
|
|
46
|
+
.pnlm-hotspot.custom-hotspot {
|
|
47
|
+
width: auto;
|
|
48
|
+
height: auto;
|
|
49
|
+
overflow: visible;
|
|
50
|
+
background: none;
|
|
51
|
+
border: none;
|
|
52
|
+
}
|
|
43
53
|
.pnlm-container {
|
|
44
54
|
background-image: url('/img/background.svg');
|
|
45
55
|
}
|
|
@@ -56,17 +66,17 @@ function Viewer360(props: Viewer360Props): React.ReactElement {
|
|
|
56
66
|
background-image: url( '/img/sprites.svg');
|
|
57
67
|
}
|
|
58
68
|
`;
|
|
59
|
-
|
|
69
|
+
|
|
60
70
|
const styleElement = document.createElement('style');
|
|
61
71
|
styleElement.textContent = customCSS;
|
|
62
72
|
document.head.appendChild(styleElement);
|
|
63
|
-
|
|
73
|
+
|
|
64
74
|
return () => {
|
|
65
75
|
document.head.removeChild(styleElement);
|
|
66
76
|
};
|
|
67
77
|
}, []);
|
|
68
|
-
|
|
69
|
-
|
|
78
|
+
|
|
79
|
+
|
|
70
80
|
console.log("rendering 360VIEWER")
|
|
71
81
|
return (
|
|
72
82
|
<>
|
|
@@ -85,7 +95,34 @@ function Viewer360(props: Viewer360Props): React.ReactElement {
|
|
|
85
95
|
raiseEvent("loaded" as any, value);
|
|
86
96
|
console.log("panorama loaded");
|
|
87
97
|
}}
|
|
88
|
-
|
|
98
|
+
>
|
|
99
|
+
<Pannellum.Hotspot
|
|
100
|
+
type="custom"
|
|
101
|
+
pitch={-10}
|
|
102
|
+
yaw={130}
|
|
103
|
+
handleClick={handleHotspotClick}
|
|
104
|
+
handleClickArg={{ id: "btn-1", pitch: -10, yaw: 130 }}
|
|
105
|
+
cssClass="custom-hotspot"
|
|
106
|
+
tooltip={(hotSpotDiv: HTMLElement) => {
|
|
107
|
+
const btn = document.createElement("div");
|
|
108
|
+
btn.style.cssText = `
|
|
109
|
+
background: #0078d4;
|
|
110
|
+
color: white;
|
|
111
|
+
border-radius: 6px;
|
|
112
|
+
padding: 6px 12px;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
font-size: 13px;
|
|
115
|
+
white-space: nowrap;
|
|
116
|
+
box-shadow: 0 2px 6px rgba(0,0,0,0.3);
|
|
117
|
+
transform: translate(-50%, -100%);
|
|
118
|
+
`;
|
|
119
|
+
btn.textContent = "📍 View Detail";
|
|
120
|
+
hotSpotDiv.appendChild(btn); // append a child, don't style the host div
|
|
121
|
+
}}
|
|
122
|
+
tooltipArg={{}}
|
|
123
|
+
/>
|
|
124
|
+
|
|
125
|
+
</Pannellum>
|
|
89
126
|
</>
|
|
90
127
|
);
|
|
91
128
|
}
|