Hi all,
I have a brush having a "brushstart" and "brushend" events:
var oldRangeLimits;
brush
.on('brushstart', function (){
oldRangeLimits = brush.extent();
})
.on('brush', function () {
var s = brush.extent();
//the user is moving the whole brush
if(oldRangeLimits[0] !== s[0] && oldRangeLimits[1] !== s[1]){
}
//the user is moving the left brush handler
else if(oldRangeLimits[0] !== s[0]){
}
//the user is moving the right brush handler
else if(oldRangeLimits[1] !== s[1]){
}
})
And I need to test what's happening in the "brush" event callback, when the brush is triggered programatically having:
- The range extent [0..20],
- The brush extent [5..15],
I tell the brush to change its extent from [5..15] to [1..19]:
d3.select('.brush')
.call(brush.extent([1, 19]))
.call(brush.event);
the problem is that call(brush.event) will trigger the brushstart event which will set the brush extent to [1..19] and then in the brush event callback, any of the IF statements will pass.
Any Help please.