Skip to content

Commit

Permalink
SystemParam / FormatOptions renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
rvilarl committed Dec 3, 2021
1 parent ce709de commit 32f9adc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface FormatterOptions {
maxIterations?: number;
}

export interface FormatOptions {
export interface FormatParams {
align_rests?: boolean;
padding?: number;
stave?: Stave;
Expand Down Expand Up @@ -262,7 +262,7 @@ export class Formatter {
ctx: RenderContext,
stave: Stave,
notes: StemmableNote[],
params?: FormatOptions | boolean
params?: FormatParams | boolean
): BoundingBox | undefined {
let options = {
auto_beam: false,
Expand Down Expand Up @@ -314,7 +314,7 @@ export class Formatter {
tabnotes: TabNote[],
notes: Tickable[],
autobeam: boolean,
params: FormatOptions
params: FormatParams
): void {
let opts = {
auto_beam: autobeam,
Expand Down Expand Up @@ -994,7 +994,7 @@ export class Formatter {
* Set `options.context` to the rendering context. Set `options.align_rests`
* to true to enable rest alignment.
*/
format(voices: Voice[], justifyWidth?: number, options?: FormatOptions): this {
format(voices: Voice[], justifyWidth?: number, options?: FormatParams): this {
const opts = {
align_rests: false,
...options,
Expand All @@ -1017,8 +1017,8 @@ export class Formatter {
}

// This method is just like `format` except that the `justifyWidth` is inferred from the `stave`.
formatToStave(voices: Voice[], stave: Stave, optionsParam?: FormatOptions): this {
const options: FormatOptions = { padding: 10, context: stave.getContext(), ...optionsParam };
formatToStave(voices: Voice[], stave: Stave, optionsParam?: FormatParams): this {
const options: FormatParams = { padding: 10, context: stave.getContext(), ...optionsParam };

// eslint-disable-next-line
const justifyWidth = stave.getNoteEndX() - stave.getNoteStartX() - Stave.defaultPadding;
Expand Down
10 changes: 5 additions & 5 deletions src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { BoundingBox } from './boundingbox';
import { Element } from './element';
import { Factory } from './factory';
import { FormatOptions, Formatter, FormatterOptions } from './formatter';
import { FormatParams, Formatter, FormatterOptions } from './formatter';
import { Note } from './note';
import { RenderContext } from './rendercontext';
import { Stave, StaveOptions } from './stave';
Expand All @@ -16,7 +16,7 @@ export interface SystemFormatterOptions extends FormatterOptions {
alpha?: number;
}

export interface SystemParams {
export interface SystemStave {
voices: Voice[];
stave?: Stave;
noJustification?: boolean;
Expand Down Expand Up @@ -48,7 +48,7 @@ export interface SystemOptions {
width?: number;
y?: number;
details?: SystemFormatterOptions;
formatOptions?: FormatOptions;
formatOptions?: FormatParams;
noJustification?: boolean;
}

Expand All @@ -67,7 +67,7 @@ export class System extends Element {
protected formatter?: Formatter;
protected startX?: number;
protected lastY?: number;
protected parts: Required<SystemParams>[];
protected parts: Required<SystemStave>[];
protected connector?: StaveConnector;
protected debugNoteMetricsYs?: { y: number; voice: Voice }[];

Expand Down Expand Up @@ -143,7 +143,7 @@ export class System extends Element {
*
* `score.voice(score.notes('C#4/h, C#4', {stem: 'down'}))]});`
*/
addStave(params: SystemParams): Stave {
addStave(params: SystemStave): Stave {
const staveOptions: StaveOptions = { left_bar: false, ...params.options };

const stave =
Expand Down

0 comments on commit 32f9adc

Please sign in to comment.