Finally fix #28 - shapes not removed properly on

A shape added with HC:add*() would be reintroduced to the spatial hash
after HC:remove() when any of shape:move(), shape:rotate() or
shape:scale() was called after the removal.
This commit is contained in:
Matthias Richter 2014-04-27 11:12:47 +02:00
parent fb8c0511cf
commit 79c3d0abf8

View File

@ -107,16 +107,17 @@ function HC:addShape(shape)
end
end
function shape:_removeFromHash()
shape.move, shape.rotate, shape.scale = move, rotate, scale
return hash:remove(shape, self:bbox())
end
function shape:neighbors()
local neighbors = hash:inRange(self:bbox())
rawset(neighbors, self, nil)
return neighbors
end
function shape:_removeFromHash()
return hash:remove(shape, self:bbox())
end
function shape:inGroup(group)
return self._groups[group]
end