Module:Sprite: Difference between revisions

Jump to navigation Jump to search
no edit summary
(add "spriteSheet = " support)
No edit summary
Line 144: Line 144:
function append(key, value) if value ~= nil then styles[#styles+1]=key .. ": " .. value end end
function append(key, value) if value ~= nil then styles[#styles+1]=key .. ": " .. value end end
local settings = self.__settings
local settings = self.__settings
-- has to be done first, otherwise the possition is overriden in chrome
if settings.image then
append("background", settings.image.url)
end


append ("background-size", settings.sheetWidth * settings.scale .. 'px auto')
append ("background-size", settings.sheetWidth * settings.scale .. 'px auto')
Line 157: Line 162:
local top = math.floor( pos / settings.tiles ) * settings.size * settings.scale
local top = math.floor( pos / settings.tiles ) * settings.size * settings.scale
append("background-position", '-' .. left .. 'px -' .. top .. 'px')
append("background-position", '-' .. left .. 'px -' .. top .. 'px')
if settings.image then
 
append("background", settings.image.url)
end


return table.concat( styles, "; " )
return table.concat( styles, "; " )
Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator, Widget editors
154

edits

Navigation menu