Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Make colorbar extent full width in mobile #1867

Benjamin King5e482c57a1bb
diff --git a/web/css/palettes.css b/web/css/palettes.css
index 9906ab447..52112ecd5 100644
--- a/web/css/palettes.css
+++ b/web/css/palettes.css
@@ -134,7 +134,7 @@
.wv-palettes-panel .wv-running-bar::after,
.wv-palettes-panel .wv-running-bar::before {
- content: "";
+ content: '';
position: absolute;
width: 0;
height: 0;
@@ -184,6 +184,15 @@
max-width: 231px;
margin-left: 5px;
}
+@media (max-width: 740px) {
+ .wv-palettes-colorbar {
+ width: 100%;
+ max-width: 100%;
+ margin-right: 0;
+ margin-left: 0;
+ }
+}
+
.scrollbar-visible .wv-palettes-colorbar {
margin-left: 0;
}
diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.js
index 47405a9ed..99809f3b4 100644
--- a/web/js/components/sidebar/paletteLegend.js
+++ b/web/js/components/sidebar/paletteLegend.js
@@ -202,7 +202,7 @@ class PaletteLegend extends React.Component {
* @param {Boolean} isMoreThanOneColorBar
*/
renderScale(legend, index, isMoreThanOneColorBar) {
- const { layer, width, getPalette } = this.props;
+ const { layer, width, getPalette, isMobile } = this.props;
const { isRunningData, colorHex, isHoveringLegend } = this.state;
const palette = getPalette(layer.id, index);
var percent, textWidth, xOffset, legendObj;
@@ -242,12 +242,13 @@ class PaletteLegend extends React.Component {
width={width}
height={12}
ref={this['canvas_' + index]}
- onMouseEnter={this.onMouseEnter.bind(this)}
- onMouseLeave={this.hideValue.bind(this)}
- onMouseMove={this.onHoverColorbar.bind(
- this,
- this['canvas_' + index]
- )}
+ onMouseEnter={!isMobile ? this.onMouseEnter.bind(this) : null}
+ onMouseLeave={!isMobile ? this.hideValue.bind(this) : null}
+ onMouseMove={
+ !isMobile
+ ? this.onHoverColorbar.bind(this, this['canvas_' + index])
+ : null
+ }
/>
<div
className="wv-running-bar"
@@ -408,6 +409,7 @@ PaletteLegend.propTypes = {
isCustomPalette: PropTypes.bool,
isHoveringCanvas: PropTypes.bool,
isHoveringLegend: PropTypes.bool,
+ isMobile: PropTypes.bool,
isRunningData: PropTypes.bool,
isRunningDataEnabled: PropTypes.bool,
layer: PropTypes.object,
diff --git a/web/js/containers/sidebar/layer.js b/web/js/containers/sidebar/layer.js
index 6b1fc4565..c57d6ffdf 100644
--- a/web/js/containers/sidebar/layer.js
+++ b/web/js/containers/sidebar/layer.js
@@ -47,7 +47,8 @@ class Layer extends React.Component {
renderedPalette,
requestPalette,
isCustomPalette,
- isLoading
+ isLoading,
+ isMobile
} = this.props;
if (!lodashIsEmpty(renderedPalette)) {
let isRunningData = !!runningObject;
@@ -62,6 +63,7 @@ class Layer extends React.Component {
isRunningData={isRunningData}
checkerBoardPattern={checkerBoardPattern}
colorHex={colorHex}
+ isMobile={isMobile}
/>
);
} else if (!isLoading) {