Selaa lähdekoodia

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

#373
Benjamin Giesinger 6 vuotta sitten
vanhempi
commit
c562a964ed
2 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  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">
 <head>
     <meta charset="utf-8">
-
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    
     <title><%= htmlWebpackPlugin.options.title %></title>
     <meta name="description" content="A showcase for OpenSheetMusicDisplay.">
     <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)
         if (lyricsStaffEntriesList.length > 0) {
             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].parentMeasure.PositionAndShape.RelativePosition.x;
+            startX = startX > endX ? endX : startX;
             skyBottomLineCalculator.updateBottomLineInRange(startX, endX, maxPosition);
         }
         return lyricsStaffEntriesList;