Skip to content

Commit

Permalink
geosolutions-it#10167: Set OL as default mapType also for 2D map in m…
Browse files Browse the repository at this point in the history
…obile

Description:
- remove all related code using ol-mobile
- add the required style for ol-scale-line
  • Loading branch information
mahmoudadel54 committed May 15, 2024
1 parent c2a7f65 commit 5020967
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion web/client/components/map/openlayers/ScaleBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class ScaleBar extends React.Component {
componentDidMount() {
this.scalebar = new ScaleLine(assign({}, this.props, this.props.container ? {
target: document.querySelector(this.props.container)
} : {}, { className: this.props.isMobile ? 'ol-mobile ol-scale-line' : this.props.className }));
} : {}));
if (this.props.map) {
this.props.map.addControl(this.scalebar);
}
Expand Down
3 changes: 1 addition & 2 deletions web/client/plugins/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,7 @@ class MapPlugin extends React.Component {
return this.props.tools.map((tool) => {
const Tool = this.getTool(tool);
const options = this.props.toolsOptions[Tool.name] && this.props.toolsOptions[Tool.name][this.props.mapType] || this.props.toolsOptions[Tool.name] || {};
const isMobile = ConfigUtils.getBrowserProperties().mobile;
return <Tool.impl key={Tool.name} {...options} isMobile={isMobile} />;
return <Tool.impl key={Tool.name} {...options}/>;
}).concat(toolsFromItems);
};

Expand Down
79 changes: 39 additions & 40 deletions web/client/themes/default/less/ol.less
Original file line number Diff line number Diff line change
Expand Up @@ -121,43 +121,51 @@
font-size: 11px;
}
}

div.ol-scale-line.ol-unselectable:not(.ol-mobile) {
border-width: 2px;
border-style: solid;
border-top: none;
line-height: 1.0;
border-radius: 0;
right: 10px;
padding: 2px 5px 1px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
top: 10px;
position: relative;
}
div.ol-scale-line.ol-mobile {
background: var(--ol-partial-background-color);
position: absolute;
border-radius: 4px;
bottom: 0;
left: 10px;
padding: 2px;
.ol-scale-line.ol-unselectable {
bottom: 35px !important;
right: 55px !important;
left: auto;
top: auto;
}
.mapstore-map-footer{
div.ol-scale-line.ol-unselectable {
border-width: 2px;
border-style: solid;
border-top: none;
line-height: 1.0;
border-radius: 0;
right: 10px;
padding: 2px 5px 1px;
white-space: nowrap;
overflow: hidden;
-moz-box-sizing: content-box;
box-sizing: content-box;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
top: 10px;
position: relative;
}
div.ol-scale-line-inner {
border: 0;
border-top: 0;
font-size: 11px;
text-align: center;
margin: 0;
}

.ol-scale-line.ol-unselectable {
right: 58px;
left: auto;
bottom: 3px;
}

.ol-scale-line {
background-color: transparent !important;
}
}
.ol-attribution ul {
text-shadow: none;
}

div.ol-scale-line-inner:not(.ol-mobile) {
border: 0;
border-top: 0;
font-size: 11px;
text-align: center;
margin: 0;
}

.ol-custom-overviewmap,
.ol-custom-overviewmap.ol-uncollapsible {
Expand All @@ -167,15 +175,6 @@ div.ol-scale-line-inner:not(.ol-mobile) {
top: auto !important;
}

.ol-scale-line.ol-unselectable:not(.ol-mobile) {
right: 58px;
left: auto;
bottom: 3px;
}

.ol-scale-line {
background-color: transparent !important;
}

.ol-viewport {
.ol-overlay-container.ol-selectable {
Expand Down

0 comments on commit 5020967

Please sign in to comment.