Forráskód Böngészése

Fixed bug with response HTTP status

Andrea Condoluci 9 éve
szülő
commit
9c3088efc7

+ 3 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -22,7 +22,7 @@ export class VexFlowMeasure extends StaffMeasure {
         this.minimumStaffEntriesWidth = -1;
         this.resetLayout();
     }
-    private realBegin: number = 0;
+
     // octaveOffset according to active clef
     public octaveOffset: number = 3;
     // The VexFlow Voices in the measure
@@ -38,6 +38,8 @@ export class VexFlowMeasure extends StaffMeasure {
     private beams: { [voiceID: number]: [Beam, VexFlowStaffEntry[]][]; } = {};
     // VexFlow Beams
     private vfbeams: { [voiceID: number]: Vex.Flow.Beam[]; };
+    // The actual, unmodified beginInstructionWidth
+    private realBegin: number = 0;
 
     // Sets the absolute coordinates of the VFStave on the canvas
     public setAbsoluteCoordinates(x: number, y: number): void {

+ 3 - 1
src/OSMD/AJAX.ts

@@ -19,7 +19,9 @@ export function ajax(url: string): Promise<string> {
     return new Promise((resolve: (value: string) => void, reject: (error: any) => void) => {
         xhttp.onreadystatechange = () => {
             if (xhttp.readyState === XMLHttpRequest.DONE) {
-                if (xhttp.status === 200 || xhttp.status === 0) {
+                if (xhttp.status === 200) {
+                    resolve(xhttp.responseText);
+                } else if (xhttp.status === 0 && xhttp.responseText) {
                     resolve(xhttp.responseText);
                 } else {
                     //reject(new Error("AJAX error: '" + xhttp.statusText + "'"));