mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-20 14:06:09 +05:00
snake replaced with canvas
This commit is contained in:
@@ -43,25 +43,15 @@ export const useCreateCacheMap = cache => {
|
||||
const map = []
|
||||
|
||||
for (let i = 0; i < PiecesCount; i++) {
|
||||
const newPiece = { id: i }
|
||||
const { Size, Length } = Pieces[i] || {}
|
||||
|
||||
const activeBlock = Pieces[i]
|
||||
const className = ['piece']
|
||||
|
||||
if (activeBlock) {
|
||||
const { Completed, Size, Length } = activeBlock
|
||||
className.push(Completed && Size >= Length ? 'piece-complete' : 'piece-loading')
|
||||
newPiece.percentage = ((Size / Length) * 100).toFixed(2)
|
||||
}
|
||||
const newPiece = { id: i, percentage: (Size / Length) * 100 || 0 }
|
||||
|
||||
Readers.forEach(r => {
|
||||
if (i === r.Reader) {
|
||||
className.push('piece-reader')
|
||||
} else if (i >= r.Start && i <= r.End) className.push('reader-range')
|
||||
if (i === r.Reader) newPiece.isReader = true
|
||||
if (i >= r.Start && i <= r.End) newPiece.isReaderRange = true
|
||||
})
|
||||
|
||||
newPiece.className = className.join(' ')
|
||||
|
||||
map.push(newPiece)
|
||||
}
|
||||
setCacheMap(map)
|
||||
|
||||
Reference in New Issue
Block a user