Browse Source

fix(Options): drawPartNames: false now also disables drawPartAbbreviations, unless set explicitly (#388)

addition/related to discussion in #388
sschmid 5 years ago
parent
commit
cd50b68c44

+ 3 - 1
src/OpenSheetMusicDisplay/OSMDOptions.ts

@@ -66,7 +66,9 @@ export interface IOSMDOptions {
     drawComposer?: boolean;
     drawComposer?: boolean;
     /** Whether to draw the lyricist's name, if given (top left of the score). */
     /** Whether to draw the lyricist's name, if given (top left of the score). */
     drawLyricist?: boolean;
     drawLyricist?: boolean;
-    /** Whether to draw part (instrument) names. */
+    /** Whether to draw part (instrument) names. Setting this to false also disables drawPartAbbreviations,
+     *  unless explicitly enabled (drawPartNames: false, drawPartAbbreviations: true).
+     */
     drawPartNames?: boolean;
     drawPartNames?: boolean;
     /** Whether to draw part (instrument) name abbreviations each system after the first. Only draws if drawPartNames. Default true. */
     /** Whether to draw part (instrument) name abbreviations each system after the first. Only draws if drawPartNames. Default true. */
     drawPartAbbreviations?: boolean;
     drawPartAbbreviations?: boolean;

+ 5 - 0
src/OpenSheetMusicDisplay/OpenSheetMusicDisplay.ts

@@ -415,6 +415,11 @@ export class OpenSheetMusicDisplay {
         }
         }
         if (options.drawPartNames !== undefined) {
         if (options.drawPartNames !== undefined) {
             this.drawingParameters.DrawPartNames = options.drawPartNames; // indirectly writes to EngravingRules
             this.drawingParameters.DrawPartNames = options.drawPartNames; // indirectly writes to EngravingRules
+
+            // by default, disable part abbreviations too, unless set explicitly.
+            if (!options.drawPartAbbreviations) {
+                this.rules.RenderPartAbbreviations = options.drawPartNames;
+            }
         }
         }
         if (options.drawPartAbbreviations !== undefined) {
         if (options.drawPartAbbreviations !== undefined) {
             this.rules.RenderPartAbbreviations = options.drawPartAbbreviations;
             this.rules.RenderPartAbbreviations = options.drawPartAbbreviations;