From cef66ee99f3924f5f74ac8c3f3190bfd125bd845 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Tue, 16 Sep 2008 12:40:48 +0000 Subject: sortable: Fixed the floating functional demo, implemented forcePlaceholderSize --- demos/functional/templates/ui.sortable.ex3.html | 16 ++++++++++------ demos/functional/templates/ui.sortable.html | 2 +- tests/sortable.js | 2 +- ui/ui.sortable.js | 6 +++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/demos/functional/templates/ui.sortable.ex3.html b/demos/functional/templates/ui.sortable.ex3.html index 1d460fd01..e6fe28ee7 100644 --- a/demos/functional/templates/ui.sortable.ex3.html +++ b/demos/functional/templates/ui.sortable.ex3.html @@ -3,13 +3,17 @@
- +
    -
  • Jack
  • -
  • John
  • -
  • Marry
  • -
  • Claire
  • -
  • Daniel
  • +
  • Jack
  • +
  • John
  • +
  • Marry
  • +
  • Claire
  • +
  • Daniel
diff --git a/demos/functional/templates/ui.sortable.html b/demos/functional/templates/ui.sortable.html index 55ea4b7a6..79cfadbfb 100644 --- a/demos/functional/templates/ui.sortable.html +++ b/demos/functional/templates/ui.sortable.html @@ -38,7 +38,7 @@ options: [ { desc: 'Floating, with defined placeholder class', - source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", revert: true });' + source: '$("#placeholderSortable").sortable({ placeholder: "ui-selected", forcePlaceholderSize: true, revert: true });' } ] } diff --git a/tests/sortable.js b/tests/sortable.js index 99c4463e5..7b79311a7 100644 --- a/tests/sortable.js +++ b/tests/sortable.js @@ -109,7 +109,7 @@ test("disable", function() { test("defaults", function() { el = $("#sortable").sortable(); - equals(el.data("helper.sortable"), "clone", "helper"); + equals(el.data("helper.sortable"), "original", "helper"); equals(el.data("tolerance.sortable"), "guess", "tolerance"); equals(el.data("distance.sortable"), 1, "distance"); equals(el.data("disabled.sortable"), false, "disabled"); diff --git a/ui/ui.sortable.js b/ui/ui.sortable.js index fd69b78e8..2ec6291de 100644 --- a/ui/ui.sortable.js +++ b/ui/ui.sortable.js @@ -302,9 +302,9 @@ $.widget("ui.sortable", $.extend({}, $.ui.mouse, { return el; }, update: function(container, p) { - if(className) return; - if(!p.height()) { p.height(self.currentItem.innerHeight()); }; - if(!p.width()) { p.width(self.currentItem.innerWidth()); }; + if(className && !o.forcePlaceholderSize) return; + if(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0) - parseInt(self.currentItem.css('paddingBottom')||0)); }; + if(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0) - parseInt(self.currentItem.css('paddingRight')||0)); }; } }; } -- cgit v1.2.3