Last change
on this file was 364f27d, checked in by MetodiMladenovski <meto.18@…>, 14 months ago |
added projects and db scripts
|
-
Property mode
set to
100644
|
File size:
935 bytes
|
Line | |
---|
1 | import React from 'react';
|
---|
2 | import L from "leaflet";
|
---|
3 | import { createControlComponent } from "@react-leaflet/core";
|
---|
4 | import "leaflet-routing-machine";
|
---|
5 |
|
---|
6 | const createRoutineMachineLayer = (props) => {
|
---|
7 | const instance = L.Routing.control({
|
---|
8 | waypoints: [
|
---|
9 | L.latLng(props.latitudes.startLat, props.latitudes.startLng),
|
---|
10 | L.latLng(props.latitudes.destLat, props.latitudes.destLng)
|
---|
11 | ],
|
---|
12 | lineOptions: {
|
---|
13 | styles: [{ color: "#6FA1EC", weight: 4 }]
|
---|
14 | },
|
---|
15 | createMarker: function() { return null; },
|
---|
16 | show: false,
|
---|
17 | addWaypoints: false,
|
---|
18 | routeWhileDragging: false,
|
---|
19 | draggableWaypoints: false,
|
---|
20 | fitSelectedRoutes: true,
|
---|
21 | showAlternatives: false
|
---|
22 | }).on('routesfound', function(e) {
|
---|
23 | e.sourceTarget._container.outerHTML = "None";
|
---|
24 | });
|
---|
25 | return instance;
|
---|
26 | };
|
---|
27 |
|
---|
28 |
|
---|
29 | const RoutingMachine = createControlComponent(createRoutineMachineLayer);
|
---|
30 |
|
---|
31 | export default RoutingMachine;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.