adding new states/tools
This commit is contained in:
@@ -3,8 +3,10 @@ import Beat, { BeatEvents } from "@/Beat";
|
||||
import TrackView from "@/ui/Track/TrackView";
|
||||
import "./Beat.css";
|
||||
import EditableTextFieldView from "@/ui/Widgets/EditableTextFIeld/EditableTextFieldView";
|
||||
import AppState from "@/AppState";
|
||||
|
||||
export type BeatUINodeOptions = RungOptions & {
|
||||
state: AppState,
|
||||
beat: Beat,
|
||||
orientation?: "horizontal" | "vertical",
|
||||
};
|
||||
@@ -21,9 +23,11 @@ export default class BeatView extends Rung<HTMLElement> implements ISubscriber<E
|
||||
private titles: HTMLHeadingElement[] = [];
|
||||
private currentOrientation: "vertical" | "horizontal";
|
||||
private subscription: ISubscription;
|
||||
private state: AppState;
|
||||
|
||||
constructor(options: BeatUINodeOptions) {
|
||||
super(options);
|
||||
this.state = options.state;
|
||||
this.beat = options.beat;
|
||||
this.currentOrientation = options.orientation ?? "horizontal";
|
||||
this.subscription = this.beat.addSubscriber(this, EventTypeSubscriptions);
|
||||
@@ -53,7 +57,7 @@ export default class BeatView extends Rung<HTMLElement> implements ISubscriber<E
|
||||
}
|
||||
this.trackViews[i].setTrack(track);
|
||||
} else {
|
||||
this.trackViews.push(new TrackView({ track: this.beat.getTrackByIndex(i) }));
|
||||
this.trackViews.push(new TrackView({ state: this.state, track: this.beat.getTrackByIndex(i) }));
|
||||
this.titles.push(this.trackViews[i].getTitleNode());
|
||||
this.titles[this.titles.length - 1].classList.add("beat-track-title");
|
||||
}
|
||||
@@ -106,4 +110,4 @@ export default class BeatView extends Rung<HTMLElement> implements ISubscriber<E
|
||||
</div>
|
||||
</div> as HTMLDivElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user