Open SingingMeerkat opened 3 years ago
Update:
The blocks on display are filtered, so that only visible blocks would create svg elements. The filter works depending on a margin (the "SEARCH Window" below):
All blocks whose START position is within the DISPLAY Window will be drawn, and we use the SEARCH Window to identify blocks wide enough to be showed on screen even though their START position is not captured in the DISPLAY window. This SEARCH Window has the same width as the larger block, so that even it could be captured by this extended filter area.
Since we do not need all the blocks that are found within SEARCH Window but only those that are at the border, I chose to keep only the last block. THIS DOES NOT TAKE INTO ACCOUNT OVERLAPPING BLOCKS.
This results in blocks that can be super large but not displayed if there is any other block closer to the left threshold. What should be checked is whether, in SEARCH Window, there are blockS with an END position exceeding DISPLAY Window's left border. This way, even very large blocks starting/ending way before/after the DISPLAY Window could be displayed if they overlap with it. Checking only if the END position is within the DISPLAY Window would end up with blocks starting before and ending after the visible area, but not drawn because their END is too far.
Sometimes special block with StartPosition < StartDisplay and EndPosition > EndDisplay exist and will not be registered for visualization, while they definitely should be on display. Filtering method could be improved to take such cases into account.