-
Notifications
You must be signed in to change notification settings - Fork 1
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 #256 from Element84/ba/feature/adding-layer-list
Ba/feature/adding layer list
- Loading branch information
Showing
12 changed files
with
438 additions
and
8 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
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
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,98 @@ | ||
.LayerList { | ||
position: absolute; | ||
top: 130px; | ||
left: 50px; | ||
z-index: 1; | ||
background-color: rgba(34, 34, 34, 0.8); | ||
border-radius: 2px; | ||
min-width: 200px; | ||
max-width: 400px; | ||
max-height: 300px; | ||
font-size: 16px; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.LayerListTitle { | ||
border-bottom: solid 2px #373d4d; | ||
height: 35px; | ||
margin-bottom: 8px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
|
||
.LayerListTitleText { | ||
margin-left: 15px; | ||
} | ||
|
||
.LayerListLayers { | ||
overflow-y: auto; | ||
margin-left: 14px; | ||
margin-bottom: 5px; | ||
} | ||
|
||
.LayerListLayer { | ||
display: flex; | ||
flex-direction: row; | ||
} | ||
|
||
.LayerListLayerContainer { | ||
display: block; | ||
position: relative; | ||
padding-left: 25px; | ||
margin-bottom: 12px; | ||
margin-right: 15px; | ||
cursor: pointer; | ||
font-size: 14px; | ||
-webkit-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
.LayerListLayerContainer input { | ||
position: absolute; | ||
opacity: 0; | ||
cursor: pointer; | ||
height: 0; | ||
width: 0; | ||
} | ||
|
||
.LayerListCheckmark { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
height: 16px; | ||
width: 16px; | ||
background-color: #eee; | ||
} | ||
|
||
.LayerListLayerContainer:hover input ~ .LayerListCheckmark { | ||
background-color: #ccc; | ||
} | ||
|
||
.LayerListLayerContainer input:checked ~ .LayerListCheckmark { | ||
background-color: #81c05b; | ||
} | ||
|
||
.LayerListCheckmark:after { | ||
content: ''; | ||
position: absolute; | ||
display: none; | ||
} | ||
|
||
.LayerListLayerContainer input:checked ~ .LayerListCheckmark:after { | ||
display: block; | ||
} | ||
|
||
.LayerListLayerContainer .LayerListCheckmark:after { | ||
left: 5px; | ||
top: 1px; | ||
width: 4px; | ||
height: 8px; | ||
border: solid #fff; | ||
border-width: 0 3px 3px 0; | ||
-webkit-transform: rotate(45deg); | ||
-ms-transform: rotate(45deg); | ||
transform: rotate(45deg); | ||
} |
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,46 @@ | ||
import React from 'react' | ||
import './LayerList.css' | ||
import { useSelector, useDispatch } from 'react-redux' | ||
import { setreferenceLayers } from '../../redux/slices/mainSlice' | ||
import { toggleReferenceLayerVisibility } from '../../utils/mapHelper' | ||
|
||
const LayerList = () => { | ||
const dispatch = useDispatch() | ||
const _referenceLayers = useSelector( | ||
(state) => state.mainSlice.referenceLayers | ||
) | ||
function onLayerClicked(combinedLayerName) { | ||
const updatedLayers = _referenceLayers.map((layer) => | ||
layer.combinedLayerName === combinedLayerName | ||
? { ...layer, visibility: !layer.visibility } | ||
: layer | ||
) | ||
dispatch(setreferenceLayers(updatedLayers)) | ||
toggleReferenceLayerVisibility(combinedLayerName) | ||
} | ||
|
||
return ( | ||
<div className="LayerList"> | ||
<div className="LayerListTitle"> | ||
<span className="LayerListTitleText">Reference Layers</span> | ||
</div> | ||
<div className="LayerListLayers"> | ||
{_referenceLayers.map((layer) => ( | ||
<div className="LayerListLayer" key={layer.combinedLayerName}> | ||
<label className="LayerListLayerContainer"> | ||
{layer.layerAlias} | ||
<input | ||
type="checkbox" | ||
checked={layer.visibility} | ||
onChange={() => onLayerClicked(layer.combinedLayerName)} | ||
></input> | ||
<span className="LayerListCheckmark"></span> | ||
</label> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default LayerList |
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
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
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
Oops, something went wrong.