Skip to content

Commit 3140374

Browse files
committed
Release v0.5.6
1 parent 79aff38 commit 3140374

8 files changed

+69
-37
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
<a name="v0.5.6"></a>
2+
### v0.5.6 (2014-09-25)
3+
4+
5+
#### Bug Fixes
6+
7+
* **draggable:** namespace events with unique ids ([79aff38c](http://github.com/ducksboard/gridster.js/commit/79aff38c60cc6ce2c0f0160bd3c6f93cb2511642))
8+
19
<a name="v0.5.5"></a>
210
### v0.5.5 (2014-07-25)
311

dist/jquery.gridster.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! gridster.js - v0.5.5 - 2014-07-25
1+
/*! gridster.js - v0.5.6 - 2014-09-25
22
* http://gridster.net/
33
* Copyright (c) 2014 ducksboard; Licensed MIT */
44

dist/jquery.gridster.js

+27-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! gridster.js - v0.5.5 - 2014-07-25
1+
/*! gridster.js - v0.5.6 - 2014-09-25
22
* http://gridster.net/
33
* Copyright (c) 2014 ducksboard; Licensed MIT */
44

@@ -458,16 +458,16 @@
458458
var $window = $(window);
459459
var dir_map = { x : 'left', y : 'top' };
460460
var isTouch = !!('ontouchstart' in window);
461-
var pointer_events = {
462-
start: 'touchstart.gridster-draggable mousedown.gridster-draggable',
463-
move: 'touchmove.gridster-draggable mousemove.gridster-draggable',
464-
end: 'touchend.gridster-draggable mouseup.gridster-draggable'
465-
};
466461

467462
var capitalize = function(str) {
468463
return str.charAt(0).toUpperCase() + str.slice(1);
469464
};
470465

466+
var idCounter = 0;
467+
var uniqId = function() {
468+
return ++idCounter + '';
469+
}
470+
471471
/**
472472
* Basic drag implementation for DOM elements inside a container.
473473
* Provide start/stop/drag callbacks.
@@ -504,6 +504,8 @@
504504
this.$dragitems = $(this.options.items, this.$container);
505505
this.is_dragging = false;
506506
this.player_min_left = 0 + this.options.offset_left;
507+
this.id = uniqId();
508+
this.ns = '.gridster-draggable-' + this.id;
507509
this.init();
508510
}
509511

@@ -518,21 +520,31 @@
518520
this.disabled = false;
519521
this.events();
520522

521-
$(window).bind('resize.gridster-draggable',
523+
$(window).bind(this.nsEvent('resize'),
522524
throttle($.proxy(this.calculate_dimensions, this), 200));
523525
};
524526

527+
fn.nsEvent = function(ev) {
528+
return (ev || '') + this.ns;
529+
};
530+
525531
fn.events = function() {
526-
this.$container.on('selectstart.gridster-draggable',
532+
this.pointer_events = {
533+
start: this.nsEvent('touchstart') + ' ' + this.nsEvent('mousedown'),
534+
move: this.nsEvent('touchmove') + ' ' + this.nsEvent('mousemove'),
535+
end: this.nsEvent('touchend') + ' ' + this.nsEvent('mouseup'),
536+
};
537+
538+
this.$container.on(this.nsEvent('selectstart'),
527539
$.proxy(this.on_select_start, this));
528540

529-
this.$container.on(pointer_events.start, this.options.items,
541+
this.$container.on(this.pointer_events.start, this.options.items,
530542
$.proxy(this.drag_handler, this));
531543

532-
this.$document.on(pointer_events.end, $.proxy(function(e) {
544+
this.$document.on(this.pointer_events.end, $.proxy(function(e) {
533545
this.is_dragging = false;
534546
if (this.disabled) { return; }
535-
this.$document.off(pointer_events.move);
547+
this.$document.off(this.pointer_events.move);
536548
if (this.drag_start) {
537549
this.on_dragstop(e);
538550
}
@@ -687,7 +699,7 @@
687699
this.mouse_init_pos = this.get_mouse_pos(e);
688700
this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
689701

690-
this.$document.on(pointer_events.move, function(mme) {
702+
this.$document.on(this.pointer_events.move, function(mme) {
691703
var mouse_actual_pos = self.get_mouse_pos(mme);
692704
var diff_x = Math.abs(
693705
mouse_actual_pos.left - self.mouse_init_pos.left);
@@ -813,9 +825,9 @@
813825
fn.destroy = function() {
814826
this.disable();
815827

816-
this.$container.off('.gridster-draggable');
817-
this.$document.off('.gridster-draggable');
818-
$(window).off('.gridster-draggable');
828+
this.$container.off(this.ns);
829+
this.$document.off(this.ns);
830+
$(window).off(this.ns);
819831

820832
$.removeData(this.$container, 'drag');
821833
};

dist/jquery.gridster.min.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.gridster.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/jquery.gridster.with-extras.js

+27-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! gridster.js - v0.5.5 - 2014-07-25
1+
/*! gridster.js - v0.5.6 - 2014-09-25
22
* http://gridster.net/
33
* Copyright (c) 2014 ducksboard; Licensed MIT */
44

@@ -458,16 +458,16 @@
458458
var $window = $(window);
459459
var dir_map = { x : 'left', y : 'top' };
460460
var isTouch = !!('ontouchstart' in window);
461-
var pointer_events = {
462-
start: 'touchstart.gridster-draggable mousedown.gridster-draggable',
463-
move: 'touchmove.gridster-draggable mousemove.gridster-draggable',
464-
end: 'touchend.gridster-draggable mouseup.gridster-draggable'
465-
};
466461

467462
var capitalize = function(str) {
468463
return str.charAt(0).toUpperCase() + str.slice(1);
469464
};
470465

466+
var idCounter = 0;
467+
var uniqId = function() {
468+
return ++idCounter + '';
469+
}
470+
471471
/**
472472
* Basic drag implementation for DOM elements inside a container.
473473
* Provide start/stop/drag callbacks.
@@ -504,6 +504,8 @@
504504
this.$dragitems = $(this.options.items, this.$container);
505505
this.is_dragging = false;
506506
this.player_min_left = 0 + this.options.offset_left;
507+
this.id = uniqId();
508+
this.ns = '.gridster-draggable-' + this.id;
507509
this.init();
508510
}
509511

@@ -518,21 +520,31 @@
518520
this.disabled = false;
519521
this.events();
520522

521-
$(window).bind('resize.gridster-draggable',
523+
$(window).bind(this.nsEvent('resize'),
522524
throttle($.proxy(this.calculate_dimensions, this), 200));
523525
};
524526

527+
fn.nsEvent = function(ev) {
528+
return (ev || '') + this.ns;
529+
};
530+
525531
fn.events = function() {
526-
this.$container.on('selectstart.gridster-draggable',
532+
this.pointer_events = {
533+
start: this.nsEvent('touchstart') + ' ' + this.nsEvent('mousedown'),
534+
move: this.nsEvent('touchmove') + ' ' + this.nsEvent('mousemove'),
535+
end: this.nsEvent('touchend') + ' ' + this.nsEvent('mouseup'),
536+
};
537+
538+
this.$container.on(this.nsEvent('selectstart'),
527539
$.proxy(this.on_select_start, this));
528540

529-
this.$container.on(pointer_events.start, this.options.items,
541+
this.$container.on(this.pointer_events.start, this.options.items,
530542
$.proxy(this.drag_handler, this));
531543

532-
this.$document.on(pointer_events.end, $.proxy(function(e) {
544+
this.$document.on(this.pointer_events.end, $.proxy(function(e) {
533545
this.is_dragging = false;
534546
if (this.disabled) { return; }
535-
this.$document.off(pointer_events.move);
547+
this.$document.off(this.pointer_events.move);
536548
if (this.drag_start) {
537549
this.on_dragstop(e);
538550
}
@@ -687,7 +699,7 @@
687699
this.mouse_init_pos = this.get_mouse_pos(e);
688700
this.offsetY = this.mouse_init_pos.top - this.el_init_pos.top;
689701

690-
this.$document.on(pointer_events.move, function(mme) {
702+
this.$document.on(this.pointer_events.move, function(mme) {
691703
var mouse_actual_pos = self.get_mouse_pos(mme);
692704
var diff_x = Math.abs(
693705
mouse_actual_pos.left - self.mouse_init_pos.left);
@@ -813,9 +825,9 @@
813825
fn.destroy = function() {
814826
this.disable();
815827

816-
this.$container.off('.gridster-draggable');
817-
this.$document.off('.gridster-draggable');
818-
$(window).off('.gridster-draggable');
828+
this.$container.off(this.ns);
829+
this.$document.off(this.ns);
830+
$(window).off(this.ns);
819831

820832
$.removeData(this.$container, 'drag');
821833
};

dist/jquery.gridster.with-extras.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "gridster",
33
"title": "gridster.js",
44
"description": "a drag-and-drop multi-column jQuery grid plugin",
5-
"version": "0.5.5",
5+
"version": "0.5.6",
66
"homepage": "http://gridster.net/",
77
"author": {
88
"name": "ducksboard",

0 commit comments

Comments
 (0)