add L.Draggable options and fix docstring (#5301)

This commit is contained in:
Iván Sánchez Ortega 2017-02-02 16:46:58 +01:00 committed by GitHub
parent ddc3a9ca61
commit 53e90945aa

View File

@ -40,15 +40,19 @@ var MOVE = {
export var Draggable = Evented.extend({ export var Draggable = Evented.extend({
options: { options: {
// @section
// @aka Draggable options
// @option clickTolerance: Number = 3 // @option clickTolerance: Number = 3
// The max number of pixels a user can shift the mouse pointer during a click // The max number of pixels a user can shift the mouse pointer during a click
// for it to be considered a valid click (as opposed to a mouse drag). // for it to be considered a valid click (as opposed to a mouse drag).
clickTolerance: 3 clickTolerance: 3
}, },
// @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline: Boolean) // @constructor L.Draggable(el: HTMLElement, dragHandle?: HTMLElement, preventOutline?: Boolean, options?: Draggable options)
// Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default). // Creates a `Draggable` object for moving `el` when you start dragging the `dragHandle` element (equals `el` itself by default).
initialize: function (element, dragStartTarget, preventOutline) { initialize: function (element, dragStartTarget, preventOutline, options) {
Util.setOptions(this, options);
this._element = element; this._element = element;
this._dragStartTarget = dragStartTarget || element; this._dragStartTarget = dragStartTarget || element;
this._preventOutline = preventOutline; this._preventOutline = preventOutline;