source: [view]
var g = this.grid;
this.connect(g, "onCellMouseDown", function(){
this.readyForAutoScroll = true;
});
this.connect(g, "onHeaderCellMouseDown", function(){
this.readyForAutoScroll = true;
});
this.connect(g, "onRowSelectorMouseDown", function(){
this.readyForAutoScroll = true;
});
this.connect(dojo.doc, "onmouseup", function(evt){
this._manageAutoScroll(true);
this.readyForAutoScroll = false;
});
this.connect(dojo.doc, "onmousemove", function(evt){
if(this.readyForAutoScroll){
this._event = evt;
var gridPos = dojo.position(g.domNode),
hh = g._getHeaderHeight(),
margin = this.autoScrollMargin,
ey = evt.clientY, ex = evt.clientX,
gy = gridPos.y, gx = gridPos.x,
gh = gridPos.h, gw = gridPos.w;
if(ex >= gx && ex <= gx + gw){
if(ey >= gy + hh && ey < gy + hh + margin){
this._manageAutoScroll(false, true, false);
return;
}else if(ey > gy + gh - margin && ey <= gy + gh){
this._manageAutoScroll(false, true, true);
return;
}else if(ey >= gy && ey <= gy + gh){
var withinSomeview = dojo.some(g.views.views, function(view, i){
if(view instanceof dojox.grid._RowSelector){
return false;
}
var viewPos = dojo.position(view.domNode);
if(ex < viewPos.x + margin && ex >= viewPos.x){
this._manageAutoScroll(false, false, false, view);
return true;
}else if(ex > viewPos.x + viewPos.w - margin && ex < viewPos.x + viewPos.w){
this._manageAutoScroll(false, false, true, view);
return true;
}
return false;
}, this);
if(withinSomeview){
return;
}
}
}
//stop autoscroll.
this._manageAutoScroll(true);
}
});