Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug: Selection is truncated if dragged to edge of summary graph #10

Open
timmc opened this issue Jul 12, 2012 · 3 comments
Open

Bug: Selection is truncated if dragged to edge of summary graph #10

timmc opened this issue Jul 12, 2012 · 3 comments

Comments

@timmc
Copy link

timmc commented Jul 12, 2012

Reproduction:

  • Go to Time Series demo
  • Select e.g. the middle third of the summary view
  • Drag it all the way to the left (or right), then back towards the center
  • It is now much less than a third of the width of the summary graph

I can't tell if this is a Flotr or Envision bug. Appears in demos built from current master.

@timmc
Copy link
Author

timmc commented Jul 13, 2012

I spot-checked this demo through its history; this bug seems to have always been there.

@cesutherland
Copy link
Member

Thanks. Sorry for the late response. This is an issue in the Flotr2 handles plugin. You'd expect that, once you reach the end of the graph, the selection stays 1/3 in size but stops moving with your mouse?

@Zielak
Copy link

Zielak commented Jan 14, 2013

I have found a solution. I'm github-newbie so instead of making pull request i'll just type my code here. I've made a change in envision.js file, line 5673, function mouseMoveHandler:

function mouseMoveHandler(e, position) {

  if (!this.handles.initialized) return;
  if (!this.handles.moveHandler) return;

  var
    delta = position.x - this.lastMousePos.x,
    selection = this.selection.selection,
    area = this.selection.getArea(),
    handles = this.handles;

  // added 2 if statements to check if selection can go any further.
  if(delta>0){
    if(selection.second.x + delta + 1 > this.canvasWidth) return false;
  }
  if(delta<0){
    if(selection.first.x + delta <= 0) return false;
  }

  handles.moveHandler(area, delta);
  checkSwap(area, handles);

  this.selection.setSelection(area);
}

Selection box never changes size when dragging over the edge.
Please let me know if this fix is satisfactory.

EDIT: Right now I see this fix isn't enough. When selection box reaches the edge it still gets smaller by pixels, but only for the first hit on drag.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants