-
Notifications
You must be signed in to change notification settings - Fork 1
/
selected_layer.js
49 lines (43 loc) · 1.17 KB
/
selected_layer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React, {Component} from "react";
import {StyleSheet, View} from "react-native";
import {connect} from "react-redux";
import Mapbox from "@mapbox/react-native-mapbox-gl";
import {MIN_LABEL_LAYER_ID} from "./constants";
import {getSelectedItem} from "./selectors";
export function SelectedLayer(props) {
const {selectedItem} = props;
if (!selectedItem || selectedItem.type === "vehicle") {
return null;
}
return (
<View>
<Mapbox.ShapeSource id="pressed_points_source" shape={selectedItem.item}>
<Mapbox.CircleLayer
id="pressed_points_layer"
style={mapStyles.pressedPointsLayer}
belowLayerID={MIN_LABEL_LAYER_ID}
/>
</Mapbox.ShapeSource>
</View>
);
}
function mapStateToProps(state) {
return {
selectedItem: getSelectedItem(state)
};
}
export default connect(mapStateToProps)(SelectedLayer);
const mapStyles = Mapbox.StyleSheet.create({
pressedPointsLayer: {
circleColor: "rgba(0,0,0,0)",
circleStrokeWidth: 2,
circleStrokeOpacity: 0.5,
circleStrokeColor: "#00FFFF",
circleRadius: 14
},
pressLineLayer: {
lineColor: "#00FF00",
lineOpacity: 1,
lineWidth: 3
}
});