Module:Sprite: Difference between revisions

No edit summary
Tag: Manual revert
No edit summary
 
(One intermediate revision by the same user not shown)
Line 22: Line 22:
end
end
local span = mw.html.create('span')
local span = mw.html.create('span')
:css({
:cssText(
position = 'relative',
string.format(
height = tostring(cellHeight * ratio) .. 'px',
[[
width = tostring(cellWidth * ratio) .. 'px',
position: relative;
overflow = 'hidden',
height: %dpx;
display = 'inline-block',
width: %dpx;
['vertical-align'] = 'middle',
overflow: hidden;
['--blackstroke-color'] = ""
display: inline-block;
})
vertical-align: middle;
]],
cellHeight * ratio,
cellWidth * ratio
)
)
:tag('span')
:tag('span')
:css({
:cssText(
position = 'absolute',
string.format(
height = tostring(sheetHeight * ratio) .. 'px',
[[
width = tostring(sheetWidth * ratio) .. 'px',
position: absolute;
top = tostring((offsetY - cellHeight * row) * ratio) .. 'px',
height: %dpx;
left = tostring((offsetX - cellWidth * col) * ratio) .. 'px'
width: %dpx;
})
top: %dpx;
left: %dpx;
]],
sheetHeight * ratio,
sheetWidth * ratio,
(offsetY - cellHeight * row) * ratio,
(offsetX - cellWidth * col) * ratio
)
)
:wikitext(string.format('[[%s|%dpx|class=pixelart]]', image, sheetWidth * ratio))
:wikitext(string.format('[[%s|%dpx|class=pixelart]]', image, sheetWidth * ratio))
:done()
:done()