Skip to content

Commit 4cc8d7f

Browse files
author
chenjing
committed
improve the mouse event
1 parent e810a4a commit 4cc8d7f

File tree

15 files changed

+386
-348
lines changed

15 files changed

+386
-348
lines changed

examples/list.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ const EXAMPLE_LIST = [
391391
name: '波纹雷达',
392392
page: 'radar_wave.html',
393393
},
394+
{
395+
name: '雷达脉冲',
396+
page: 'radar_outer.html',
397+
},
394398
{
395399
name: '墙',
396400
page: 'wall.html',
@@ -523,6 +527,10 @@ const EXAMPLE_LIST = [
523527
name: '3dtiles-osgb',
524528
page: '3dtiles_osgb.html',
525529
},
530+
{
531+
name: '3dtiles-3dgs',
532+
page: '3dtiles_3dgs.html',
533+
},
526534
{
527535
name: '3dtiles-shp',
528536
page: '3dtiles_shp.html',

examples/model/3dtiles_3dgs.html

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
6+
<title>dc-example</title>
7+
<script src="/libs/dc-sdk/dc.min.js"></script>
8+
<link href="/libs/dc-sdk/dc.min.css" type="text/css" rel="stylesheet" />
9+
<link href="../index.css" type="text/css" rel="stylesheet" />
10+
</head>
11+
12+
<body>
13+
<div id="viewer-container" class="viewer-container"></div>
14+
<script>
15+
DC.config.baseUrl = '../libs/dc-sdk/resources/'
16+
let viewer = new DC.Viewer('viewer-container')
17+
let baseLayer = DC.ImageryLayerFactory.createImageryLayer(
18+
DC.ImageryType.AMAP,
19+
{
20+
style: 'img',
21+
crs: 'WGS84'
22+
}
23+
)
24+
viewer.addBaseLayer(baseLayer)
25+
let layer = new DC.TilesetLayer('layer')
26+
viewer.addLayer(layer)
27+
let tileset = new DC.Tileset('//resource.dvgis.cn/data/3dtiles/cesium-gs/tileset.json')
28+
layer.addOverlay(tileset)
29+
viewer.flyTo(tileset)
30+
</script>
31+
</body>
32+
</html>

examples/vector/radar_outer.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
6+
<title>dc-example</title>
7+
<script src="/libs/dc-sdk/dc.min.js"></script>
8+
<link href="/libs/dc-sdk/dc.min.css" type="text/css" rel="stylesheet" />
9+
<link href="../index.css" type="text/css" rel="stylesheet" />
10+
</head>
11+
12+
<body>
13+
<div id="viewer-container" class="viewer-container"></div>
14+
<script>
15+
16+
DC.config.baseUrl = '../libs/dc-sdk/resources/'
17+
let viewer = new DC.Viewer('viewer-container')
18+
let baseLayer = DC.ImageryLayerFactory.createAMapImageryLayer({
19+
style: 'img',
20+
crs: 'WGS84'
21+
})
22+
viewer.addBaseLayer(baseLayer)
23+
let layer = new DC.VectorLayer('layer')
24+
viewer.addLayer(layer)
25+
let redCylinder = new DC.Cylinder('120.1,32,10000', 20000, 5000, 0)
26+
redCylinder.setStyle({
27+
material: new DC.RadarOuterMaterialProperty({
28+
color: DC.Color.RED
29+
})
30+
})
31+
let greenCylinder = new DC.Cylinder('120.3, 32.0,10000', 20000, 0, 5000)
32+
greenCylinder.setStyle({
33+
material: new DC.RadarOuterMaterialProperty({
34+
color: DC.Color.GREEN
35+
})
36+
})
37+
let blueCylinder = new DC.Cylinder('120.5, 32.0,10000', 20000, 5000, 0)
38+
blueCylinder.setStyle({
39+
material: new DC.RadarOuterMaterialProperty(
40+
{
41+
color: DC.Color.BLUE
42+
}
43+
)
44+
})
45+
layer
46+
.addOverlay(redCylinder)
47+
.addOverlay(greenCylinder)
48+
.addOverlay(blueCylinder)
49+
viewer.flyTo(layer)
50+
</script>
51+
</body>
52+
</html>

examples/vector/wall.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
<div id="viewer-container" class="viewer-container"></div>
1616
<script>
17-
DC.config.baseUrl = '../libs/dc-sdk/resources/'
18-
let viewer = new DC.Viewer('viewer-container')
17+
DC.config.baseUrl = '../libs/dc-sdk/resources/'
18+
let viewer = new DC.Viewer('viewer-container')
1919
let baseLayer = DC.ImageryLayerFactory.createImageryLayer(DC.ImageryType.AMAP,{
2020
style:'img',
2121
crs:'WGS84',
@@ -30,9 +30,7 @@
3030
material: DC.Color.RED,
3131
outline: true
3232
})
33-
layer.addOverlay(wall)
3433
viewer.flyTo(layer)
35-
3634
</script>
3735
</body>
3836
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"dist"
6565
],
6666
"dependencies": {
67-
"cesium": "^1.132.0",
67+
"cesium": "^1.133.1",
6868
"supercluster": "^8.0.1"
6969
}
7070
}

