Browse Source

fix(Zooming on mobile devices crashed OSMD): If the zoom gets to tough for vexflow to handle it will (#375)

#373
Benjamin Giesinger 6 years ago
parent
commit
c562a964ed
2 changed files with 4 additions and 2 deletions
  1. 2 1
      demo/index.html
  2. 2 1
      src/MusicalScore/Graphical/MusicSheetCalculator.ts

+ 2 - 1
demo/index.html

@@ -2,7 +2,8 @@
 <html lang="en">
 <html lang="en">
 <head>
 <head>
     <meta charset="utf-8">
     <meta charset="utf-8">
-
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    
     <title><%= htmlWebpackPlugin.options.title %></title>
     <title><%= htmlWebpackPlugin.options.title %></title>
     <meta name="description" content="A showcase for OpenSheetMusicDisplay.">
     <meta name="description" content="A showcase for OpenSheetMusicDisplay.">
     <meta name="author" content="OpenSheetMusicDisplay contributors">
     <meta name="author" content="OpenSheetMusicDisplay contributors">

+ 2 - 1
src/MusicalScore/Graphical/MusicSheetCalculator.ts

@@ -550,9 +550,10 @@ export abstract class MusicSheetCalculator {
         // update BottomLine (on the whole StaffLine's length)
         // update BottomLine (on the whole StaffLine's length)
         if (lyricsStaffEntriesList.length > 0) {
         if (lyricsStaffEntriesList.length > 0) {
             const endX: number = staffLine.PositionAndShape.Size.width;
             const endX: number = staffLine.PositionAndShape.Size.width;
-            const startX: number = lyricsStaffEntriesList[0].PositionAndShape.RelativePosition.x +
+            let startX: number = lyricsStaffEntriesList[0].PositionAndShape.RelativePosition.x +
                 lyricsStaffEntriesList[0].PositionAndShape.BorderMarginLeft +
                 lyricsStaffEntriesList[0].PositionAndShape.BorderMarginLeft +
                 lyricsStaffEntriesList[0].parentMeasure.PositionAndShape.RelativePosition.x;
                 lyricsStaffEntriesList[0].parentMeasure.PositionAndShape.RelativePosition.x;
+            startX = startX > endX ? endX : startX;
             skyBottomLineCalculator.updateBottomLineInRange(startX, endX, maxPosition);
             skyBottomLineCalculator.updateBottomLineInRange(startX, endX, maxPosition);
         }
         }
         return lyricsStaffEntriesList;
         return lyricsStaffEntriesList;