diff --git a/src/renderer/assets/button.css b/src/renderer/assets/button.css new file mode 100644 index 0000000..a260a6c --- /dev/null +++ b/src/renderer/assets/button.css @@ -0,0 +1,8 @@ +.leaflet-touch .leaflet-control-layers-toggle { + width: 30px; + height: 30px; + color:black; + background-image: none; + } + + \ No newline at end of file diff --git a/src/renderer/components/EditLayer.vue b/src/renderer/components/EditLayer.vue index d8c42bf..704e551 100644 --- a/src/renderer/components/EditLayer.vue +++ b/src/renderer/components/EditLayer.vue @@ -983,7 +983,7 @@ You should have received a copy of the GNU General Public License along with FG }); }, setVisible(visible) { - if (this.layerGroup) { + if (this.layerGroup) { if (visible) { this.layerGroup.addTo(this.$parent.mapObject) } else { diff --git a/src/renderer/components/FlightgearMap.vue b/src/renderer/components/FlightgearMap.vue index c01c4d4..5170fa9 100644 --- a/src/renderer/components/FlightgearMap.vue +++ b/src/renderer/components/FlightgearMap.vue @@ -30,7 +30,7 @@ You should have received a copy of the GNU General Public License along with FG - + import 'leaflet/dist/leaflet.css' + import '@/assets/button.css' import { LMap, LTileLayer, LMarker, LCircle, LLayerGroup, LControl } from 'vue2-leaflet' import LeafletSidebar from './LeafletSidebar' import AiLayer from './AiLayer' @@ -75,6 +76,8 @@ You should have received a copy of the GNU General Public License along with FG components: { LMap, LTileLayer, LMarker, LCircle, LeafletSidebar, AiLayer, EditBar, ToolBar, EditLayer, PavementLayer, LLayerGroup, LControl, ThresholdLayer, ToolLayer }, props: [], mounted () { + this.$refs.map.mapObject.on('layeradd', this.onLayerAdd) + this.$store.dispatch('getAirports') this.$store.subscribe((mutation, state) => { if (mutation.type === 'CENTER' || mutation.type === 'SET_AIRPORTS' || mutation.type === 'ZOOM') { @@ -109,13 +112,31 @@ You should have received a copy of the GNU General Public License along with FG ' Electron ' + ' element.io ' + ' © OpenStreetMap contributors', - marker: L.latLng(47.413220, -1.219482), airports: this.$store.state.Airports.airports, options: {editable: true}, + layersControl: null, icao: 'TEST' } }, methods: { + onLayerAdd (e) { + if (this.layersControl === null) { + this.layersControl = L.control.layers({}, {}, {position: 'topleft'}) + this.layersControl.addTo(this.$refs.map.mapObject) + debugger + var icon = this.layersControl._container.ownerDocument.createElement('I') + icon.className = 'fas fa-layer-group' + icon.style = 'padding-top: 9px; height: 30px; width: 30px; text-align: center; vertical-align: sub;' + this.layersControl._container.children[0].appendChild(icon) + // this.layersControl.addOverlay(this.$refs.thresholdLayer, 'Threshold Layer') + } + if (this.$refs.pavementLayer.getLayer() === e.layer) { + var l = this.layersControl._layers.filter(l => l.name === 'APT Layer') + if (l.length === 0) { + this.layersControl.addOverlay(this.$refs.pavementLayer.getLayer(), 'APT Layer') + } + } + }, onSelectedPolygon (ring) { var parkings = this.$refs.editLayer.getParkings(ring) console.debug(ring) @@ -262,4 +283,8 @@ You should have received a copy of the GNU General Public License along with FG padding-right: 2px; padding-bottom: 0px; } +.leaflet-touch .leaflet-control-layers-toggle { + width: 30px; + height: 30px; +} diff --git a/src/renderer/components/PavementLayer.vue b/src/renderer/components/PavementLayer.vue index 08ec3fd..4ec1111 100644 --- a/src/renderer/components/PavementLayer.vue +++ b/src/renderer/components/PavementLayer.vue @@ -1,8 +1,4 @@ - +