Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fe0d8bb

Browse filesBrowse files
committed
add geo.proto.updateFx method:
- propatet hovermode update into geo using updateFx - port relayout shortcut from modebar to Plotly.relayout - make toogle hover mode bar using stock Plotly.relayout
1 parent 986e8b0 commit fe0d8bb
Copy full SHA for fe0d8bb

File tree

Expand file treeCollapse file tree

3 files changed

+18
-4
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+18
-4
lines changed

‎src/components/modebar/buttons.js

Copy file name to clipboardExpand all lines: src/components/modebar/buttons.js
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ modeBarButtons.hoverClosestGeo = {
447447
toggle: true,
448448
icon: Icons.tooltip_basic,
449449
gravity: 'ne',
450-
click: handleGeo
450+
click: toggleHover
451451
};
452452

453453
function handleGeo(gd, ev) {
@@ -468,7 +468,6 @@ function handleGeo(gd, ev) {
468468
geo.render();
469469
}
470470
else if(attr === 'reset') geo.zoomReset();
471-
else if(attr === 'hovermode') geo.showHover = !geo.showHover;
472471
}
473472
}
474473

‎src/plot_api/plot_api.js

Copy file name to clipboardExpand all lines: src/plot_api/plot_api.js
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2336,9 +2336,9 @@ Plotly.relayout = function relayout(gd, astr, val) {
23362336

23372337
// this is decoupled enough it doesn't need async regardless
23382338
if(domodebar) {
2339+
var subplotIds;
23392340
manageModeBar(gd);
23402341

2341-
var subplotIds;
23422342
subplotIds = Plots.getSubplotIds(fullLayout, 'gl3d');
23432343
for(i = 0; i < subplotIds.length; i++) {
23442344
scene = fullLayout[subplotIds[i]]._scene;
@@ -2350,6 +2350,12 @@ Plotly.relayout = function relayout(gd, astr, val) {
23502350
scene = fullLayout._plots[subplotIds[i]]._scene2d;
23512351
scene.updateFx(fullLayout);
23522352
}
2353+
2354+
subplotIds = Plots.getSubplotIds(fullLayout, 'geo');
2355+
for(i = 0; i < subplotIds.length; i++) {
2356+
var geo = fullLayout[subplotIds[i]]._geo;
2357+
geo.updateFx(fullLayout.hovermode);
2358+
}
23532359
}
23542360
}
23552361

‎src/plots/geo/geo.js

Copy file name to clipboardExpand all lines: src/plots/geo/geo.js
+10-1Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ function Geo(options, fullLayout) {
3939
// a subset of https://github.com/d3/d3-geo-projection
4040
addProjectionsToD3();
4141

42-
this.showHover = (fullLayout.hovermode === 'closest');
4342
this.hoverContainer = null;
4443

4544
this.topojsonName = null;
@@ -56,6 +55,7 @@ function Geo(options, fullLayout) {
5655
this.zoomReset = null;
5756

5857
this.makeFramework();
58+
this.updateFx(fullLayout.hovermode);
5959
}
6060

6161
module.exports = Geo;
@@ -174,6 +174,15 @@ proto.onceTopojsonIsLoaded = function(geoData, geoLayout) {
174174
this.render();
175175
};
176176

177+
proto.updateFx = function(hovermode) {
178+
this.showHover = (hovermode !== false);
179+
180+
// TODO should more strict, any layout.hovermode other
181+
// then false will make all geo subplot display hover text.
182+
// Instead each geo should have its own geo.hovermode
183+
// to control hover visibility independently of other subplots.
184+
};
185+
177186
proto.makeProjection = function(geoLayout) {
178187
var projLayout = geoLayout.projection,
179188
projType = projLayout.type,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.