Line 74: |
Line 74: |
| | | |
| local function scaleLayer(hd, layer) | | local function scaleLayer(hd, layer) |
− | local top, left, right, width, height = layer.top, layer.left, layer.right, layer.width, layer.height or layer.width | + | local scale = hd and 1.5 or 1 |
| + | local top, left, right, width, height = layer.top, layer.left, layer.right, (layer.width or layer.height), (layer.height or layer.width) |
| layer.style = layer.style or {} | | layer.style = layer.style or {} |
| if top then | | if top then |
− | layer.style.top = top * (hd and 1.5 or 1) .. 'px' | + | layer.style.top = _.round(scale * top) .. 'px' |
| end | | end |
| if left then | | if left then |
− | layer.style.left = left * (hd and 1.5 or 1) .. 'px' | + | layer.style.left = _.round(scale * left) .. 'px' |
| end | | end |
| if right then | | if right then |
− | layer.style.right = right * (hd and 1.5 or 1) .. 'px' | + | layer.style.right = _.round(scale * right) .. 'px' |
| end | | end |
− | if width then | + | if width and height then |
− | layer.size = width * (hd and 1.5 or 1) .. 'x' .. height * (hd and 1.5 or 1) .. 'px' | + | layer.size = _.round(scale * width) .. 'x' .. _.round(scale * height) .. 'px' |
| end | | end |
| if layer.opacity then | | if layer.opacity then |