Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src.compiler/csharp/CSharpEmitterContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,14 @@ export default class CSharpEmitterContext {
} else if (actualType == null) {
actualType = t;
} else if (actualType != null && actualType.flags !== t.flags) {
this.addCsNodeDiagnostics(
parent,
'Union type covering multiple types detected, fallback to dynamic',
ts.DiagnosticCategory.Warning
);
let isEmitted = this.isNodeEmitted(parent);
if (isEmitted) {
this.addCsNodeDiagnostics(
parent,
'Union type covering multiple types detected, fallback to dynamic',
ts.DiagnosticCategory.Warning
);
}
fallbackToObject = true;
} else {
actualType = t;
Expand Down Expand Up @@ -568,6 +571,15 @@ export default class CSharpEmitterContext {
isOptional: isOptional
} as cs.TypeReference;
}

private isNodeEmitted(node: cs.Node): boolean {
if ('skipEmit' in node && node.skipEmit as boolean) {
return false;
} else if (node.parent) {
return this.isNodeEmitted(node.parent);
}
return true;
}

public isDefaultValueNull(tsType: ts.Type): boolean {
tsType = this.typeChecker.getNonNullableType(tsType);
Expand Down
11 changes: 11 additions & 0 deletions src/model/Bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export class Bar {
*/
public simileMark: SimileMark = SimileMark.None;

/**
* Gets a value indicating whether this bar contains multiple voices with notes.
* @json_ignore
*/
public isMultiVoice: boolean = false;


public get masterBar(): MasterBar {
return this.staff.track.score.masterBars[this.index];
}
Expand All @@ -83,9 +90,13 @@ export class Bar {
}

public finish(settings: Settings): void {
this.isMultiVoice = false;
for (let i: number = 0, j: number = this.voices.length; i < j; i++) {
let voice: Voice = this.voices[i];
voice.finish(settings);
if(i > 0 && !voice.isEmpty) {
this.isMultiVoice = true;
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/platform/ICanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ export enum TextBaseline {
Top,
/**
* Text is aligned middle
*/ Middle,
*/
Middle,
/**
* Text is aligend on the bottom.
*/ Bottom
*/
Bottom
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/platform/svg/SvgCanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export abstract class SvgCanvas implements ICanvas {
}px" class="at-surface-svg">\n`;
this._currentPath = '';
this._currentPathIsEmpty = true;
this.textBaseline = TextBaseline.Top;
}

public beginGroup(identifier: string): void {
Expand Down Expand Up @@ -164,10 +165,11 @@ export abstract class SvgCanvas implements ICanvas {
protected getSvgBaseLine(): string {
switch (this.textBaseline) {
case TextBaseline.Top:
return `dy="1.25ex"`;
return `dominant-baseline="hanging"`;
case TextBaseline.Middle:
return `dy="0.5ex"`;
return `dominant-baseline="central"`;
case TextBaseline.Bottom:
return `dominant-baseline="bottom"`;
default:
return '';
}
Expand Down
5 changes: 5 additions & 0 deletions src/rendering/BarRendererBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { MasterBarBounds } from '@src/rendering/utils/MasterBarBounds';
import { RenderingResources } from '@src/RenderingResources';
import { Settings } from '@src/Settings';
import { BeatOnNoteGlyphBase } from './glyphs/BeatOnNoteGlyphBase';
import { BeamingHelper } from './utils/BeamingHelper';

/**
* Lists the different position modes for {@link BarRendererBase.getNoteY}
Expand Down Expand Up @@ -486,4 +487,8 @@ export class BarRendererBase {
break;
}
}

public completeBeamingHelper(helper: BeamingHelper) {
// nothing by default
}
}
Loading