updated docs and dist

This commit is contained in:
vieron
2012-07-23 22:08:09 +02:00
parent 33b8f206cf
commit aa939d8bf7
15 changed files with 1387 additions and 769 deletions

View File

@@ -42,9 +42,25 @@
<div id="api-tabview-panel">
<ul id="api-classes" class="apis classes">
<li><a href="..&#x2F;classes/Collision.html">Collision</a></li>
<li><a href="..&#x2F;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="..&#x2F;classes/Coords.html">Coords</a></li>
<li><a href="..&#x2F;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="..&#x2F;classes/Draggable.html">Draggable</a></li>
@@ -107,24 +123,42 @@
items: &#x27;.gs_w&#x27;,
distance: 1,
limit: true,
offset_left: 0,
drag: function(e){},
start : function(e, ui){},
stop : function(e){}
offset_left: 0
&#x2F;&#x2F; ,drag: function(e){},
&#x2F;&#x2F; start : function(e, ui){},
&#x2F;&#x2F; stop : function(e){}
};
var $body = $(document.body);
&#x2F;**
* 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 &#x60;el&#x60;.
* @constructor
*&#x2F;
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(&#x27;mousemove.draggable&#x27;, 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);