From ba7bed570de56350e3c9f259dabaa6e2ed15eaa0 Mon Sep 17 00:00:00 2001 From: HugoCrd Date: Fri, 14 Feb 2014 16:13:11 +0100 Subject: [PATCH] Prevent dragging before the first item when using cutoffStart. Fixes #63 --- core/jquery.shapeshift.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/jquery.shapeshift.js b/core/jquery.shapeshift.js index 3b3621f..504ac03 100644 --- a/core/jquery.shapeshift.js +++ b/core/jquery.shapeshift.js @@ -30,7 +30,7 @@ dragRate: 100, dragWhitelist: "*", crossDropWhitelist: "*", - cutoffStart: null, + cutoffStart: 1, cutoffEnd: null, handle: false, cloneClass: "ss-cloned-child", @@ -65,6 +65,10 @@ console.error("" + error_msg + " option colWidth must be specified if Shapeshift is initialized with no active children."); } } + if (options.cutoffStart<1) { + errors = true; + console.error("" + error_msg + " cutoffStart must be >0."); + } return !errors; }; @@ -512,7 +516,7 @@ selected_x = $selected.offset().left - $start_container.offset().left + (this.globals.col_width / 2); selected_y = $selected.offset().top - $start_container.offset().top + ($selected.height() / 2); shortest_distance = 9999999; - target_position = 0; + target_position = options.cutoffStart-1; if (total_positions > 1) { cutoff_start = options.cutoffStart + 1 || 0; cutoff_end = options.cutoffEnd || total_positions;