Skip to content

Commit

Permalink
LineCollection: move meta/styles generation to the constructor
Browse files Browse the repository at this point in the history
This was originally moved out with 6931979 for performance reasons when reusing a LineCollection instance, but changes since then have created a data flow where if the selection is empty, styles will never be generated. Looking at how people use this class in practice, I think it makes sense to just move this back to the constructor.
  • Loading branch information
CoffeeFlux committed Mar 8, 2019
1 parent f37cd9c commit 1a9d284
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/LineCollection.moon
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class LineCollection
else
metaIndex[index]

@generateMetaAndStyles!

if type( sel ) == "table" and #sel > 0
@collectLines sel, validationCb, selectLines
if frameFromMs 0
Expand Down Expand Up @@ -112,9 +114,6 @@ class LineCollection
@hasMetaStyles = true

collectLines: ( sel, validationCb = (( line ) -> return not line.comment), selectLines = true ) =>
unless @hasMetaStyles
@generateMetaAndStyles!

dialogueStart = 0
for x = 1, #@sub
if @sub[x].class == "dialogue"
Expand Down

0 comments on commit 1a9d284

Please sign in to comment.