@cloud-app-dev/vidc 4.0.19 → 4.0.21
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/AppContext/Sync.d.ts +8 -0
- package/es/AppContext/Sync.js +42 -0
- package/es/AppContext/index.d.ts +10 -0
- package/es/AppContext/index.js +141 -0
- package/es/AppContext/interface.d.ts +41 -0
- package/es/AppContext/static.d.ts +8 -0
- package/es/AppContext/static.js +9 -0
- package/es/Auth/index.d.ts +8 -0
- package/es/Auth/index.js +14 -0
- package/es/AutoExit/index.d.ts +6 -0
- package/es/AutoExit/index.js +19 -0
- package/es/CheckGroupFixed/demo.d.ts +3 -0
- package/es/CheckGroupFixed/demo.js +22 -0
- package/es/CheckGroupFixed/index.d.ts +24 -0
- package/es/CheckGroupFixed/index.js +140 -0
- package/es/CheckGroupFixed/index.less +56 -0
- package/es/Config/index.d.ts +4 -0
- package/es/Config/index.js +77 -0
- package/es/Config/interface.d.ts +65 -0
- package/es/Config/utils.d.ts +4 -0
- package/es/Config/utils.js +33 -0
- package/es/ConfigContext/index.d.ts +17 -0
- package/es/ConfigContext/index.js +21 -0
- package/es/CustomRenderSelect/index.d.ts +12 -0
- package/es/CustomRenderSelect/index.js +73 -0
- package/es/CustomRenderSelect/index.less +25 -0
- package/es/DBTools/index.d.ts +25 -0
- package/es/DBTools/index.js +336 -0
- package/es/DisableMark/index.d.ts +9 -0
- package/es/DisableMark/index.js +19 -0
- package/es/DisableMark/index.less +9 -0
- package/es/DomMove/demo.d.ts +2 -0
- package/es/DomMove/demo.js +16 -0
- package/es/DomMove/index.d.ts +16 -0
- package/es/DomMove/index.js +139 -0
- package/es/DomMove/utils.d.ts +8 -0
- package/es/DomMove/utils.js +32 -0
- package/es/Drag/DragAndDropItem.d.ts +4 -0
- package/es/Drag/DragAndDropItem.js +134 -0
- package/es/Drag/DropItem.d.ts +4 -0
- package/es/Drag/DropItem.js +50 -0
- package/es/Drag/index.d.ts +7 -0
- package/es/Drag/index.js +7 -0
- package/es/Drag/interface.d.ts +16 -0
- package/es/DynamicGridList/Demo.d.ts +3 -0
- package/es/DynamicGridList/Demo.js +77 -0
- package/es/DynamicGridList/index.d.ts +24 -0
- package/es/DynamicGridList/index.js +67 -0
- package/es/DynamicList/demo.d.ts +2 -0
- package/es/DynamicList/demo.js +44 -0
- package/es/DynamicList/index.d.ts +22 -0
- package/es/DynamicList/index.js +86 -0
- package/es/DynamicList/index.less +17 -0
- package/es/DynamicList/interface.d.ts +19 -0
- package/es/DynamicList/utils.d.ts +4 -0
- package/es/DynamicList/utils.js +6 -0
- package/es/ErrorFallback/index.d.ts +9 -0
- package/es/ErrorFallback/index.js +31 -0
- package/es/ErrorFallback/inerface.d.ts +48 -0
- package/es/EventTools/index.d.ts +3 -0
- package/es/EventTools/index.js +12 -0
- package/es/FrontendPlayer/index.d.ts +4 -0
- package/es/FrontendPlayer/index.js +2 -0
- package/es/FullScreen/index.d.ts +22 -0
- package/es/FullScreen/index.js +33 -0
- package/es/FullScreen/index.less +18 -0
- package/es/GridList/Demo.d.ts +3 -0
- package/es/GridList/Demo.js +80 -0
- package/es/GridList/data.d.ts +16 -0
- package/es/GridList/data.js +609 -0
- package/es/GridList/hook.d.ts +13 -0
- package/es/GridList/hook.js +270 -0
- package/es/GridList/index.d.ts +15 -0
- package/es/GridList/index.js +44 -0
- package/es/GridList/index.less +8 -0
- package/es/GridList/interface.d.ts +59 -0
- package/es/GridList/utils.d.ts +9 -0
- package/es/GridList/utils.js +42 -0
- package/es/HightLevel/index.d.ts +9 -0
- package/es/HightLevel/index.js +18 -0
- package/es/HightLevel/index.less +3 -0
- package/es/IconFont/index.d.ts +12 -0
- package/es/IconFont/index.js +54 -0
- package/es/ImageView/index.d.ts +20 -0
- package/es/ImageView/index.js +51 -0
- package/es/ImageView/index.less +11 -0
- package/es/InstanceHistory/index.d.ts +3 -0
- package/es/InstanceHistory/index.js +7 -0
- package/es/LabelPlayer/111.png +0 -0
- package/es/LabelPlayer/demo.d.ts +2 -0
- package/es/LabelPlayer/demo.js +115 -0
- package/es/LabelPlayer/index.d.ts +21 -0
- package/es/LabelPlayer/index.js +160 -0
- package/es/LabelPlayer/index.less +24 -0
- package/es/LabelValue/index.d.ts +15 -0
- package/es/LabelValue/index.js +27 -0
- package/es/LabelValue/index.less +23 -0
- package/es/List/demo.d.ts +3 -0
- package/es/List/demo.js +23 -0
- package/es/List/index.d.ts +28 -0
- package/es/List/index.js +28 -0
- package/es/List/index.less +20 -0
- package/es/ListWithSizeAnimate/demo.d.ts +2 -0
- package/es/ListWithSizeAnimate/demo.js +98 -0
- package/es/ListWithSizeAnimate/index.d.ts +14 -0
- package/es/ListWithSizeAnimate/index.js +85 -0
- package/es/ListWithSizeAnimate/index.less +23 -0
- package/es/LoaderScript/index.d.ts +47 -0
- package/es/LoaderScript/index.js +34 -0
- package/es/LoaderScript/utils.d.ts +13 -0
- package/es/LoaderScript/utils.js +179 -0
- package/es/Map/AMap.d.ts +7109 -0
- package/es/Map/BasicMap/AMapInstance.d.ts +19 -0
- package/es/Map/BasicMap/AMapInstance.js +98 -0
- package/es/Map/BasicMap/LeafletInstance.d.ts +18 -0
- package/es/Map/BasicMap/LeafletInstance.js +111 -0
- package/es/Map/BasicMap/index.d.ts +9 -0
- package/es/Map/BasicMap/index.js +90 -0
- package/es/Map/BasicMap/index.less +29 -0
- package/es/Map/ClusterLayer/demo.d.ts +3 -0
- package/es/Map/ClusterLayer/demo.js +18 -0
- package/es/Map/ClusterLayer/hook.d.ts +5 -0
- package/es/Map/ClusterLayer/hook.js +123 -0
- package/es/Map/ClusterLayer/index.d.ts +6 -0
- package/es/Map/ClusterLayer/index.js +28 -0
- package/es/Map/ClusterLayer/index.less +29 -0
- package/es/Map/ClusterLayer/props.d.ts +8 -0
- package/es/Map/Config/index.d.ts +9 -0
- package/es/Map/Config/index.js +48 -0
- package/es/Map/Config/utils.d.ts +2 -0
- package/es/Map/Config/utils.js +65 -0
- package/es/Map/Context/index.d.ts +11 -0
- package/es/Map/Context/index.js +51 -0
- package/es/Map/FindPio/index.d.ts +4 -0
- package/es/Map/FindPio/index.js +13 -0
- package/es/Map/FindPio/index.less +7 -0
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +4 -0
- package/es/Map/InfoWindow/MakerLikeWindow.js +112 -0
- package/es/Map/InfoWindow/demo.d.ts +3 -0
- package/es/Map/InfoWindow/demo.js +70 -0
- package/es/Map/InfoWindow/index.d.ts +11 -0
- package/es/Map/InfoWindow/index.js +66 -0
- package/es/Map/LevelCenter/DragMarker/index.d.ts +10 -0
- package/es/Map/LevelCenter/DragMarker/index.js +42 -0
- package/es/Map/LevelCenter/demo.d.ts +3 -0
- package/es/Map/LevelCenter/demo.js +38 -0
- package/es/Map/LevelCenter/index.d.ts +15 -0
- package/es/Map/LevelCenter/index.js +66 -0
- package/es/Map/LoaderMap/index.d.ts +7 -0
- package/es/Map/LoaderMap/index.js +62 -0
- package/es/Map/MapDrawSelect/demo.d.ts +3 -0
- package/es/Map/MapDrawSelect/demo.js +71 -0
- package/es/Map/MapDrawSelect/index.d.ts +15 -0
- package/es/Map/MapDrawSelect/index.js +56 -0
- package/es/Map/MouseTool/index.d.ts +10 -0
- package/es/Map/MouseTool/index.js +40 -0
- package/es/Map/MouseTool/useMouseTools.d.ts +7 -0
- package/es/Map/MouseTool/useMouseTools.js +83 -0
- package/es/Map/ResetTools/index.d.ts +10 -0
- package/es/Map/ResetTools/index.js +57 -0
- package/es/Map/ResetTools/index.less +39 -0
- package/es/Map/SinglePoint/demo.d.ts +3 -0
- package/es/Map/SinglePoint/demo.js +14 -0
- package/es/Map/SinglePoint/index.d.ts +27 -0
- package/es/Map/SinglePoint/index.js +52 -0
- package/es/Map/SinglePoint/index.less +41 -0
- package/es/Map/hook/useMapEvent.d.ts +2 -0
- package/es/Map/hook/useMapEvent.js +19 -0
- package/es/Map/hook/useMapType.d.ts +4 -0
- package/es/Map/hook/useMapType.js +12 -0
- package/es/Map/icon.d.ts +2 -0
- package/es/Map/icon.js +10 -0
- package/es/Map/index.d.ts +24 -0
- package/es/Map/index.js +25 -0
- package/es/Map/interface.d.ts +74 -0
- package/es/Map/points.d.ts +50 -0
- package/es/Map/points.js +1 -0
- package/es/Map/useMarker/index.d.ts +10 -0
- package/es/Map/useMarker/index.js +71 -0
- package/es/Map/withMap/index.d.ts +3 -0
- package/es/Map/withMap/index.js +10 -0
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +8 -0
- package/es/Picture/component/DefaultRects/RectInfo.js +80 -0
- package/es/Picture/component/DefaultRects/index.d.ts +13 -0
- package/es/Picture/component/DefaultRects/index.js +52 -0
- package/es/Picture/component/DefaultRects/index.less +211 -0
- package/es/Picture/component/DefaultRects/utils.d.ts +2 -0
- package/es/Picture/component/DefaultRects/utils.js +11 -0
- package/es/Picture/component/DrawRect/index.d.ts +13 -0
- package/es/Picture/component/DrawRect/index.js +46 -0
- package/es/Picture/component/DrawRect/index.less +8 -0
- package/es/Picture/component/RectMenu/index.d.ts +12 -0
- package/es/Picture/component/RectMenu/index.js +76 -0
- package/es/Picture/component/RectMenu/index.less +36 -0
- package/es/Picture/component/RectMenu/utils.d.ts +12 -0
- package/es/Picture/component/RectMenu/utils.js +19 -0
- package/es/Picture/component/Tools/index.d.ts +12 -0
- package/es/Picture/component/Tools/index.js +73 -0
- package/es/Picture/component/Tools/index.less +49 -0
- package/es/Picture/component/WheelScale/index.d.ts +7 -0
- package/es/Picture/component/WheelScale/index.js +27 -0
- package/es/Picture/demo.d.ts +2 -0
- package/es/Picture/demo.js +105 -0
- package/es/Picture/index.d.ts +5 -0
- package/es/Picture/index.js +341 -0
- package/es/Picture/index.less +20 -0
- package/es/Picture/interface.d.ts +196 -0
- package/es/Picture/loadCaptureRectImage.d.ts +3 -0
- package/es/Picture/loadCaptureRectImage.js +99 -0
- package/es/Picture/useDraw.d.ts +1 -0
- package/es/Picture/useDraw.js +103 -0
- package/es/Picture/utils.d.ts +26 -0
- package/es/Picture/utils.js +143 -0
- package/es/Player/api/index.d.ts +68 -0
- package/es/Player/api/index.js +309 -0
- package/es/Player/context.d.ts +17 -0
- package/es/Player/context.js +24 -0
- package/es/Player/contraller_bar/bar.d.ts +8 -0
- package/es/Player/contraller_bar/bar.js +20 -0
- package/es/Player/contraller_bar/contraller_event.d.ts +6 -0
- package/es/Player/contraller_bar/contraller_event.js +50 -0
- package/es/Player/contraller_bar/index.d.ts +14 -0
- package/es/Player/contraller_bar/index.js +27 -0
- package/es/Player/contraller_bar/left_bar.d.ts +10 -0
- package/es/Player/contraller_bar/left_bar.js +83 -0
- package/es/Player/contraller_bar/right_bar.d.ts +8 -0
- package/es/Player/contraller_bar/right_bar.js +32 -0
- package/es/Player/contraller_bar/time.d.ts +3 -0
- package/es/Player/contraller_bar/time.js +19 -0
- package/es/Player/contraller_bar/useBarStatus.d.ts +2 -0
- package/es/Player/contraller_bar/useBarStatus.js +43 -0
- package/es/Player/contraller_bar/volume.d.ts +9 -0
- package/es/Player/contraller_bar/volume.js +62 -0
- package/es/Player/demo.d.ts +3 -0
- package/es/Player/demo.js +266 -0
- package/es/Player/empty.d.ts +2 -0
- package/es/Player/empty.js +4 -0
- package/es/Player/event/errorEvent.d.ts +14 -0
- package/es/Player/event/errorEvent.js +88 -0
- package/es/Player/event/eventName.d.ts +18 -0
- package/es/Player/event/eventName.js +29 -0
- package/es/Player/event/index.d.ts +24 -0
- package/es/Player/event/index.js +205 -0
- package/es/Player/fps_play.d.ts +11 -0
- package/es/Player/fps_play.js +83 -0
- package/es/Player/frontend_player.d.ts +8 -0
- package/es/Player/frontend_player.js +64 -0
- package/es/Player/frontend_timeline.d.ts +10 -0
- package/es/Player/frontend_timeline.js +132 -0
- package/es/Player/iconfont.d.ts +5 -0
- package/es/Player/iconfont.js +16 -0
- package/es/Player/index.d.ts +2 -0
- package/es/Player/index.js +2 -0
- package/es/Player/live_heart.d.ts +8 -0
- package/es/Player/live_heart.js +45 -0
- package/es/Player/message.d.ts +5 -0
- package/es/Player/message.js +137 -0
- package/es/Player/player.d.ts +233 -0
- package/es/Player/segment_player.d.ts +9 -0
- package/es/Player/segment_player.js +228 -0
- package/es/Player/segment_timeline.d.ts +12 -0
- package/es/Player/segment_timeline.js +173 -0
- package/es/Player/single_player.d.ts +5 -0
- package/es/Player/single_player.js +262 -0
- package/es/Player/style/bar.less +43 -0
- package/es/Player/style/iconfont.js +43 -0
- package/es/Player/style/index.less +34 -0
- package/es/Player/style/message.less +56 -0
- package/es/Player/style/slider.less +106 -0
- package/es/Player/style/timeline.less +117 -0
- package/es/Player/style/volume.less +24 -0
- package/es/Player/timeline.d.ts +5 -0
- package/es/Player/timeline.js +95 -0
- package/es/Player/util.d.ts +43 -0
- package/es/Player/util.js +189 -0
- package/es/PlayerExt/demo.d.ts +3 -0
- package/es/PlayerExt/demo.js +154 -0
- package/es/PlayerExt/index.d.ts +48 -0
- package/es/PlayerExt/index.js +188 -0
- package/es/PlayerExt/index.less +10 -0
- package/es/Progress/index.d.ts +7 -0
- package/es/Progress/index.js +53 -0
- package/es/Progress/index.less +21 -0
- package/es/ROI/demo.d.ts +3 -0
- package/es/ROI/demo.js +16 -0
- package/es/ROI/index.d.ts +33 -0
- package/es/ROI/index.js +54 -0
- package/es/ROI/index.less +33 -0
- package/es/RefDrawer/Footer.d.ts +9 -0
- package/es/RefDrawer/Footer.js +22 -0
- package/es/RefDrawer/demo.d.ts +3 -0
- package/es/RefDrawer/demo.js +18 -0
- package/es/RefDrawer/index.d.ts +26 -0
- package/es/RefDrawer/index.js +71 -0
- package/es/RefModal/demo.d.ts +3 -0
- package/es/RefModal/demo.js +18 -0
- package/es/RefModal/index.d.ts +17 -0
- package/es/RefModal/index.js +70 -0
- package/es/ScreenPlayer/Live.d.ts +5 -0
- package/es/ScreenPlayer/Live.js +212 -0
- package/es/ScreenPlayer/LiveTools.d.ts +29 -0
- package/es/ScreenPlayer/LiveTools.js +151 -0
- package/es/ScreenPlayer/PlayerWithExt.d.ts +34 -0
- package/es/ScreenPlayer/PlayerWithExt.js +231 -0
- package/es/ScreenPlayer/RatePick.d.ts +8 -0
- package/es/ScreenPlayer/RatePick.js +29 -0
- package/es/ScreenPlayer/Record.d.ts +10 -0
- package/es/ScreenPlayer/Record.js +442 -0
- package/es/ScreenPlayer/RecordTools.d.ts +38 -0
- package/es/ScreenPlayer/RecordTools.js +197 -0
- package/es/ScreenPlayer/ScreenSelect.d.ts +7 -0
- package/es/ScreenPlayer/ScreenSelect.js +46 -0
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +17 -0
- package/es/ScreenPlayer/SegmentTimeLine.js +36 -0
- package/es/ScreenPlayer/TimeMode.d.ts +7 -0
- package/es/ScreenPlayer/TimeMode.js +26 -0
- package/es/ScreenPlayer/TimeSelect.d.ts +7 -0
- package/es/ScreenPlayer/TimeSelect.js +88 -0
- package/es/ScreenPlayer/demo.d.ts +2 -0
- package/es/ScreenPlayer/demo.js +21 -0
- package/es/ScreenPlayer/demo2.d.ts +2 -0
- package/es/ScreenPlayer/demo2.js +194 -0
- package/es/ScreenPlayer/index.d.ts +6 -0
- package/es/ScreenPlayer/index.js +9 -0
- package/es/ScreenPlayer/index.less +335 -0
- package/es/ScreenPlayer/interface.d.ts +216 -0
- package/es/ScreenPlayer/useTimeSlider.d.ts +25 -0
- package/es/ScreenPlayer/useTimeSlider.js +451 -0
- package/es/ScreenPlayer/useVideoFit.d.ts +5 -0
- package/es/ScreenPlayer/useVideoFit.js +35 -0
- package/es/ScreenPlayer/utils.d.ts +17 -0
- package/es/ScreenPlayer/utils.js +85 -0
- package/es/SegmentPlayer/index.d.ts +2 -0
- package/es/SegmentPlayer/index.js +2 -0
- package/es/Service/http.d.ts +6 -0
- package/es/Service/http.js +133 -0
- package/es/Service/index.d.ts +3 -0
- package/es/Service/index.js +11 -0
- package/es/Service/interface.d.ts +23 -0
- package/es/Service/middleware.d.ts +8 -0
- package/es/Service/middleware.js +22 -0
- package/es/SocketEmitter/eventEmitter.d.ts +27 -0
- package/es/SocketEmitter/eventEmitter.js +88 -0
- package/es/SocketEmitter/index.d.ts +24 -0
- package/es/SocketEmitter/index.js +125 -0
- package/es/SocketEmitter/interface.d.ts +4 -0
- package/es/TableLayout/index.d.ts +10 -0
- package/es/TableLayout/index.js +27 -0
- package/es/TableLayout/index.less +4 -0
- package/es/ThemeAntd/demo.d.ts +4 -0
- package/es/ThemeAntd/demo.js +81 -0
- package/es/ThemeAntd/demo.less +20 -0
- package/es/ThemeAntd/index.d.ts +7 -0
- package/es/ThemeAntd/index.js +21 -0
- package/es/ThemeAntd/index.less +4 -0
- package/es/Timeout/index.d.ts +26 -0
- package/es/Timeout/index.js +65 -0
- package/es/bigNumberTransformCN/index.d.ts +5 -0
- package/es/bigNumberTransformCN/index.js +58 -0
- package/es/cache/index.d.ts +34 -0
- package/es/cache/index.js +94 -0
- package/es/copy/index.d.ts +1 -0
- package/es/copy/index.js +9 -0
- package/es/core.d.ts +0 -0
- package/es/getThemeStyle/index.d.ts +2 -0
- package/es/getThemeStyle/index.js +5 -0
- package/es/index.d.ts +62 -0
- package/es/index.js +62 -0
- package/es/likeGo/index.d.ts +2 -0
- package/es/likeGo/index.js +31 -0
- package/es/likeGoSync/index.d.ts +2 -0
- package/es/likeGoSync/index.js +10 -0
- package/es/logger/index.d.ts +7 -0
- package/es/logger/index.js +30 -0
- package/es/nextTick/index.d.ts +1 -0
- package/es/nextTick/index.js +3 -0
- package/es/recorder/demo.d.ts +3 -0
- package/es/recorder/demo.js +181 -0
- package/es/recorder/index.d.ts +294 -0
- package/es/recorder/index.js +992 -0
- package/es/submidstr/index.d.ts +5 -0
- package/es/submidstr/index.js +14 -0
- package/es/treeHelper/index.d.ts +11 -0
- package/es/treeHelper/index.js +188 -0
- package/es/typings.d.ts +2 -0
- package/es/useDrawROI/index.d.ts +16 -0
- package/es/useDrawROI/index.js +318 -0
- package/es/useEventEmitterHandle/index.d.ts +2 -0
- package/es/useEventEmitterHandle/index.js +17 -0
- package/es/useFullscreen/demo.d.ts +2 -0
- package/es/useFullscreen/demo.js +43 -0
- package/es/useFullscreen/index.d.ts +12 -0
- package/es/useFullscreen/index.js +76 -0
- package/es/useHistory/index.d.ts +3 -0
- package/es/useHistory/index.js +9 -0
- package/es/useHistory/interface.d.ts +3 -0
- package/es/useInfiniteScroll/index.d.ts +16 -0
- package/es/useInfiniteScroll/index.js +102 -0
- package/es/useRafInterval/index.d.ts +5 -0
- package/es/useRafInterval/index.js +71 -0
- package/es/useSimpleState/index.d.ts +3 -0
- package/es/useSimpleState/index.js +35 -0
- package/es/useVirtualList/index.d.ts +13 -0
- package/es/useVirtualList/index.js +136 -0
- package/es/utils.d.ts +14 -0
- package/es/utils.js +46 -0
- package/es/uuid/index.d.ts +5 -0
- package/es/uuid/index.js +6 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useMount } from 'ahooks';
|
|
2
|
+
import React, { useCallback, useContext, useMemo } from 'react';
|
|
3
|
+
import ClusterLayer from "../ClusterLayer";
|
|
4
|
+
import { mapContext } from "../Context";
|
|
5
|
+
import useMapEvent from "../hook/useMapEvent";
|
|
6
|
+
import ResetTools from "../ResetTools";
|
|
7
|
+
import withMap from "../withMap";
|
|
8
|
+
import DragMarker from "./DragMarker";
|
|
9
|
+
function LevelCenter(_ref) {
|
|
10
|
+
var center = _ref.center,
|
|
11
|
+
zoom = _ref.zoom,
|
|
12
|
+
points = _ref.points,
|
|
13
|
+
onLevelCenterChange = _ref.onLevelCenterChange,
|
|
14
|
+
enableClick = _ref.enableClick,
|
|
15
|
+
children = _ref.children;
|
|
16
|
+
var _useContext = useContext(mapContext),
|
|
17
|
+
instance = _useContext.instance;
|
|
18
|
+
var defaultCenter = useMemo(function () {
|
|
19
|
+
return center || instance.config.center;
|
|
20
|
+
}, [center, instance]);
|
|
21
|
+
var defaultZoom = useMemo(function () {
|
|
22
|
+
return zoom || instance.config.zoom;
|
|
23
|
+
}, [zoom, instance]);
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
+
var mapRest = useCallback(function () {
|
|
27
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
28
|
+
}, [defaultZoom, defaultCenter]);
|
|
29
|
+
useMount(function () {
|
|
30
|
+
if (enableClick) {
|
|
31
|
+
instance.setCursor('pointer');
|
|
32
|
+
}
|
|
33
|
+
mapRest();
|
|
34
|
+
});
|
|
35
|
+
useMapEvent('click', function (event) {
|
|
36
|
+
if (enableClick) {
|
|
37
|
+
var _center = [event.lnglat.lng, event.lnglat.lat];
|
|
38
|
+
instance.setCenter(_center);
|
|
39
|
+
onLevelCenterChange === null || onLevelCenterChange === void 0 || onLevelCenterChange({
|
|
40
|
+
center: _center,
|
|
41
|
+
zoom: instance.getZoom()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
useMapEvent('zoomend', function () {
|
|
46
|
+
onLevelCenterChange === null || onLevelCenterChange === void 0 || onLevelCenterChange({
|
|
47
|
+
center: defaultCenter,
|
|
48
|
+
zoom: instance.getZoom()
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
52
|
+
points: points
|
|
53
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
54
|
+
onMapReset: mapRest
|
|
55
|
+
}), /*#__PURE__*/React.createElement(DragMarker, {
|
|
56
|
+
center: defaultCenter,
|
|
57
|
+
onChange: function onChange(_ref2) {
|
|
58
|
+
var center = _ref2.center;
|
|
59
|
+
return onLevelCenterChange === null || onLevelCenterChange === void 0 ? void 0 : onLevelCenterChange({
|
|
60
|
+
center: center,
|
|
61
|
+
zoom: instance.getZoom()
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}), children);
|
|
65
|
+
}
|
|
66
|
+
export default withMap(LevelCenter, 'lv-center-map-container');
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["children", "MAP_GLABAL_KEY"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
|
+
import Config from "../../Config";
|
|
12
|
+
import LoaderScript from "../../LoaderScript";
|
|
13
|
+
var L_SCRIPTS = [{
|
|
14
|
+
scripts: ['https://cdn.bootcdn.net/ajax/libs/leaflet/1.8.0/leaflet.min.js'],
|
|
15
|
+
styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet/1.8.0/leaflet.min.css']
|
|
16
|
+
// scripts: ['/statics/libs/map/leaflet/leaflet.min.js'],
|
|
17
|
+
// styles: ['/statics/libs/map/leaflet/leaflet.min.css'],
|
|
18
|
+
}, {
|
|
19
|
+
scripts: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/leaflet.markercluster.min.js'
|
|
20
|
+
// '/statics/libs/map/leaflet/echarts-leaflet.js'
|
|
21
|
+
// '/statics/libs/map/leaflet/leaflet.markercluster.js'
|
|
22
|
+
],
|
|
23
|
+
styles: ['https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.min.css', 'https://cdn.bootcdn.net/ajax/libs/leaflet.markercluster/1.5.3/MarkerCluster.Default.min.css'
|
|
24
|
+
// '/statics/libs/map/leaflet/MarkerCluster.css'
|
|
25
|
+
// '/statics/libs/map/leaflet/MarkerCluster.Default.css'
|
|
26
|
+
]
|
|
27
|
+
}];
|
|
28
|
+
var AMAP_SCRIPTS = [{
|
|
29
|
+
scripts: ['https://webapi.amap.com/maps?v=2.0&key=2232e46c0b578b711e6e9851cb92dbfe']
|
|
30
|
+
}];
|
|
31
|
+
function EmptyParent(_ref) {
|
|
32
|
+
var children = _ref.children;
|
|
33
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
34
|
+
}
|
|
35
|
+
function LoaderMap(_ref2) {
|
|
36
|
+
var children = _ref2.children,
|
|
37
|
+
_ref2$MAP_GLABAL_KEY = _ref2.MAP_GLABAL_KEY,
|
|
38
|
+
MAP_GLABAL_KEY = _ref2$MAP_GLABAL_KEY === void 0 ? 'AMap' : _ref2$MAP_GLABAL_KEY,
|
|
39
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
40
|
+
var glaobalKey = useMemo(function () {
|
|
41
|
+
return MAP_GLABAL_KEY ? MAP_GLABAL_KEY : Config.BSConfig.MAP_GLABAL_KEY || 'L';
|
|
42
|
+
}, [MAP_GLABAL_KEY]);
|
|
43
|
+
var isL = useMemo(function () {
|
|
44
|
+
return glaobalKey === 'L';
|
|
45
|
+
}, [glaobalKey]);
|
|
46
|
+
var isLoaded = useMemo(function () {
|
|
47
|
+
return !!window[glaobalKey];
|
|
48
|
+
}, [glaobalKey]);
|
|
49
|
+
var options = useMemo(function () {
|
|
50
|
+
return isL ? L_SCRIPTS : AMAP_SCRIPTS;
|
|
51
|
+
}, [isL]);
|
|
52
|
+
var Parent = useMemo(function () {
|
|
53
|
+
return isLoaded ? EmptyParent : LoaderScript;
|
|
54
|
+
}, [isLoaded]);
|
|
55
|
+
return /*#__PURE__*/React.createElement(Parent, {
|
|
56
|
+
options: options
|
|
57
|
+
}, /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
58
|
+
isL: isL,
|
|
59
|
+
glaobalKey: glaobalKey
|
|
60
|
+
})));
|
|
61
|
+
}
|
|
62
|
+
export default LoaderMap;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useEffect, useState } from 'react';
|
|
8
|
+
import deviceList from "../points";
|
|
9
|
+
import MapDrawSelect from "./index";
|
|
10
|
+
var App = function App() {
|
|
11
|
+
var _useState = useState([]),
|
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13
|
+
points = _useState2[0],
|
|
14
|
+
setPoints = _useState2[1];
|
|
15
|
+
var _useState3 = useState(),
|
|
16
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
17
|
+
type = _useState4[0],
|
|
18
|
+
setType = _useState4[1];
|
|
19
|
+
var _useState5 = useState({
|
|
20
|
+
zoom: null,
|
|
21
|
+
center: null
|
|
22
|
+
}),
|
|
23
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
24
|
+
state = _useState6[0],
|
|
25
|
+
setState = _useState6[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
setTimeout(function () {
|
|
28
|
+
setPoints(deviceList);
|
|
29
|
+
setState({
|
|
30
|
+
center: [116.397392, 39.918206],
|
|
31
|
+
zoom: 13.74
|
|
32
|
+
});
|
|
33
|
+
}, 1000);
|
|
34
|
+
}, []);
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
style: {
|
|
37
|
+
width: '100%',
|
|
38
|
+
height: 800
|
|
39
|
+
}
|
|
40
|
+
}, /*#__PURE__*/React.createElement(MapDrawSelect, {
|
|
41
|
+
zoom: state.zoom,
|
|
42
|
+
center: state.center,
|
|
43
|
+
points: points,
|
|
44
|
+
drawEnd: console.log,
|
|
45
|
+
drawType: type,
|
|
46
|
+
drawUi: /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
style: {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
right: 20,
|
|
50
|
+
top: 120
|
|
51
|
+
}
|
|
52
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
53
|
+
onClick: function onClick() {
|
|
54
|
+
return setType(type === 'rect' ? 'close' : 'rect');
|
|
55
|
+
}
|
|
56
|
+
}, "\u77E9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
57
|
+
onClick: function onClick() {
|
|
58
|
+
return setType(type === 'polygon' ? 'close' : 'polygon');
|
|
59
|
+
}
|
|
60
|
+
}, "\u591A\u8FB9\u5F62"), /*#__PURE__*/React.createElement("span", {
|
|
61
|
+
onClick: function onClick() {
|
|
62
|
+
return setType(type === 'circle' ? 'close' : 'circle');
|
|
63
|
+
}
|
|
64
|
+
}, "\u5706\u5F27"), /*#__PURE__*/React.createElement("span", {
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
return setType('clear');
|
|
67
|
+
}
|
|
68
|
+
}, "\u6E05\u9664"))
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
export default App;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DrawType, MapPoint } from '../interface';
|
|
3
|
+
export interface IMapDrawSelectProps {
|
|
4
|
+
center?: [number, number];
|
|
5
|
+
zoom?: number;
|
|
6
|
+
points: MapPoint[];
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
drawUi?: React.ReactNode;
|
|
9
|
+
drawType?: DrawType | 'clear' | 'close';
|
|
10
|
+
selectCenter?: [number, number];
|
|
11
|
+
drawEnd?: (points: MapPoint[]) => void;
|
|
12
|
+
onPointClick?: (point: MapPoint) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: (props: IMapDrawSelectProps) => React.JSX.Element;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { useMount, useUpdateEffect } from 'ahooks';
|
|
2
|
+
import React, { useCallback, useContext, useEffect, useMemo } from 'react';
|
|
3
|
+
import ClusterLayer from "../ClusterLayer";
|
|
4
|
+
import { mapContext } from "../Context";
|
|
5
|
+
import MouseTool from "../MouseTool";
|
|
6
|
+
import ResetTools from "../ResetTools";
|
|
7
|
+
import withMap from "../withMap";
|
|
8
|
+
function MapDrawSelect(_ref) {
|
|
9
|
+
var center = _ref.center,
|
|
10
|
+
zoom = _ref.zoom,
|
|
11
|
+
points = _ref.points,
|
|
12
|
+
children = _ref.children,
|
|
13
|
+
drawUi = _ref.drawUi,
|
|
14
|
+
drawType = _ref.drawType,
|
|
15
|
+
selectCenter = _ref.selectCenter,
|
|
16
|
+
drawEnd = _ref.drawEnd,
|
|
17
|
+
onPointClick = _ref.onPointClick;
|
|
18
|
+
var _useContext = useContext(mapContext),
|
|
19
|
+
instance = _useContext.instance;
|
|
20
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21
|
+
var defaultCenter = useMemo(function () {
|
|
22
|
+
return center || instance.config.center;
|
|
23
|
+
}, [center]);
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
var defaultZoom = useMemo(function () {
|
|
26
|
+
return zoom || instance.config.zoom;
|
|
27
|
+
}, [zoom]);
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
+
var mapRest = useCallback(function () {
|
|
31
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
32
|
+
}, [defaultZoom, defaultCenter]);
|
|
33
|
+
useMount(function () {
|
|
34
|
+
return mapRest();
|
|
35
|
+
});
|
|
36
|
+
useUpdateEffect(function () {
|
|
37
|
+
return instance.setZoomAndCenter(defaultZoom, defaultCenter);
|
|
38
|
+
}, [defaultZoom, defaultCenter]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (selectCenter) {
|
|
41
|
+
instance.setZoomAndCenter(defaultZoom, selectCenter);
|
|
42
|
+
}
|
|
43
|
+
}, [defaultZoom, instance, selectCenter]);
|
|
44
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ClusterLayer, {
|
|
45
|
+
points: points,
|
|
46
|
+
onPointClick: onPointClick
|
|
47
|
+
}), /*#__PURE__*/React.createElement(ResetTools, {
|
|
48
|
+
onMapReset: mapRest
|
|
49
|
+
}), /*#__PURE__*/React.createElement(MouseTool, {
|
|
50
|
+
ui: drawUi,
|
|
51
|
+
drawType: drawType,
|
|
52
|
+
drawEnd: drawEnd,
|
|
53
|
+
points: points
|
|
54
|
+
}), children);
|
|
55
|
+
}
|
|
56
|
+
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): React.JSX.Element;
|
|
10
|
+
export default MouseTool;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useUpdateEffect } from 'ahooks';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import nextTick from "../../nextTick";
|
|
4
|
+
import useMouseTools from "./useMouseTools";
|
|
5
|
+
function MouseTool(_ref) {
|
|
6
|
+
var ui = _ref.ui,
|
|
7
|
+
drawType = _ref.drawType,
|
|
8
|
+
_ref$points = _ref.points,
|
|
9
|
+
points = _ref$points === void 0 ? [] : _ref$points,
|
|
10
|
+
drawEnd = _ref.drawEnd;
|
|
11
|
+
var _useMouseTools = useMouseTools(function (obj) {
|
|
12
|
+
var selectPoints = [];
|
|
13
|
+
for (var i = 0; i < points.length; i++) {
|
|
14
|
+
var item = points[i];
|
|
15
|
+
if (item.longitude && item.latitude && obj.contains([item.longitude, item.latitude])) {
|
|
16
|
+
selectPoints.push(item);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
nextTick(function () {
|
|
20
|
+
return drawEnd === null || drawEnd === void 0 ? void 0 : drawEnd(selectPoints);
|
|
21
|
+
});
|
|
22
|
+
}),
|
|
23
|
+
draw = _useMouseTools.draw,
|
|
24
|
+
close = _useMouseTools.close;
|
|
25
|
+
useUpdateEffect(function () {
|
|
26
|
+
switch (drawType) {
|
|
27
|
+
case 'clear':
|
|
28
|
+
close(true);
|
|
29
|
+
break;
|
|
30
|
+
case 'close':
|
|
31
|
+
close();
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
draw(drawType);
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}, [drawType]);
|
|
38
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, ui);
|
|
39
|
+
}
|
|
40
|
+
export default MouseTool;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
|
+
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."); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
+
import { useMount } from 'ahooks';
|
|
14
|
+
import { useContext, useEffect, useRef, useState } from 'react';
|
|
15
|
+
import { mapContext } from "../Context";
|
|
16
|
+
function useMouseTools(onDrawEnd) {
|
|
17
|
+
var _useState = useState({
|
|
18
|
+
focusKey: Date.now()
|
|
19
|
+
}),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
state = _useState2[0],
|
|
22
|
+
setState = _useState2[1];
|
|
23
|
+
var _useContext = useContext(mapContext),
|
|
24
|
+
instance = _useContext.instance;
|
|
25
|
+
var overlayersRef = useRef([]);
|
|
26
|
+
var mouseRef = useRef(null);
|
|
27
|
+
useMount(function () {
|
|
28
|
+
var map = instance.map;
|
|
29
|
+
AMap.plugin(['AMap.MouseTool'], function () {
|
|
30
|
+
mouseRef.current = new AMap.MouseTool(map);
|
|
31
|
+
setState(function (old) {
|
|
32
|
+
return _objectSpread(_objectSpread({}, old), {}, {
|
|
33
|
+
focusKey: Date.now()
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
useEffect(function () {
|
|
39
|
+
if (!mouseRef.current) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
var fn = function fn(e) {
|
|
43
|
+
overlayersRef.current.push(e.obj);
|
|
44
|
+
onDrawEnd === null || onDrawEnd === void 0 || onDrawEnd(e.obj);
|
|
45
|
+
};
|
|
46
|
+
mouseRef.current.on('draw', fn);
|
|
47
|
+
return function () {
|
|
48
|
+
mouseRef.current.off('draw', fn);
|
|
49
|
+
};
|
|
50
|
+
}, [onDrawEnd, state.focusKey]);
|
|
51
|
+
var draw = function draw(type) {
|
|
52
|
+
if (!mouseRef.current) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
switch (type) {
|
|
56
|
+
case 'rect':
|
|
57
|
+
mouseRef.current.rectangle();
|
|
58
|
+
break;
|
|
59
|
+
case 'polygon':
|
|
60
|
+
mouseRef.current.polygon();
|
|
61
|
+
break;
|
|
62
|
+
case 'circle':
|
|
63
|
+
mouseRef.current.circle();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var clear = function clear(objs) {
|
|
67
|
+
objs.forEach(function (obj) {
|
|
68
|
+
instance.map.remove(obj);
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
var close = function close(ifClear) {
|
|
72
|
+
if (!mouseRef.current) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
mouseRef.current.close(ifClear);
|
|
76
|
+
};
|
|
77
|
+
return {
|
|
78
|
+
clear: clear,
|
|
79
|
+
draw: draw,
|
|
80
|
+
close: close
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export default useMouseTools;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../Player/style/iconfont';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface IResetTools {
|
|
5
|
+
onMapReset?: () => void;
|
|
6
|
+
onMapZoom?: (num: number) => void;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
declare function ResetTools({ onMapReset, onMapZoom, className }: IResetTools): React.JSX.Element;
|
|
10
|
+
export default ResetTools;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
2
|
+
import { mapContext } from "../Context";
|
|
3
|
+
import { Popover } from 'antd';
|
|
4
|
+
import IconFont from "../../IconFont";
|
|
5
|
+
import "../../Player/style/iconfont";
|
|
6
|
+
import "./index.less";
|
|
7
|
+
function ResetTools(_ref) {
|
|
8
|
+
var onMapReset = _ref.onMapReset,
|
|
9
|
+
onMapZoom = _ref.onMapZoom,
|
|
10
|
+
_ref$className = _ref.className,
|
|
11
|
+
className = _ref$className === void 0 ? '' : _ref$className;
|
|
12
|
+
var _useContext = useContext(mapContext),
|
|
13
|
+
instance = _useContext.instance;
|
|
14
|
+
var mapReset = useCallback(function () {
|
|
15
|
+
return onMapReset ? onMapReset() : instance.mapReset();
|
|
16
|
+
}, []);
|
|
17
|
+
var mapZoom = useCallback(function (num) {
|
|
18
|
+
return onMapZoom ? onMapZoom(num) : instance.setZoom(instance.getZoom() + num);
|
|
19
|
+
}, []);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
className: "map-reset-tool-container ".concat(className)
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
23
|
+
placement: "left",
|
|
24
|
+
content: "\u590D\u4F4D",
|
|
25
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
26
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
className: "map-reset map-tool-icon",
|
|
28
|
+
onClick: mapReset
|
|
29
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
30
|
+
type: "lm-player-S_Bar_Reduction"
|
|
31
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
32
|
+
className: "map-zoom"
|
|
33
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
34
|
+
placement: "left",
|
|
35
|
+
content: "\u653E\u5927",
|
|
36
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
37
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: "map-tool-icon",
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return mapZoom(1);
|
|
41
|
+
}
|
|
42
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
43
|
+
type: "lm-player-S_Edit_LinePlus"
|
|
44
|
+
}))), /*#__PURE__*/React.createElement(Popover, {
|
|
45
|
+
placement: "left",
|
|
46
|
+
content: "\u7F29\u5C0F",
|
|
47
|
+
overlayClassName: "map-rest-tools-item-popup"
|
|
48
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
49
|
+
className: "map-tool-icon",
|
|
50
|
+
onClick: function onClick() {
|
|
51
|
+
return mapZoom(-1);
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
54
|
+
type: "lm-player-S_Edit_LineMinus"
|
|
55
|
+
})))));
|
|
56
|
+
}
|
|
57
|
+
export default ResetTools;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
.map-reset-tool-container {
|
|
2
|
+
position: absolute;
|
|
3
|
+
right: 10px;
|
|
4
|
+
bottom: 10px;
|
|
5
|
+
z-index: 3;
|
|
6
|
+
padding: 5px 0;
|
|
7
|
+
background: #fff;
|
|
8
|
+
|
|
9
|
+
.map-reset,
|
|
10
|
+
.map-zoom {
|
|
11
|
+
background: #fff;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.map-zoom {
|
|
15
|
+
margin-bottom: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.map-tool-icon {
|
|
19
|
+
display: flex;
|
|
20
|
+
width: 30px;
|
|
21
|
+
height: 25px;
|
|
22
|
+
font-size: 18px;
|
|
23
|
+
color: var(--icon);
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
|
|
28
|
+
&:hover {
|
|
29
|
+
color: var(--primary);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.map-rest-tools-item-popup {
|
|
35
|
+
.ant-popover-inner-content {
|
|
36
|
+
padding: 4px 8px;
|
|
37
|
+
font-size: var(--fs-small);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SinglePoint from "./index";
|
|
3
|
+
var App = function App() {
|
|
4
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
+
style: {
|
|
6
|
+
width: '100%',
|
|
7
|
+
height: 800
|
|
8
|
+
}
|
|
9
|
+
}, /*#__PURE__*/React.createElement(SinglePoint, {
|
|
10
|
+
center: [112.94477421092171, 38.499347690146514],
|
|
11
|
+
title: "\u8BBE\u7F6E1111"
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
export default App;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MapPoint } from '../interface';
|
|
3
|
+
import './index.less';
|
|
4
|
+
export interface ISinglePlayerProps {
|
|
5
|
+
/**
|
|
6
|
+
* 点位经纬度
|
|
7
|
+
*/
|
|
8
|
+
center?: [number, number];
|
|
9
|
+
/**
|
|
10
|
+
* 展示标题
|
|
11
|
+
*/
|
|
12
|
+
title?: string;
|
|
13
|
+
points?: MapPoint[];
|
|
14
|
+
/**
|
|
15
|
+
* 开启点击设置
|
|
16
|
+
*/
|
|
17
|
+
enableClick?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* 中心点变化
|
|
20
|
+
*/
|
|
21
|
+
onCenterChange?: (options: {
|
|
22
|
+
center: [number, number];
|
|
23
|
+
}) => void;
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare const _default: (props: ISinglePlayerProps) => React.JSX.Element;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useCallback, useContext } from 'react';
|
|
2
|
+
import ClusterLayer from "../ClusterLayer";
|
|
3
|
+
import ResetTools from "../ResetTools";
|
|
4
|
+
import DragMarker from "../LevelCenter/DragMarker";
|
|
5
|
+
import withMap from "../withMap";
|
|
6
|
+
import { mapContext } from "../Context";
|
|
7
|
+
import { useMount } from 'ahooks';
|
|
8
|
+
import useMapEvent from "../hook/useMapEvent";
|
|
9
|
+
import "./index.less";
|
|
10
|
+
function SinglePoint(_ref) {
|
|
11
|
+
var center = _ref.center,
|
|
12
|
+
points = _ref.points,
|
|
13
|
+
onCenterChange = _ref.onCenterChange,
|
|
14
|
+
enableClick = _ref.enableClick,
|
|
15
|
+
title = _ref.title,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
var _useContext = useContext(mapContext),
|
|
18
|
+
instance = _useContext.instance;
|
|
19
|
+
var mapRest = useCallback(function () {
|
|
20
|
+
return instance.setZoomAndCenter(instance.config.zoom, center !== null && center !== void 0 ? center : instance.config.center);
|
|
21
|
+
}, [center, instance]);
|
|
22
|
+
useMount(function () {
|
|
23
|
+
if (enableClick) {
|
|
24
|
+
instance.setCursor('pointer');
|
|
25
|
+
}
|
|
26
|
+
mapRest();
|
|
27
|
+
});
|
|
28
|
+
useMapEvent('click', function (event) {
|
|
29
|
+
if (enableClick) {
|
|
30
|
+
var _center = [event.lnglat.lng, event.lnglat.lat];
|
|
31
|
+
instance.setCenter(_center);
|
|
32
|
+
onCenterChange === null || onCenterChange === void 0 || onCenterChange({
|
|
33
|
+
center: _center
|
|
34
|
+
});
|
|
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(DragMarker, {
|
|
42
|
+
title: title,
|
|
43
|
+
center: center,
|
|
44
|
+
onChange: function onChange(_ref2) {
|
|
45
|
+
var center = _ref2.center;
|
|
46
|
+
return onCenterChange === null || onCenterChange === void 0 ? void 0 : onCenterChange({
|
|
47
|
+
center: center
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}), children);
|
|
51
|
+
}
|
|
52
|
+
export default withMap(SinglePoint, 'single-point-map-container');
|