Merge pull request #702 from stepie22/dragndrop-fix

Fix channels behaving strangely while dragging
This commit is contained in:
Jérémie Astori 2016-10-23 10:34:02 -04:00 committed by GitHub
commit 61a582f71f
2 changed files with 8 additions and 3 deletions

View File

@ -409,6 +409,7 @@ button {
text-align: left; text-align: left;
transition: color .2s; transition: color .2s;
width: 180px; width: 180px;
left: auto !important; /* Fix for drag'n'drop not recalculating left position */
} }
#sidebar .chan-placeholder { #sidebar .chan-placeholder {

View File

@ -1245,15 +1245,17 @@ $(function() {
} }
function sortable() { function sortable() {
sidebar.sortable({ sidebar.find(".networks").sortable({
axis: "y", axis: "y",
containment: "parent", containment: "parent",
cursor: "grabbing", cursor: "move",
distance: 12, distance: 12,
items: ".network", items: ".network",
handle: ".lobby", handle: ".lobby",
placeholder: "network-placeholder", placeholder: "network-placeholder",
forcePlaceholderSize: true, forcePlaceholderSize: true,
tolerance: "pointer", // Use the pointer to figure out where the network is in the list
update: function() { update: function() {
var order = []; var order = [];
sidebar.find(".network").each(function() { sidebar.find(".network").each(function() {
@ -1271,11 +1273,13 @@ $(function() {
sidebar.find(".network").sortable({ sidebar.find(".network").sortable({
axis: "y", axis: "y",
containment: "parent", containment: "parent",
cursor: "grabbing", cursor: "move",
distance: 12, distance: 12,
items: ".chan:not(.lobby)", items: ".chan:not(.lobby)",
placeholder: "chan-placeholder", placeholder: "chan-placeholder",
forcePlaceholderSize: true, forcePlaceholderSize: true,
tolerance: "pointer", // Use the pointer to figure out where the channel is in the list
update: function(e, ui) { update: function(e, ui) {
var order = []; var order = [];
var network = ui.item.parent(); var network = ui.item.parent();