Skip to content

Commit

Permalink
Merge pull request #823 from peuter/fix-diagram-pan-loading
Browse files Browse the repository at this point in the history
use a debounced function to load diagram data after pan event
  • Loading branch information
ChristianMayer committed Jan 16, 2019
2 parents 76caa21 + 9a549fc commit aac4160
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions source/class/cv/plugins/diagram/AbstractDiagram.js
Expand Up @@ -61,6 +61,16 @@ qx.Class.define('cv.plugins.diagram.AbstractDiagram', {
include: [cv.ui.common.Operate, cv.ui.common.Refresh],
type: "abstract",

/*
***********************************************
CONSTRUCTOR
***********************************************
*/
construct: function (props) {
this.base(arguments, props);
this._debouncedLoadDiagramData = qx.util.Function.debounce(this.loadDiagramData.bind(this), 200);
},

/*
******************************************************
STATICS
Expand Down Expand Up @@ -600,11 +610,8 @@ qx.Class.define('cv.plugins.diagram.AbstractDiagram', {
this.plotted = true;

var that = this;
diagram.bind("plotpan", function(event, plot, args) {
// TODO and FIXME: args.dragEnded doesn't exist, so data isn't reloaded after pan end!
if (args.dragEnded) {
that.loadDiagramData( plot, isPopup, false );
}
diagram.bind("plotpan", function(event, plot) {
that._debouncedLoadDiagramData( plot, isPopup, false );
}).bind("plotzoom", function() {
that.loadDiagramData( plot, isPopup, false );
}).bind("touchended", function() {
Expand Down

0 comments on commit aac4160

Please sign in to comment.