Skip to content

Commit

Permalink
Don't block mouse click events on the image.
Browse files Browse the repository at this point in the history
Doing so means that when the focus is on one of the text boxes,
clicking on the image doesn't remove the focus from the text box,
which is annoying as change of focus is often used to trigger an
update of the graph.

Also increase the minimum selection size to avoid unintentional
drag-to-zoom events, which happen easily with a touch pad.
  • Loading branch information
tsuna committed Nov 15, 2012
1 parent 22f52f1 commit da56730
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/tsd/client/QueryUi.java
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,6 @@ private final class ZoomBox extends HTML

@Override
public void onMouseDown(final MouseDownEvent event) {
event.preventDefault();
// Check if the zoom selection is active, if so, it's possible that the
// mouse left the browser mid-selection and got stuck enabled even
// though the mouse isn't still pressed. If that's the case, do a similar
Expand Down Expand Up @@ -1114,10 +1113,6 @@ public void onMouseDown(final MouseDownEvent event) {
public void onMouseMove(final MouseMoveEvent event) {
event.preventDefault();

if (!zoom_selection_active) {
return;
}

final int x = event.getRelativeX(graph.getElement());
final int y = event.getRelativeY(graph.getElement());
int left;
Expand Down Expand Up @@ -1152,8 +1147,6 @@ public void onMouseMove(final MouseMoveEvent event) {

@Override
public void onMouseUp(final MouseUpEvent event) {
event.preventDefault();

if (zoom_selection_active) {
endSelection(event);
}
Expand Down Expand Up @@ -1206,7 +1199,7 @@ private <H extends EventHandler> void endSelection(final MouseEvent<H> event) {
// Prevent division by zero if image is pathologically small.
// or: Prevent changing anything if the distance the cursor traveled was
// too small (as happens during a simple click or unintentional click).
if (actual_width < 1 || end_x - start_x < 2) {
if (actual_width < 1 || end_x - start_x <= 5) {
return;
}

Expand Down

0 comments on commit da56730

Please sign in to comment.