Jelajahi Sumber

Fixed lint errors

Andrea Condoluci 9 tahun lalu
induk
melakukan
087d4cb875

+ 8 - 8
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -15,7 +15,7 @@ import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
 import StaveConnector = Vex.Flow.StaveConnector;
 import StaveNote = Vex.Flow.StaveNote;
 import {Logging} from "../../../Common/Logging";
-import {UnitInPixels} from "./VexFlowMusicSheetDrawer";
+import {unitInPixels} from "./VexFlowMusicSheetDrawer";
 
 export class VexFlowMeasure extends StaffMeasure {
     constructor(staff: Staff, staffLine: StaffLine = undefined, sourceMeasure: SourceMeasure = undefined) {
@@ -79,9 +79,9 @@ export class VexFlowMeasure extends StaffMeasure {
         let vfline: any = VexFlowConverter.line(line);
         switch (vfline) {
             case Vex.Flow.StaveConnector.type.SINGLE:
-                return 1.0 / UnitInPixels;
+                return 1.0 / unitInPixels;
             case Vex.Flow.StaveConnector.type.DOUBLE:
-                return 3.0 / UnitInPixels;
+                return 3.0 / unitInPixels;
             default:
                 return 0;
         }
@@ -147,14 +147,14 @@ export class VexFlowMeasure extends StaffMeasure {
     public setWidth(width: number): void {
         super.setWidth(width);
         // Set the width of the Vex.Flow.Stave
-        this.stave.setWidth(width * UnitInPixels);
+        this.stave.setWidth(width * unitInPixels);
         // Force the width of the Begin Instructions
         //this.stave.setNoteStartX(this.beginInstructionsWidth * UnitInPixels);
         // If this is the first stave in the vertical measure, call the format
         // method to set the width of all the voices
         if (this.formatVoices) {
             // The width of the voices does not include the instructions (StaveModifiers)
-            this.formatVoices((width - this.beginInstructionsWidth - this.endInstructionsWidth) * UnitInPixels);
+            this.formatVoices((width - this.beginInstructionsWidth - this.endInstructionsWidth) * unitInPixels);
         }
     }
 
@@ -182,7 +182,7 @@ export class VexFlowMeasure extends StaffMeasure {
      */
     public draw(ctx: Vex.Flow.CanvasContext): void {
         // Force the width of the Begin Instructions
-        this.stave.setNoteStartX(this.stave.getX() + UnitInPixels * this.beginInstructionsWidth);
+        this.stave.setNoteStartX(this.stave.getX() + unitInPixels * this.beginInstructionsWidth);
         // Draw stave lines
         this.stave.setContext(ctx).draw();
         // Draw all voices
@@ -315,7 +315,7 @@ export class VexFlowMeasure extends StaffMeasure {
 
     private updateInstructionWidth(): void {
         //this.stave.format();
-        this.beginInstructionsWidth = (this.stave.getNoteStartX() - this.stave.getX()) / UnitInPixels;
-        this.endInstructionsWidth = (this.stave.getNoteEndX() - this.stave.getX()) / UnitInPixels;
+        this.beginInstructionsWidth = (this.stave.getNoteStartX() - this.stave.getX()) / unitInPixels;
+        this.endInstructionsWidth = (this.stave.getNoteEndX() - this.stave.getX()) / unitInPixels;
     }
 }

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -27,7 +27,7 @@ import {VexFlowTextMeasurer} from "./VexFlowTextMeasurer";
 
 import Vex = require("vexflow");
 import {Logging} from "../../../Common/Logging";
-import {UnitInPixels} from "./VexFlowMusicSheetDrawer";
+import {unitInPixels} from "./VexFlowMusicSheetDrawer";
 
 export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
     constructor() {
@@ -87,7 +87,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
         let firstMeasure: VexFlowMeasure = measures[0] as VexFlowMeasure;
         // FIXME: The following ``+ 5.0'' is temporary: it was added as a workaround for
         // FIXME: a more relaxed formatting of voices
-        let width: number = formatter.preCalculateMinTotalWidth(allVoices) / UnitInPixels + 5.0;
+        let width: number = formatter.preCalculateMinTotalWidth(allVoices) / unitInPixels + 5.0;
         for (let measure of measures) {
             measure.minimumStaffEntriesWidth = width;
             (measure as VexFlowMeasure).formatVoices = undefined;

+ 7 - 7
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts

@@ -7,7 +7,7 @@ import {GraphicalLabel} from "../GraphicalLabel";
 import {VexFlowConverter} from "./VexFlowConverter";
 import {VexFlowTextMeasurer} from "./VexFlowTextMeasurer";
 
-export const UnitInPixels = 10;
+export const unitInPixels: number = 10;
 
 export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
     private renderer: Vex.Flow.Renderer;
@@ -55,13 +55,13 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
      * @returns {number} the distance in pixels
      */
     public calculatePixelDistance(unitDistance: number): number {
-        return unitDistance * UnitInPixels;
+        return unitDistance * unitInPixels;
     }
 
     protected drawMeasure(measure: VexFlowMeasure): void {
         measure.setAbsoluteCoordinates(
-            measure.PositionAndShape.AbsolutePosition.x * UnitInPixels,
-            measure.PositionAndShape.AbsolutePosition.y * UnitInPixels
+            measure.PositionAndShape.AbsolutePosition.x * unitInPixels,
+            measure.PositionAndShape.AbsolutePosition.y * unitInPixels
         );
         return measure.draw(this.vfctx);
     }
@@ -94,7 +94,7 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
         let ctx: CanvasRenderingContext2D = (this.vfctx as any).vexFlowCanvasContext;
         let old: string = ctx.font;
         ctx.font = VexFlowConverter.font(
-            graphicalLabel.Label.fontHeight * UnitInPixels,
+            graphicalLabel.Label.fontHeight * unitInPixels,
             graphicalLabel.Label.fontStyle,
             graphicalLabel.Label.font
         );
@@ -122,7 +122,7 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
      * @returns {PointF2D}
      */
     protected applyScreenTransformation(point: PointF2D): PointF2D {
-        return new PointF2D(point.x * UnitInPixels, point.y * UnitInPixels);
+        return new PointF2D(point.x * unitInPixels, point.y * unitInPixels);
     }
 
     /**
@@ -131,6 +131,6 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
      * @returns {RectangleF2D}
      */
     protected applyScreenTransformationForRect(rectangle: RectangleF2D): RectangleF2D {
-        return new RectangleF2D(rectangle.x * UnitInPixels, rectangle.y * UnitInPixels, rectangle.width * UnitInPixels, rectangle.height * UnitInPixels);
+        return new RectangleF2D(rectangle.x * unitInPixels, rectangle.y * unitInPixels, rectangle.width * unitInPixels, rectangle.height * unitInPixels);
     }
 }

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts

@@ -2,7 +2,7 @@ import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
 import {VexFlowMeasure} from "./VexFlowMeasure";
 import {SourceStaffEntry} from "../../VoiceData/SourceStaffEntry";
 import {GraphicalNote} from "../GraphicalNote";
-import {UnitInPixels} from "./VexFlowMusicSheetDrawer";
+import {unitInPixels} from "./VexFlowMusicSheetDrawer";
 
 export class VexFlowStaffEntry extends GraphicalStaffEntry {
     constructor(measure: VexFlowMeasure, sourceStaffEntry: SourceStaffEntry, staffEntryParent: VexFlowStaffEntry) {
@@ -28,6 +28,6 @@ export class VexFlowStaffEntry extends GraphicalStaffEntry {
                 n += 1;
             }
         }
-        return x / n / UnitInPixels;
+        return x / n / unitInPixels;
     }
 }

+ 1 - 2
src/OSMD/OSMD.ts

@@ -11,7 +11,6 @@ import {Promise} from "es6-promise";
 import {handleResize} from "./ResizeHandler";
 import {ajax} from "./AJAX";
 import {Logging} from "../Common/Logging";
-import {GraphicalLine} from "../MusicalScore/Graphical/GraphicalLine";
 import {Fraction} from "../Common/DataObjects/Fraction";
 import {OutlineAndFillStyleEnum} from "../MusicalScore/Graphical/DrawingEnums";
 
@@ -141,7 +140,7 @@ export class OSMD {
         // Calculate again
         this.graphic.reCalculate();
         this.graphic.Cursors.length = 0;
-        this.graphic.Cursors.push(this.graphic.calculateCursorLineAtTimestamp(new Fraction(7,1), OutlineAndFillStyleEnum.PlaybackCursor));
+        this.graphic.Cursors.push(this.graphic.calculateCursorLineAtTimestamp(new Fraction(7, 1), OutlineAndFillStyleEnum.PlaybackCursor));
         // Update Sheet Page
         let height: number = this.graphic.MusicPages[0].PositionAndShape.BorderBottom * 10.0 * this.zoom;
         this.drawer.resize(width, height);