From 9e30bba202486254d734e6a7c94fcfb9df1c7fc2 Mon Sep 17 00:00:00 2001 From: Raghav Ramesh Date: Fri, 25 Sep 2015 15:40:51 +0800 Subject: [PATCH 1/2] added containment and axis restrictions for dragging elements --- core/jquery.shapeshift.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/jquery.shapeshift.js b/core/jquery.shapeshift.js index 3b3621f..513b4e7 100644 --- a/core/jquery.shapeshift.js +++ b/core/jquery.shapeshift.js @@ -25,6 +25,8 @@ animateOnInit: false, animationSpeed: 225, animationThreshold: 100, + axis: "x", + containment: "#containmentWrapper", dragClone: false, deleteClone: true, dragRate: 100, @@ -411,8 +413,9 @@ drag_timeout = false; if (options.enableDrag) { $container.children("." + active_class).filter(options.dragWhitelist).draggable({ + axis: options.axis || 'x', addClasses: false, - containment: 'document', + containment: options.containment || 'document', handle: options.handle, zIndex: 9999, start: function(e, ui) { @@ -438,8 +441,6 @@ return drag_timeout = false; }), drag_rate); } - ui.position.left = e.pageX - $selected.parent().offset().left - selected_offset_x; - return ui.position.top = e.pageY - $selected.parent().offset().top - selected_offset_y; }, stop: function() { var $current_container, $original_container, $previous_container; From 837ed24d1db67f0a3a68e0c86e7328008f79a46c Mon Sep 17 00:00:00 2001 From: Raghav Ramesh Date: Mon, 28 Sep 2015 18:11:47 +0800 Subject: [PATCH 2/2] changed the initial axis and containment options to null to remove unintentional defaults --- core/jquery.shapeshift.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/jquery.shapeshift.js b/core/jquery.shapeshift.js index 513b4e7..8289594 100644 --- a/core/jquery.shapeshift.js +++ b/core/jquery.shapeshift.js @@ -25,8 +25,8 @@ animateOnInit: false, animationSpeed: 225, animationThreshold: 100, - axis: "x", - containment: "#containmentWrapper", + axis: null, + containment: null, dragClone: false, deleteClone: true, dragRate: 100, @@ -413,7 +413,7 @@ drag_timeout = false; if (options.enableDrag) { $container.children("." + active_class).filter(options.dragWhitelist).draggable({ - axis: options.axis || 'x', + axis: options.axis, addClasses: false, containment: options.containment || 'document', handle: options.handle,