Skip to content

Commit

Permalink
Prep release of 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
David S Morse authored and David S Morse committed Feb 26, 2016
1 parent e7d7b55 commit 58b8f8a
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 116 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
<a name="v0.7.0"></a>
## v0.7.0 (2016-02-26)


#### Bug Fixes

* Apply fix from #22 to vertical positioning ([dfc64916](http://github.com/dsmorse/gridster.js/commit/dfc649168c5b6a2a230b90a47e19621a6937fc7c))
* convert from JQury to DOM ([4936ef82](http://github.com/dsmorse/gridster.js/commit/4936ef82c04690fde118c3d54b798ceaf7c376e6))
* **fn.generate_stylesheet:** only return new stylesheet if colWidth and this.$wrapper.width() are > 0 ([f513793a](http://github.com/dsmorse/gridster.js/commit/f513793a8c0ec63509f6296325a8a7a6e34179f5))
* **gridster:** Add additiona error checking on widgets removal ([2b0f9963](http://github.com/dsmorse/gridster.js/commit/2b0f9963ef80c9acc6f66545eb53597836e2ebec))

<a name="v0.6.10"></a>
### v0.6.10 (2015-05-31)
* Add Ruby on Rails support
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "gridster",
"homepage": "dsmorse.github.io/gridster.js/",
"version": "0.6.10",
"version": "0.7.0",
"dependencies": {
"jquery": "^2.1.3"
},
Expand Down
102 changes: 49 additions & 53 deletions dist/jquery.gridster.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.6.10 - 2016-01-21
/*! gridster.js - v0.7.0 - 2016-02-26
* https://dsmorse.github.io/gridster.js/
* Copyright (c) 2016 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -938,6 +938,7 @@
responsive_breakpoint: false,
scroll_container: window,
shift_larger_widgets_down: true,
move_widgets_down_only: false,
shift_widgets_up: true,
show_element: function($el, callback) {
if (callback) {
Expand Down Expand Up @@ -1692,45 +1693,6 @@
};


/**
* Change the dimensions of widgets.
*
* @method resize_widget_dimensions
* @param {Object} [options] An Object with all options you want to
* overwrite:
* @param {Array} [options.widget_margins] Margin between widgets.
* The first index for the horizontal margin (left, right) and
* the second for the vertical margin (top, bottom).
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
* in pixels. The first index for the width and the second for the
* height.
* @return {Class} Returns the instance of the Gridster Class.
*/
fn.resize_widget_dimensions = function (options) {
if (options.widget_margins) {
this.options.widget_margins = options.widget_margins;
}

if (options.widget_base_dimensions) {
this.options.widget_base_dimensions = options.widget_base_dimensions;
}

this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];

this.$widgets.each($.proxy(function (i, widget) {
var $widget = $(widget);
this.resize_widget($widget);
}, this));

this.generate_grid_and_stylesheet();
this.get_widgets_from_DOM();
this.set_dom_grid_height();

return this;
};


/**
* Mutate widget dimensions and position in the grid map.
*
Expand Down Expand Up @@ -1864,7 +1826,7 @@
}, this));

if (!this.is_resizing) {
this.set_dom_grid_height();
this.set_dom_grid_height();
}

return this;
Expand Down Expand Up @@ -2472,13 +2434,23 @@

this.$changed = this.$changed.add(this.$player);

// move the cells down if there is an overlap and we are in static mode
if (this.options.collision.wait_for_mouseup) {
this.for_each_cell_occupied(this.placeholder_grid_data, function (tcol, trow) {
if (this.is_widget(tcol, trow)) {
this.move_widget_down(this.is_widget(tcol, trow), this.placeholder_grid_data.size_y);
}
});
//If widget has new position, clean previous grid
if (this.placeholder_grid_data.el.coords().grid.col !== this.placeholder_grid_data.col ||
this.placeholder_grid_data.el.coords().grid.row !== this.placeholder_grid_data.row) {
this.update_widget_position(this.placeholder_grid_data.el.coords().grid, false);

// move the cells down if there is an overlap and we are in static mode
if (this.options.collision.wait_for_mouseup) {
this.for_each_cell_occupied(this.placeholder_grid_data, function (tcol, trow) {
if (this.is_widget(tcol, trow)) {
// get number of cells to move
var destinyRow = this.placeholder_grid_data.row + this.placeholder_grid_data.size_y;
var currentOverlappedRow = parseInt(this.gridmap[tcol][trow][0].getAttribute('data-row'));
var cellsToMove = destinyRow - currentOverlappedRow;
this.move_widget_down(this.is_widget(tcol, trow), cellsToMove);
}
});
}
}

this.cells_occupied_by_player = this.get_cells_occupied(this.placeholder_grid_data);
Expand Down Expand Up @@ -2808,9 +2780,6 @@
fn.set_player = function (col, row, no_player) {
var self = this;
var swap = false;
if (!no_player) {
this.empty_cells_player_occupies();
}
var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
var to_col = cell.col;
var to_row = cell.row || row;
Expand Down Expand Up @@ -2861,7 +2830,19 @@
});
} else if (wgd.size_x <= player_size_x && wgd.size_y <= player_size_y) {
if (!$gr.is_swap_occupied(placeholder_cells.cols[0], wgd.row, wgd.size_x, wgd.size_y) && !$gr.is_player_in(placeholder_cells.cols[0], wgd.row) && !$gr.is_in_queue(placeholder_cells.cols[0], wgd.row, $w)) {
swap = $gr.queue_widget(placeholder_cells.cols[0], wgd.row, $w);
if($gr.options.move_widgets_down_only){
$overlapped_widgets.each($.proxy(function (i, w) {
var $w = $(w);

if ($gr.can_go_down($w) && $w.coords().grid.row === $gr.player_grid_data.row && !$gr.is_in_queue($w.coords().grid.col, wgd.row, $w)) {
$gr.move_widget_down($w, $gr.player_grid_data.size_y);
$gr.set_placeholder(to_col, to_row);
}
}));
}
else{
swap = $gr.queue_widget(placeholder_cells.cols[0], wgd.row, $w);
}
}
else if (!$gr.is_swap_occupied(outside_col, wgd.row, wgd.size_x, wgd.size_y) && !$gr.is_player_in(outside_col, wgd.row) && !$gr.is_in_queue(outside_col, wgd.row, $w)) {
swap = $gr.queue_widget(outside_col, wgd.row, $w);
Expand All @@ -2873,7 +2854,19 @@
swap = $gr.queue_widget(wgd.col, outside_row, $w);
}
else if (!$gr.is_swap_occupied(placeholder_cells.cols[0], placeholder_cells.rows[0], wgd.size_x, wgd.size_y) && !$gr.is_player_in(placeholder_cells.cols[0], placeholder_cells.rows[0]) && !$gr.is_in_queue(placeholder_cells.cols[0], placeholder_cells.rows[0], $w)) {
swap = $gr.queue_widget(placeholder_cells.cols[0], placeholder_cells.rows[0], $w);
if($gr.options.move_widgets_down_only){
$overlapped_widgets.each($.proxy(function (i, w) {
var $w = $(w);

if ($gr.can_go_down($w) && $w.coords().grid.row === $gr.player_grid_data.row && !$gr.is_in_queue(outside_col, wgd.row, $w)) {
$gr.move_widget_down($w, $gr.player_grid_data.size_y);
$gr.set_placeholder(to_col, to_row);
}
}));
}
else{
swap = $gr.queue_widget(placeholder_cells.cols[0], placeholder_cells.rows[0], $w);
}
} else {
//in one last attempt we check for any other empty spaces
for (var c = 0; c < player_size_x; c++) {
Expand Down Expand Up @@ -4940,6 +4933,9 @@
this.options.widget_base_dimensions = options.widget_base_dimensions;
}

this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];

this.$widgets.each($.proxy(function (i, widget) {
var $widget = $(widget);
this.resize_widget($widget);
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.

102 changes: 49 additions & 53 deletions dist/jquery.gridster.with-extras.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.6.10 - 2016-01-21
/*! gridster.js - v0.7.0 - 2016-02-26
* https://dsmorse.github.io/gridster.js/
* Copyright (c) 2016 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -938,6 +938,7 @@
responsive_breakpoint: false,
scroll_container: window,
shift_larger_widgets_down: true,
move_widgets_down_only: false,
shift_widgets_up: true,
show_element: function($el, callback) {
if (callback) {
Expand Down Expand Up @@ -1692,45 +1693,6 @@
};


/**
* Change the dimensions of widgets.
*
* @method resize_widget_dimensions
* @param {Object} [options] An Object with all options you want to
* overwrite:
* @param {Array} [options.widget_margins] Margin between widgets.
* The first index for the horizontal margin (left, right) and
* the second for the vertical margin (top, bottom).
* @param {Array} [options.widget_base_dimensions] Base widget dimensions
* in pixels. The first index for the width and the second for the
* height.
* @return {Class} Returns the instance of the Gridster Class.
*/
fn.resize_widget_dimensions = function (options) {
if (options.widget_margins) {
this.options.widget_margins = options.widget_margins;
}

if (options.widget_base_dimensions) {
this.options.widget_base_dimensions = options.widget_base_dimensions;
}

this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];

this.$widgets.each($.proxy(function (i, widget) {
var $widget = $(widget);
this.resize_widget($widget);
}, this));

this.generate_grid_and_stylesheet();
this.get_widgets_from_DOM();
this.set_dom_grid_height();

return this;
};


/**
* Mutate widget dimensions and position in the grid map.
*
Expand Down Expand Up @@ -1864,7 +1826,7 @@
}, this));

if (!this.is_resizing) {
this.set_dom_grid_height();
this.set_dom_grid_height();
}

return this;
Expand Down Expand Up @@ -2472,13 +2434,23 @@

this.$changed = this.$changed.add(this.$player);

// move the cells down if there is an overlap and we are in static mode
if (this.options.collision.wait_for_mouseup) {
this.for_each_cell_occupied(this.placeholder_grid_data, function (tcol, trow) {
if (this.is_widget(tcol, trow)) {
this.move_widget_down(this.is_widget(tcol, trow), this.placeholder_grid_data.size_y);
}
});
//If widget has new position, clean previous grid
if (this.placeholder_grid_data.el.coords().grid.col !== this.placeholder_grid_data.col ||
this.placeholder_grid_data.el.coords().grid.row !== this.placeholder_grid_data.row) {
this.update_widget_position(this.placeholder_grid_data.el.coords().grid, false);

// move the cells down if there is an overlap and we are in static mode
if (this.options.collision.wait_for_mouseup) {
this.for_each_cell_occupied(this.placeholder_grid_data, function (tcol, trow) {
if (this.is_widget(tcol, trow)) {
// get number of cells to move
var destinyRow = this.placeholder_grid_data.row + this.placeholder_grid_data.size_y;
var currentOverlappedRow = parseInt(this.gridmap[tcol][trow][0].getAttribute('data-row'));
var cellsToMove = destinyRow - currentOverlappedRow;
this.move_widget_down(this.is_widget(tcol, trow), cellsToMove);
}
});
}
}

this.cells_occupied_by_player = this.get_cells_occupied(this.placeholder_grid_data);
Expand Down Expand Up @@ -2808,9 +2780,6 @@
fn.set_player = function (col, row, no_player) {
var self = this;
var swap = false;
if (!no_player) {
this.empty_cells_player_occupies();
}
var cell = !no_player ? self.colliders_data[0].el.data : {col: col};
var to_col = cell.col;
var to_row = cell.row || row;
Expand Down Expand Up @@ -2861,7 +2830,19 @@
});
} else if (wgd.size_x <= player_size_x && wgd.size_y <= player_size_y) {
if (!$gr.is_swap_occupied(placeholder_cells.cols[0], wgd.row, wgd.size_x, wgd.size_y) && !$gr.is_player_in(placeholder_cells.cols[0], wgd.row) && !$gr.is_in_queue(placeholder_cells.cols[0], wgd.row, $w)) {
swap = $gr.queue_widget(placeholder_cells.cols[0], wgd.row, $w);
if($gr.options.move_widgets_down_only){
$overlapped_widgets.each($.proxy(function (i, w) {
var $w = $(w);

if ($gr.can_go_down($w) && $w.coords().grid.row === $gr.player_grid_data.row && !$gr.is_in_queue($w.coords().grid.col, wgd.row, $w)) {
$gr.move_widget_down($w, $gr.player_grid_data.size_y);
$gr.set_placeholder(to_col, to_row);
}
}));
}
else{
swap = $gr.queue_widget(placeholder_cells.cols[0], wgd.row, $w);
}
}
else if (!$gr.is_swap_occupied(outside_col, wgd.row, wgd.size_x, wgd.size_y) && !$gr.is_player_in(outside_col, wgd.row) && !$gr.is_in_queue(outside_col, wgd.row, $w)) {
swap = $gr.queue_widget(outside_col, wgd.row, $w);
Expand All @@ -2873,7 +2854,19 @@
swap = $gr.queue_widget(wgd.col, outside_row, $w);
}
else if (!$gr.is_swap_occupied(placeholder_cells.cols[0], placeholder_cells.rows[0], wgd.size_x, wgd.size_y) && !$gr.is_player_in(placeholder_cells.cols[0], placeholder_cells.rows[0]) && !$gr.is_in_queue(placeholder_cells.cols[0], placeholder_cells.rows[0], $w)) {
swap = $gr.queue_widget(placeholder_cells.cols[0], placeholder_cells.rows[0], $w);
if($gr.options.move_widgets_down_only){
$overlapped_widgets.each($.proxy(function (i, w) {
var $w = $(w);

if ($gr.can_go_down($w) && $w.coords().grid.row === $gr.player_grid_data.row && !$gr.is_in_queue(outside_col, wgd.row, $w)) {
$gr.move_widget_down($w, $gr.player_grid_data.size_y);
$gr.set_placeholder(to_col, to_row);
}
}));
}
else{
swap = $gr.queue_widget(placeholder_cells.cols[0], placeholder_cells.rows[0], $w);
}
} else {
//in one last attempt we check for any other empty spaces
for (var c = 0; c < player_size_x; c++) {
Expand Down Expand Up @@ -4940,6 +4933,9 @@
this.options.widget_base_dimensions = options.widget_base_dimensions;
}

this.min_widget_width = (this.options.widget_margins[0] * 2) + this.options.widget_base_dimensions[0];
this.min_widget_height = (this.options.widget_margins[1] * 2) + this.options.widget_base_dimensions[1];

this.$widgets.each($.proxy(function (i, widget) {
var $widget = $(widget);
this.resize_widget($widget);
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 lib/gridster.js-rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Gridster
module Rails
VERSION = "0.6.10"
VERSION = "0.7.0"
end
end
6 changes: 3 additions & 3 deletions 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.6.10",
"version": "0.7.0",
"homepage": "https://dsmorse.github.io/gridster.js/",
"author": {
"name": "ducksboard"
Expand All @@ -23,15 +23,15 @@
],
"keywords": [],
"devDependencies": {
"bower": "~0.9.2",
"bower": "~1.7.7",
"grunt": "~0.4.5",
"grunt-bump": "0.0.11",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-cssmin": "~0.10.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-less": "^1.2.0",
"grunt-contrib-qunit": "^0.7.0",
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-watch": "~0.6.1",
Expand Down

0 comments on commit 58b8f8a

Please sign in to comment.