X Tutup
Skip to content
This repository was archived by the owner on Jan 4, 2023. It is now read-only.

Commit c6f91b2

Browse files
committed
Cleaning up brush preview logic.
1 parent 0c91180 commit c6f91b2

File tree

5 files changed

+771
-584
lines changed

5 files changed

+771
-584
lines changed

Disks/PixelVisionOS/System/Libs/pixel-vision-ui-v2.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,18 @@ function EditorUI:CreateData(rect, spriteName, toolTip, forceDraw)
153153

154154
end
155155

156-
function EditorUI:RebuildMetaSpriteCache(data, invalidate)
156+
function EditorUI:RebuildMetaSpriteCache(data, spriteName)
157157

158-
-- invalidate = invalidate or true
159-
local spriteName = data.spriteName
160-
161-
-- TODO this should cache the meta sprite id
158+
-- Look for the sprite name or use the one that is provided
159+
spriteName = spriteName or data.spriteName
162160

163161
-- If a sprite name is provided then look for the correct sprite states
164162
if(spriteName ~= nil) then
163+
164+
-- Make sure the sprite name is up to date
165+
data.spriteName = spriteName
166+
167+
-- Find meta sprites for each of the button states
165168
data.cachedMetaSpriteIds = {
166169
up = FindMetaSpriteId(spriteName .. "up"),
167170
down = FindMetaSpriteId(spriteName .. "down" ~= nil and spriteName .. "down" or spriteName .. "selectedup"),
@@ -172,8 +175,10 @@ function EditorUI:RebuildMetaSpriteCache(data, invalidate)
172175
disabled = FindMetaSpriteId(spriteName .. "disabled"),
173176
empty = FindMetaSpriteId(spriteName .. "empty") -- used to clear the sprites
174177
}
178+
175179
end
176180

181+
-- Invalidate the button so it redraws on the next frame
177182
self:Invalidate(data)
178183

179184
end

0 commit comments

Comments
 (0)
X Tutup