Skip to content

Commit

Permalink
Merge pull request #13 from Choirless/respectoffset
Browse files Browse the repository at this point in the history
make the JS renderer respect the offset from the database
  • Loading branch information
hammertoe authored Aug 24, 2020
2 parents f55b568 + 209b124 commit e9d996f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion js/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const main = async (opts) => {

// turn the song parts in to an array of rectangle objects
if (response.ok && response.parts.length > 0) {
const partMap = {}
const rectangles = []
const hiddenParts = []
for (var i in response.parts) {
Expand All @@ -89,6 +90,12 @@ const main = async (opts) => {
} else {
hiddenParts.push(obj)
}

// add to part map - to allow quick lookup of offset by partId
if (typeof p.offset !== 'number') {
p.offset = 0
}
partMap[p.partId] = p
}

// sort the rectangles into a deterministic random order (i.e not totally random, but
Expand Down Expand Up @@ -128,7 +135,7 @@ const main = async (opts) => {
size: [r.width, r.height],
volume: 1.0,
panning: 0,
offset: 0
offset: partMap[r.id].offset
}
// if an 'x' coordinate is present, the video is visible and needs
// to be positioned and possibly have audio panned left/right
Expand Down

0 comments on commit e9d996f

Please sign in to comment.