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

Skip to content

Commit ca4aaae

Browse files
committed
Fix initial-shift selection
1 parent e8c18f0 commit ca4aaae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/plots/cartesian/dragbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,12 @@ module.exports = function dragBox(gd, plotinfo, x, y, w, h, ns, ew) {
173173
dragOptions.yaxes = ya;
174174

175175
// take over selection polygons from prev mode, if any
176-
if((e.shiftKey || e.altKey) && plotinfo.selection.polygons && !dragOptions.polygons) {
176+
if((e.shiftKey || e.altKey) && (plotinfo.selection && plotinfo.selection.polygons) && !dragOptions.polygons) {
177177
dragOptions.polygons = plotinfo.selection.polygons;
178178
dragOptions.mergedPolygons = plotinfo.selection.mergedPolygons;
179179
}
180180
// create new polygons, if shift mode
181-
else if((!e.shiftKey && !e.altKey) || ((e.shiftKey || e.altKey) && !plotinfo.selection.polygons)) {
181+
else if((!e.shiftKey && !e.altKey) || ((e.shiftKey || e.altKey) && !plotinfo.selection)) {
182182
plotinfo.selection = {};
183183
plotinfo.selection.polygons = dragOptions.polygons = [];
184184
plotinfo.selection.mergedPolygons = dragOptions.mergedPolygons = [];

0 commit comments

Comments
 (0)