ebta-workflow-prod 4.0.3 → 4.0.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ebta-workflow-prod",
3
3
  "private": false,
4
- "version": "4.0.3",
4
+ "version": "4.0.5",
5
5
  "description": "",
6
6
  "license": "UNLICENSED",
7
7
  "author": "",
@@ -0,0 +1,116 @@
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("data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="67" height="100" viewBox="0 0 67 100">
45
+ <path stroke="#ccc" fill="none" d="M33.5,50,0,63,33.5,75,67,63,33.5,50m-33.5-50,67,25m-0.5,0,0,75m-66.5-75,67-25m-33.5,75,0,25m0-100,0,50"/>
46
+ </svg>");
47
+ }
48
+ .pnlm-compass {
49
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" height="50" width="50">
50
+ <path d="m24.5078 6-3.2578 18h7.5l-3.25781-18h-0.984376zm-3.2578 20 3.2578 18h0.9844l3.2578-18h-7.5zm1.19531 0.9941h5.10938l-2.5547 14.1075-2.5547-14.1075z"/>
51
+ </svg>");
52
+ }
53
+ .pnlm-grab {
54
+ cursor: url( '/img/grab.svg'), grab;
55
+ }
56
+ .pnlm-grabbing {
57
+ cursor: url( '/img/grabbing.svg'), grabbing;
58
+ }
59
+ .pnlm-sprite {
60
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="26" height="208">
61
+ <circle fill-opacity=".78" cy="117" cx="13" r="11" fill="#fff"/>
62
+ <circle fill-opacity=".78" cy="143" cx="13" r="11" fill="#fff"/>
63
+ <circle cy="169" cx="13" r="7" fill="none" stroke="#000" stroke-width="2"/>
64
+ <circle cy="195" cx="13" r="7" fill="none" stroke="#000" stroke-width="2"/>
65
+ <circle cx="13" cy="195" r="2.5"/>
66
+ <path d="m5 83v6h2v-4h4v-2zm10 0v2h4v4h2v-6zm-5 5v6h6v-6zm-5 5v6h6v-2h-4v-4zm14 0v4h-4v2h6v-6z"/>
67
+ <path d="m13 110a7 7 0 0 0 -7 7 7 7 0 0 0 7 7 7 7 0 0 0 7 -7 7 7 0 0 0 -7 -7zm-1 3h2v2h-2zm0 3h2v5h-2z"/>
68
+ <path d="m5 57v6h2v-4h4v-2zm10 0v2h4v4h2v-6zm-10 10v6h6v-2h-4v-4zm14 0v4h-4v2h6v-6z"/>
69
+ <path d="m17 38v2h-8v-2z"/>
70
+ <path d="m12 9v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/>
71
+ <path d="m13 136-6.125 6.125h4.375v7.875h3.5v-7.875h4.375z"/>
72
+ <path d="m10.428 173.33v-5.77l5-2.89v5.77zm1-1.73 3-1.73-3.001-1.74z"/>
73
+ </svg>");
74
+ }
75
+ `;
76
+
77
+ const styleElement = document.createElement('style');
78
+ styleElement.textContent = customCSS;
79
+ document.head.appendChild(styleElement);
80
+
81
+ return () => {
82
+ document.head.removeChild(styleElement);
83
+ };
84
+ }, []);
85
+
86
+
87
+ console.log("rendering 360VIEWER")
88
+ return (
89
+ <>
90
+ <Pannellum
91
+ width={setting?.width || "100%"}
92
+ height={setting?.height || "auto"}
93
+ image={value}
94
+ pitch={pitch || -20}
95
+ yaw={yaw || 120}
96
+ hfov={hfov || 110}
97
+ haov={haov || 360}
98
+ vaov={vaov || 180}
99
+ minHfov={minHfov || 10}
100
+ autoLoad
101
+ onLoad={() => {
102
+ raiseEvent("loaded" as any, value);
103
+ console.log("panorama loaded");
104
+ }}
105
+ ></Pannellum>
106
+ </>
107
+ );
108
+ }
109
+
110
+ const Viewer360V2ElementRegistration: FormElementRegistration<Viewer360V2Props> = {
111
+ component: Viewer360V2,
112
+ getInitialProperties: () => ({}),
113
+ id: "Viewer360V2",
114
+ };
115
+
116
+ export default Viewer360V2ElementRegistration;
package/src/index.ts CHANGED
@@ -37,7 +37,9 @@ export { default as CreateGraphicLayerActivity } from "./activities/CreateGraphi
37
37
  export { default as SliceLineActivity } from "./activities/SliceLine";
38
38
  export { default as GetTaskStatusActivity } from "./activities/GetTaskStatus";
39
39
  export { default as DrapGeometryActivity } from "./activities/DrapGeometry";
40
-
41
- export { default as SampleActivity } from "./activities/Sample";
42
-
43
- export { default as SampleInputRegistration } from "./elements/SampleInput";
40
+
41
+ export { default as SampleActivity } from "./activities/Sample";
42
+
43
+ export { default as SampleInputRegistration } from "./elements/SampleInput";
44
+
45
+ export { default as Viewer360V2Registration } from "./elements/Viewer360V2";