mirror of
https://github.com/enso-org/enso.git
synced 2025-01-02 01:02:05 +03:00
Revert "Geo_Point popup on hover in Geo_Maps. (https://github.com/enso-org/ide/pull/1018)"
This reverts commit15c5017f18
. Original commit:48661c476c
This commit is contained in:
parent
15c5017f18
commit
5cce1c2550
@ -15,19 +15,9 @@ const GEO_MAP = 'Geo_Map'
|
||||
const SCATTERPLOT_LAYER = 'Scatterplot_Layer'
|
||||
const DEFAULT_POINT_RADIUS = 150
|
||||
|
||||
const LABEL_FONT = 'DejaVuSansMonoBook, sans-serif'
|
||||
const LABEL_FONT_SIZE = '12px'
|
||||
const LABEL_BORDER_RADIUS = '14px'
|
||||
const LABEL_BORDER_TOP_LEFT_RADIUS = '2px'
|
||||
const LABEL_MARGIN = '4px'
|
||||
|
||||
const DEFAULT_MAP_ZOOM = 11
|
||||
const DARK_ACCENT_COLOR = [222, 162, 47]
|
||||
const LIGHT_ACCENT_COLOR = [1, 234, 146]
|
||||
const DARK_LABEL_BACKGROUND = `rgb(58, 55, 53)`
|
||||
const LIGHT_LABEL_BACKGROUND = `rgb(252, 250, 245)`
|
||||
const DARK_LABEL_COLOR = `rgba(255, 255, 255, 0.8)`
|
||||
const LIGHT_LABEL_COLOR = `rgba(0, 0, 0, 0.8)`
|
||||
|
||||
// =====================================
|
||||
// === Script & Style Initialisation ===
|
||||
@ -94,7 +84,6 @@ const makeId = makeGenerator()
|
||||
* "longitude": -122.45,
|
||||
* "zoom": 15,
|
||||
* "controller": true,
|
||||
* "showingLabels": true, // Enables presenting labels when hovering over Geo_Point.
|
||||
* "layers": [{
|
||||
* "type": "Scatterplot_Layer",
|
||||
* "data": [{
|
||||
@ -102,8 +91,7 @@ const makeId = makeGenerator()
|
||||
* "latitude": -122.45,
|
||||
* "longitude": 37.8,
|
||||
* "color": [255, 0, 0],
|
||||
* "radius": 100,
|
||||
* "label": "an example label"
|
||||
* "radius": 100
|
||||
* }]
|
||||
* }]
|
||||
* }
|
||||
@ -137,19 +125,12 @@ class GeoMapVisualization extends Visualization {
|
||||
initStyle() {
|
||||
let defaultMapStyle = 'mapbox://styles/mapbox/light-v9'
|
||||
let accentColor = LIGHT_ACCENT_COLOR
|
||||
let labelBackgroundColor = LIGHT_LABEL_BACKGROUND
|
||||
let labelColor = LIGHT_LABEL_COLOR
|
||||
if (document.getElementById('root').classList.contains('dark-theme')) {
|
||||
defaultMapStyle =
|
||||
'mapbox://styles/enso-org/ckiu0o0in2fpp19rpk0jfvg2s'
|
||||
defaultMapStyle = 'mapbox://styles/mapbox/dark-v9'
|
||||
accentColor = DARK_ACCENT_COLOR
|
||||
labelBackgroundColor = DARK_LABEL_BACKGROUND
|
||||
labelColor = DARK_LABEL_COLOR
|
||||
}
|
||||
this.defaultMapStyle = defaultMapStyle
|
||||
this.accentColor = accentColor
|
||||
this.labelBackgroundColor = labelBackgroundColor
|
||||
this.labelColor = labelColor
|
||||
}
|
||||
|
||||
onDataReceived(data) {
|
||||
@ -180,7 +161,6 @@ class GeoMapVisualization extends Visualization {
|
||||
this.mapStyle = ok(data.mapStyle) ? data.mapStyle : this.defaultMapStyle
|
||||
this.pitch = ok(data.pitch) ? data.pitch : 0
|
||||
this.controller = ok(data.controller) ? data.controller : true
|
||||
this.showingLabels = ok(data.showingLabels) ? data.showingLabels : false
|
||||
}
|
||||
|
||||
viewState() {
|
||||
@ -205,7 +185,6 @@ class GeoMapVisualization extends Visualization {
|
||||
data: this.dataPoints,
|
||||
getFillColor: (d) => d.color,
|
||||
getRadius: (d) => d.radius,
|
||||
pickable: this.showingLabels,
|
||||
})
|
||||
}
|
||||
|
||||
@ -227,19 +206,6 @@ class GeoMapVisualization extends Visualization {
|
||||
updateLayers() {
|
||||
this.deckgl.setProps({
|
||||
layers: [this.makeScatterLayer()],
|
||||
getTooltip: ({ object }) =>
|
||||
object && {
|
||||
html: `<div>${object.label}</div>`,
|
||||
style: {
|
||||
backgroundColor: this.labelBackgroundColor,
|
||||
fontSize: LABEL_FONT_SIZE,
|
||||
borderRadius: LABEL_BORDER_RADIUS,
|
||||
borderTopLeftRadius: LABEL_BORDER_TOP_LEFT_RADIUS,
|
||||
fontFamily: LABEL_FONT,
|
||||
margin: LABEL_MARGIN,
|
||||
color: this.labelColor,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@ -348,8 +314,7 @@ class GeoMapVisualization extends Visualization {
|
||||
? DEFAULT_POINT_RADIUS
|
||||
: geoPoint.radius
|
||||
let color = ok(geoPoint.color) ? geoPoint.color : accentColor
|
||||
let label = ok(geoPoint.label) ? geoPoint.label : ''
|
||||
preparedDataPoints.push({ position, color, radius, label })
|
||||
preparedDataPoints.push({ position, color, radius })
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -184,6 +184,8 @@ impl View {
|
||||
|
||||
ensogl_theme::builtin::dark::register(app);
|
||||
ensogl_theme::builtin::light::register(app);
|
||||
// Should not be needed after proper theme management will be introduced:
|
||||
ensogl_theme::builtin::light::enable(app);
|
||||
|
||||
let model = Model::new(app);
|
||||
let frp = Frp::new();
|
||||
|
Loading…
Reference in New Issue
Block a user