-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Kingforce01/algoprak-ws21-overlay
Algoprak ws21 overlay
- Loading branch information
Showing
32 changed files
with
1,742 additions
and
604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
import { getFromLocalStorage, setLocalStorage } from '../App/LocalStorage'; | ||
import {Translations} from '../App/Localization'; | ||
|
||
export let markerSearch = null; | ||
|
||
export const RailvizContextMenu: React.FC<{'translation': Translations}> = (props) => { | ||
|
||
const [x, setX] = useState(0); | ||
const [y, setY] = useState(0); | ||
const [lat, setLat] = useState(0); | ||
const [lng, setLng] = useState(0); | ||
const [contextMenuHidden, setContextMenuHidden] = useState<Boolean>(true); | ||
|
||
useEffect(() => { | ||
window.portEvents.sub('mapShowContextMenu', function(data){ | ||
setX(data.mouseX); | ||
setY(data.mouseY); | ||
setLat(data.lat); | ||
setLng(data.lng); | ||
setContextMenuHidden(false); | ||
}); | ||
window.portEvents.sub('mapCloseContextMenu', function(data){ | ||
setContextMenuHidden(true); | ||
}) | ||
}) | ||
return ( | ||
<div className={contextMenuHidden ? 'railviz-contextmenu hidden': 'railviz-contextmenu'} style={{ top: y+'px', left: x+'px' }}> | ||
<div className='item' onClick={() => { | ||
setContextMenuHidden(true); | ||
setLocalStorage("motis.routing.from_location", {'name': lat+';'+lng, 'pos':{'lat': lat, 'lng': lng}, 'type_': '', 'regions': {}}); | ||
markerSearch = [true, {'name': lat+';'+lng, 'pos':{'lat': lat, 'lng': lng}, 'type_': '', 'regions': {}}]; | ||
window.portEvents.pub('mapSetMarkers', { 'startPosition':{'lat': lat,'lng': lng}, | ||
'startName': lat+';'+lng, | ||
'destinationPosition': getFromLocalStorage("motis.routing.to_location").pos, | ||
'destinationName': getFromLocalStorage("motis.routing.to_location").name}); | ||
markerSearch = null; | ||
}}>{props.translation.mapContextMenu.routeFromHere}</div> | ||
<div className='item' onClick={() => { | ||
setContextMenuHidden(true); | ||
setLocalStorage("motis.routing.to_location", {'name': lat+';'+lng, 'pos':{'lat': lat, 'lng': lng}, 'type_': '', 'regions': {}}) | ||
markerSearch = [false, {'name': lat+';'+lng, 'pos':{'lat': lat, 'lng': lng}, 'type_': '', 'regions': {}}]; | ||
window.portEvents.pub('mapSetMarkers', {'startPosition': getFromLocalStorage("motis.routing.from_location").pos, | ||
'startName': getFromLocalStorage("motis.routing.from_location").name, | ||
'destinationPosition':{'lat': lat, 'lng': lng}, | ||
'destinationName':lat+';'+lng}); | ||
markerSearch = null; | ||
}}>{props.translation.mapContextMenu.routeToHere}</div> | ||
</div>); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.