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: 14 additions & 8 deletions packages/alphatab/scripts/Serializer.setProperty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ function generateSetPropertyBody(serializable: TypeSchema, importer: (name: stri
`${mapValueTypeInfo.typeAsString}.fromJson(v)`,
ts.SyntaxKind.CallExpression
);

if(!mapValueTypeInfo.isOptional && !mapValueTypeInfo.isNullable) {
mapValue = ts.factory.createNonNullExpression(mapValue);
}
} else {
itemSerializer = `${mapValueTypeInfo.typeAsString}Serializer`;
importer(itemSerializer, findSerializerModule(mapValueTypeInfo));
Expand All @@ -181,15 +185,17 @@ function generateSetPropertyBody(serializable: TypeSchema, importer: (name: stri
.filter(t => t.tagName.text === 'json_add')
.map(t => t.comment ?? '')[0] as string;

caseStatements.push(
assignField(
ts.factory.createNewExpression(
ts.factory.createIdentifier('Map'),
prop.type.typeArguments!.map(t => t.createTypeNode()),
[]
if(!prop.isReadOnly) {
caseStatements.push(
assignField(
ts.factory.createNewExpression(
ts.factory.createIdentifier('Map'),
prop.type.typeArguments!.map(t => t.createTypeNode()),
[]
)
)
)
);
);
}

caseStatements.push(
ts.factory.createExpressionStatement(
Expand Down
2 changes: 1 addition & 1 deletion packages/alphatab/scripts/Serializer.toJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function generateToJsonBody(serializable: TypeSchema, importer: (name: string, m
const fieldName = prop.name;
const jsonName = prop.jsonNames.filter(n => n !== '')[0];

if (!jsonName || prop.isReadOnly) {
if (!jsonName || prop.isJsonReadOnly) {
continue;
}

Expand Down
4 changes: 3 additions & 1 deletion packages/alphatab/scripts/TypeSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export function buildTypeSchema(program: ts.Program, input: ts.ClassDeclaration)
asRaw,
partialNames: !!jsDoc.find(t => t.tagName.text === 'json_partial_names'),
target: jsDoc.find(t => t.tagName.text === 'target')?.comment as string,
isReadOnly: !!jsDoc.find(t => t.tagName.text === 'json_read_only'),
isJsonReadOnly: isReadonly,
isReadOnly: propertyDeclaration.modifiers!.some(m => m.kind == ts.SyntaxKind.ReadonlyKeyword),
name: (member.name as ts.Identifier).text,
jsDocTags: jsDoc,
type: getTypeWithNullableInfo(
Expand Down Expand Up @@ -379,6 +380,7 @@ export interface TypeProperty {
jsonNames: string[];
asRaw: boolean;
target?: string;
isJsonReadOnly: boolean;
isReadOnly: boolean;
}

Expand Down
10 changes: 9 additions & 1 deletion packages/alphatab/src/DisplaySettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export class DisplaySettings {
* @category Display
* @defaultValue `10`
*/
public systemPaddingBottom: number = 10
public systemPaddingBottom: number = 10;
/**
* The bottom padding applied to the last system.
* @since 1.4.0
Expand Down Expand Up @@ -334,6 +334,14 @@ export class DisplaySettings {
*/
public trackStaffPaddingBetween = 5;

/**
* The additional padding to apply between multiple lyric lines.
* @since 1.8.0
* @category Display
* @defaultValue `5`
*/
public lyricLinesPaddingBetween = 5;

/**
* The mode used to arrange staves and systems.
* @since 1.3.0
Expand Down
20 changes: 20 additions & 0 deletions packages/alphatab/src/NotationSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,26 @@ export enum NotationElement {
*/
EffectNumberedNotationKeySignature = 51,

/**
* The fretboard numbers shown in chord diagrams.
*/
ChordDiagramFretboardNumbers = 52,

/**
* The bar numbers.
*/
BarNumber = 53,

/**
* The repeat count indicator shown above the thick bar line to describe
* how many repeats should be played.
*/
RepeatCount = 54,

/**
* The slurs shown on bend effects within the score staff.
*/
ScoreBendSlur = 55
}

/**
Expand Down
Loading
Loading