From: Michael P. <mp...@ph...> - 2001-02-20 01:28:45
|
the best method for doing this is using a slide method. if you start the slide when the mouse goes down, the slide can be stopped if the mouse comes up before it has finished sliding. here's the code I knowckout out of the scrollpane: buttonListener.onmousedown=function(e) { var scroll=e.getTarget(); scroll["scroll"+e.getSource().direction](); scroll.findDimensions(); }; buttonListener.onmouseup=function(e) { e.getTarget().cancelScroll(); }; Here's the viewport code that it extends: ViewPort.prototype.scrollUp=function() {this.scrollSlide(null,0);}; ViewPort.prototype.scrollDown=function() {this.scrollSlide(null,-this.availableScrollY);}; ViewPort.prototype.scrollLeft=function() {this.scrollSlide(0,null);}; ViewPort.prototype.scrollRight=function() {this.scrollSlide(-this.availableScrollX,null);}; ViewPort.prototype.scrollSlide=function(x,y) { if (x!=null && this.enableHScroll) { this.invokeEvent("scrollstart"); this.content.slideTo(x,this.content.y); } else if (y!=null && this.enableVScroll) { this.invokeEvent("scrollstart"); this.content.slideTo(this.content.x,y); }; }; ViewPort.prototype.cancelScroll=function() { this.content.stopSlide(); this.invokeEvent("scrollend"); }; Hope this is of some use. Doug Melvin wrote: > And for my next trick: Continuous scroll on mousedown. -- Michael Pemberton mp...@ph... ICQ: 12107010 |