Skip to content

Implement an option to avoid calling the pan trigger before end of dragging - #1255

Closed
Wallaby1999 wants to merge 1 commit into
flot:0.9-workfrom
Wallaby1999:0.9-work
Closed

Wallaby1999 wants to merge 1 commit into
flot:0.9-workfrom
Wallaby1999:0.9-work

Conversation

@Wallaby1999

Copy link
Copy Markdown

If navigate plugin is used with pan functionality and data needs to be reloaded, it may be usefull to avoid calling the pan trigger during dragging.

This can help to avoid constantsly reloading data during dragging and instead just reload data, when dragging has been finished.

@dnschnur

dnschnur commented Mar 5, 2014

Copy link
Copy Markdown
Member

Please correct me if I'm mis-understanding something, but couldn't you simply not listen for the event? Or if unbinding is inconvenient, add an if (ignorePan) return; at the top of the callback?

@Wallaby1999

Copy link
Copy Markdown
Author

Background is, that I want to reload data dynamically from remote RRD files when the graph is panned.
If reloading is done on each panning event, this is extremly time consuming and can lead to UI looking freezed. Nevertheless I want to see the grid being redrawn during dragging, because the user needs to see some feedback. Therefore I need to set "frameRate" to a value > 0, but I do not want to be notified during dragging, only in the end of the dragging.

Maybe I missed something, but I did not find a possibly to achieve this without adapting the plugin itself. Outside of the plugin I am not able to see if plot.getPlaceholder().trigger("plotpan", [plot, args]); is called during or in the end of dragging.
Please correct me if I am wrong.

@dnschnur

dnschnur commented Mar 5, 2014

Copy link
Copy Markdown
Member

Okay, I see what you're trying to do. I'd rather not introduce new options unless they're really necessary, and in this case I think there's a simple alternative: add a flag to the final call args, like this:

plot.pan({
    left: prevPageX - e.pageX,
    top: prevPageY - e.pageY,
    end: true
});

You should then be able to check this in your listener. If you submit this patch to 0.9-work, I'll merge it right away.

@Wallaby1999

Copy link
Copy Markdown
Author

As I do not know how to change this pull request I created a new one: #1258

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants