703 var o = this.options; |
768 var o = this.options; |
704 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; |
769 if(o.containment == 'parent') o.containment = this.helper[0].parentNode; |
705 if(o.containment == 'document' || o.containment == 'window') this.containment = [ |
770 if(o.containment == 'document' || o.containment == 'window') this.containment = [ |
706 0 - this.offset.relative.left - this.offset.parent.left, |
771 0 - this.offset.relative.left - this.offset.parent.left, |
707 0 - this.offset.relative.top - this.offset.parent.top, |
772 0 - this.offset.relative.top - this.offset.parent.top, |
708 $(o.containment == 'document' ? document : window).width() - this.offset.relative.left - this.offset.parent.left - this.margins.left - (parseInt(this.currentItem.css("marginRight"),10) || 0), |
773 $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left, |
709 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.offset.relative.top - this.offset.parent.top - this.margins.top - (parseInt(this.currentItem.css("marginBottom"),10) || 0) |
774 ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top |
710 ]; |
775 ]; |
711 |
776 |
712 if(!(/^(document|window|parent)$/).test(o.containment)) { |
777 if(!(/^(document|window|parent)$/).test(o.containment)) { |
713 var ce = $(o.containment)[0]; |
778 var ce = $(o.containment)[0]; |
714 var co = $(o.containment).offset(); |
779 var co = $(o.containment).offset(); |
715 var over = ($(ce).css("overflow") != 'hidden'); |
780 var over = ($(ce).css("overflow") != 'hidden'); |
716 |
781 |
717 this.containment = [ |
782 this.containment = [ |
718 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.margins.left, |
783 co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left, |
719 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.margins.top, |
784 co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top, |
720 co.left + (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.margins.left, |
785 co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left, |
721 co.top + (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.margins.top |
786 co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top |
722 ]; |
787 ]; |
723 } |
788 } |
724 |
789 |
725 }, |
790 }, |
726 |
791 |
727 _convertPositionTo: function(d, pos) { |
792 _convertPositionTo: function(d, pos) { |
728 |
793 |
729 if(!pos) pos = this.position; |
794 if(!pos) pos = this.position; |
730 var mod = d == "absolute" ? 1 : -1; |
795 var mod = d == "absolute" ? 1 : -1; |
731 var scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
796 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
732 |
797 |
733 return { |
798 return { |
734 top: ( |
799 top: ( |
735 pos.top // the calculated relative position |
800 pos.top // The absolute mouse position |
736 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
801 + this.offset.relative.top * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
737 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) |
802 + this.offset.parent.top * mod // The offsetParent's offset without borders (offset + border) |
738 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod |
803 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod) |
739 + this.margins.top * mod //Add the margin (you don't want the margin counting in intersection methods) |
|
740 ), |
804 ), |
741 left: ( |
805 left: ( |
742 pos.left // the calculated relative position |
806 pos.left // The absolute mouse position |
743 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
807 + this.offset.relative.left * mod // Only for relative positioned nodes: Relative offset from element to offset parent |
744 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) |
808 + this.offset.parent.left * mod // The offsetParent's offset without borders (offset + border) |
745 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) * mod |
809 - ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod) |
746 + this.margins.left * mod //Add the margin (you don't want the margin counting in intersection methods) |
|
747 ) |
810 ) |
748 }; |
811 }; |
|
812 |
749 }, |
813 }, |
750 |
814 |
751 _generatePosition: function(event) { |
815 _generatePosition: function(event) { |
752 |
816 |
753 var o = this.options, scroll = this[(this.cssPosition == 'absolute' ? 'offset' : 'scroll')+'Parent'], scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
817 var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName); |
754 |
818 |
755 var position = { |
819 // This is another very weird special case that only happens for relative elements: |
756 top: ( |
820 // 1. If the css position is relative |
757 event.pageY // The absolute mouse position |
821 // 2. and the scroll parent is the document or similar to the offset parent |
758 - this.offset.click.top // Click offset (relative to the element) |
822 // we have to refresh the relative offset during the scroll so there are no jumps |
759 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent |
823 if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) { |
760 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) |
824 this.offset.relative = this._getRelativeOffset(); |
761 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) |
825 } |
762 ), |
826 |
763 left: ( |
827 var pageX = event.pageX; |
764 event.pageX // The absolute mouse position |
828 var pageY = event.pageY; |
765 - this.offset.click.left // Click offset (relative to the element) |
|
766 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent |
|
767 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) |
|
768 + ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : ( scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) |
|
769 ) |
|
770 }; |
|
771 |
|
772 if(!this.originalPosition) return position; //If we are not dragging yet, we won't check for options |
|
773 |
829 |
774 /* |
830 /* |
775 * - Position constraining - |
831 * - Position constraining - |
776 * Constrain the position to a mix of grid, containment. |
832 * Constrain the position to a mix of grid, containment. |
777 */ |
833 */ |
778 if(this.containment) { |
834 |
779 if(position.left < this.containment[0]) position.left = this.containment[0]; |
835 if(this.originalPosition) { //If we are not dragging yet, we won't check for options |
780 if(position.top < this.containment[1]) position.top = this.containment[1]; |
836 |
781 if(position.left + this.helperProportions.width > this.containment[2]) position.left = this.containment[2] - this.helperProportions.width; |
837 if(this.containment) { |
782 if(position.top + this.helperProportions.height > this.containment[3]) position.top = this.containment[3] - this.helperProportions.height; |
838 if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left; |
783 } |
839 if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top; |
784 |
840 if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left; |
785 if(o.grid) { |
841 if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top; |
786 var top = this.originalPosition.top + Math.round((position.top - this.originalPosition.top) / o.grid[1]) * o.grid[1]; |
842 } |
787 position.top = this.containment ? (!(top < this.containment[1] || top > this.containment[3]) ? top : (!(top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; |
843 |
788 |
844 if(o.grid) { |
789 var left = this.originalPosition.left + Math.round((position.left - this.originalPosition.left) / o.grid[0]) * o.grid[0]; |
845 var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1]; |
790 position.left = this.containment ? (!(left < this.containment[0] || left > this.containment[2]) ? left : (!(left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; |
846 pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top; |
791 } |
847 |
792 |
848 var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0]; |
793 return position; |
849 pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left; |
|
850 } |
|
851 |
|
852 } |
|
853 |
|
854 return { |
|
855 top: ( |
|
856 pageY // The absolute mouse position |
|
857 - this.offset.click.top // Click offset (relative to the element) |
|
858 - this.offset.relative.top // Only for relative positioned nodes: Relative offset from element to offset parent |
|
859 - this.offset.parent.top // The offsetParent's offset without borders (offset + border) |
|
860 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) )) |
|
861 ), |
|
862 left: ( |
|
863 pageX // The absolute mouse position |
|
864 - this.offset.click.left // Click offset (relative to the element) |
|
865 - this.offset.relative.left // Only for relative positioned nodes: Relative offset from element to offset parent |
|
866 - this.offset.parent.left // The offsetParent's offset without borders (offset + border) |
|
867 + ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() )) |
|
868 ) |
|
869 }; |
|
870 |
794 }, |
871 }, |
795 |
872 |
796 _rearrange: function(event, i, a, hardRefresh) { |
873 _rearrange: function(event, i, a, hardRefresh) { |
797 |
874 |
798 a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); |
875 a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling)); |
826 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); |
907 this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"); |
827 } else { |
908 } else { |
828 this.currentItem.show(); |
909 this.currentItem.show(); |
829 } |
910 } |
830 |
911 |
831 if(this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) this._propagate("update", event, null, noPropagation); //Trigger update callback if the DOM position has changed |
912 if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); }); |
|
913 if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed |
832 if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element |
914 if(!$.ui.contains(this.element[0], this.currentItem[0])) { //Node was moved out of the current element |
833 this._propagate("remove", event, null, noPropagation); |
915 if(!noPropagation) delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); }); |
834 for (var i = this.containers.length - 1; i >= 0; i--){ |
916 for (var i = this.containers.length - 1; i >= 0; i--){ |
835 if($.ui.contains(this.containers[i].element[0], this.currentItem[0])) { |
917 if($.ui.contains(this.containers[i].element[0], this.currentItem[0]) && !noPropagation) { |
836 this.containers[i]._propagate("update", event, this, noPropagation); |
918 delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); }; }).call(this, this.containers[i])); |
837 this.containers[i]._propagate("receive", event, this, noPropagation); |
919 delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this)); }; }).call(this, this.containers[i])); |
838 } |
920 } |
839 }; |
921 }; |
840 }; |
922 }; |
841 |
923 |
842 //Post events to containers |
924 //Post events to containers |
843 for (var i = this.containers.length - 1; i >= 0; i--){ |
925 for (var i = this.containers.length - 1; i >= 0; i--){ |
844 this.containers[i]._propagate("deactivate", event, this, noPropagation); |
926 if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); }; }).call(this, this.containers[i])); |
845 if(this.containers[i].containerCache.over) { |
927 if(this.containers[i].containerCache.over) { |
846 this.containers[i]._propagate("out", event, this); |
928 delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); }; }).call(this, this.containers[i])); |
847 this.containers[i].containerCache.over = 0; |
929 this.containers[i].containerCache.over = 0; |
848 } |
930 } |
849 } |
931 } |
850 |
932 |
|
933 //Do what was originally in plugins |
|
934 if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor |
|
935 if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset cursor |
|
936 if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index |
|
937 |
851 this.dragging = false; |
938 this.dragging = false; |
852 if(this.cancelHelperRemoval) { |
939 if(this.cancelHelperRemoval) { |
853 this._propagate("beforeStop", event, null, noPropagation); |
940 if(!noPropagation) { |
854 this._propagate("stop", event, null, noPropagation); |
941 this._trigger("beforeStop", event, this._uiHash()); |
|
942 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events |
|
943 this._trigger("stop", event, this._uiHash()); |
|
944 } |
855 return false; |
945 return false; |
856 } |
946 } |
857 |
947 |
858 this._propagate("beforeStop", event, null, noPropagation); |
948 if(!noPropagation) this._trigger("beforeStop", event, this._uiHash()); |
859 |
949 |
860 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! |
950 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node! |
861 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); |
951 this.placeholder[0].parentNode.removeChild(this.placeholder[0]); |
862 |
952 |
863 if(this.options.helper != "original") this.helper.remove(); this.helper = null; |
953 if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null; |
864 this._propagate("stop", event, null, noPropagation); |
954 |
865 |
955 if(!noPropagation) { |
|
956 for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events |
|
957 this._trigger("stop", event, this._uiHash()); |
|
958 } |
|
959 |
|
960 this.fromOutside = false; |
866 return true; |
961 return true; |
867 |
962 |
868 }, |
963 }, |
869 |
964 |
870 _propagate: function(n, event, inst, noPropagation) { |
965 _trigger: function() { |
871 $.ui.plugin.call(this, n, [event, this._ui(inst)]); |
966 if ($.widget.prototype._trigger.apply(this, arguments) === false) { |
872 var dontCancel = !noPropagation ? this.element.triggerHandler(n == "sort" ? n : "sort"+n, [event, this._ui(inst)], this.options[n]) : true; |
967 this.cancel(); |
873 if(dontCancel === false) this.cancel(); |
968 } |
874 }, |
969 }, |
875 |
970 |
876 plugins: {}, |
971 _uiHash: function(inst) { |
877 |
|
878 _ui: function(inst) { |
|
879 var self = inst || this; |
972 var self = inst || this; |
880 return { |
973 return { |
881 helper: self.helper, |
974 helper: self.helper, |
882 placeholder: self.placeholder || $([]), |
975 placeholder: self.placeholder || $([]), |
883 position: self.position, |
976 position: self.position, |
884 absolutePosition: self.positionAbs, |
977 absolutePosition: self.positionAbs, //deprecated |
|
978 offset: self.positionAbs, |
885 item: self.currentItem, |
979 item: self.currentItem, |
886 sender: inst ? inst.element : null |
980 sender: inst ? inst.element : null |
887 }; |
981 }; |
888 } |
982 } |
889 |
983 |
890 })); |
984 })); |
891 |
985 |
892 $.extend($.ui.sortable, { |
986 $.extend($.ui.sortable, { |
893 getter: "serialize toArray", |
987 getter: "serialize toArray", |
894 version: "1.6", |
988 version: "1.7.2", |
|
989 eventPrefix: "sort", |
895 defaults: { |
990 defaults: { |
896 accurateIntersection: true, |
|
897 appendTo: "parent", |
991 appendTo: "parent", |
898 cancel: ":input", |
992 axis: false, |
|
993 cancel: ":input,option", |
|
994 connectWith: false, |
|
995 containment: false, |
|
996 cursor: 'auto', |
|
997 cursorAt: false, |
899 delay: 0, |
998 delay: 0, |
900 distance: 1, |
999 distance: 1, |
901 dropOnEmpty: true, |
1000 dropOnEmpty: true, |
902 forcePlaceholderSize: false, |
1001 forcePlaceholderSize: false, |
903 forceHelperSize: false, |
1002 forceHelperSize: false, |
|
1003 grid: false, |
|
1004 handle: false, |
904 helper: "original", |
1005 helper: "original", |
905 items: '> *', |
1006 items: '> *', |
906 scope: "default", |
1007 opacity: false, |
|
1008 placeholder: false, |
|
1009 revert: false, |
907 scroll: true, |
1010 scroll: true, |
908 scrollSensitivity: 20, |
1011 scrollSensitivity: 20, |
909 scrollSpeed: 20, |
1012 scrollSpeed: 20, |
910 sortIndicator: $.ui.sortable.prototype._rearrange, |
1013 scope: "default", |
911 tolerance: "default", |
1014 tolerance: "intersect", |
912 zIndex: 1000 |
1015 zIndex: 1000 |
913 } |
1016 } |
914 }); |
1017 }); |
915 |
1018 |
916 /* |
|
917 * Sortable Extensions |
|
918 */ |
|
919 |
|
920 $.ui.plugin.add("sortable", "cursor", { |
|
921 start: function(event, ui) { |
|
922 var t = $('body'), i = $(this).data('sortable'); |
|
923 if (t.css("cursor")) i.options._cursor = t.css("cursor"); |
|
924 t.css("cursor", i.options.cursor); |
|
925 }, |
|
926 beforeStop: function(event, ui) { |
|
927 var i = $(this).data('sortable'); |
|
928 if (i.options._cursor) $('body').css("cursor", i.options._cursor); |
|
929 } |
|
930 }); |
|
931 |
|
932 $.ui.plugin.add("sortable", "opacity", { |
|
933 start: function(event, ui) { |
|
934 var t = ui.helper, i = $(this).data('sortable'); |
|
935 if(t.css("opacity")) i.options._opacity = t.css("opacity"); |
|
936 t.css('opacity', i.options.opacity); |
|
937 }, |
|
938 beforeStop: function(event, ui) { |
|
939 var i = $(this).data('sortable'); |
|
940 if(i.options._opacity) $(ui.helper).css('opacity', i.options._opacity); |
|
941 } |
|
942 }); |
|
943 |
|
944 $.ui.plugin.add("sortable", "scroll", { |
|
945 start: function(event, ui) { |
|
946 var i = $(this).data("sortable"), o = i.options; |
|
947 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset(); |
|
948 }, |
|
949 sort: function(event, ui) { |
|
950 |
|
951 var i = $(this).data("sortable"), o = i.options, scrolled = false; |
|
952 |
|
953 if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') { |
|
954 |
|
955 if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity) |
|
956 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed; |
|
957 else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity) |
|
958 i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed; |
|
959 |
|
960 if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity) |
|
961 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed; |
|
962 else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity) |
|
963 i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed; |
|
964 |
|
965 } else { |
|
966 |
|
967 if(event.pageY - $(document).scrollTop() < o.scrollSensitivity) |
|
968 scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed); |
|
969 else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity) |
|
970 scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed); |
|
971 |
|
972 if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity) |
|
973 scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed); |
|
974 else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity) |
|
975 scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed); |
|
976 |
|
977 } |
|
978 |
|
979 if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) |
|
980 $.ui.ddmanager.prepareOffsets(i, event); |
|
981 |
|
982 |
|
983 |
|
984 //This is a special case where we need to modify a offset calculated on start, since the following happened: |
|
985 // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent |
|
986 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that |
|
987 // the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag |
|
988 if(scrolled !== false && i.cssPosition == 'absolute' && i.scrollParent[0] != document && $.ui.contains(i.scrollParent[0], i.offsetParent[0])) { |
|
989 i.offset.parent = i._getParentOffset(); |
|
990 } |
|
991 |
|
992 // This is another very weird special case that only happens for relative elements: |
|
993 // 1. If the css position is relative |
|
994 // 2. and the scroll parent is the document or similar to the offset parent |
|
995 // we have to refresh the relative offset during the scroll so there are no jumps |
|
996 if(scrolled !== false && i.cssPosition == 'relative' && !(i.scrollParent[0] != document && i.scrollParent[0] != i.offsetParent[0])) { |
|
997 i.offset.relative = i._getRelativeOffset(); |
|
998 } |
|
999 |
|
1000 } |
|
1001 }); |
|
1002 |
|
1003 $.ui.plugin.add("sortable", "zIndex", { |
|
1004 start: function(event, ui) { |
|
1005 var t = ui.helper, i = $(this).data('sortable'); |
|
1006 if(t.css("zIndex")) i.options._zIndex = t.css("zIndex"); |
|
1007 t.css('zIndex', i.options.zIndex); |
|
1008 }, |
|
1009 beforeStop: function(event, ui) { |
|
1010 var i = $(this).data('sortable'); |
|
1011 if(i.options._zIndex) $(ui.helper).css('zIndex', i.options._zIndex == 'auto' ? '' : i.options._zIndex); |
|
1012 } |
|
1013 }); |
|
1014 |
|
1015 })(jQuery); |
1019 })(jQuery); |