Skip to content

Commit

Permalink
Release 0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
vieron committed Jun 16, 2014
1 parent 021a6c2 commit c554aa8
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 38 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
<a name="v0.5.2"></a>
### v0.5.2 (2014-06-16)


#### Bug Fixes

* **draggable:**
* handle both touch and click events ([021a6c23](http://github.com/ducksboard/gridster.js/commit/021a6c23e851210c1b817bd353a1e5e19ce10b90), closes [#207](http://github.com/ducksboard/gridster.js/issues/207), [#236](http://github.com/ducksboard/gridster.js/issues/236), [#329](http://github.com/ducksboard/gridster.js/issues/329), [#380](http://github.com/ducksboard/gridster.js/issues/380))
* replaced scrollX/Y with scrollLeft/Top ([bb7463a3](http://github.com/ducksboard/gridster.js/commit/bb7463a3241750397492dfbac133cea193f0254f))
* fix offset during drag ([c726c4ad](http://github.com/ducksboard/gridster.js/commit/c726c4ad9c18fea95e4b46b9bacd36c42aa9691c))
* bind drag events to $document ([dd6c7420](http://github.com/ducksboard/gridster.js/commit/dd6c7420087d5810a9f6b02bf9d81a04a60ae840))
* **gridster:**
* fix add_widget to use correct size_y when adding rows ([7d22e6c8](http://github.com/ducksboard/gridster.js/commit/7d22e6c8b201de33e33def77a93dc9009d0aa4cb))
* Removing previously added style tags before adding new one. ([93c46ff4](http://github.com/ducksboard/gridster.js/commit/93c46ff45ebe59f3658b7f32f05b67109aa87311))


#### Features

* **draggable:**
* allow ignore_dragging config option to be a function ([69fcfe45](http://github.com/ducksboard/gridster.js/commit/69fcfe459678e833cb53de040b9fbc96dd687543))
* option to not remove helper on drag stop ([03910df9](http://github.com/ducksboard/gridster.js/commit/03910df967a1ae7bcb2fa3aadd58255e0bcbf327))

<a name="v0.5.1"></a>
### v0.5.1 (2014-03-05)

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.1 - 2014-03-26
/*! gridster.js - v0.5.2 - 2014-06-16
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down
39 changes: 22 additions & 17 deletions dist/jquery.gridster.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! gridster.js - v0.5.1 - 2014-03-26
/*! gridster.js - v0.5.2 - 2014-06-16
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -430,9 +430,9 @@
var dir_map = { x : 'left', y : 'top' };
var isTouch = !!('ontouchstart' in window);
var pointer_events = {
start: isTouch ? 'touchstart.gridster-draggable' : 'mousedown.gridster-draggable',
move: isTouch ? 'touchmove.gridster-draggable' : 'mousemove.gridster-draggable',
end: isTouch ? 'touchend.gridster-draggable' : 'mouseup.gridster-draggable'
start: 'touchstart.gridster-draggable mousedown.gridster-draggable',
move: 'touchmove.gridster-draggable mousemove.gridster-draggable',
end: 'touchend.gridster-draggable mouseup.gridster-draggable'
};

var capitalize = function(str) {
Expand Down Expand Up @@ -467,7 +467,7 @@
*/
function Draggable(el, options) {
this.options = $.extend({}, defaults, options);
this.$body = $(document.body);
this.$document = $(document);
this.$container = $(el);
this.$dragitems = $(this.options.items, this.$container);
this.is_dragging = false;
Expand Down Expand Up @@ -495,10 +495,10 @@
this.$container.on(pointer_events.start, this.options.items,
$.proxy(this.drag_handler, this));

this.$body.on(pointer_events.end, $.proxy(function(e) {
this.$document.on(pointer_events.end, $.proxy(function(e) {
this.is_dragging = false;
if (this.disabled) { return; }
this.$body.off(pointer_events.move);
this.$document.off(pointer_events.move);
if (this.drag_start) {
this.on_dragstop(e);
}
Expand All @@ -512,7 +512,7 @@


fn.get_mouse_pos = function(e) {
if (isTouch) {
if (e.originalEvent && e.originalEvent.touches) {
var oe = e.originalEvent;
e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
}
Expand All @@ -532,9 +532,9 @@
var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);

var left = Math.round(this.el_init_offset.left +
diff_x - this.baseX + this.scroll_offset_x);
diff_x - this.baseX + $(window).scrollLeft() - this.win_offset_x);
var top = Math.round(this.el_init_offset.top +
diff_y - this.baseY + this.scroll_offset_y);
diff_y - this.baseY + $(window).scrollTop() - this.win_offset_y);

if (this.options.limit) {
if (left > this.player_max_left) {
Expand All @@ -552,8 +552,8 @@
pointer: {
left: mouse_actual_pos.left,
top: mouse_actual_pos.top,
diff_left: diff_x + this.scroll_offset_x,
diff_top: diff_y + this.scroll_offset_y
diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
}
};
};
Expand Down Expand Up @@ -636,6 +636,7 @@

fn.drag_handler = function(e) {
var node = e.target.nodeName;
// skip if drag is disabled, or click was not done with the mouse primary button
if (this.disabled || e.which !== 1 && !isTouch) {
return;
}
Expand All @@ -652,7 +653,7 @@
this.mouse_init_pos = this.get_mouse_pos(e);
this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;

this.$body.on(pointer_events.move, function(mme) {
this.$document.on(pointer_events.move, 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);
Expand Down Expand Up @@ -700,6 +701,8 @@
this.helper = false;
}

this.win_offset_y = $(window).scrollTop();
this.win_offset_x = $(window).scrollLeft();
this.scroll_offset_y = 0;
this.scroll_offset_x = 0;
this.el_init_offset = this.$player.offset();
Expand Down Expand Up @@ -777,7 +780,7 @@
this.disable();

this.$container.off('.gridster-draggable');
this.$body.off('.gridster-draggable');
this.$document.off('.gridster-draggable');
$(window).off('.gridster-draggable');

$.removeData(this.$container, 'drag');
Expand Down Expand Up @@ -1028,7 +1031,9 @@
}else{
pos = {
col: col,
row: row
row: row,
size_x: size_x,
size_y: size_y
};

this.empty_cells(col, row, size_x, size_y);
Expand Down Expand Up @@ -3592,8 +3597,8 @@
(x * opts.widget_base_dimensions[0] +
(x - 1) * (opts.widget_margins[0] * 2)) + 'px; }\n');
}
this.remove_style_tags();

this.remove_style_tags();

return this.add_style_tag(styles);
};
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.

3 changes: 2 additions & 1 deletion dist/jquery.gridster.min.js

Large diffs are not rendered by default.

37 changes: 22 additions & 15 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.1 - 2014-03-26
/*! gridster.js - v0.5.2 - 2014-06-16
* http://gridster.net/
* Copyright (c) 2014 ducksboard; Licensed MIT */

Expand Down Expand Up @@ -430,9 +430,9 @@
var dir_map = { x : 'left', y : 'top' };
var isTouch = !!('ontouchstart' in window);
var pointer_events = {
start: isTouch ? 'touchstart.gridster-draggable' : 'mousedown.gridster-draggable',
move: isTouch ? 'touchmove.gridster-draggable' : 'mousemove.gridster-draggable',
end: isTouch ? 'touchend.gridster-draggable' : 'mouseup.gridster-draggable'
start: 'touchstart.gridster-draggable mousedown.gridster-draggable',
move: 'touchmove.gridster-draggable mousemove.gridster-draggable',
end: 'touchend.gridster-draggable mouseup.gridster-draggable'
};

var capitalize = function(str) {
Expand Down Expand Up @@ -467,7 +467,7 @@
*/
function Draggable(el, options) {
this.options = $.extend({}, defaults, options);
this.$body = $(document.body);
this.$document = $(document);
this.$container = $(el);
this.$dragitems = $(this.options.items, this.$container);
this.is_dragging = false;
Expand Down Expand Up @@ -495,10 +495,10 @@
this.$container.on(pointer_events.start, this.options.items,
$.proxy(this.drag_handler, this));

this.$body.on(pointer_events.end, $.proxy(function(e) {
this.$document.on(pointer_events.end, $.proxy(function(e) {
this.is_dragging = false;
if (this.disabled) { return; }
this.$body.off(pointer_events.move);
this.$document.off(pointer_events.move);
if (this.drag_start) {
this.on_dragstop(e);
}
Expand All @@ -512,7 +512,7 @@


fn.get_mouse_pos = function(e) {
if (isTouch) {
if (e.originalEvent && e.originalEvent.touches) {
var oe = e.originalEvent;
e = oe.touches.length ? oe.touches[0] : oe.changedTouches[0];
}
Expand All @@ -532,9 +532,9 @@
var diff_y = Math.round(mouse_actual_pos.top - this.mouse_init_pos.top);

var left = Math.round(this.el_init_offset.left +
diff_x - this.baseX + this.scroll_offset_x);
diff_x - this.baseX + $(window).scrollLeft() - this.win_offset_x);
var top = Math.round(this.el_init_offset.top +
diff_y - this.baseY + this.scroll_offset_y);
diff_y - this.baseY + $(window).scrollTop() - this.win_offset_y);

if (this.options.limit) {
if (left > this.player_max_left) {
Expand All @@ -552,8 +552,8 @@
pointer: {
left: mouse_actual_pos.left,
top: mouse_actual_pos.top,
diff_left: diff_x + this.scroll_offset_x,
diff_top: diff_y + this.scroll_offset_y
diff_left: diff_x + ($(window).scrollLeft() - this.win_offset_x),
diff_top: diff_y + ($(window).scrollTop() - this.win_offset_y)
}
};
};
Expand Down Expand Up @@ -636,6 +636,7 @@

fn.drag_handler = function(e) {
var node = e.target.nodeName;
// skip if drag is disabled, or click was not done with the mouse primary button
if (this.disabled || e.which !== 1 && !isTouch) {
return;
}
Expand All @@ -652,7 +653,7 @@
this.mouse_init_pos = this.get_mouse_pos(e);
this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;

this.$body.on(pointer_events.move, function(mme) {
this.$document.on(pointer_events.move, 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);
Expand Down Expand Up @@ -700,6 +701,8 @@
this.helper = false;
}

this.win_offset_y = $(window).scrollTop();
this.win_offset_x = $(window).scrollLeft();
this.scroll_offset_y = 0;
this.scroll_offset_x = 0;
this.el_init_offset = this.$player.offset();
Expand Down Expand Up @@ -777,7 +780,7 @@
this.disable();

this.$container.off('.gridster-draggable');
this.$body.off('.gridster-draggable');
this.$document.off('.gridster-draggable');
$(window).off('.gridster-draggable');

$.removeData(this.$container, 'drag');
Expand Down Expand Up @@ -1028,7 +1031,9 @@
}else{
pos = {
col: col,
row: row
row: row,
size_x: size_x,
size_y: size_y
};

this.empty_cells(col, row, size_x, size_y);
Expand Down Expand Up @@ -3593,6 +3598,8 @@
(x - 1) * (opts.widget_margins[0] * 2)) + 'px; }\n');
}

this.remove_style_tags();

return this.add_style_tag(styles);
};

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.1",
"version": "0.5.2",
"homepage": "http://gridster.net/",
"author": {
"name": "ducksboard",
Expand Down

0 comments on commit c554aa8

Please sign in to comment.