diff --git a/Panels.lua b/Panels.lua index 37e20e2..39438f8 100644 --- a/Panels.lua +++ b/Panels.lua @@ -1,4 +1,4 @@ --- Panels version 1.7.2 +-- Panels version 1.7.3 -- https://cadin.github.io/panels/ import "CoreLibs/object" diff --git a/modules/Panel.lua b/modules/Panel.lua index 447f4ac..6b0852a 100644 --- a/modules/Panel.lua +++ b/modules/Panel.lua @@ -410,8 +410,14 @@ function Panels.Panel.new(data) end if layer.pixelLock then - xPos = math.floor((xPos + offset.x) / layer.pixelLock) * layer.pixelLock - offset.x - yPos = math.floor((yPos + offset.y) / layer.pixelLock) * layer.pixelLock - offset.y + -- offset gets added here to ensure the layer position + offset gets rounded properly + -- then subtract the offset because it's applied at the panel level + local offX = math.floor(offset.x) + local offY = math.floor(offset.y) + + xPos = math.floor((xPos + offX) / layer.pixelLock) * layer.pixelLock - offX + yPos = math.floor((yPos + offY) / layer.pixelLock) * layer.pixelLock - offY + end if layer.effect then @@ -735,7 +741,7 @@ function Panels.Panel.new(data) self:updateFunction(offset) end - gfx.setDrawOffset(offset.x + frame.x, offset.y + frame.y) + gfx.setDrawOffset(math.floor(offset.x + frame.x), math.floor(offset.y + frame.y)) gfx.setClipRect(0, 0, frame.width, frame.height) if self.backgroundColor then gfx.clear(self.backgroundColor) end