@cloud-app-dev/vidc 3.2.16 → 3.2.18
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/.prettierrc.js +1 -1
- package/.stylelintrc.js +113 -0
- package/es/AppContext/index.js +3 -4
- package/es/Box/InfoBox/index.less +8 -6
- package/es/Box/TwoColumnBox/index.less +32 -22
- package/es/Box/index.less +1 -1
- package/es/CheckGroupFixed/index.less +17 -14
- package/es/CustomRenderSelect/index.less +7 -7
- package/es/DisableMark/index.less +3 -3
- package/es/DomMove/index.js +5 -5
- package/es/Drag/DragAndDropItem.js +1 -2
- package/es/Drag/DropItem.js +2 -2
- package/es/Drag/index.d.ts +9 -7
- package/es/Drawer/index.js +19 -20
- package/es/Drawer/index.less +8 -8
- package/es/Drawer/interface.d.ts +4 -3
- package/es/DynamicGridList/Demo.js +1 -1
- package/es/DynamicList/index.less +2 -0
- package/es/FullScreen/index.less +6 -4
- package/es/GridList/Demo.js +2 -2
- package/es/GridList/index.js +2 -1
- package/es/GridList/index.less +1 -1
- package/es/ImageView/index.less +2 -1
- package/es/Input/index.less +1 -1
- package/es/LabelValue/index.less +5 -2
- package/es/List/index.less +2 -2
- package/es/ListWithSizeAnimate/demo.js +0 -1
- package/es/ListWithSizeAnimate/index.js +18 -28
- package/es/ListWithSizeAnimate/index.less +10 -6
- package/es/Map/BasicMap/index.less +8 -3
- package/es/Map/ClusterLayer/index.less +8 -6
- package/es/Map/FindPio/index.less +2 -2
- package/es/Map/LevelCenter/index.js +3 -4
- package/es/Map/MapDrawSelect/index.js +2 -3
- package/es/Map/ResetTools/index.less +10 -6
- package/es/Map/SinglePoint/index.less +3 -3
- package/es/Map/useMarker/index.js +1 -1
- package/es/Modal/index.js +17 -17
- package/es/Modal/index.less +10 -11
- package/es/Picture/component/DefaultRects/index.js +3 -1
- package/es/Picture/component/DefaultRects/index.less +51 -28
- package/es/Picture/component/DrawRect/index.js +3 -1
- package/es/Picture/component/DrawRect/index.less +2 -2
- package/es/Picture/component/RectMenu/index.less +11 -6
- package/es/Picture/component/Tools/index.js +1 -1
- package/es/Picture/component/Tools/index.less +12 -6
- package/es/Picture/index.js +50 -26
- package/es/Picture/index.less +3 -2
- package/es/Picture/useDraw.js +1 -1
- package/es/Picture/utils.js +35 -34
- package/es/Player/api/index.js +67 -35
- package/es/Player/contraller_bar/contraller_event.js +4 -4
- package/es/Player/contraller_bar/left_bar.js +12 -10
- package/es/Player/empty.js +6 -0
- package/es/Player/event/errorEvent.js +7 -8
- package/es/Player/event/index.js +1 -1
- package/es/Player/fps_play.js +10 -8
- package/es/Player/frontend_player.js +13 -10
- package/es/Player/frontend_timeline.js +41 -41
- package/es/Player/live_heart.js +15 -5
- package/es/Player/message.js +5 -5
- package/es/Player/segment_player.js +31 -24
- package/es/Player/segment_timeline.js +71 -71
- package/es/Player/single_player.js +17 -21
- package/es/Player/style/bar.less +13 -9
- package/es/Player/style/index.less +8 -4
- package/es/Player/style/message.less +22 -16
- package/es/Player/style/slider.less +40 -37
- package/es/Player/style/timeline.less +43 -33
- package/es/Player/style/volume.less +7 -4
- package/es/Player/timeline.js +16 -8
- package/es/Player/util.js +82 -58
- package/es/PlayerExt/index.less +2 -2
- package/es/Progress/index.d.ts +8 -11
- package/es/Progress/index.less +5 -4
- package/es/ROI/index.less +8 -4
- package/es/ScreenPlayer/index.less +49 -26
- package/es/TableLayout/index.less +1 -1
- package/es/ThemeAntd/demo.less +4 -3
- package/es/ThemeAntd/index.less +12 -12
- package/es/ThemeAntd/style/button.less +4 -4
- package/es/ThemeAntd/style/checkbox.less +3 -3
- package/es/ThemeAntd/style/input.less +7 -7
- package/es/ThemeAntd/style/pagination.less +4 -4
- package/es/ThemeAntd/style/picker.less +5 -5
- package/es/ThemeAntd/style/radio.less +2 -2
- package/es/ThemeAntd/style/scrollbar.less +5 -3
- package/es/ThemeAntd/style/select.less +8 -8
- package/es/ThemeAntd/style/table.less +4 -4
- package/es/Tree/index.less +13 -12
- package/es/VList/index.d.ts +12 -18
- package/es/useSimpleState/index.js +1 -1
- package/package.json +12 -6
- package/tsconfig.json +12 -0
- package/es/Api/index.d.ts +0 -12
- package/es/AppContext/Sync.d.ts +0 -8
- package/es/AppContext/index.d.ts +0 -10
- package/es/AppContext/static.d.ts +0 -8
- package/es/Auth/index.d.ts +0 -8
- package/es/AutoExit/index.d.ts +0 -6
- package/es/Box/BetweenBox/index.d.ts +0 -12
- package/es/Box/InfoBox/index.d.ts +0 -12
- package/es/Box/TwoColumnBox/index.d.ts +0 -10
- package/es/Box/deps/content-grid.d.ts +0 -9
- package/es/Box/deps/grid-factory.d.ts +0 -10
- package/es/Box/deps/simple-grid.d.ts +0 -9
- package/es/Box/index.d.ts +0 -14
- package/es/CheckGroupFixed/demo.d.ts +0 -3
- package/es/CheckGroupFixed/index.d.ts +0 -18
- package/es/Config/index.d.ts +0 -4
- package/es/Config/utils.d.ts +0 -4
- package/es/ConfigContext/index.d.ts +0 -22
- package/es/CustomRenderSelect/index.d.ts +0 -12
- package/es/DisableMark/index.d.ts +0 -9
- package/es/DomMove/demo.d.ts +0 -2
- package/es/DomMove/index.d.ts +0 -16
- package/es/DomMove/utils.d.ts +0 -8
- package/es/Drag/DragAndDropItem.d.ts +0 -4
- package/es/Drag/DropItem.d.ts +0 -4
- package/es/Drag/index.less +0 -0
- package/es/Drawer/Footer.d.ts +0 -5
- package/es/Drawer/demo.d.ts +0 -3
- package/es/Drawer/index.d.ts +0 -38
- package/es/DynamicGridList/Demo.d.ts +0 -3
- package/es/DynamicGridList/index.d.ts +0 -27
- package/es/DynamicList/demo.d.ts +0 -2
- package/es/DynamicList/index.d.ts +0 -31
- package/es/DynamicList/utils.d.ts +0 -4
- package/es/ErrorFallback/index.d.ts +0 -9
- package/es/FrontendPlayer/index.d.ts +0 -2
- package/es/FullScreen/index.d.ts +0 -22
- package/es/GridList/Demo.d.ts +0 -3
- package/es/GridList/data.d.ts +0 -16
- package/es/GridList/hook.d.ts +0 -13
- package/es/GridList/index.d.ts +0 -15
- package/es/GridList/utils.d.ts +0 -9
- package/es/HightLevel/index.d.ts +0 -9
- package/es/IconFont/index.d.ts +0 -12
- package/es/ImageView/index.d.ts +0 -17
- package/es/Input/demo.d.ts +0 -3
- package/es/Input/index.d.ts +0 -19
- package/es/InstanceHistory/index.d.ts +0 -3
- package/es/LabelValue/index.d.ts +0 -23
- package/es/List/demo.d.ts +0 -3
- package/es/List/index.d.ts +0 -41
- package/es/ListWithSizeAnimate/demo.d.ts +0 -2
- package/es/ListWithSizeAnimate/index.d.ts +0 -15
- package/es/LoaderApp/index.d.ts +0 -31
- package/es/LoaderApp/loader.d.ts +0 -19
- package/es/LoaderApp/sandbox.back.d.ts +0 -18
- package/es/LoaderApp/sandbox.d.ts +0 -12
- package/es/LoaderApp/utils.d.ts +0 -19
- package/es/LoaderScript/index.d.ts +0 -26
- package/es/LoaderScript/utils.d.ts +0 -14
- package/es/Map/BasicMap/AMapInstance.d.ts +0 -19
- package/es/Map/BasicMap/LeafletInstance.d.ts +0 -18
- package/es/Map/BasicMap/index.d.ts +0 -9
- package/es/Map/ClusterLayer/hook.d.ts +0 -5
- package/es/Map/ClusterLayer/index.d.ts +0 -6
- package/es/Map/Config/index.d.ts +0 -7
- package/es/Map/Config/utils.d.ts +0 -2
- package/es/Map/Context/index.d.ts +0 -11
- package/es/Map/FindPio/index.d.ts +0 -4
- package/es/Map/InfoWindow/MakerLikeWindow.d.ts +0 -4
- package/es/Map/InfoWindow/demo.d.ts +0 -3
- package/es/Map/InfoWindow/index.d.ts +0 -10
- package/es/Map/LevelCenter/DragMarker/index.d.ts +0 -10
- package/es/Map/LevelCenter/demo.d.ts +0 -3
- package/es/Map/LevelCenter/index.d.ts +0 -16
- package/es/Map/LevelCenter/index.less +0 -2
- package/es/Map/LoaderMap/index.d.ts +0 -12
- package/es/Map/MapDrawSelect/demo.d.ts +0 -3
- package/es/Map/MapDrawSelect/index.d.ts +0 -16
- package/es/Map/MapDrawSelect/index.less +0 -2
- package/es/Map/MouseTool/index.d.ts +0 -10
- package/es/Map/MouseTool/useMouseTools.d.ts +0 -7
- package/es/Map/ResetTools/index.d.ts +0 -10
- package/es/Map/SinglePoint/index.d.ts +0 -27
- package/es/Map/hook/useMapEvent.d.ts +0 -2
- package/es/Map/hook/useMapType.d.ts +0 -4
- package/es/Map/icon.d.ts +0 -2
- package/es/Map/index.d.ts +0 -24
- package/es/Map/useMarker/index.d.ts +0 -11
- package/es/Map/useMarker/index.less +0 -0
- package/es/Map/withMap/index.d.ts +0 -3
- package/es/Modal/demo.d.ts +0 -3
- package/es/Modal/index.d.ts +0 -44
- package/es/Picture/component/DefaultRects/RectInfo.d.ts +0 -8
- package/es/Picture/component/DefaultRects/index.d.ts +0 -13
- package/es/Picture/component/DefaultRects/utils.d.ts +0 -2
- package/es/Picture/component/DrawRect/index.d.ts +0 -13
- package/es/Picture/component/RectMenu/index.d.ts +0 -12
- package/es/Picture/component/RectMenu/utils.d.ts +0 -12
- package/es/Picture/component/Tools/index.d.ts +0 -13
- package/es/Picture/component/WheelScale/index.d.ts +0 -7
- package/es/Picture/demo.d.ts +0 -2
- package/es/Picture/dragBound.d.ts +0 -5
- package/es/Picture/index.d.ts +0 -19
- package/es/Picture/loadCaptureRectImage.d.ts +0 -8
- package/es/Picture/useDraw.d.ts +0 -1
- package/es/Picture/utils.d.ts +0 -21
- package/es/Player/api/index.d.ts +0 -68
- package/es/Player/context.d.ts +0 -21
- package/es/Player/contraller_bar/bar.d.ts +0 -8
- package/es/Player/contraller_bar/contraller_event.d.ts +0 -6
- package/es/Player/contraller_bar/index.d.ts +0 -14
- package/es/Player/contraller_bar/left_bar.d.ts +0 -10
- package/es/Player/contraller_bar/right_bar.d.ts +0 -8
- package/es/Player/contraller_bar/time.d.ts +0 -3
- package/es/Player/contraller_bar/useBarStatus.d.ts +0 -2
- package/es/Player/contraller_bar/volume.d.ts +0 -9
- package/es/Player/demo.d.ts +0 -3
- package/es/Player/event/errorEvent.d.ts +0 -16
- package/es/Player/event/eventName.d.ts +0 -18
- package/es/Player/event/index.d.ts +0 -24
- package/es/Player/fps_play.d.ts +0 -11
- package/es/Player/frontend_player.d.ts +0 -8
- package/es/Player/frontend_timeline.d.ts +0 -10
- package/es/Player/iconfont.d.ts +0 -5
- package/es/Player/index.d.ts +0 -2
- package/es/Player/live_heart.d.ts +0 -8
- package/es/Player/message.d.ts +0 -5
- package/es/Player/segment_player.d.ts +0 -9
- package/es/Player/segment_timeline.d.ts +0 -12
- package/es/Player/single_player.d.ts +0 -5
- package/es/Player/timeline.d.ts +0 -5
- package/es/Player/util.d.ts +0 -28
- package/es/PlayerExt/demo.d.ts +0 -3
- package/es/PlayerExt/index.d.ts +0 -48
- package/es/ROI/demo.d.ts +0 -3
- package/es/ROI/index.d.ts +0 -39
- package/es/ROI/utils.d.ts +0 -1
- package/es/ScreenPlayer/Live.d.ts +0 -10
- package/es/ScreenPlayer/LiveTools.d.ts +0 -29
- package/es/ScreenPlayer/PlayerWithExt.d.ts +0 -34
- package/es/ScreenPlayer/RatePick.d.ts +0 -7
- package/es/ScreenPlayer/Record.d.ts +0 -10
- package/es/ScreenPlayer/RecordTools.d.ts +0 -37
- package/es/ScreenPlayer/ScreenSelect.d.ts +0 -7
- package/es/ScreenPlayer/SegmentTimeLine.d.ts +0 -17
- package/es/ScreenPlayer/TimeMode.d.ts +0 -7
- package/es/ScreenPlayer/TimeSelect.d.ts +0 -7
- package/es/ScreenPlayer/demo.d.ts +0 -2
- package/es/ScreenPlayer/demo2.d.ts +0 -2
- package/es/ScreenPlayer/index.d.ts +0 -6
- package/es/ScreenPlayer/useTimeSlider.d.ts +0 -25
- package/es/ScreenPlayer/useVideoFit.d.ts +0 -5
- package/es/ScreenPlayer/utils.d.ts +0 -19
- package/es/SegmentPlayer/index.d.ts +0 -2
- package/es/Service/fetch-adapter.d.ts +0 -12
- package/es/Service/http.d.ts +0 -6
- package/es/Service/index.d.ts +0 -3
- package/es/Service/middleware.d.ts +0 -5
- package/es/TableLayout/index.d.ts +0 -13
- package/es/ThemeAntd/demo.d.ts +0 -4
- package/es/ThemeAntd/index.d.ts +0 -7
- package/es/Timeout/index.d.ts +0 -32
- package/es/Tree/demo.d.ts +0 -3
- package/es/Tree/index.d.ts +0 -24
- package/es/VList/utils.d.ts +0 -14
- package/es/index.d.ts +0 -52
- package/es/useDrawROI/index.d.ts +0 -16
- package/es/useEventEmitterHandle/index.d.ts +0 -2
- package/es/useFullscreen/demo.d.ts +0 -2
- package/es/useFullscreen/index.d.ts +0 -12
- package/es/useHistory/index.d.ts +0 -3
- package/es/useInfiniteScroll/index.d.ts +0 -16
- package/es/useRafInterval/index.d.ts +0 -5
- package/es/useSimpleState/index.d.ts +0 -3
- package/es/useVirtualList/index.d.ts +0 -13
- package/es/utils.d.ts +0 -25
|
@@ -4,16 +4,19 @@
|
|
|
4
4
|
border-top-color: @color;
|
|
5
5
|
border-left-color: @color;
|
|
6
6
|
}
|
|
7
|
+
|
|
7
8
|
&::after {
|
|
8
9
|
border-top-color: @color;
|
|
9
10
|
border-right-color: @color;
|
|
10
11
|
}
|
|
11
12
|
}
|
|
13
|
+
|
|
12
14
|
.border-bottom-decorator {
|
|
13
15
|
&::before {
|
|
14
16
|
border-bottom-color: @color;
|
|
15
17
|
border-left-color: @color;
|
|
16
18
|
}
|
|
19
|
+
|
|
17
20
|
&::after {
|
|
18
21
|
border-bottom-color: @color;
|
|
19
22
|
border-right-color: @color;
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
.rect-item {
|
|
26
29
|
border-color: @lightColor;
|
|
27
30
|
.border-decorator-color-mixin(@color);
|
|
31
|
+
|
|
28
32
|
&:hover {
|
|
29
33
|
border-color: @color;
|
|
30
34
|
box-shadow: inset 0 0 24px 0 @shadowColor;
|
|
@@ -36,8 +40,8 @@
|
|
|
36
40
|
.rect-info-list-wrapper {
|
|
37
41
|
.data-type {
|
|
38
42
|
.data-tag {
|
|
39
|
-
border: 1px solid @color;
|
|
40
43
|
background: @bgColor;
|
|
44
|
+
border: 1px solid @color;
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
// border-color: @color;
|
|
@@ -53,24 +57,28 @@
|
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
.rect-item-face-wrapper {
|
|
56
|
-
.rect-item-style-mixin(#ff5f57, rgba(255, 95, 87,
|
|
57
|
-
.rect-info-list-mixin(#FF5F57, rgba(255,95,87
|
|
60
|
+
.rect-item-style-mixin(#ff5f57, rgba(255, 95, 87, .6), rgba(255, 95, 87, .4));
|
|
61
|
+
.rect-info-list-mixin(#FF5F57, rgba(255,95,87,.6), rgba(179,49,43,.6));
|
|
58
62
|
}
|
|
63
|
+
|
|
59
64
|
.rect-item-body-wrapper {
|
|
60
|
-
.rect-item-style-mixin(#ffbb22, rgba(255, 187, 34,
|
|
61
|
-
.rect-info-list-mixin(#FFBB22, rgba(255,187,34
|
|
65
|
+
.rect-item-style-mixin(#ffbb22, rgba(255, 187, 34, .6), rgba(255, 187, 34, .4));
|
|
66
|
+
.rect-info-list-mixin(#FFBB22, rgba(255,187,34,.6), rgba(176,94,0,.6));
|
|
62
67
|
}
|
|
68
|
+
|
|
63
69
|
.rect-item-vehicle-wrapper {
|
|
64
|
-
.rect-item-style-mixin(#44aaff, rgba(68, 170, 255,
|
|
65
|
-
.rect-info-list-mixin(#44aaff, rgba(68,170,255
|
|
70
|
+
.rect-item-style-mixin(#44aaff, rgba(68, 170, 255, .6), rgba(68, 170, 255, .4));
|
|
71
|
+
.rect-info-list-mixin(#44aaff, rgba(68,170,255,.6), rgba(31,114,183,.6));
|
|
66
72
|
}
|
|
73
|
+
|
|
67
74
|
.rect-item-nonVehicle-wrapper {
|
|
68
|
-
.rect-item-style-mixin(#50e9b2, rgba(80, 233, 178,
|
|
69
|
-
.rect-info-list-mixin(#50e9b2, rgba(80,233,178
|
|
75
|
+
.rect-item-style-mixin(#50e9b2, rgba(80, 233, 178, .6), rgba(80, 233, 178, .4));
|
|
76
|
+
.rect-info-list-mixin(#50e9b2, rgba(80,233,178,.6), rgba(15,196,132,.6));
|
|
70
77
|
}
|
|
78
|
+
|
|
71
79
|
.rect-item-thing-wrapper {
|
|
72
|
-
.rect-item-style-mixin(#b946d2, rgba(185, 70, 210,
|
|
73
|
-
.rect-info-list-mixin(#b946d2, rgba(185, 70, 210,
|
|
80
|
+
.rect-item-style-mixin(#b946d2, rgba(185, 70, 210, .6), rgba(185, 70, 210, .4));
|
|
81
|
+
.rect-info-list-mixin(#b946d2, rgba(185, 70, 210, .6), rgba(155, 58, 177, .4));
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
.rect-item {
|
|
@@ -78,42 +86,51 @@
|
|
|
78
86
|
border-width: 1px;
|
|
79
87
|
border-style: solid;
|
|
80
88
|
cursor: pointer;
|
|
89
|
+
|
|
81
90
|
.border-top-decorator,
|
|
82
91
|
.border-bottom-decorator {
|
|
83
92
|
position: absolute;
|
|
84
|
-
pointer-events: none;
|
|
85
93
|
width: 100%;
|
|
94
|
+
pointer-events: none;
|
|
95
|
+
|
|
86
96
|
&::before,
|
|
87
97
|
&::after {
|
|
88
|
-
content: '';
|
|
89
98
|
display: block;
|
|
90
99
|
width: 8px;
|
|
91
100
|
height: 8px;
|
|
92
101
|
border: 2px solid transparent;
|
|
102
|
+
content: '';
|
|
93
103
|
}
|
|
104
|
+
|
|
94
105
|
&::before {
|
|
95
106
|
float: left;
|
|
96
107
|
margin-left: -1px;
|
|
97
108
|
}
|
|
109
|
+
|
|
98
110
|
&::after {
|
|
99
111
|
float: right;
|
|
100
112
|
margin-right: -1px;
|
|
101
113
|
}
|
|
102
114
|
}
|
|
115
|
+
|
|
103
116
|
.border-top-decorator {
|
|
104
117
|
top: 0;
|
|
118
|
+
|
|
105
119
|
&::before,
|
|
106
120
|
&::after {
|
|
107
121
|
margin-top: -1px;
|
|
108
122
|
}
|
|
109
123
|
}
|
|
124
|
+
|
|
110
125
|
.border-bottom-decorator {
|
|
111
126
|
bottom: 0;
|
|
127
|
+
|
|
112
128
|
&::before,
|
|
113
129
|
&::after {
|
|
114
130
|
margin-bottom: -1px;
|
|
115
131
|
}
|
|
116
132
|
}
|
|
133
|
+
|
|
117
134
|
&:hover + .rect-info-list-wrapper {
|
|
118
135
|
display: block;
|
|
119
136
|
}
|
|
@@ -121,22 +138,22 @@
|
|
|
121
138
|
|
|
122
139
|
// 结构化窗体
|
|
123
140
|
.rect-info-list-wrapper {
|
|
124
|
-
display: none;
|
|
125
|
-
background: rgba(16, 21, 36, 0.8);
|
|
126
141
|
position: absolute;
|
|
127
142
|
z-index: 11;
|
|
128
|
-
|
|
143
|
+
display: none;
|
|
129
144
|
padding-top: 5px;
|
|
145
|
+
background: rgb(16 21 36 / 80%);
|
|
146
|
+
border: 1px solid transparent;
|
|
130
147
|
|
|
131
|
-
|
|
148
|
+
/* 高低质量 */
|
|
132
149
|
.data-type {
|
|
133
150
|
padding: 0 5px;
|
|
134
151
|
color: #fff;
|
|
135
152
|
|
|
136
153
|
.data-tag {
|
|
137
154
|
padding: 4px;
|
|
138
|
-
font-size: 12px;
|
|
139
155
|
margin-right: 4px;
|
|
156
|
+
font-size: 12px;
|
|
140
157
|
|
|
141
158
|
.anticon {
|
|
142
159
|
margin-right: 4px;
|
|
@@ -144,42 +161,48 @@
|
|
|
144
161
|
}
|
|
145
162
|
}
|
|
146
163
|
}
|
|
164
|
+
|
|
147
165
|
.rect-card-corner {
|
|
148
166
|
position: absolute;
|
|
149
167
|
top: -9px;
|
|
150
168
|
left: -1px;
|
|
151
169
|
}
|
|
170
|
+
|
|
152
171
|
.rect-info-arrow {
|
|
153
172
|
position: absolute;
|
|
173
|
+
top: 6px;
|
|
174
|
+
left: -4px;
|
|
154
175
|
display: block;
|
|
155
176
|
background: transparent;
|
|
177
|
+
transform: rotate(45deg);
|
|
156
178
|
border-style: solid;
|
|
157
179
|
border-width: 4px;
|
|
158
|
-
border-color:
|
|
159
|
-
transform: rotate(45deg);
|
|
160
|
-
left: -4px;
|
|
161
|
-
top: 6px;
|
|
180
|
+
border-color: rgb(16 21 36 / 80%);
|
|
162
181
|
}
|
|
182
|
+
|
|
163
183
|
.rect-info-list {
|
|
164
184
|
height: 100%;
|
|
165
|
-
border-radius: 2px;
|
|
166
185
|
padding: 3px 10px;
|
|
186
|
+
border-radius: 2px;
|
|
187
|
+
|
|
167
188
|
.info-item {
|
|
168
189
|
padding: 3px 0;
|
|
169
|
-
white-space: nowrap;
|
|
170
|
-
text-overflow: ellipsis;
|
|
171
190
|
overflow: hidden;
|
|
172
|
-
line-height: 18px;
|
|
173
191
|
font-size: var(--fs-small);
|
|
192
|
+
line-height: 18px;
|
|
174
193
|
color: #fff;
|
|
194
|
+
text-overflow: ellipsis;
|
|
195
|
+
white-space: nowrap;
|
|
196
|
+
|
|
175
197
|
.anticon {
|
|
176
198
|
position: relative;
|
|
177
199
|
top: 1px;
|
|
178
|
-
|
|
200
|
+
padding-right: 4px;
|
|
179
201
|
font-size: 16px;
|
|
180
202
|
color: #fff;
|
|
181
|
-
|
|
203
|
+
cursor: default;
|
|
182
204
|
}
|
|
205
|
+
|
|
183
206
|
.item-label {
|
|
184
207
|
margin: 0 4px;
|
|
185
208
|
}
|
|
@@ -26,8 +26,10 @@ function DrawRect(_ref) {
|
|
|
26
26
|
return rect[1] + rect[3];
|
|
27
27
|
}, [rect]);
|
|
28
28
|
var onMenuClickAction = useCallback(function (item) {
|
|
29
|
+
var _getRectImage;
|
|
30
|
+
|
|
29
31
|
onMenuClick === null || onMenuClick === void 0 ? void 0 : onMenuClick(_objectSpread(_objectSpread({}, item), {}, {
|
|
30
|
-
base64: getRectImage(rect)
|
|
32
|
+
base64: (_getRectImage = getRectImage(rect)) !== null && _getRectImage !== void 0 ? _getRectImage : ''
|
|
31
33
|
}));
|
|
32
34
|
}, [getRectImage, onMenuClick, rect]);
|
|
33
35
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.select-rect-layout {
|
|
2
|
-
|
|
2
|
+
position: absolute;
|
|
3
3
|
border: 1px solid;
|
|
4
|
+
box-shadow: 0 0 0 9999em rgb(0 0 0 / 40%);
|
|
4
5
|
border-image-source: url('data:image/gif;base64,R0lGODlhCgAKAJECAAAAAP///////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OEI5RDc5MTFDNkE2MTFFM0JCMDZEODI2QTI4MzJBOTIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OEI5RDc5MTBDNkE2MTFFM0JCMDZEODI2QTI4MzJBOTIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuZGlkOjAyODAxMTc0MDcyMDY4MTE4MDgzQzNDMjA5MzREQ0ZDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjAyODAxMTc0MDcyMDY4MTE4MDgzQzNDMjA5MzREQ0ZDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEBQoAAgAsAAAAAAoACgAAAhWEERkn7W3ei7KlagMWF/dKgYeyGAUAIfkEBQoAAgAsAAAAAAoACgAAAg+UYwLJ7RnQm7QmsCyVKhUAIfkEBQoAAgAsAAAAAAoACgAAAhCUYgLJHdiinNSAVfOEKoUCACH5BAUKAAIALAAAAAAKAAoAAAIRVISAdusPo3RAzYtjaMIaUQAAIfkEBQoAAgAsAAAAAAoACgAAAg+MDiem7Q8bSLFaG5il6xQAIfkEBQoAAgAsAAAAAAoACgAAAg+UYRLJ7QnQm7SmsCyVKhUAIfkEBQoAAgAsAAAAAAoACgAAAhCUYBLJDdiinNSEVfOEKoECACH5BAUKAAIALAAAAAAKAAoAAAIRFISBdusPo3RBzYsjaMIaUQAAOw==');
|
|
5
6
|
border-image-repeat: repeat;
|
|
6
7
|
border-image-slice: 1;
|
|
7
|
-
position: absolute;
|
|
8
8
|
}
|
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
.select-rect-menu-layout {
|
|
2
2
|
position: absolute;
|
|
3
|
-
font-size: var(--fs-small);
|
|
4
3
|
width: 105px;
|
|
5
4
|
overflow: hidden;
|
|
5
|
+
font-size: var(--fs-small);
|
|
6
|
+
|
|
6
7
|
.menu-action-item {
|
|
7
8
|
padding: 4px 10px;
|
|
8
|
-
background: #ffffff;
|
|
9
9
|
margin-bottom: 4px;
|
|
10
|
-
|
|
11
|
-
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
|
|
12
|
-
color: rgba(0, 0, 0, 0.65);
|
|
10
|
+
color: rgb(0 0 0 / 65%);
|
|
13
11
|
white-space: nowrap;
|
|
12
|
+
background: #fff;
|
|
13
|
+
border-radius: 15px;
|
|
14
|
+
box-shadow: 0 0 2px rgb(0 0 0 / 20%);
|
|
15
|
+
|
|
14
16
|
.anticon {
|
|
15
17
|
padding-right: 2px;
|
|
16
18
|
font-size: 16px;
|
|
17
19
|
color: #89b;
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
&:hover {
|
|
20
|
-
background: #ffaa00;
|
|
21
23
|
color: #fff;
|
|
22
24
|
cursor: pointer;
|
|
25
|
+
background: #fa0;
|
|
26
|
+
|
|
23
27
|
.anticon {
|
|
24
28
|
color: #fff;
|
|
25
29
|
}
|
|
26
30
|
}
|
|
31
|
+
|
|
27
32
|
&:last-child {
|
|
28
33
|
margin-bottom: 0;
|
|
29
34
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "antd/lib/tooltip/style";
|
|
2
2
|
import _Tooltip from "antd/lib/tooltip";
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import IconFont from "../../../Player/iconfont";
|
|
5
4
|
import FullScreen from "../../../FullScreen";
|
|
5
|
+
import IconFont from "../../../Player/iconfont";
|
|
6
6
|
import "./index.less";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
.picture-tools {
|
|
2
2
|
position: absolute;
|
|
3
|
-
bottom: 10px;
|
|
4
3
|
right: 10px;
|
|
4
|
+
bottom: 10px;
|
|
5
5
|
background: #fff;
|
|
6
|
-
box-shadow: 0 2px 5px 0
|
|
6
|
+
box-shadow: 0 2px 5px 0 rgb(0 0 0 / 30%);
|
|
7
|
+
|
|
7
8
|
&.actions-change-rotate {
|
|
8
9
|
bottom: 150px;
|
|
9
10
|
}
|
|
11
|
+
|
|
10
12
|
& > div {
|
|
11
13
|
width: 30px;
|
|
12
14
|
height: 25px;
|
|
@@ -15,28 +17,32 @@
|
|
|
15
17
|
cursor: pointer;
|
|
16
18
|
|
|
17
19
|
&.disabled {
|
|
18
|
-
cursor: not-allowed;
|
|
19
20
|
color: #999;
|
|
21
|
+
cursor: not-allowed;
|
|
22
|
+
|
|
20
23
|
.anticon {
|
|
21
24
|
color: #999;
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
}
|
|
29
|
+
|
|
26
30
|
.picture-actions {
|
|
27
31
|
position: absolute;
|
|
28
32
|
top: 8px;
|
|
29
33
|
right: 8px;
|
|
34
|
+
|
|
30
35
|
& > div {
|
|
36
|
+
float: left;
|
|
31
37
|
width: 28px;
|
|
32
38
|
height: 28px;
|
|
39
|
+
margin-left: 4px;
|
|
33
40
|
line-height: 28px;
|
|
34
|
-
background: #fff;
|
|
35
|
-
float: left;
|
|
36
41
|
text-align: center;
|
|
37
|
-
margin-left: 4px;
|
|
38
42
|
cursor: pointer;
|
|
43
|
+
background: #fff;
|
|
39
44
|
}
|
|
45
|
+
|
|
40
46
|
.tools-screen-layer .anticon {
|
|
41
47
|
padding-right: 0;
|
|
42
48
|
}
|
package/es/Picture/index.js
CHANGED
|
@@ -31,17 +31,17 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
31
31
|
|
|
32
32
|
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; }
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
import React, { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
34
|
+
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
36
35
|
import DomMove from "../DomMove";
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import { customContextMenu, computedRectScale, cloneImageNode } from "./utils";
|
|
40
|
-
import useDraw from "./useDraw";
|
|
41
|
-
import Tools from "./component/Tools";
|
|
36
|
+
import useSimpleState from "../useSimpleState";
|
|
37
|
+
import DefaultRects from "./component/DefaultRects";
|
|
42
38
|
import DrawRect from "./component/DrawRect";
|
|
39
|
+
import Tools from "./component/Tools";
|
|
43
40
|
import WheelScale from "./component/WheelScale";
|
|
44
|
-
import
|
|
41
|
+
import { computedBound } from "./dragBound";
|
|
42
|
+
import { getRectImagePath } from "./loadCaptureRectImage";
|
|
43
|
+
import useDraw from "./useDraw";
|
|
44
|
+
import { cloneImageNode, computedRectScale, customContextMenu } from "./utils";
|
|
45
45
|
import "./index.less";
|
|
46
46
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
47
47
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -70,23 +70,43 @@ function Picture(_ref) {
|
|
|
70
70
|
onMenuClick = _useMemo.onMenuClick,
|
|
71
71
|
children = _useMemo.children;
|
|
72
72
|
|
|
73
|
-
var
|
|
73
|
+
var _useSimpleState = useSimpleState({
|
|
74
74
|
x: 0,
|
|
75
75
|
y: 0,
|
|
76
76
|
rotate: 0,
|
|
77
77
|
scale: 1,
|
|
78
78
|
baseXOrY: 'x',
|
|
79
79
|
forceUpdateKey: Date.now(),
|
|
80
|
-
fullScreenStatus: false
|
|
80
|
+
fullScreenStatus: false,
|
|
81
|
+
localUrl: ''
|
|
81
82
|
}),
|
|
82
|
-
|
|
83
|
-
state =
|
|
84
|
-
|
|
83
|
+
_useSimpleState2 = _slicedToArray(_useSimpleState, 3),
|
|
84
|
+
state = _useSimpleState2[0],
|
|
85
|
+
updateState = _useSimpleState2[1],
|
|
86
|
+
setState = _useSimpleState2[2];
|
|
85
87
|
|
|
86
88
|
var layoutRef = useRef(null);
|
|
87
89
|
var moveActionRef = useRef(null);
|
|
88
90
|
var domImgRef = useRef(null);
|
|
89
91
|
var imageSourceRef = useRef(null);
|
|
92
|
+
useEffect(function () {
|
|
93
|
+
if (!imagePath) {
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var localUrl;
|
|
98
|
+
fetch(imagePath).then(function (res) {
|
|
99
|
+
return res.blob();
|
|
100
|
+
}).then(function (blob) {
|
|
101
|
+
localUrl = URL.createObjectURL(blob);
|
|
102
|
+
updateState({
|
|
103
|
+
localUrl: localUrl
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return function () {
|
|
107
|
+
return URL.revokeObjectURL(localUrl);
|
|
108
|
+
};
|
|
109
|
+
}, [imagePath]);
|
|
90
110
|
|
|
91
111
|
var _useDraw = useDraw(layoutRef.current, isOpenSelect),
|
|
92
112
|
_useDraw2 = _slicedToArray(_useDraw, 2),
|
|
@@ -95,7 +115,7 @@ function Picture(_ref) {
|
|
|
95
115
|
|
|
96
116
|
var loadImageSuccess = useCallback( /*#__PURE__*/function () {
|
|
97
117
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(flag) {
|
|
98
|
-
var
|
|
118
|
+
var nodeEle, _ref3, width, height;
|
|
99
119
|
|
|
100
120
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
101
121
|
while (1) {
|
|
@@ -105,8 +125,9 @@ function Picture(_ref) {
|
|
|
105
125
|
return cloneImageNode(domImgRef.current);
|
|
106
126
|
|
|
107
127
|
case 2:
|
|
108
|
-
|
|
109
|
-
|
|
128
|
+
nodeEle = _context.sent;
|
|
129
|
+
imageSourceRef.current = nodeEle;
|
|
130
|
+
_ref3 = domImgRef.current, width = _ref3.width, height = _ref3.height;
|
|
110
131
|
setState(function (old) {
|
|
111
132
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
112
133
|
forceUpdateKey: Date.now(),
|
|
@@ -115,7 +136,7 @@ function Picture(_ref) {
|
|
|
115
136
|
});
|
|
116
137
|
});
|
|
117
138
|
|
|
118
|
-
case
|
|
139
|
+
case 6:
|
|
119
140
|
case "end":
|
|
120
141
|
return _context.stop();
|
|
121
142
|
}
|
|
@@ -176,13 +197,14 @@ function Picture(_ref) {
|
|
|
176
197
|
|
|
177
198
|
var resetPicture = useCallback(function (event) {
|
|
178
199
|
event.stopPropagation();
|
|
200
|
+
var moveObj = moveActionRef.current;
|
|
179
201
|
setState(function (old) {
|
|
180
202
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
181
203
|
scale: 1,
|
|
182
204
|
rotate: 0
|
|
183
205
|
});
|
|
184
206
|
});
|
|
185
|
-
|
|
207
|
+
moveObj.updatePosition({
|
|
186
208
|
x: 0,
|
|
187
209
|
y: 0
|
|
188
210
|
});
|
|
@@ -191,9 +213,9 @@ function Picture(_ref) {
|
|
|
191
213
|
* 拖拽更新位置
|
|
192
214
|
*/
|
|
193
215
|
|
|
194
|
-
var onDragChange = useCallback(function (
|
|
195
|
-
var x =
|
|
196
|
-
y =
|
|
216
|
+
var onDragChange = useCallback(function (_ref4) {
|
|
217
|
+
var x = _ref4.x,
|
|
218
|
+
y = _ref4.y;
|
|
197
219
|
return setState(function (old) {
|
|
198
220
|
return _objectSpread(_objectSpread({}, old), {}, {
|
|
199
221
|
x: x,
|
|
@@ -216,7 +238,8 @@ function Picture(_ref) {
|
|
|
216
238
|
var position = computedBound(layoutRef.current, currrentPosition, scale, rotate);
|
|
217
239
|
|
|
218
240
|
if (position) {
|
|
219
|
-
moveActionRef.current
|
|
241
|
+
var moveObj = moveActionRef.current;
|
|
242
|
+
moveObj.updatePosition(position);
|
|
220
243
|
}
|
|
221
244
|
}, [state]);
|
|
222
245
|
/**
|
|
@@ -262,7 +285,7 @@ function Picture(_ref) {
|
|
|
262
285
|
return computedRectScale({
|
|
263
286
|
imageSource: imageSourceRef.current,
|
|
264
287
|
domImg: domImgRef.current,
|
|
265
|
-
rects: rects
|
|
288
|
+
rects: rects !== null && rects !== void 0 ? rects : []
|
|
266
289
|
});
|
|
267
290
|
}, [rects, state.forceUpdateKey]);
|
|
268
291
|
var isEmpty = useMemo(function () {
|
|
@@ -324,7 +347,8 @@ function Picture(_ref) {
|
|
|
324
347
|
maxHeight: baseXOrY === 'x' ? 'unset' : height || '100%'
|
|
325
348
|
},
|
|
326
349
|
draggable: false,
|
|
327
|
-
src:
|
|
350
|
+
src: state.localUrl,
|
|
351
|
+
"data-src": imagePath,
|
|
328
352
|
onLoad: function onLoad() {
|
|
329
353
|
return loadImageSuccess();
|
|
330
354
|
}
|
|
@@ -332,8 +356,8 @@ function Picture(_ref) {
|
|
|
332
356
|
rect: selectArea,
|
|
333
357
|
onMenuClick: onMenuClick,
|
|
334
358
|
getRectImage: getRectImage,
|
|
335
|
-
menus: menus,
|
|
336
|
-
canRenderMenu: isEnd && !disabledDrawMenu && menus.length > 0,
|
|
359
|
+
menus: menus !== null && menus !== void 0 ? menus : [],
|
|
360
|
+
canRenderMenu: isEnd && !disabledDrawMenu && menus && menus.length > 0,
|
|
337
361
|
containerDom: layoutRef.current
|
|
338
362
|
}) : !isOpenSelect ? /*#__PURE__*/_jsx(DefaultRects, {
|
|
339
363
|
rects: scaleRects,
|
package/es/Picture/index.less
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
.picture-view-layout {
|
|
2
2
|
position: relative;
|
|
3
|
+
min-height: 300px;
|
|
3
4
|
overflow: hidden;
|
|
4
5
|
user-select: none;
|
|
5
|
-
|
|
6
|
+
|
|
6
7
|
.picture-move-layout {
|
|
7
8
|
& > div {
|
|
8
9
|
width: 100%;
|
|
9
10
|
height: 100%;
|
|
10
|
-
transition: all
|
|
11
|
+
transition: all .3s;
|
|
11
12
|
overflow: hidden;
|
|
12
13
|
}
|
|
13
14
|
}
|
package/es/Picture/useDraw.js
CHANGED
|
@@ -12,7 +12,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
12
12
|
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { useCallback, useRef, useState } from 'react';
|
|
16
16
|
export default function useDraw(dom, open) {
|
|
17
17
|
var _useState = useState({
|
|
18
18
|
rect: [0, 0, 0, 0],
|
package/es/Picture/utils.js
CHANGED
|
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
|
+
/* eslint-disable @typescript-eslint/no-unused-expressions */
|
|
7
8
|
import { cloneDeep } from 'lodash-es';
|
|
8
9
|
export function customContextMenu(e) {
|
|
9
10
|
e.preventDefault();
|
|
@@ -11,7 +12,7 @@ export function customContextMenu(e) {
|
|
|
11
12
|
}
|
|
12
13
|
export function cloneImageNode(image) {
|
|
13
14
|
if (!image) {
|
|
14
|
-
return Promise.
|
|
15
|
+
return Promise.reject();
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
var newImage = image.cloneNode();
|
|
@@ -24,43 +25,11 @@ export function cloneImageNode(image) {
|
|
|
24
25
|
}, false);
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
export function computedRectScale(_ref) {
|
|
28
|
-
var imageSource = _ref.imageSource,
|
|
29
|
-
domImg = _ref.domImg,
|
|
30
|
-
rects = _ref.rects;
|
|
31
|
-
|
|
32
|
-
if (!imageSource || !domImg) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var width = domImg.width;
|
|
37
|
-
var height = domImg.height;
|
|
38
|
-
var scaleOptions = {
|
|
39
|
-
scaleX: width / imageSource.width,
|
|
40
|
-
scaleY: height / imageSource.height
|
|
41
|
-
};
|
|
42
|
-
return rects.map(function (item) {
|
|
43
|
-
var rect = item.needExpand ? getCaptureRect(cloneDeep(item.rect), item.type) : cloneDeep(item.rect);
|
|
44
|
-
rect[0] = Math.round(rect[0] * scaleOptions.scaleX);
|
|
45
|
-
rect[0] < 0 && (rect[0] = 0);
|
|
46
|
-
rect[2] = Math.round(rect[2] * scaleOptions.scaleX);
|
|
47
|
-
rect[2] < 0 && (rect[2] = 0);
|
|
48
|
-
rect[1] = Math.round(rect[1] * scaleOptions.scaleY);
|
|
49
|
-
rect[1] < 0 && (rect[1] = 0);
|
|
50
|
-
rect[3] = Math.round(rect[3] * scaleOptions.scaleY);
|
|
51
|
-
rect[3] < 0 && (rect[3] = 0);
|
|
52
|
-
rect[2] > width - rect[0] && (rect[2] = width - rect[0]);
|
|
53
|
-
rect[3] > height - rect[1] && (rect[3] = height - rect[1]);
|
|
54
|
-
return _objectSpread(_objectSpread({}, item), {}, {
|
|
55
|
-
rect: rect
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
28
|
export function getCaptureRect(rect, type) {
|
|
60
29
|
var rectArea = rect;
|
|
61
30
|
|
|
62
31
|
if (rectArea.length !== 4) {
|
|
63
|
-
console.error('区域有误
|
|
32
|
+
console.error('区域有误 rect = "[x,y,w,h]"! ', rect);
|
|
64
33
|
return [0, 0, 0, 0];
|
|
65
34
|
}
|
|
66
35
|
|
|
@@ -93,4 +62,36 @@ export function getCaptureRect(rect, type) {
|
|
|
93
62
|
}
|
|
94
63
|
|
|
95
64
|
return [x, y, w, h];
|
|
65
|
+
}
|
|
66
|
+
export function computedRectScale(_ref) {
|
|
67
|
+
var imageSource = _ref.imageSource,
|
|
68
|
+
domImg = _ref.domImg,
|
|
69
|
+
rects = _ref.rects;
|
|
70
|
+
|
|
71
|
+
if (!imageSource || !domImg) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
var width = domImg.width;
|
|
76
|
+
var height = domImg.height;
|
|
77
|
+
var scaleOptions = {
|
|
78
|
+
scaleX: width / imageSource.width,
|
|
79
|
+
scaleY: height / imageSource.height
|
|
80
|
+
};
|
|
81
|
+
return rects.map(function (item) {
|
|
82
|
+
var rect = item.needExpand ? getCaptureRect(cloneDeep(item.rect), item.type) : cloneDeep(item.rect);
|
|
83
|
+
rect[0] = Math.round(rect[0] * scaleOptions.scaleX);
|
|
84
|
+
rect[0] < 0 && (rect[0] = 0);
|
|
85
|
+
rect[2] = Math.round(rect[2] * scaleOptions.scaleX);
|
|
86
|
+
rect[2] < 0 && (rect[2] = 0);
|
|
87
|
+
rect[1] = Math.round(rect[1] * scaleOptions.scaleY);
|
|
88
|
+
rect[1] < 0 && (rect[1] = 0);
|
|
89
|
+
rect[3] = Math.round(rect[3] * scaleOptions.scaleY);
|
|
90
|
+
rect[3] < 0 && (rect[3] = 0);
|
|
91
|
+
rect[2] > width - rect[0] && (rect[2] = width - rect[0]);
|
|
92
|
+
rect[3] > height - rect[1] && (rect[3] = height - rect[1]);
|
|
93
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
94
|
+
rect: rect
|
|
95
|
+
});
|
|
96
|
+
});
|
|
96
97
|
}
|