src/modules/event/EventType.js

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,32 @@ const BaseEventType = {
99
REMOVE: 'remove',
1010
}
1111

12-
const MouseEventType = {
12+
const BaseMouseEventType = {
1313
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
1414
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
1515
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
1616
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
1717
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
1818
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
1919
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
20+
}
21+
22+
const MouseEventType = {
23+
...BaseMouseEventType,
2024
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
2125
WHEEL: Cesium.ScreenSpaceEventType.WHEEL,
2226
MOUSE_OVER: 'mouseover',
2327
MOUSE_OUT: 'mouseout',
2428
}
2529

2630
const ViewerEventType = {
31+
...BaseMouseEventType,
32+
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
33+
WHEEL: Cesium.ScreenSpaceEventType.WHEEL,
2734
ADD_LAYER: 'addLayer',
2835
REMOVE_LAYER: 'removeLayer',
2936
ADD_EFFECT: 'addEffect',
3037
REMOVE_EFFECT: 'removeEffect',
31-
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
32-
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
33-
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
34-
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
35-
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
36-
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
37-
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
38-
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
39-
WHEEL: Cesium.ScreenSpaceEventType.WHEEL,
4038
}
4139

4240
const SceneEventType = {
@@ -53,14 +51,7 @@ const SceneEventType = {
5351

5452
const OverlayEventType = {
5553
...BaseEventType,
56-
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
57-
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
58-
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
59-
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
60-
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
61-
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
62-
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
63-
MOUSE_MOVE: Cesium.ScreenSpaceEventType.MOUSE_MOVE,
54+
...BaseMouseEventType,
6455
MOUSE_OVER: 'mouseover',
6556
MOUSE_OUT: 'mouseout',
6657
POSITION_UPDATE: 'positionUpdate',
@@ -85,13 +76,7 @@ const LayerGroupEventType = BaseEventType
8576

8677
const LayerEventType = {
8778
...BaseEventType,
88-
LEFT_DOWN: Cesium.ScreenSpaceEventType.LEFT_DOWN,
89-
LEFT_UP: Cesium.ScreenSpaceEventType.LEFT_UP,
90-
CLICK: Cesium.ScreenSpaceEventType.LEFT_CLICK,
91-
RIGHT_DOWN: Cesium.ScreenSpaceEventType.RIGHT_DOWN,
92-
RIGHT_UP: Cesium.ScreenSpaceEventType.RIGHT_UP,
93-
RIGHT_CLICK: Cesium.ScreenSpaceEventType.RIGHT_CLICK,
94-
DB_CLICK: Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK,
79+
...BaseMouseEventType,
9580
}
9681

9782
const TrackEventType = {

0 commit comments

Comments
 (0)