Skip to content

Commit b5c090f

Browse files
committed
MINSELECT bigger than MINDRAG
1 parent 342f991 commit b5c090f

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/plots/cartesian/constants.js

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ module.exports = {
1515
// pixels to move mouse before you stop clamping to starting point
1616
MINDRAG: 8,
1717

18+
// smallest dimension allowed for a select box
19+
MINSELECT: 12,
20+
1821
// smallest dimension allowed for a zoombox
1922
MINZOOM: 20,
2023

src/plots/cartesian/select.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var constants = require('./constants');
1717

1818
var filteredPolygon = polygon.filter;
1919
var polygonTester = polygon.tester;
20-
var MINDRAG = constants.MINDRAG;
20+
var MINSELECT = constants.MINSELECT;
2121

2222
function getAxId(ax) { return ax._id; }
2323

@@ -98,23 +98,23 @@ module.exports = function prepSelect(e, startX, startY, dragOptions, mode) {
9898
dy = Math.abs(y1 - y0);
9999

100100
if(mode === 'select') {
101-
if(dy < Math.min(dx * 0.6, MINDRAG)) {
101+
if(dy < Math.min(dx * 0.6, MINSELECT)) {
102102
// horizontal motion: make a vertical box
103103
poly = polygonTester([[x0, 0], [x0, ph], [x1, ph], [x1, 0]]);
104104
// extras to guide users in keeping a straight selection
105-
corners.attr('d', 'M' + poly.xmin + ',' + (y0 - MINDRAG) +
106-
'h-4v' + (2 * MINDRAG) + 'h4Z' +
107-
'M' + (poly.xmax - 1) + ',' + (y0 - MINDRAG) +
108-
'h4v' + (2 * MINDRAG) + 'h-4Z');
105+
corners.attr('d', 'M' + poly.xmin + ',' + (y0 - MINSELECT) +
106+
'h-4v' + (2 * MINSELECT) + 'h4Z' +
107+
'M' + (poly.xmax - 1) + ',' + (y0 - MINSELECT) +
108+
'h4v' + (2 * MINSELECT) + 'h-4Z');
109109

110110
}
111-
else if(dx < Math.min(dy * 0.6, MINDRAG)) {
111+
else if(dx < Math.min(dy * 0.6, MINSELECT)) {
112112
// vertical motion: make a horizontal box
113113
poly = polygonTester([[0, y0], [0, y1], [pw, y1], [pw, y0]]);
114-
corners.attr('d', 'M' + (x0 - MINDRAG) + ',' + poly.ymin +
115-
'v-4h' + (2 * MINDRAG) + 'v4Z' +
116-
'M' + (x0 - MINDRAG) + ',' + (poly.ymax - 1) +
117-
'v4h' + (2 * MINDRAG) + 'v-4Z');
114+
corners.attr('d', 'M' + (x0 - MINSELECT) + ',' + poly.ymin +
115+
'v-4h' + (2 * MINSELECT) + 'v4Z' +
116+
'M' + (x0 - MINSELECT) + ',' + (poly.ymax - 1) +
117+
'v4h' + (2 * MINSELECT) + 'v-4Z');
118118
}
119119
else {
120120
// diagonal motion

0 commit comments

Comments
 (0)