在鼠标拖动到底部之前进行VSP计算,增加一个fudge,具体方法:
private function addMove(event:MouseEvent) {
var currentMouseX:Number = event.stageX;
var currentMouseY:Number = event.stageY;
const fudge:Number = 20;
var needScroll:Boolean = !vpBound.contains(currentMouseX, currentMouseY + fudge);
if(needScroll) {
// drag out the top viewport
if(currentMouseY < 0) {
vp.verticalScrollPosition = 0;
return;
}
//first child in the viewport
if(typicalBounds.y > 0 && currentMouseY < typicalBounds.y) {
vp.verticalScrollPosition = 0;
return;
}
//drag out the bottom viewport
if((currentMouseY > lastChildBounds.y) && isInBottomView()) {
vp.verticalScrollPosition = -vp.getVerticalScrollPositionDelta(NavigationUnit.HOME);
return;
}
vp.layout.verticalScrollPosition += SCROLL_DELTA*direction;
//container.verticalScrollPosition += SCROLL_DELTA*direction;
Logger.gInfo("vp.verticalPosition: ", vp.verticalScrollPosition);
}
oldMovingMouseY = currentMouseY;
}
No comments:
Post a Comment