performance improvement
This commit is contained in:
parent
a459a8b8e7
commit
13325c1e89
@ -704,56 +704,46 @@ function onMouseEnter_item(player, param)
|
|||||||
-- get metadata from library
|
-- get metadata from library
|
||||||
local item = library[contentToShow][index]
|
local item = library[contentToShow][index]
|
||||||
|
|
||||||
UI.setValue("previewTitle", item.name or "Unknown Name")
|
-- error handling
|
||||||
UI.setValue("previewAuthor", "by " .. (item.author or "Unknown"))
|
if not item.name
|
||||||
UI.setValue("previewDescription", item.description or "Unknown")
|
or not item.author
|
||||||
|
or not item.description
|
||||||
|
or not item.boxsize
|
||||||
|
or not item.boxart then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- update box art
|
UI.setValue("previewTitle", item.name)
|
||||||
if not item.boxsize or not item.boxart then return end
|
UI.setValue("previewAuthor", "by " .. item.author)
|
||||||
|
UI.setValue("previewDescription", item.description)
|
||||||
local ui = UI.getXmlTable()
|
|
||||||
local previewArtPanel = find_tag_with_id(ui, 'previewArtPanel')
|
|
||||||
|
|
||||||
-- update mask according to size
|
-- update mask according to size
|
||||||
|
local maskData = {}
|
||||||
if item.boxsize == "big" then
|
if item.boxsize == "big" then
|
||||||
previewArtPanel.children = {
|
maskData = {
|
||||||
tag = "Mask",
|
|
||||||
attributes = {
|
|
||||||
image = "box-cover-mask-big",
|
image = "box-cover-mask-big",
|
||||||
width = "870",
|
width = "870",
|
||||||
height = "435",
|
height = "435",
|
||||||
offsetXY = "154 60"
|
offsetXY = "154 60"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elseif item.boxsize == "small" then
|
elseif item.boxsize == "small" then
|
||||||
previewArtPanel.children = {
|
maskData = {
|
||||||
tag = "Mask",
|
|
||||||
attributes = {
|
|
||||||
image = "box-cover-mask-small",
|
image = "box-cover-mask-small",
|
||||||
width = "668",
|
width = "668",
|
||||||
height = "501",
|
height = "501",
|
||||||
offsetXY = "120 10"
|
offsetXY = "120 10"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
elseif item.boxsize == "wide" then
|
elseif item.boxsize == "wide" then
|
||||||
previewArtPanel.children = {
|
maskData = {
|
||||||
tag = "Mask",
|
|
||||||
attributes = {
|
|
||||||
image = "box-cover-mask-wide",
|
image = "box-cover-mask-wide",
|
||||||
width = "780",
|
width = "780",
|
||||||
height = "650",
|
height = "650",
|
||||||
offsetXY = "-195 -70"
|
offsetXY = "-195 -70"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- insert the image itself
|
-- insert the image itself
|
||||||
previewArtPanel.children.children = {
|
UI.setAttribute("previewArtImage", "image", item.boxart)
|
||||||
tag = "Image",
|
|
||||||
attributes = { image = item.boxart }
|
|
||||||
}
|
|
||||||
|
|
||||||
UI.setXmlTable(ui)
|
|
||||||
|
|
||||||
-- update the preview window height according to box size
|
-- update the preview window height according to box size
|
||||||
local hWindow, hArt, offsetXY
|
local hWindow, hArt, offsetXY
|
||||||
@ -771,9 +761,12 @@ function onMouseEnter_item(player, param)
|
|||||||
offsetXY = "-510 210"
|
offsetXY = "-510 210"
|
||||||
end
|
end
|
||||||
|
|
||||||
UI.setAttribute("previewWindow", "height", hWindow)
|
UI.setAttributes("previewArtMask", maskData)
|
||||||
UI.setAttribute("previewWindow", "offsetXY", offsetXY)
|
|
||||||
UI.setAttribute("previewArtPanel", "preferredHeight", hArt)
|
UI.setAttribute("previewArtPanel", "preferredHeight", hArt)
|
||||||
|
UI.setAttributes("previewWindow", {
|
||||||
|
height = hWindow,
|
||||||
|
offsetXY = offsetXY
|
||||||
|
})
|
||||||
|
|
||||||
-- show the window
|
-- show the window
|
||||||
UI.show("previewWindow")
|
UI.show("previewWindow")
|
||||||
|
@ -108,6 +108,10 @@
|
|||||||
<!-- box art -->
|
<!-- box art -->
|
||||||
<Panel id="previewArtPanel"
|
<Panel id="previewArtPanel"
|
||||||
preferredHeight="300">
|
preferredHeight="300">
|
||||||
|
<Mask id="previewArtMask">
|
||||||
|
<Image id="previewArtImage" />
|
||||||
|
</Mask>
|
||||||
|
|
||||||
<!-- mask for scenario size boxes
|
<!-- mask for scenario size boxes
|
||||||
<Mask image="box-cover-mask-small" width="668" height="501" offsetXY="120 10">
|
<Mask image="box-cover-mask-small" width="668" height="501" offsetXY="120 10">
|
||||||
<Image image="testArtSmall"/>
|
<Image image="testArtSmall"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user