fx.DragScrollSupport Extends goog.Disposable
A scroll support class. Currently this class will automatically scroll a scrollable container node and scroll it by a fixed amount at a timed interval when the mouse is moved above or below the container or in vertical margin areas. Intended for use in drag and drop. This could potentially be made more general and could support horizontal scrolling.

Inheritance

Constructor

goog.fx.DragScrollSupport(containerNodeopt_marginopt_externalMouseMoveTracking)

Parameters

containerNode : Element
A container that can be scrolled.
opt_margin : number=
Optional margin to use while scrolling.
opt_externalMouseMoveTracking : boolean=
Whether mouse move events are tracked externally by the client object which calls the mouse move event handler, useful when events are generated for more than one source element and/or are not real mousemove events.

Instance Methods

Public Protected Private
calculateScrollDelta(coordinateminrangeLength) number
Calculates scroll delta.
Arguments:
coordinate : number
Current mouse pointer coordinate.
min : number
The coordinate value below which scrolling up should be started.
rangeLength : number
The length of the range in which scrolling should be disabled and above which scrolling down should be started.
Returns: number  The calculated scroll delta.
code »
constrainBounds_(bounds) goog.math.Rect
Constrains the container bounds with respect to the margin.
Arguments:
bounds : goog.math.Rect
The container element.
Returns: goog.math.Rect  The bounding rectangle used to calculate scrolling direction.
code »
disposeInternal()
No description.
code »
isInContainerBounds_(xy) boolean
Gets whether the input coordinate is in the container bounds.
Arguments:
x : number
The x coordinate.
y : number
The y coordinate.
Returns: boolean  Whether the input coordinate is in the container bounds.
code »
onMouseMove(event)
Handler for mouse moves events.
Arguments:
event : goog.events.Event
Mouse move event.
code »
onTick_(event)
Handler for timer tick event, scrolls the container by one scroll step if needed.
Arguments:
event : goog.events.Event
Timer tick event.
code »
setConstrainScroll(constrain)
Sets whether scrolling should be constrained to happen only when the cursor is inside the container node. NOTE: If a margin is not set, then it does not make sense to contain the scroll, because in that case scroll will never be triggered.
Arguments:
constrain : boolean
Whether scrolling should be constrained to happen only when the cursor is inside the container node.
code »
setHorizontalScrolling(scrolling)
Sets whether horizontal scrolling is allowed.
Arguments:
scrolling : boolean
Whether horizontal scrolling is allowed.
code »
setupListeners_(externalMouseMoveTracking)
Attaches listeners and activates automatic scrolling.
Arguments:
externalMouseMoveTracking : boolean
Whether to enable internal mouse move event handling.
code »
addOnDisposeCallback(callbackopt_scope)
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
Arguments:
callback : function(this:T):?
The callback function.
opt_scope : T=
An optional scope to call the callback in.
code »
dispose() void
Disposes of the object. If the object hasn't already been disposed of, calls #disposeInternal. Classes that extend goog.Disposable should override #disposeInternal in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
Returns: void  Nothing.
code »
disposeInternal()
Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend goog.Disposable should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' disposeInternal method. Everywhere else the public dispose method must be used. For example:
  mypackage.MyClass = function() {
    mypackage.MyClass.base(this, 'constructor');
    // Constructor logic specific to MyClass.
    ...
  };
  goog.inherits(mypackage.MyClass, goog.Disposable);

  mypackage.MyClass.prototype.disposeInternal = function() {
    // Dispose logic specific to MyClass.
    ...
    // Call superclass's disposeInternal at the end of the subclass's, like
    // in C++, to avoid hard-to-catch issues.
    mypackage.MyClass.base(this, 'disposeInternal');
  };
code »
getDisposed() boolean
Use #isDisposed instead. No description.
Returns: boolean  Whether the object has been disposed of.
code »
isDisposed() boolean
No description.
Returns: boolean  Whether the object has been disposed of.
code »
registerDisposable(disposable)
Associates a disposable object with this object so that they will be disposed together.
Arguments:
disposable : goog.disposable.IDisposable
that will be disposed when this object is disposed.
code »

Instance Properties

constrainScroll_ :
Whether scrolling should be constrained to happen only when the cursor is inside the container node.
Code »
constructor :
No description.
Code »
containerBounds_ : goog.math.Rect
The container bounds.
Code »
containerNode_ :
The container to be scrolled.
Code »
eventHandler_ : goog.events.EventHandler
EventHandler used to set up and tear down listeners.
Code »
horizontalScrolling_ :
Whether horizontal scrolling is allowed.
Code »
margin_ :
The margin for triggering a scroll.
Code »
scrollBounds_ : goog.math.Rect
The bounding rectangle which if left triggers scrolling.
Code »
scrollDelta_ : goog.math.Coordinate
The current scroll delta.
Code »
scrollTimer_ : goog.Timer
Scroll timer that will scroll the container until it is stopped. It will scroll when the mouse is outside the scrolling area of the container.
Code »
creationStack :
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
Code »
disposed_ :
Whether the object has been disposed of.
Code »
onDisposeCallbacks_ :
Callbacks to invoke when this object is disposed.
Code »

Static Properties

goog.fx.DragScrollSupport.MARGIN :
The suggested scrolling margin.
Code »
goog.fx.DragScrollSupport.SCROLL_STEP_ :
The scroll step in pixels.
Code »
goog.fx.DragScrollSupport.TIMER_STEP_ :
The scroll timer step in ms.
Code »
goog.fx.DragScrollSupport.superClass_ :
No description.
Code »

Package fx

Package Reference