Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cc0fd0a

Browse files
committed
Fix selection
1 parent ea123a6 commit cc0fd0a

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/plot_api/plot_api.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,12 +2264,12 @@ function _relayout(gd, aobj) {
22642264
ai.match(/^(bar|box|font)/)) {
22652265
flags.docalc = true;
22662266
}
2267-
else if(fullLayout._has('gl2d') &&
2267+
else if((fullLayout._has('gl2d') || fullLayout._has('regl')) &&
22682268
(ai.indexOf('axis') !== -1 || ai === 'plot_bgcolor')
22692269
) {
22702270
flags.doplot = true;
22712271
}
2272-
else if(fullLayout._has('gl2d') &&
2272+
else if((fullLayout._has('gl2d') || fullLayout._has('regl')) &&
22732273
(ai === 'dragmode' &&
22742274
(vi === 'lasso' || vi === 'select') &&
22752275
!(vOld === 'lasso' || vOld === 'select'))

src/traces/scattergl/index.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,6 @@ ScatterRegl.hoverPoints = function hover(pointData, xval, yval, hovermode) {
787787

788788
// FIXME: make sure this is a proper way to calc search radius
789789
if (stash.tree) {
790-
// ids = stash.tree.range(
791-
// xval - MAXDIST / xa._m, yval - MAXDIST / ya._m,
792-
// xval + MAXDIST / xa._m, yval + MAXDIST / ya._m
793-
// );
794-
795-
//FIXME: this works only for the case of linear points
796790
if (hovermode === 'x') {
797791
ids = stash.tree.range(
798792
xa.p2c(xpx - MAXDIST), ya._rl[0],
@@ -914,7 +908,9 @@ ScatterRegl.selectPoints = function select(searchInfo, polygon) {
914908
ya = searchInfo.yaxis,
915909
selection = [],
916910
trace = cd[0].trace,
917-
stash = cd[0].t;
911+
stash = cd[0].t,
912+
x = stash.x,
913+
y = stash.y;
918914

919915
var scene = stash.scene;
920916

@@ -937,8 +933,8 @@ ScatterRegl.selectPoints = function select(searchInfo, polygon) {
937933
if(polygon.contains([stash.xpx[i], stash.ypx[i]])) {
938934
selection.push({
939935
pointNumber: i,
940-
x: trace.x[i],
941-
y: trace.y[i]
936+
x: x[i],
937+
y: y[i]
942938
});
943939
}
944940
}

0 commit comments

Comments
 (0)