exb-camviewer 1.0.0 → 1.0.1
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 +5 -0
- package/manifest.json +0 -1
- package/package.json +1 -1
- package/src/runtime/widget.tsx +3 -3
- package/src/setting/setting.tsx +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
[![npm version][npm-img]][npm-url]
|
|
2
|
+
[](https://raw.githubusercontent.com/SunshineLuke90/widgets/master/CamViewer/LICENSE.md)
|
|
3
|
+
|
|
4
|
+
[npm-img]: https://img.shields.io/npm/v/exb-camviewer.svg?style=flat
|
|
5
|
+
[npm-url]: https://www.npmjs.com/package/exb-camviewer
|
|
1
6
|
# CamViewer Widget
|
|
2
7
|
|
|
3
8
|
This is a simple widget to view .m3u8 streams using a url field in a feature layer. The widget appears as a button, which when clicked will turn on the "camera" layer, and when a camera is clicked a popup video stream will appear to start streaming the live camera feed.
|
package/manifest.json
CHANGED
package/package.json
CHANGED
package/src/runtime/widget.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import type { IMConfig } from '../config'
|
|
|
3
3
|
import defaultMessages from './translations/default'
|
|
4
4
|
import { JimuMapViewComponent, type JimuMapView, type JimuLayerView } from 'jimu-arcgis'
|
|
5
5
|
import { Button, Icon } from 'jimu-ui'
|
|
6
|
+
// @ts-expect-error - No types available for this package
|
|
6
7
|
import './style.css'
|
|
7
8
|
import { useCallback, useState } from 'react'
|
|
8
9
|
import { createPortal } from 'react-dom'
|
|
@@ -11,7 +12,7 @@ import { createPortal } from 'react-dom'
|
|
|
11
12
|
// Run npm install hls.js in your client directory to install.
|
|
12
13
|
import Hls from 'hls.js'
|
|
13
14
|
|
|
14
|
-
export default function Widget(props: AllWidgetProps<IMConfig>) {
|
|
15
|
+
export default function Widget (props: AllWidgetProps<IMConfig>) {
|
|
15
16
|
const { useDataSources, useMapWidgetIds } = props
|
|
16
17
|
const [jimuMapView, setJimuMapView] = React.useState<JimuMapView>(null)
|
|
17
18
|
|
|
@@ -42,11 +43,10 @@ export default function Widget(props: AllWidgetProps<IMConfig>) {
|
|
|
42
43
|
setCurrentURL(url)
|
|
43
44
|
setShowVideo(true)
|
|
44
45
|
}
|
|
45
|
-
return null
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
// Draggable, resizable, closable video portal
|
|
49
|
-
const handleMouseMove = (e) => {
|
|
49
|
+
const handleMouseMove = (e: MouseEvent) => {
|
|
50
50
|
if (dragging) {
|
|
51
51
|
setVideoPos({ x: e.clientX - dragOffset.x, y: e.clientY - dragOffset.y })
|
|
52
52
|
} else if (resizing) {
|
package/src/setting/setting.tsx
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
} from "jimu-ui/advanced/data-source-selector"
|
|
19
19
|
import { IconPicker } from "jimu-ui/advanced/resource-selector"
|
|
20
20
|
|
|
21
|
-
export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
|
|
21
|
+
export default function Setting (props: AllWidgetSettingProps<IMConfig>) {
|
|
22
22
|
const onMapSelected = (useMapWidgetIds: string[]) => {
|
|
23
23
|
props.onSettingChange({
|
|
24
24
|
id: props.id,
|
|
@@ -47,7 +47,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
|
|
|
47
47
|
})
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
const onIconChange = (icon) => {
|
|
50
|
+
const onIconChange = (icon: any) => {
|
|
51
51
|
props.onSettingChange({
|
|
52
52
|
id: props.id,
|
|
53
53
|
config: {
|
|
@@ -77,7 +77,7 @@ export default function Setting(props: AllWidgetSettingProps<IMConfig>) {
|
|
|
77
77
|
</SettingRow>
|
|
78
78
|
<SettingRow>
|
|
79
79
|
<DataSourceSelector
|
|
80
|
-
types={Immutable([DataSourceTypes.FeatureLayer])}
|
|
80
|
+
types={Immutable.from([DataSourceTypes.FeatureLayer])}
|
|
81
81
|
mustUseDataSource={true}
|
|
82
82
|
useDataSources={props.useDataSources}
|
|
83
83
|
useDataSourcesEnabled={props.useDataSourcesEnabled}
|