Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list[_index].func = function()
- if listElement and listElement.contentBounds and listElement.contentBounds.yMax and
- listElement.contentBounds.yMin then
- local _yMin = listElement.contentBounds.yMin
- local _yMax = listElement.contentBounds.yMax
- local isWithinRenderDistance = _yMax > -_H * _renderDistance and _yMax < _H *
- ( _renderDistance + 1 ) or _yMin < _H * ( _renderDistance + 1 ) and
- _yMin > -_H * _renderDistance
- local isOutsideRenderDistance = _yMax <= -_H * _renderDistance and _yMin < -_H *
- _renderDistance or _yMax > _H * _renderDistance + 1 ) and _yMin >= _H * _renderDistance + 1
- unload = true
- if isWithinRenderDistance then
- if not listElement._status then
- listElement._status = true
- timerThread = timer.performWithDelay(5, function()
- if not listElement._isRendering then
- listElement._isRendering = true
- if unload then
- if listElement._y then
- _newElement = createElement(data)
- listElement:insert(_newElement)
- listElement.y = listElement._y
- end
- else
- if _newElement.loadContent and
- type(_newElement.loadContent) == "function" then
- _newElement:loadContent()
- end
- end
- end
- end)
- end
- elseif isOutsideRenderDistance then
- if listElement._status then
- listElement._status = false
- if unload then
- if listElement.y and _newElement then
- listElement._y = listElement.y
- _newElement:destroy()
- _newElement = nil
- end
- else
- if _newElement.unloadContent and type(_newElement.unloadContent) == "function" then
- _newElement:unloadContent()
- end
- end
- end
- listElement._isRendering = false
- end
- end
- ---collectgarbage()
- --printMemUsage()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement