goog.fx.Dragger
Classgoog.fx.Dragger
> goog.events.EventTarget
> goog.Disposable
goog.fx.Dragger(target, opt_handle, opt_limits)
A class that allows mouse or touch-based dragging (moving) of an element
target
{Element
}
opt_handle
{Element
=}
opt_limits
{goog.math.Rect
=}
goog.fx.Dragger.EventType
EnumConstants for event names. … more
.addEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Adds an event listener to the event target. The same handler can only be added once per the type. Even if you add the same handler multiple times using the same type then it will only be called once when the event is dispatched. Supported for legacy but use goog.events.listen(src, type, handler) instead.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.addOnDisposeCallback(callback, opt_scope)
Inherited from goog.Disposable
.
Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.
callback
{!Function
}
opt_scope
{Object
=}
.clientX
{number
}Current x position of mouse or touch relative to viewport.
.clientY
{number
}Current y position of mouse or touch relative to viewport.
.creationStack
{string
}Inherited from goog.Disposable
.
If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.
.defaultAction(x, y)
Overridable function for handling the default action of the drag behaviour. Normally this is simply moving the element to x,y though in some cases it might be used to resize the layer. This is basically a shortcut to implementing a default ondrag event handler.
x
{number
}
y
{number
}
.deltaX
{number
}Current x position of drag relative to target's parent.
.deltaY
{number
}Current y position of drag relative to target's parent.
.dispatchEvent(e)
Inherited from goog.events.EventTarget
.
Dispatches an event (or event like object) and calls all listeners listening for events of this type. The type of the event is decided by the type property on the event object. If any of the listeners returns false OR calls preventDefault then this function will return false. If one of the capture listeners calls stopPropagation, then the bubble listeners won't fire.
e
{string
|Object
|goog.events.Event
}
boolean
}
.dispose()
Inherited from goog.Disposable
.
Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.
void
}
.disposeInternal()
[protected]Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() { MyClass.superClass_.disposeInternal.call(this); // Dispose logic for MyClass };
.doDrag(e, x, y, dragFromScroll)
[protected]e
{goog.events.BrowserEvent
}
x
{number
}
y
{number
}
dragFromScroll
{boolean
}
.enableRightPositioningForRtl(useRightPositioningForRtl)
Turns on/off true RTL behavior. This should be called immediately after construction. This is a temporary flag to allow clients to transition to the new component at their convenience. At some point true will be the default.
useRightPositioningForRtl
{boolean
}
.endDrag(e, opt_dragCanceled)
Event handler that is used to end the drag.
e
{goog.events.BrowserEvent
}
opt_dragCanceled
{boolean
=}
.endDragCancel(e)
Event handler that is used to end the drag by cancelling it.
e
{goog.events.BrowserEvent
}
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getEnabled()
boolean
}
.getHandler()
Returns the event handler, intended for subclass use.
goog.events.EventHandler
}
.getHysteresis()
Gets the distance the user has to drag the element before a drag operation is started.
number
}
.getParentEventTarget()
Inherited from goog.events.EventTarget
.
Returns the parent of this event target to use for bubbling.
goog.events.EventTarget
}
.handle
{Element
}Reference to the handler that initiates the drag.
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.isDragging()
boolean
}
.limitX(x)
Returns the 'real' x after limits are applied (allows for some limits to be undefined).
x
{number
}
number
}
.limitY(y)
Returns the 'real' y after limits are applied (allows for some limits to be undefined).
y
{number
}
number
}
.limits
{goog.math.Rect
}Object representing the limits of the drag region.
.pageScroll
{goog.math.Coordinate
}The current page scroll value.
.registerDisposable(disposable)
Inherited from goog.Disposable
.
Associates a disposable object with this object so that they will be disposed together.
disposable
{goog.disposable.IDisposable
}
.removeEventListener(type, handler, opt_capture, opt_handlerScope)
Inherited from goog.events.EventTarget
.
Removes an event listener from the event target. The handler must be the same object as the one added. If the handler has not been added then nothing is done.
type
{string
}
handler
{Function
|Object
}
opt_capture
{boolean
=}
opt_handlerScope
{Object
=}
.screenX
[deprecated] {number
}Deprecated. Consider switching to clientX instead.
Current x position of mouse or touch relative to screen. Deprecated because it doesn't take into affect zoom level or pixel density.
.screenY
[deprecated] {number
}Deprecated. Consider switching to clientY instead.
Current y position of mouse or touch relative to screen. Deprecated because it doesn't take into affect zoom level or pixel density.
.setCancelIeDragStart(cancelIeDragStart)
Enables cancelling of built-in IE drag events.
cancelIeDragStart
{boolean
}
.setEnabled(enabled)
Set whether dragger is enabled
enabled
{boolean
}
.setHysteresis(distance)
Sets the distance the user has to drag the element before a drag operation is started.
distance
{number
}
.setLimits(limits)
Sets (or reset) the Drag limits after a Dragger is created.
limits
{goog.math.Rect
?}
.setParentEventTarget(parent)
Inherited from goog.events.EventTarget
.
Sets the parent of this event target to use for bubbling.
parent
{goog.events.EventTarget
?}
.setScrollTarget(scrollTarget)
Sets the SCROLL event target to make drag element follow scrolling.
scrollTarget
{EventTarget
}
.setupDragHandlers()
[protected]Sets up event handlers when dragging starts.
.startDrag(e)
Event handler that is used to start the drag
e
{goog.events.BrowserEvent
}
.startX
{number
}The x position where the first mousedown or touchstart occurred.
.startY
{number
}The y position where the first mousedown or touchstart occurred.
.target
{Element
}Reference to drag target element.