project loading fixes, also some zoom improvements
This commit is contained in:
@@ -83,7 +83,7 @@ class Timeline(Vertical):
|
||||
self.app.zoom_level += (self.app.scroll_sensitivity_x / 200)
|
||||
self.calc_bar_offset()
|
||||
self.app.last_zoom_level = self.app.zoom_level
|
||||
self.handle_zoom()
|
||||
await self.handle_zoom()
|
||||
|
||||
@on(events.MouseScrollUp)
|
||||
async def mouse_scroll_up(self, event: events.MouseScrollUp):
|
||||
@@ -92,7 +92,7 @@ class Timeline(Vertical):
|
||||
if self.app.zoom_level != self.app.last_zoom_level:
|
||||
self.app.last_zoom_level = self.app.zoom_level
|
||||
self.calc_bar_offset()
|
||||
self.handle_zoom()
|
||||
await self.handle_zoom()
|
||||
|
||||
@on(events.MouseDown)
|
||||
async def mouse_down(self, event: events.MouseDown):
|
||||
@@ -107,7 +107,7 @@ class Timeline(Vertical):
|
||||
# seek to number of seconds
|
||||
self.song_player.seek(seconds)
|
||||
|
||||
def handle_zoom(self):
|
||||
async def handle_zoom(self):
|
||||
for chunk in self.query(Chunk):
|
||||
chunk.calculate_size()
|
||||
chunk.update_offset(self)
|
||||
@@ -119,10 +119,16 @@ class Timeline(Vertical):
|
||||
if self.app.zoom_level >= 0.09 and bar_line.has_class("beat-line"):
|
||||
bar_line.display = False
|
||||
else:
|
||||
bar_line.display = True
|
||||
if self.app.zoom_level < 0.18:
|
||||
bar_line.display = True
|
||||
else:
|
||||
if bar_line.has_class("bar-line") and bar_line.index % 16 == 0:
|
||||
bar_line.display = True
|
||||
else:
|
||||
bar_line.display = False
|
||||
|
||||
if self.song_player.paused and self.song_player.project:
|
||||
self.run_worker(self.song_player.update_visual_playhead())
|
||||
await self.song_player.update_visual_playhead()
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user