base: Fix broken move logic
Sometime I wonder WTF I was on when I wrote some parts or Radical... I guess I can call it university stress... Note that this will probably cause a bunch of regressions because some other code expected the garbage I was creating.
This commit is contained in:
parent
0e00d45cd4
commit
e29771fa48
20
base.lua
20
base.lua
|
@ -558,21 +558,15 @@ local function new(args)
|
|||
break
|
||||
end
|
||||
end
|
||||
if idx1 then
|
||||
-- if idx < idx1 then
|
||||
-- idx = idx + 1
|
||||
-- end
|
||||
if idx1 > #internal.items + 1 then
|
||||
idx1 = #internal.items + 1
|
||||
end
|
||||
if idx ~= idx1 then
|
||||
table.insert(internal.items,idx1,table.remove(internal.items,idx))
|
||||
item.index = idx
|
||||
data:emit_signal("item::moved",item,idx,idx1)
|
||||
for i=idx,idx1 do
|
||||
if idx1 and idx ~= idx1 then
|
||||
table.remove(internal.items,idx1)
|
||||
table.insert(internal.items,idx, item)
|
||||
|
||||
for i=math.min(idx,idx1), idx1 > idx and idx1 or #internal.items do
|
||||
internal.items[i].index = i
|
||||
end
|
||||
end
|
||||
|
||||
data:emit_signal("item::moved",item,idx,idx1)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue