|
@@ -70,6 +70,7 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
/** space needed for a dash for lyrics spacing, calculated once */
|
|
/** space needed for a dash for lyrics spacing, calculated once */
|
|
private dashSpace: number;
|
|
private dashSpace: number;
|
|
public beamsNeedUpdate: boolean = false;
|
|
public beamsNeedUpdate: boolean = false;
|
|
|
|
+ public isFirstZero: boolean = false
|
|
|
|
|
|
constructor(rules: EngravingRules) {
|
|
constructor(rules: EngravingRules) {
|
|
super();
|
|
super();
|
|
@@ -515,20 +516,26 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
public calculateMeasureWidthFromStaffEntries(measuresVertical: GraphicalMeasure[], oldMinimumStaffEntriesWidth: number): number {
|
|
public calculateMeasureWidthFromStaffEntries(measuresVertical: GraphicalMeasure[], oldMinimumStaffEntriesWidth: number): number {
|
|
let elongationFactorForMeasureWidth: number = 1;
|
|
let elongationFactorForMeasureWidth: number = 1;
|
|
|
|
|
|
- for (const measure of measuresVertical) {
|
|
|
|
- if (!measure || measure.staffEntries.length === 0) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- elongationFactorForMeasureWidth =
|
|
|
|
- this.calculateElongationFactorFromStaffEntries(
|
|
|
|
- measure.staffEntries,
|
|
|
|
- oldMinimumStaffEntriesWidth,
|
|
|
|
- elongationFactorForMeasureWidth,
|
|
|
|
- measure.MeasureNumber,
|
|
|
|
- );
|
|
|
|
|
|
+ const multitrack = (window as any).GYM?.multitrack
|
|
|
|
|
|
|
|
+ // 修改 单声轨多声部, 平均分配
|
|
|
|
+ if (!multitrack) {
|
|
|
|
+ for (const measure of measuresVertical) {
|
|
|
|
+ if (!measure || measure.staffEntries.length === 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ elongationFactorForMeasureWidth =
|
|
|
|
+ this.calculateElongationFactorFromStaffEntries(
|
|
|
|
+ measure.staffEntries,
|
|
|
|
+ oldMinimumStaffEntriesWidth,
|
|
|
|
+ elongationFactorForMeasureWidth,
|
|
|
|
+ measure.MeasureNumber,
|
|
|
|
+ );
|
|
|
|
+ elongationFactorForMeasureWidth = 1
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
elongationFactorForMeasureWidth = Math.min(elongationFactorForMeasureWidth, this.rules.MaximumLyricsElongationFactor);
|
|
elongationFactorForMeasureWidth = Math.min(elongationFactorForMeasureWidth, this.rules.MaximumLyricsElongationFactor);
|
|
// TODO check when this is > 2.0. there seems to be an error here where this is unnecessarily > 2 in Beethoven Geliebte.
|
|
// TODO check when this is > 2.0. there seems to be an error here where this is unnecessarily > 2 in Beethoven Geliebte.
|
|
|
|
|
|
@@ -629,6 +636,25 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
first_note: vfStartNote
|
|
first_note: vfStartNote
|
|
});
|
|
});
|
|
const measure1: VexFlowMeasure = (startNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
const measure1: VexFlowMeasure = (startNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
|
|
+ // 修改 跨行的延音线前面的方向和后面的保持一致
|
|
|
|
+ if (vfEndNote) {
|
|
|
|
+ if (vfEndNote.getDuration() === 'w' && (vfEndNote as any).keyProps?.[0]?.line >= 3) {
|
|
|
|
+ vfEndNote.setStemDirection(-1)
|
|
|
|
+ }
|
|
|
|
+ let tieDirection = (window as any).GYM?.tieDirection || 0;
|
|
|
|
+ if (Math.abs(tieDirection) === 1) {
|
|
|
|
+ if ((vfEndNote as any).keyProps?.[0]?.line >= 3) {
|
|
|
|
+ vfEndNote.setStemDirection(-tieDirection)
|
|
|
|
+ } else {
|
|
|
|
+ vfEndNote.setStemDirection(tieDirection)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ (vfTie1 as any)?.setDirection(vfEndNote.getStemDirection());
|
|
|
|
+ }
|
|
|
|
+ if (measure1.vfTies.length > 0) {
|
|
|
|
+ const direction = (measure1.vfTies[0] as any).direction
|
|
|
|
+ ;(vfTie1 as any)?.setDirection(direction ? -direction : 1);
|
|
|
|
+ }
|
|
measure1.addStaveTie(vfTie1, tie);
|
|
measure1.addStaveTie(vfTie1, tie);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -638,6 +664,10 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
last_note: vfEndNote
|
|
last_note: vfEndNote
|
|
});
|
|
});
|
|
const measure2: VexFlowMeasure = (endNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
const measure2: VexFlowMeasure = (endNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
|
|
+ if (measure2.vfTies.length > 0) {
|
|
|
|
+ const direction = (measure2.vfTies[0] as any).direction
|
|
|
|
+ ;(vfTie2 as any)?.setDirection(direction ? -direction : 1);
|
|
|
|
+ }
|
|
measure2.addStaveTie(vfTie2, tie);
|
|
measure2.addStaveTie(vfTie2, tie);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -699,6 +729,10 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
}
|
|
}
|
|
|
|
|
|
const measure: VexFlowMeasure = (endNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
const measure: VexFlowMeasure = (endNote.parentVoiceEntry.parentStaffEntry.parentMeasure as VexFlowMeasure);
|
|
|
|
+ const graceCustom = (window as any).GYM?.graceCustom || false
|
|
|
|
+ if (graceCustom){
|
|
|
|
+ vfTie.setDirection(graceCustom.direction)
|
|
|
|
+ }
|
|
measure.addStaveTie(vfTie, tie);
|
|
measure.addStaveTie(vfTie, tie);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -932,9 +966,13 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
// somehow this is called repeatedly in Clementi, so skyline[0] = Math.min instead of -=
|
|
// somehow this is called repeatedly in Clementi, so skyline[0] = Math.min instead of -=
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
protected calculateRehearsalMark(measure: SourceMeasure): void {
|
|
protected calculateRehearsalMark(measure: SourceMeasure): void {
|
|
const rehearsalExpression: RehearsalExpression = measure.rehearsalExpression;
|
|
const rehearsalExpression: RehearsalExpression = measure.rehearsalExpression;
|
|
|
|
+ // 修改 判断小节是否是从1开始
|
|
|
|
+ if (!this.isFirstZero && measure.MeasureNumber === 0){
|
|
|
|
+ this.isFirstZero = true;
|
|
|
|
+ }
|
|
if (!rehearsalExpression) {
|
|
if (!rehearsalExpression) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -964,7 +1002,12 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
repetition.setShiftY(repetition.y_shift - 10)
|
|
repetition.setShiftY(repetition.y_shift - 10)
|
|
}
|
|
}
|
|
|
|
|
|
- (vfStave as any).setSection(rehearsalExpression.label, yOffset, xOffset, fontSize); // fontSize is an extra argument from VexFlowPatch
|
|
|
|
|
|
+ // 修改 小节数不对问题
|
|
|
|
+ if (this.isFirstZero) {
|
|
|
|
+ (vfStave as any).setSection(measure.MeasureNumberXML + 1 + '', yOffset, xOffset, fontSize); // fontSize is an extra argument from VexFlowPatch
|
|
|
|
+ } else {
|
|
|
|
+ (vfStave as any).setSection(rehearsalExpression.label, yOffset, xOffset, fontSize); // fontSize is an extra argument from VexFlowPatch
|
|
|
|
+ }
|
|
|
|
|
|
//修改 存在方块数字时,如果当前行有文字,修改文字Y轴位置偏移
|
|
//修改 存在方块数字时,如果当前行有文字,修改文字Y轴位置偏移
|
|
if (this.graphicalMusicSheet.MeasureList[measureNumber][staffNumber]?.ParentStaffLine.AbstractExpressions){
|
|
if (this.graphicalMusicSheet.MeasureList[measureNumber][staffNumber]?.ParentStaffLine.AbstractExpressions){
|
|
@@ -1167,6 +1210,9 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
|
|
//return; // also possible: don't handle faulty pedal without end
|
|
//return; // also possible: don't handle faulty pedal without end
|
|
endMeasure = this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(staffIndex, true); // get last rendered measure
|
|
endMeasure = this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(staffIndex, true); // get last rendered measure
|
|
}
|
|
}
|
|
|
|
+ if (!endMeasure){
|
|
|
|
+ endMeasure = pedal.ParentStartMultiExpression.SourceMeasureParent.VerticalMeasureList[staffIndex]
|
|
|
|
+ }
|
|
if (endMeasure.MeasureNumber > maxMeasureToDrawIndex + 1) { // ends in measure not rendered
|
|
if (endMeasure.MeasureNumber > maxMeasureToDrawIndex + 1) { // ends in measure not rendered
|
|
endMeasure = this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(staffIndex, true);
|
|
endMeasure = this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(staffIndex, true);
|
|
}
|
|
}
|