Skip to content

Commit

Permalink
svg: normalize pitch points
Browse files Browse the repository at this point in the history
  • Loading branch information
SoulMelody committed Jan 22, 2025
1 parent d61fb84 commit d654570
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libresvip/plugins/svg/coordinate_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class CoordinateHelper:
key_range_end: int = dataclasses.field(init=False)

def calculate_range(self, track: SingingTrack) -> None:
if not len(track.edited_params.pitch.points):
track.edited_params.pitch.points.root = [Point.start_point(), Point.end_point()]
self.position_range_start = min(
track.note_list[0].start_pos, track.edited_params.pitch.points[1].x
)
Expand Down
2 changes: 1 addition & 1 deletion libresvip/plugins/svg/svg_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def generate_project(self, project: Project) -> Drawing:
)
else:
first_singing_track = project.track_list[self.options.track_index]
if first_singing_track is not None:
if isinstance(first_singing_track, SingingTrack):
self.coordinate_helper.calculate_range(first_singing_track)
if self.options.show_grid:
self.svg_factory.draw_grid(project.time_signature_list)
Expand Down

0 comments on commit d654570

Please sign in to comment.