ebta-workflow-prod 4.0.3 → 4.0.4
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/build/activitypack.json +1 -1
- package/build/main.js +4 -4
- package/package.json +1 -1
- package/src/elements/Viewer360V2.tsx +99 -0
- package/src/index.ts +2 -0
package/package.json
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FormElementProps, FormElementRegistration } from "@vertigis/workflow";
|
|
3
|
+
import { Pannellum } from "pannellum-react-update";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The generic type argument provided to `FormElementProps<T>` controls the type
|
|
7
|
+
* of `props.value` and `props.setValue(value)`. If your element doesn't need a
|
|
8
|
+
* `value`, you can omit the type argument.
|
|
9
|
+
*
|
|
10
|
+
* You can also declare additional public properties of your element by adding
|
|
11
|
+
* properties to this interface. The properties will be managed by the Workflow
|
|
12
|
+
* runtime, and passed in as `props`. You can update the properties by using
|
|
13
|
+
* `props.setProperty(key, value)`.
|
|
14
|
+
*/
|
|
15
|
+
interface Viewer360V2Props extends FormElementProps<string> {
|
|
16
|
+
value: string //url of image
|
|
17
|
+
pitch: number; //pitch of the image
|
|
18
|
+
yaw: number; //yaw of the image
|
|
19
|
+
hfov: number; //horizontal field of view
|
|
20
|
+
minHfov: number; //minimum horizontal field of view
|
|
21
|
+
haov: number; //horizontal angle of view
|
|
22
|
+
vaov: number; //vertical angle of view
|
|
23
|
+
setting?: {
|
|
24
|
+
width?: string;
|
|
25
|
+
height?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A Workflow element built using React.
|
|
31
|
+
* @displayName Viewer360V2
|
|
32
|
+
* @description Viewer360 Version 2
|
|
33
|
+
* @param props The props that will be provided by the Workflow runtime.
|
|
34
|
+
*/
|
|
35
|
+
function Viewer360V2(props: Viewer360V2Props): React.ReactElement {
|
|
36
|
+
const { setting, value , pitch ,yaw, hfov, minHfov , haov, vaov, raiseEvent } = props;
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// Copy SVG assets to consumer's public folder and reference them
|
|
40
|
+
React.useEffect(() => {
|
|
41
|
+
// Ensure pannellum CSS has correct asset paths
|
|
42
|
+
const customCSS = `
|
|
43
|
+
.pnlm-container {
|
|
44
|
+
background-image: url('/img/background.svg');
|
|
45
|
+
}
|
|
46
|
+
.pnlm-compass {
|
|
47
|
+
background-image: url ('/img/compass.svg');
|
|
48
|
+
}
|
|
49
|
+
.pnlm-grab {
|
|
50
|
+
cursor: url( '/img/grab.svg'), grab;
|
|
51
|
+
}
|
|
52
|
+
.pnlm-grabbing {
|
|
53
|
+
cursor: url( '/img/grabbing.svg'), grabbing;
|
|
54
|
+
}
|
|
55
|
+
.pnlm-sprite {
|
|
56
|
+
background-image: url( '/img/sprites.svg');
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const styleElement = document.createElement('style');
|
|
61
|
+
styleElement.textContent = customCSS;
|
|
62
|
+
document.head.appendChild(styleElement);
|
|
63
|
+
|
|
64
|
+
return () => {
|
|
65
|
+
document.head.removeChild(styleElement);
|
|
66
|
+
};
|
|
67
|
+
}, []);
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
console.log("rendering 360VIEWER")
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<Pannellum
|
|
74
|
+
width={setting?.width || "100%"}
|
|
75
|
+
height={setting?.height || "auto"}
|
|
76
|
+
image={value}
|
|
77
|
+
pitch={pitch || -20}
|
|
78
|
+
yaw={yaw || 120}
|
|
79
|
+
hfov={hfov || 110}
|
|
80
|
+
haov={haov || 360}
|
|
81
|
+
vaov={vaov || 180}
|
|
82
|
+
minHfov={minHfov || 10}
|
|
83
|
+
autoLoad
|
|
84
|
+
onLoad={() => {
|
|
85
|
+
raiseEvent("loaded" as any, value);
|
|
86
|
+
console.log("panorama loaded");
|
|
87
|
+
}}
|
|
88
|
+
></Pannellum>
|
|
89
|
+
</>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const Viewer360V2ElementRegistration: FormElementRegistration<Viewer360V2Props> = {
|
|
94
|
+
component: Viewer360V2,
|
|
95
|
+
getInitialProperties: () => ({ }),
|
|
96
|
+
id: "Viewer360V2",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export default Viewer360V2ElementRegistration;
|
package/src/index.ts
CHANGED
|
@@ -41,3 +41,5 @@ export { default as DrapGeometryActivity } from "./activities/DrapGeometry";
|
|
|
41
41
|
export { default as SampleActivity } from "./activities/Sample";
|
|
42
42
|
|
|
43
43
|
export { default as SampleInputRegistration } from "./elements/SampleInput";
|
|
44
|
+
|
|
45
|
+
export { default as Viewer360V2Registration } from "./elements/Viewer360V2";
|