mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
updated docs and dist
This commit is contained in:
@@ -42,9 +42,25 @@
|
||||
<div id="api-tabview-panel">
|
||||
<ul id="api-classes" class="apis classes">
|
||||
|
||||
<li><a href="../classes/Collision.html">Collision</a></li>
|
||||
<li><a href="../classes/Collision
|
||||
|
||||
Detects collisions between a DOM element against other DOM elements or
|
||||
Coords objects..html">Collision
|
||||
|
||||
Detects collisions between a DOM element against other DOM elements or
|
||||
Coords objects.</a></li>
|
||||
|
||||
<li><a href="../classes/Coords.html">Coords</a></li>
|
||||
<li><a href="../classes/Coords
|
||||
|
||||
Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
|
||||
to simulate DOM elements on the screen.
|
||||
Coords is used by Gridster to create a faux grid with any DOM element can
|
||||
collide..html">Coords
|
||||
|
||||
Creates objects with coordinates (x1, y1, x2, y2, cx, cy, width, height)
|
||||
to simulate DOM elements on the screen.
|
||||
Coords is used by Gridster to create a faux grid with any DOM element can
|
||||
collide.</a></li>
|
||||
|
||||
<li><a href="../classes/Draggable.html">Draggable</a></li>
|
||||
|
||||
@@ -107,24 +123,42 @@
|
||||
items: '.gs_w',
|
||||
distance: 1,
|
||||
limit: true,
|
||||
offset_left: 0,
|
||||
drag: function(e){},
|
||||
start : function(e, ui){},
|
||||
stop : function(e){}
|
||||
offset_left: 0
|
||||
// ,drag: function(e){},
|
||||
// start : function(e, ui){},
|
||||
// stop : function(e){}
|
||||
};
|
||||
|
||||
var $body = $(document.body);
|
||||
|
||||
|
||||
/**
|
||||
* Draggable
|
||||
*
|
||||
* @class Draggable
|
||||
*
|
||||
* @param {HTMLElement} el The HTMLelement that contains all the widgets
|
||||
* to be dragged.
|
||||
* @param {Object} [options] An Object with all options you want to
|
||||
* overwrite:
|
||||
* @param {HTMLElement|String} [options.items] Define who will
|
||||
* be the draggable items. Can be a CSS Selector String or a
|
||||
* collection of HTMLElements.
|
||||
* @param {Number} [options.distance] Distance in pixels after mousedown
|
||||
* the mouse must move before dragging should start.
|
||||
* @param {Boolean} [options.limit] Constrains dragging to the width of
|
||||
* the container
|
||||
* @param {offset_left} [options.offset_left] Offset added to the item
|
||||
* that is being dragged.
|
||||
* @param {Number} [options.drag] Executes a callback when the mouse is
|
||||
* moved during the dragging.
|
||||
* @param {Number} [options.start] Executes a callback when the drag
|
||||
* starts.
|
||||
* @param {Number} [options.stop] Executes a callback when the drag stops.
|
||||
* @return {Object} Returns `el`.
|
||||
* @constructor
|
||||
*/
|
||||
function Draggable(element, options) {
|
||||
this.options = $.extend(defaults, options);
|
||||
this.$container = $(element);
|
||||
function Draggable(el, options) {
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.$container = $(el);
|
||||
this.$dragitems = $(this.options.items, this.$container);
|
||||
this.is_dragging = false;
|
||||
this.player_min_left = 0 + this.options.offset_left;
|
||||
@@ -139,6 +173,7 @@
|
||||
this.enable();
|
||||
};
|
||||
|
||||
|
||||
fn.get_actual_pos = function($el) {
|
||||
var pos = $el.position();
|
||||
return pos;
|
||||
@@ -154,6 +189,10 @@
|
||||
|
||||
|
||||
fn.drag_handler = function(e) {
|
||||
if (e.which !== 1) {
|
||||
return false;
|
||||
};
|
||||
|
||||
var self = this;
|
||||
var first = true;
|
||||
this.$player = $(e.currentTarget);
|
||||
@@ -162,6 +201,7 @@
|
||||
this.mouse_init_pos = this.get_mouse_pos(e);
|
||||
|
||||
$body.on('mousemove.draggable', function(mme){
|
||||
|
||||
var mouse_actual_pos = self.get_mouse_pos(mme);
|
||||
var diff_x = Math.abs(mouse_actual_pos.left - self.mouse_init_pos.left);
|
||||
var diff_y = Math.abs(mouse_actual_pos.top - self.mouse_init_pos.top);
|
||||
|
Reference in New Issue
Block a user