@cloud-app-dev/vidc 3.0.18 → 3.0.20
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/es/CustomRenderSelect/index.d.ts +1 -1
- package/es/CustomRenderSelect/index.js +3 -3
- package/es/LoaderScript/utils.js +1 -0
- package/es/Map/AMap.d.ts +4 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +1 -4
- package/es/Map/LevelCenter/DragMarker/index.js +2 -5
- package/es/Map/LevelCenter/index.js +13 -2
- package/es/Map/MapDrawSelect/demo.d.ts +2 -0
- package/es/Map/MapDrawSelect/demo.js +58 -0
- package/es/Map/MapDrawSelect/index.css +0 -0
- package/es/Map/MapDrawSelect/index.d.ts +14 -0
- package/es/Map/MapDrawSelect/index.js +49 -0
- package/es/Map/MouseTool/index.d.ts +10 -0
- package/es/Map/MouseTool/index.js +50 -0
- package/es/Map/MouseTool/useMouseTools.d.ts +7 -0
- package/es/Map/MouseTool/useMouseTools.js +63 -0
- package/es/Map/SinglePoint/index.d.ts +10 -3
- package/es/Map/SinglePoint/index.js +37 -15
- package/es/Map/index.d.ts +1 -1
- package/es/Map/interface.d.ts +2 -0
- package/es/Player/api/index.d.ts +2 -0
- package/es/Player/api/index.js +9 -0
- package/es/Player/contraller_bar/left_bar.js +7 -14
- package/es/Player/contraller_bar/time.d.ts +3 -0
- package/es/Player/contraller_bar/time.js +34 -0
- package/es/Player/contraller_bar/volume.d.ts +9 -0
- package/es/Player/contraller_bar/volume.js +86 -0
- package/es/Player/fps_play.d.ts +2 -1
- package/es/Player/fps_play.js +25 -6
- package/es/Player/frontend_timeline.js +6 -7
- package/es/Player/player.d.ts +5 -0
- package/es/Player/segment_player.js +0 -1
- package/es/Player/segment_timeline.js +46 -5
- package/es/Player/single_player.js +7 -3
- package/es/Player/style/bar.css +1 -1
- package/es/Player/style/iconfont.js +15 -16
- package/es/Player/style/timeline.css +7 -0
- package/es/Player/style/volume.css +19 -0
- package/es/Player/util.d.ts +1 -0
- package/es/Player/util.js +8 -1
- package/es/ScreenPlayer/LiveTools.js +7 -27
- package/es/ScreenPlayer/RecordTools.js +31 -16
- package/es/ScreenPlayer/ScreenSelect.js +2 -2
- package/es/ScreenPlayer/TimeMode.js +1 -1
- package/es/ScreenPlayer/index.css +17 -8
- package/es/ScreenPlayer/utils.js +4 -4
- package/icon-fix.js +31 -0
- package/package.json +1 -1
- package/es/Map/SinglePoint/Marker/index.d.ts +0 -7
- package/es/Map/SinglePoint/Marker/index.js +0 -29
- package/es/ScreenPlayer/TimeSlider.d.ts +0 -129
- package/es/ScreenPlayer/TimeSlider.js +0 -556
|
@@ -6,5 +6,5 @@ interface ICustomRenderSelectProps extends SelectProps {
|
|
|
6
6
|
value: any;
|
|
7
7
|
customRender: (value: any) => JSX.Element;
|
|
8
8
|
}
|
|
9
|
-
declare function CustomRenderSelect({ children, value, customRender,
|
|
9
|
+
declare function CustomRenderSelect({ children, value, customRender, popupClassName, getPopupContainer, ...props }: ICustomRenderSelectProps): JSX.Element;
|
|
10
10
|
export default CustomRenderSelect;
|
|
@@ -24,9 +24,9 @@ function CustomRenderSelect(_a) {
|
|
|
24
24
|
var children = _a.children,
|
|
25
25
|
value = _a.value,
|
|
26
26
|
customRender = _a.customRender,
|
|
27
|
-
|
|
27
|
+
popupClassName = _a.popupClassName,
|
|
28
28
|
getPopupContainer = _a.getPopupContainer,
|
|
29
|
-
props = __rest(_a, ["children", "value", "customRender", "
|
|
29
|
+
props = __rest(_a, ["children", "value", "customRender", "popupClassName", "getPopupContainer"]);
|
|
30
30
|
|
|
31
31
|
var classname = useMemo(function () {
|
|
32
32
|
return "custom-render-select-dropdown-".concat(_uuid());
|
|
@@ -57,7 +57,7 @@ function CustomRenderSelect(_a) {
|
|
|
57
57
|
ref: domRef
|
|
58
58
|
}, /*#__PURE__*/React.createElement(_Select, Object.assign({}, props, {
|
|
59
59
|
value: value,
|
|
60
|
-
|
|
60
|
+
popupClassName: "custom-render-select-dropdown ".concat(classname, " ").concat(popupClassName),
|
|
61
61
|
getPopupContainer: getPopupContainer ? getPopupContainer : function () {
|
|
62
62
|
return domRef.current.parentElement.parentElement;
|
|
63
63
|
},
|
package/es/LoaderScript/utils.js
CHANGED
package/es/Map/AMap.d.ts
CHANGED
|
@@ -6914,6 +6914,10 @@ declare global {
|
|
|
6914
6914
|
static post(path: string, params: any, callback: (status: string, data: any) => void): void;
|
|
6915
6915
|
}
|
|
6916
6916
|
|
|
6917
|
+
export class MouseTool {
|
|
6918
|
+
constructor(map: AMap.Map);
|
|
6919
|
+
}
|
|
6920
|
+
|
|
6917
6921
|
/**
|
|
6918
6922
|
* 图块切片加载完成事件
|
|
6919
6923
|
* @event complete
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { LatLng } from '../../interface';
|
|
3
2
|
export interface IDragMarkerProps {
|
|
4
3
|
center?: [number, number];
|
|
5
|
-
zoom?: number;
|
|
6
4
|
onChange?: (options: {
|
|
7
|
-
center: [number, number]
|
|
8
|
-
zoom: number;
|
|
5
|
+
center: [number, number];
|
|
9
6
|
}) => void;
|
|
10
7
|
}
|
|
11
8
|
declare function DragMarker({ center, onChange }: IDragMarkerProps): JSX.Element;
|
|
@@ -29,16 +29,13 @@ function DragMarker(_ref) {
|
|
|
29
29
|
var latlng = type.leaflet ? e.target.getLatLng() : e.target.getPosition();
|
|
30
30
|
instance.setCenter(latlng);
|
|
31
31
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
32
|
-
center: latlng
|
|
33
|
-
zoom: instance.getZoom()
|
|
32
|
+
center: latlng
|
|
34
33
|
});
|
|
35
34
|
});
|
|
36
35
|
instance.map.on('zoomend', function (e) {
|
|
37
|
-
var zoom = e.target.getZoom();
|
|
38
36
|
var latlng = type.leaflet ? marker.getLatLng() : marker.getPosition();
|
|
39
37
|
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
40
|
-
center: latlng,
|
|
41
|
-
zoom: zoom
|
|
38
|
+
center: [latlng.getLng(), latlng.getLat()]
|
|
42
39
|
});
|
|
43
40
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
44
41
|
}, [marker]);
|
|
@@ -48,14 +48,25 @@ function LevelCenter(_ref) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
+
useMapEvent('zoomed', function (event) {
|
|
52
|
+
onLevelCenterChange === null || onLevelCenterChange === void 0 ? void 0 : onLevelCenterChange({
|
|
53
|
+
center: defaultCenter,
|
|
54
|
+
zoom: event.target.getZoom()
|
|
55
|
+
});
|
|
56
|
+
});
|
|
51
57
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
52
58
|
points: points
|
|
53
59
|
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
54
60
|
onMapReset: mapRest
|
|
55
61
|
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
56
62
|
center: defaultCenter,
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
onChange: function onChange(_ref2) {
|
|
64
|
+
var center = _ref2.center;
|
|
65
|
+
return onLevelCenterChange === null || onLevelCenterChange === void 0 ? void 0 : onLevelCenterChange({
|
|
66
|
+
center: center,
|
|
67
|
+
zoom: defaultZoom
|
|
68
|
+
});
|
|
69
|
+
}
|
|
59
70
|
}), children);
|
|
60
71
|
}
|
|
61
72
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import MapDrawSelect from './index';
|
|
15
|
+
import deviceList from '../points.json';
|
|
16
|
+
|
|
17
|
+
var App = function App() {
|
|
18
|
+
var _useState = useState(),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
type = _useState2[0],
|
|
21
|
+
setType = _useState2[1];
|
|
22
|
+
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
style: {
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: 800
|
|
27
|
+
}
|
|
28
|
+
}, /*#__PURE__*/React.createElement(MapDrawSelect, {
|
|
29
|
+
points: deviceList,
|
|
30
|
+
drawEnd: console.log,
|
|
31
|
+
drawType: type,
|
|
32
|
+
drawUi: /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
style: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: 20,
|
|
36
|
+
top: 120
|
|
37
|
+
}
|
|
38
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return setType(type === 'rect' ? 'close' : 'rect');
|
|
41
|
+
}
|
|
42
|
+
}, "\u77E9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return setType(type === 'polygon' ? 'close' : 'polygon');
|
|
45
|
+
}
|
|
46
|
+
}, "\u591A\u8FB9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
47
|
+
onClick: function onClick() {
|
|
48
|
+
return setType(type === 'circle' ? 'close' : 'circle');
|
|
49
|
+
}
|
|
50
|
+
}, "\u5706\u5F27"), /*#__PURE__*/React.createElement("span", {
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return setType('clear');
|
|
53
|
+
}
|
|
54
|
+
}, "\u6E05\u9664"))
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default App;
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawType, MapPoint } from '../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface IMapDrawSelectProps {
|
|
5
|
+
center?: [number, number];
|
|
6
|
+
zoom?: number;
|
|
7
|
+
points: MapPoint[];
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
drawUi?: React.ReactNode;
|
|
10
|
+
drawType?: DrawType | 'clear' | 'close';
|
|
11
|
+
drawEnd?: (points: MapPoint[]) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: (props: IMapDrawSelectProps) => JSX.Element;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import _useMount from "ahooks/es/useMount";
|
|
2
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
3
|
+
import ClusterLayer from '../ClusterLayer';
|
|
4
|
+
import ResetTools from '../ResetTools';
|
|
5
|
+
import withMap from '../withMap';
|
|
6
|
+
import { mapContext } from '../Context';
|
|
7
|
+
import MouseTool from '../MouseTool';
|
|
8
|
+
import "./index.css";
|
|
9
|
+
|
|
10
|
+
function MapDrawSelect(_ref) {
|
|
11
|
+
var center = _ref.center,
|
|
12
|
+
zoom = _ref.zoom,
|
|
13
|
+
points = _ref.points,
|
|
14
|
+
children = _ref.children,
|
|
15
|
+
drawUi = _ref.drawUi,
|
|
16
|
+
drawType = _ref.drawType,
|
|
17
|
+
drawEnd = _ref.drawEnd;
|
|
18
|
+
|
|
19
|
+
var _useContext = useContext(mapContext),
|
|
20
|
+
instance = _useContext.instance;
|
|
21
|
+
|
|
22
|
+
var defaultCenter = useMemo(function () {
|
|
23
|
+
return center || instance.config.center;
|
|
24
|
+
}, [center, instance]);
|
|
25
|
+
var defaultZoom = useMemo(function () {
|
|
26
|
+
return zoom || instance.config.zoom;
|
|
27
|
+
}, [zoom, instance]); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
28
|
+
|
|
29
|
+
var mapRest = useCallback(function () {
|
|
30
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
31
|
+
}, [defaultZoom, defaultCenter]);
|
|
32
|
+
|
|
33
|
+
_useMount(function () {
|
|
34
|
+
return mapRest();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
38
|
+
points: points
|
|
39
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
40
|
+
onMapReset: mapRest
|
|
41
|
+
}), /*#__PURE__*/React.createElement(MouseTool, {
|
|
42
|
+
ui: drawUi,
|
|
43
|
+
drawType: drawType,
|
|
44
|
+
drawEnd: drawEnd,
|
|
45
|
+
points: points
|
|
46
|
+
}), children);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default withMap(MapDrawSelect, 'map-draw-select-container');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawType, MapPoint } from '../interface';
|
|
3
|
+
interface IMouseTool {
|
|
4
|
+
ui: React.ReactNode;
|
|
5
|
+
drawType?: DrawType | 'clear' | 'close';
|
|
6
|
+
drawEnd?: (points: MapPoint[]) => void;
|
|
7
|
+
points?: MapPoint[];
|
|
8
|
+
}
|
|
9
|
+
declare function MouseTool({ ui, drawType, points, drawEnd }: IMouseTool): JSX.Element;
|
|
10
|
+
export default MouseTool;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
|
+
import _nextTick from "@cloud-app-dev/utils/es/nextTick";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import useMouseTools from './useMouseTools';
|
|
5
|
+
|
|
6
|
+
function MouseTool(_ref) {
|
|
7
|
+
var ui = _ref.ui,
|
|
8
|
+
drawType = _ref.drawType,
|
|
9
|
+
_ref$points = _ref.points,
|
|
10
|
+
points = _ref$points === void 0 ? [] : _ref$points,
|
|
11
|
+
drawEnd = _ref.drawEnd;
|
|
12
|
+
|
|
13
|
+
var _useMouseTools = useMouseTools(function (obj) {
|
|
14
|
+
var selectPoints = [];
|
|
15
|
+
|
|
16
|
+
for (var i = 0; i < points.length; i++) {
|
|
17
|
+
var item = points[i];
|
|
18
|
+
|
|
19
|
+
if (item.longitude && item.latitude && obj.contains([item.longitude, item.latitude])) {
|
|
20
|
+
selectPoints.push(item);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
_nextTick(function () {
|
|
25
|
+
return drawEnd === null || drawEnd === void 0 ? void 0 : drawEnd(selectPoints);
|
|
26
|
+
});
|
|
27
|
+
}),
|
|
28
|
+
draw = _useMouseTools.draw,
|
|
29
|
+
close = _useMouseTools.close;
|
|
30
|
+
|
|
31
|
+
_useUpdateEffect(function () {
|
|
32
|
+
switch (drawType) {
|
|
33
|
+
case 'clear':
|
|
34
|
+
close(true);
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'close':
|
|
38
|
+
close();
|
|
39
|
+
break;
|
|
40
|
+
|
|
41
|
+
default:
|
|
42
|
+
draw(drawType);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}, [drawType]);
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, ui);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default MouseTool;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _useMount from "ahooks/es/useMount";
|
|
2
|
+
import { useContext, useRef } from 'react';
|
|
3
|
+
import { mapContext } from '../Context';
|
|
4
|
+
|
|
5
|
+
function useMouseTools(onDrawEnd) {
|
|
6
|
+
var _useContext = useContext(mapContext),
|
|
7
|
+
instance = _useContext.instance;
|
|
8
|
+
|
|
9
|
+
var overlayersRef = useRef([]);
|
|
10
|
+
var mouseRef = useRef(null);
|
|
11
|
+
|
|
12
|
+
_useMount(function () {
|
|
13
|
+
var map = instance.map;
|
|
14
|
+
AMap.plugin(['AMap.MouseTool'], function () {
|
|
15
|
+
mouseRef.current = new AMap.MouseTool(map);
|
|
16
|
+
mouseRef.current.on('draw', function (e) {
|
|
17
|
+
overlayersRef.current.push(e.obj);
|
|
18
|
+
onDrawEnd === null || onDrawEnd === void 0 ? void 0 : onDrawEnd(e.obj);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
var draw = function draw(type) {
|
|
24
|
+
if (!mouseRef.current) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
switch (type) {
|
|
29
|
+
case 'rect':
|
|
30
|
+
mouseRef.current.rectangle();
|
|
31
|
+
break;
|
|
32
|
+
|
|
33
|
+
case 'polygon':
|
|
34
|
+
mouseRef.current.polygon();
|
|
35
|
+
break;
|
|
36
|
+
|
|
37
|
+
case 'circle':
|
|
38
|
+
mouseRef.current.circle();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
var clear = function clear(objs) {
|
|
43
|
+
objs.forEach(function (obj) {
|
|
44
|
+
instance.map.remove(obj);
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var close = function close(ifClear) {
|
|
49
|
+
if (!mouseRef.current) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
mouseRef.current.close(ifClear);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
clear: clear,
|
|
58
|
+
draw: draw,
|
|
59
|
+
close: close
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default useMouseTools;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { MapPoint } from '../interface';
|
|
2
3
|
import './index.less';
|
|
3
|
-
export interface
|
|
4
|
-
|
|
4
|
+
export interface ISinglePlayerProps {
|
|
5
|
+
center?: [number, number];
|
|
6
|
+
points: MapPoint[];
|
|
7
|
+
enableClick?: boolean;
|
|
8
|
+
onCenterChange?: (options: {
|
|
9
|
+
center: [number, number];
|
|
10
|
+
}) => void;
|
|
11
|
+
children?: React.ReactNode;
|
|
5
12
|
}
|
|
6
|
-
declare const _default: (props:
|
|
13
|
+
declare const _default: (props: ISinglePlayerProps) => JSX.Element;
|
|
7
14
|
export default _default;
|
|
@@ -1,35 +1,57 @@
|
|
|
1
1
|
import _useMount from "ahooks/es/useMount";
|
|
2
|
-
import React, { useCallback, useContext
|
|
2
|
+
import React, { useCallback, useContext } from 'react';
|
|
3
|
+
import ClusterLayer from '../ClusterLayer';
|
|
3
4
|
import ResetTools from '../ResetTools';
|
|
4
|
-
import
|
|
5
|
+
import DragMarker from '../LevelCenter/DragMarker';
|
|
5
6
|
import withMap from '../withMap';
|
|
6
7
|
import { mapContext } from '../Context';
|
|
7
|
-
import
|
|
8
|
+
import useMapEvent from '../hook/useMapEvent';
|
|
8
9
|
import "./index.css";
|
|
9
10
|
|
|
10
11
|
function SinglePoint(_ref) {
|
|
11
|
-
var
|
|
12
|
+
var center = _ref.center,
|
|
13
|
+
points = _ref.points,
|
|
14
|
+
onCenterChange = _ref.onCenterChange,
|
|
15
|
+
enableClick = _ref.enableClick,
|
|
16
|
+
children = _ref.children;
|
|
12
17
|
|
|
13
18
|
var _useContext = useContext(mapContext),
|
|
14
19
|
instance = _useContext.instance;
|
|
15
20
|
|
|
16
|
-
var type = useMapType();
|
|
17
|
-
var defaultCenter = useMemo(function () {
|
|
18
|
-
return type.AMap ? [point.longitude, point.latitude] : [point.latitude, point.longitude];
|
|
19
|
-
}, [type.AMap, point.longitude, point.latitude]);
|
|
20
21
|
var mapRest = useCallback(function () {
|
|
21
|
-
return instance.setZoomAndCenter(instance.config.zoom,
|
|
22
|
-
}, [
|
|
22
|
+
return instance.setZoomAndCenter(instance.config.zoom, instance.config.center);
|
|
23
|
+
}, [instance]);
|
|
23
24
|
|
|
24
25
|
_useMount(function () {
|
|
25
|
-
|
|
26
|
+
if (enableClick) {
|
|
27
|
+
instance.setCursor('pointer');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
mapRest();
|
|
26
31
|
});
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
useMapEvent('click', function (event) {
|
|
34
|
+
if (enableClick) {
|
|
35
|
+
var _center = [event.lnglat.lng, event.lnglat.lat];
|
|
36
|
+
instance.setCenter(_center);
|
|
37
|
+
onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
38
|
+
center: _center
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
43
|
+
points: points
|
|
44
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
29
45
|
onMapReset: mapRest
|
|
30
|
-
}), /*#__PURE__*/React.createElement(
|
|
31
|
-
|
|
32
|
-
|
|
46
|
+
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
47
|
+
center: center,
|
|
48
|
+
onChange: function onChange(_ref2) {
|
|
49
|
+
var center = _ref2.center;
|
|
50
|
+
return onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
51
|
+
center: center
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}), children);
|
|
33
55
|
}
|
|
34
56
|
|
|
35
57
|
export default withMap(SinglePoint, 'single-point-map-container');
|
package/es/Map/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ declare const Map: {
|
|
|
16
16
|
LoaderMap: typeof LoaderMap;
|
|
17
17
|
BasicMap: typeof BasicMap;
|
|
18
18
|
ResetTools: typeof ResetTools;
|
|
19
|
-
SinglePoint: (props: import("./SinglePoint").
|
|
19
|
+
SinglePoint: (props: import("./SinglePoint").ISinglePlayerProps) => JSX.Element;
|
|
20
20
|
useMarker: typeof useMarker;
|
|
21
21
|
withMap: typeof withMap;
|
|
22
22
|
};
|
package/es/Map/interface.d.ts
CHANGED
package/es/Player/api/index.d.ts
CHANGED
|
@@ -8,12 +8,14 @@ declare class Api {
|
|
|
8
8
|
play: () => void;
|
|
9
9
|
pause: () => void;
|
|
10
10
|
get paused(): boolean;
|
|
11
|
+
get muted(): boolean;
|
|
11
12
|
/**
|
|
12
13
|
* 设置currentTime实现seek
|
|
13
14
|
* @param {*} seconds
|
|
14
15
|
*/
|
|
15
16
|
seekTo: (seconds: number) => void;
|
|
16
17
|
setVolume: (fraction: number) => void;
|
|
18
|
+
getVolume: () => number;
|
|
17
19
|
mute: () => void;
|
|
18
20
|
unmute: () => void;
|
|
19
21
|
/**
|
package/es/Player/api/index.js
CHANGED
|
@@ -50,6 +50,10 @@ var Api = /*#__PURE__*/function () {
|
|
|
50
50
|
_this.video.volume = fraction;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
+
this.getVolume = function () {
|
|
54
|
+
return _this.video.volume;
|
|
55
|
+
};
|
|
56
|
+
|
|
53
57
|
this.mute = function () {
|
|
54
58
|
_this.video.muted = true;
|
|
55
59
|
};
|
|
@@ -185,6 +189,11 @@ var Api = /*#__PURE__*/function () {
|
|
|
185
189
|
get: function get() {
|
|
186
190
|
return this.video.paused;
|
|
187
191
|
}
|
|
192
|
+
}, {
|
|
193
|
+
key: "muted",
|
|
194
|
+
get: function get() {
|
|
195
|
+
return this.video.muted;
|
|
196
|
+
}
|
|
188
197
|
}]);
|
|
189
198
|
|
|
190
199
|
return Api;
|
|
@@ -13,10 +13,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import React, { useState, useCallback, useMemo, useContext } from 'react';
|
|
14
14
|
import IconFont from '../iconfont';
|
|
15
15
|
import Bar from './bar';
|
|
16
|
-
import { useTimes } from '../timeline';
|
|
17
|
-
import { timeStamp } from '../util';
|
|
18
16
|
import { Context } from '../context';
|
|
19
17
|
import { useVideoEvent } from '../event';
|
|
18
|
+
import Volume from './volume';
|
|
19
|
+
import Time from './time';
|
|
20
20
|
|
|
21
21
|
function LeftBar(_ref) {
|
|
22
22
|
var reload = _ref.reload,
|
|
@@ -27,7 +27,6 @@ function LeftBar(_ref) {
|
|
|
27
27
|
|
|
28
28
|
var _useContext = useContext(Context),
|
|
29
29
|
api = _useContext.api,
|
|
30
|
-
event = _useContext.event,
|
|
31
30
|
container = _useContext.container,
|
|
32
31
|
isLive = _useContext.isLive,
|
|
33
32
|
isFpsPlay = _useContext.isFpsPlay;
|
|
@@ -55,13 +54,7 @@ function LeftBar(_ref) {
|
|
|
55
54
|
}, [paused]);
|
|
56
55
|
var statusText = useMemo(function () {
|
|
57
56
|
return paused ? '播放' : '暂停';
|
|
58
|
-
}, [paused]);
|
|
59
|
-
|
|
60
|
-
var _useTimes = useTimes(api, event, isFpsPlay),
|
|
61
|
-
_useTimes2 = _slicedToArray(_useTimes, 3),
|
|
62
|
-
current = _useTimes2[0],
|
|
63
|
-
duration = _useTimes2[2]; //TODO 方法
|
|
64
|
-
|
|
57
|
+
}, [paused]); //TODO 方法
|
|
65
58
|
|
|
66
59
|
var changePlayStatus = useCallback(function () {
|
|
67
60
|
if (video === null || video === void 0 ? void 0 : video.paused) {
|
|
@@ -78,15 +71,15 @@ function LeftBar(_ref) {
|
|
|
78
71
|
onClick: changePlayStatus,
|
|
79
72
|
type: statusIconClassName,
|
|
80
73
|
title: statusText
|
|
81
|
-
})),
|
|
82
|
-
|
|
83
|
-
}
|
|
74
|
+
})), /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(Volume, {
|
|
75
|
+
api: api
|
|
76
|
+
})), !isLive && !hideTimeProgress && /*#__PURE__*/React.createElement(Time, null), /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(IconFont, {
|
|
84
77
|
onClick: reload,
|
|
85
78
|
type: "lm-player-Refresh_Main",
|
|
86
79
|
title: "\u91CD\u8F7D"
|
|
87
80
|
})), !isLive && oneFpsPlay && /*#__PURE__*/React.createElement(Bar, null, /*#__PURE__*/React.createElement(IconFont, {
|
|
88
81
|
onClick: isFpsPlay ? api.closeFpsPlay : api.openFpsPlay,
|
|
89
|
-
type: "lm-player-
|
|
82
|
+
type: "lm-player-zhuzhenplay",
|
|
90
83
|
title: "\u9010\u5E27\u64AD\u653E"
|
|
91
84
|
})), leftMidExtContents);
|
|
92
85
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useContext } from 'react';
|
|
14
|
+
import { Context } from '../context';
|
|
15
|
+
import { useTimes } from '../timeline';
|
|
16
|
+
import { timeStamp } from '../util';
|
|
17
|
+
|
|
18
|
+
function Time() {
|
|
19
|
+
var _useContext = useContext(Context),
|
|
20
|
+
api = _useContext.api,
|
|
21
|
+
event = _useContext.event,
|
|
22
|
+
isFpsPlay = _useContext.isFpsPlay;
|
|
23
|
+
|
|
24
|
+
var _useTimes = useTimes(api, event, isFpsPlay),
|
|
25
|
+
_useTimes2 = _slicedToArray(_useTimes, 3),
|
|
26
|
+
current = _useTimes2[0],
|
|
27
|
+
duration = _useTimes2[2];
|
|
28
|
+
|
|
29
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
30
|
+
className: "video-time-progress"
|
|
31
|
+
}, timeStamp(current), "/", timeStamp(duration || 0));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default Time;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type Api from '../api';
|
|
3
|
+
import '../style/volume.less';
|
|
4
|
+
declare function Volume({ api, style }: {
|
|
5
|
+
api: Api;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}): JSX.Element;
|
|
8
|
+
declare const _default: React.MemoExoticComponent<typeof Volume>;
|
|
9
|
+
export default _default;
|