Skip to content

Commit

Permalink
Search Layers Scrolling issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
iquitwow committed Jan 14, 2020
1 parent ff65e78 commit 63e6ab7
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 37 deletions.
7 changes: 5 additions & 2 deletions src/header/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,9 @@ class Search extends Component {
// WHEN USER SELECTS ITEM
onItemSelect(value, item) {
if (item.type === "Map Layer") {
window.emitter.emit("activeTocLayer", item);
window.emitter.emit("activeTocLayerGroup", item.layerGroup, () => {
window.emitter.emit("activeTocLayer", item);
});
return;
}

Expand Down Expand Up @@ -422,7 +424,8 @@ class Search extends Component {
const layerItems = row[1];
layerItems.forEach(layer => {
if (layer.name.toUpperCase().indexOf(this.state.value.toUpperCase()) >= 0) {
layers.push({ name: helpers.replaceAllInString(layer.name, "_", " "), type: "Map Layer", layerGroup: groupName, imageName: "layers.png" });
//console.log(layer);
layers.push({ name: helpers.replaceAllInString(layer.name, "_", " "), type: "Map Layer", layerGroup: groupName, imageName: "layers.png", index: layer.index });
}
});
});
Expand Down
30 changes: 14 additions & 16 deletions src/map/OLOverrides.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.ol-zoom{
display: none;
.ol-zoom {
display: none;
}

.ol-scale-line{
.ol-scale-line {
right: 5px;
left: auto !important;
bottom: 5px;
Expand All @@ -27,7 +27,8 @@
border-radius: 3px !important;
}

.ol-popup:after, .ol-popup:before {
.ol-popup:after,
.ol-popup:before {
top: 100%;
border: solid transparent;
content: " ";
Expand Down Expand Up @@ -57,13 +58,11 @@
max-width: 258px !important;
z-index: 1;
padding: 6px !important;
background-color: #FFFFFF !important;
overflow: hidden;
max-height: 320px !important;
background-color: #fff !important;
max-height: 240px !important;
min-height: 50px !important;
/* min-width: 170px;
max-height: 200px;
overflow-x: auto; */
overflow-y: auto;
overflow-x: hidden;
}

.ol-popup-closer {
Expand Down Expand Up @@ -97,7 +96,7 @@
margin-bottom: 30px;
}

.ol-full-screen{
.ol-full-screen {
bottom: 5px;
left: 4px;
position: absolute;
Expand All @@ -113,24 +112,23 @@
z-index: 100 !important;
}

.ol-attribution{
.ol-attribution {
display: none;
}
@media only screen and (max-width: 770px) {
.ol-full-screen {
display: none !important;
}
.ol-scale-line{
.ol-scale-line {
left: 5px;
}

}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.ol-full-screen {
display: none !important;
}
.ol-scale-line{
.ol-scale-line {
left: 5px;
}
}
}
7 changes: 4 additions & 3 deletions src/sidebar/components/reports/Reports.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.sc-reports-tab-init{
.sc-reports-tab-init {
text-align: center;
padding: 10px;
}

.sc-reports-tab-content{
.sc-reports-tab-content {
position: absolute;
margin-bottom: 0px;
overflow: auto;
padding: 0px !important;
bottom: 0px;
top: 67px;
width: 100%;
overflow-x: hidden;
overflow-y: auto;
}
14 changes: 7 additions & 7 deletions src/sidebar/components/toc/Layers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,9 @@ class Layers extends Component {
layersCopy.forEach(layer => {
if (helpers.replaceAllInString(layer.name, "_", " ") === layerItem.name) {
layer.visible = true;
layer.layer.setVisible(true);

//document.getElementById(layer.elementId).scrollIntoView();
document.getElementById(this.virtualId).scrollTop = 0;

var i = 0;
// var isScrolling = false;
var elemFound = false;
for (var i = 1; i <= 100; i++) {
if (elemFound) return;
Expand All @@ -58,14 +55,16 @@ class Layers extends Component {
if (elemFound) return;

const elem = document.getElementById(layer.elementId);
console.log(elem);
if (elem !== null) {
elemFound = true;
const topPos = elem.offsetTop;
document.getElementById(this.virtualId).scrollTop = topPos;
document.getElementById(this.virtualId).scrollTop = topPos + 1;
setTimeout(() => {
document.getElementById(this.virtualId).scrollTop = topPos;
}, 50);
} else {
// isScrolling = true;
document.getElementById(this.virtualId).scrollTop += i * 10;
// isScrolling = false;
}
}, i * 100);
})(i);
Expand Down Expand Up @@ -517,6 +516,7 @@ class Layers extends Component {
searchText={this.props.searchText}
onLayerOptionsClick={this.onLayerOptionsClick}
sortAlpha={this.props.sortAlpha}
//scrollToIndex={50}
/>
);
}}
Expand Down
8 changes: 4 additions & 4 deletions src/sidebar/components/toc/TOC.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class TOC extends Component {
window.emitter.addListener("layersLoaded", numLayers => this.onLayersLoad(numLayers));

// LISTEN FOR SEARCH RESULT
window.emitter.addListener("activeTocLayer", layerItem => this.onActivateLayer(layerItem));
window.emitter.addListener("activeTocLayerGroup", (groupName, callback) => this.onActivateLayer(groupName, callback));
}

onActivateLayer = layerItem => {
onActivateLayer = (groupName, callback) => {
window.emitter.emit("setSidebarVisiblity", "OPEN");
window.emitter.emit("activateTab", "layers");

this.state.layerGroups.forEach(layerGroup => {
if (layerGroup.label === layerItem.layerGroup) {
this.setState({ selectedGroup: layerGroup });
if (layerGroup.label === groupName) {
this.setState({ selectedGroup: layerGroup }, () => callback());
return;
}
});
Expand Down
1 change: 1 addition & 0 deletions src/sidebar/components/toc/VirtualLayers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class VirtualLayers extends Component {
width={mobileAdjustment !== -1 ? 360 - mobileAdjustment : 360}
height={height}
style={{ outline: "none" }}
//scrollToIndex={50}
/>
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/sidebar/components/tools/weather/WeatherForecast.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
display: inline-table;
}

.sc-tool-weather-forecast-days-container.two-warnings {
margin-top: 30px;
}
.sc-tool-weather-forecast-day-details {
display: inline-grid;
text-align: center;
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar/components/tools/weather/WeatherForecast.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const Forecast = props => {
<Warning key={helpers.getUID()} info={event} url={warningUrl}></Warning>
))}
</div>
<div className="sc-tool-weather-forecast-days-container">
<div className={warningEvents.length === 2 ? "sc-tool-weather-forecast-days-container two-warnings" : "sc-tool-weather-forecast-days-container"}>
<div className="sc-tool-weather-forecast-day-container" title={forecast1.textSummary[0]}>
<div className="sc-tool-weather-forecast-day-details">
<label>{forecast1.period[0].$.textForecastName}</label>
Expand Down
19 changes: 15 additions & 4 deletions src/sidebar/components/tools/weather/WeatherRadar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,20 @@ class WeatherRadar extends Component {
const lastImage = this.radarImages[this.radarImages.length - 1];
const endDate = lastImage.get("radarDate");
this.setState({ startDate: startDate, endDate: endDate, radarDateSliderValue: endDate }, () => {
window.map.once("postrender", event => {
this.updateRadarVisibility();
this.setState({ isLoading: false });
});
window.map.once(
"postrender",
event => {
this.updateRadarVisibility();
this.setState({ isLoading: false });
},
() => {
//const steps = Math.round((this.state.endDate - this.state.startDate) / (1000 * 60) / 10);
//var stepValue = this.state.startDate;
this.setState({ radarDateSliderValue: this.state.endDate }, () => {
this.updateRadarVisibility();
});
}
);
});
};

Expand Down Expand Up @@ -129,6 +139,7 @@ class WeatherRadar extends Component {

// SLIDER CHANGE EVENT
onRadarDateSliderChange = value => {
console.log(value);
this.setState(prevState => ({ radarDateSliderValue: value }));
this.updateRadarVisibility();
};
Expand Down

0 comments on commit 63e6ab7

Please sign in to comment.