Skip to content

Commit

Permalink
Release v0.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vieron committed Mar 5, 2014
1 parent dc09f19 commit b84f364
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 27 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<a name="v0.5.1"></a>
### v0.5.1 (2014-03-05)


#### Features

* **collision:** overlapping region as a config option ([720d487e](http://github.com/ducksboard/gridster.js/commit/720d487e3988593e2c60909c88aaff13fbd4f842))
* **coords:**
* allow both (left/x1) and (top/y1) attr keys ([6f22217f](http://github.com/ducksboard/gridster.js/commit/6f22217f056e4fc52f6405f2af49596105aae150))
* add destroy method ([fdeee4f6](http://github.com/ducksboard/gridster.js/commit/fdeee4f636266c7a0579ced833f04fec013b6863))
* **draggable:** keep container position prop if different than static ([04868a38](http://github.com/ducksboard/gridster.js/commit/04868a384d655d110f2d153d2fddb94b1c6d54a9))
* **gridster:** destroy element's data and optionally remove from DOM ([dc09f191](http://github.com/ducksboard/gridster.js/commit/dc09f191d8503669cfa4737122c77cb0f5b9c3d2))

<a name="v0.5.0"></a>
## v0.5.0 (2014-02-14)

Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.gridster.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.5.0 - 2014-02-14
/*! gridster.js - v0.5.1 - 2014-03-05
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down
34 changes: 24 additions & 10 deletions dist/jquery.gridster.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.5.0 - 2014-02-14
/*! gridster.js - v0.5.1 - 2014-03-05
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -55,6 +55,9 @@

var d = this.data;

typeof d.left === 'undefined' && (d.left = d.x1);
typeof d.top === 'undefined' && (d.top = d.y1);

this.coords.x1 = d.left;
this.coords.y1 = d.top;
this.coords.x2 = d.left + d.width;
Expand Down Expand Up @@ -89,6 +92,10 @@
return this.coords;
};

fn.destroy = function() {
this.el.removeData('coords');
delete this.el;
};

//jQuery adapter
$.fn.coords = function() {
Expand All @@ -106,7 +113,8 @@
;(function($, window, document, undefined){

var defaults = {
colliders_context: document.body
colliders_context: document.body,
overlapping_region: 'C'
// ,on_overlap: function(collider_data){},
// on_overlap_start : function(collider_data){},
// on_overlap_stop : function(collider_data){}
Expand All @@ -124,6 +132,9 @@
* of HTMLElements or an Array of Coords instances.
* @param {Object} [options] An Object with all options you want to
* overwrite:
* @param {String} [options.overlapping_region] Determines when collision
* is valid, depending on the overlapped area. Values can be: 'N', 'S',
* 'W', 'E', 'C' or 'all'. Default is 'C'.
* @param {Function} [options.on_overlap_start] Executes a function the first
* time each `collider ` is overlapped.
* @param {Function} [options.on_overlap_stop] Executes a function when a
Expand Down Expand Up @@ -223,6 +234,7 @@

fn.find_collisions = function(player_data_coords){
var self = this;
var overlapping_region = this.options.overlapping_region;
var colliders_coords = [];
var colliders_data = [];
var $colliders = (this.colliders || this.$colliders);
Expand All @@ -246,7 +258,8 @@
player_coords, collider_coords);

//todo: make this an option
if (region === 'C'){
if (region === overlapping_region || overlapping_region === 'all') {

var area_coords = self.calculate_overlapped_area_coords(
player_coords, collider_coords);
var area = self.calculate_overlapped_area(area_coords);
Expand Down Expand Up @@ -464,8 +477,9 @@
var fn = Draggable.prototype;

fn.init = function() {
var pos = this.$container.css('position');
this.calculate_dimensions();
this.$container.css('position', 'relative');
this.$container.css('position', pos === 'static' ? 'relative' : pos);
this.disabled = false;
this.events();

Expand Down Expand Up @@ -3820,9 +3834,12 @@
* Destroy this gridster by removing any sign of its presence, making it easy to avoid memory leaks
*
* @method destroy
* @return {undefined}
* @param {Boolean} remove If true, remove gridster from DOM.
* @return {Object} Returns the instance of the Gridster class.
*/
fn.destroy = function(){
fn.destroy = function(remove) {
this.$el.removeData('gridster');

// remove bound callback on window resize
$(window).unbind('.gridster');

Expand All @@ -3832,10 +3849,7 @@

this.remove_style_tags();

// lastly, remove gridster element
// this will additionally cause any data associated to this element to be removed, including this
// very gridster instance
this.$el.remove();
remove && this.$el.remove();

return this;
};
Expand Down
2 changes: 1 addition & 1 deletion dist/jquery.gridster.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/jquery.gridster.min.js

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions dist/jquery.gridster.with-extras.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.5.0 - 2014-02-14
/*! gridster.js - v0.5.1 - 2014-03-05
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -55,6 +55,9 @@

var d = this.data;

typeof d.left === 'undefined' && (d.left = d.x1);
typeof d.top === 'undefined' && (d.top = d.y1);

this.coords.x1 = d.left;
this.coords.y1 = d.top;
this.coords.x2 = d.left + d.width;
Expand Down Expand Up @@ -89,6 +92,10 @@
return this.coords;
};

fn.destroy = function() {
this.el.removeData('coords');
delete this.el;
};

//jQuery adapter
$.fn.coords = function() {
Expand All @@ -106,7 +113,8 @@
;(function($, window, document, undefined){

var defaults = {
colliders_context: document.body
colliders_context: document.body,
overlapping_region: 'C'
// ,on_overlap: function(collider_data){},
// on_overlap_start : function(collider_data){},
// on_overlap_stop : function(collider_data){}
Expand All @@ -124,6 +132,9 @@
* of HTMLElements or an Array of Coords instances.
* @param {Object} [options] An Object with all options you want to
* overwrite:
* @param {String} [options.overlapping_region] Determines when collision
* is valid, depending on the overlapped area. Values can be: 'N', 'S',
* 'W', 'E', 'C' or 'all'. Default is 'C'.
* @param {Function} [options.on_overlap_start] Executes a function the first
* time each `collider ` is overlapped.
* @param {Function} [options.on_overlap_stop] Executes a function when a
Expand Down Expand Up @@ -223,6 +234,7 @@

fn.find_collisions = function(player_data_coords){
var self = this;
var overlapping_region = this.options.overlapping_region;
var colliders_coords = [];
var colliders_data = [];
var $colliders = (this.colliders || this.$colliders);
Expand All @@ -246,7 +258,8 @@
player_coords, collider_coords);

//todo: make this an option
if (region === 'C'){
if (region === overlapping_region || overlapping_region === 'all') {

var area_coords = self.calculate_overlapped_area_coords(
player_coords, collider_coords);
var area = self.calculate_overlapped_area(area_coords);
Expand Down Expand Up @@ -464,8 +477,9 @@
var fn = Draggable.prototype;

fn.init = function() {
var pos = this.$container.css('position');
this.calculate_dimensions();
this.$container.css('position', 'relative');
this.$container.css('position', pos === 'static' ? 'relative' : pos);
this.disabled = false;
this.events();

Expand Down Expand Up @@ -3820,9 +3834,12 @@
* Destroy this gridster by removing any sign of its presence, making it easy to avoid memory leaks
*
* @method destroy
* @return {undefined}
* @param {Boolean} remove If true, remove gridster from DOM.
* @return {Object} Returns the instance of the Gridster class.
*/
fn.destroy = function(){
fn.destroy = function(remove) {
this.$el.removeData('gridster');

// remove bound callback on window resize
$(window).unbind('.gridster');

Expand All @@ -3832,10 +3849,7 @@

this.remove_style_tags();

// lastly, remove gridster element
// this will additionally cause any data associated to this element to be removed, including this
// very gridster instance
this.$el.remove();
remove && this.$el.remove();

return this;
};
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.gridster.with-extras.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gridster",
"title": "gridster.js",
"description": "a drag-and-drop multi-column jQuery grid plugin",
"version": "0.5.0",
"version": "0.5.1",
"homepage": "http://gridster.net/",
"author": {
"name": "ducksboard",
Expand Down

0 comments on commit b84f364

Please sign in to comment.