Skip to content

Commit

Permalink
editedフラグをinnerContextに移動
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Feb 4, 2025
1 parent 41d42a0 commit 14ee6ed
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/sing/sequencerStateMachine/states/moveNoteState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class MoveNoteState
private readonly returnStateId: IdleStateId;

private currentCursorPos: PositionOnSequencer;
private edited: boolean;
private applyPreview: boolean;

private innerContext:
| {
targetNotesAtStart: Map<NoteId, Note>;
previewRequestId: number;
executePreviewProcess: boolean;
edited: boolean;
guideLineTicksAtStart: number;
}
| undefined;
Expand All @@ -54,7 +54,6 @@ export class MoveNoteState
this.returnStateId = args.returnStateId;

this.currentCursorPos = args.cursorPosAtStart;
this.edited = false;
this.applyPreview = false;
}

Expand Down Expand Up @@ -93,7 +92,7 @@ export class MoveNoteState
context.previewNotes.value = previewNotes.map((value) => {
return editedNotes.get(value.id) ?? value;
});
this.edited = true;
this.innerContext.edited = true;
}

context.guideLineTicks.value =
Expand Down Expand Up @@ -131,6 +130,7 @@ export class MoveNoteState
targetNotesAtStart: targetNotesMap,
executePreviewProcess: false,
previewRequestId,
edited: false,
guideLineTicksAtStart: guideLineTicks,
};
}
Expand All @@ -155,7 +155,7 @@ export class MoveNoteState
input.mouseEvent.type === "mouseup" &&
mouseButton === "LEFT_BUTTON"
) {
this.applyPreview = this.edited;
this.applyPreview = this.innerContext.edited;
setNextState(this.returnStateId, undefined);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/sing/sequencerStateMachine/states/resizeNoteLeftState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class ResizeNoteLeftState
private readonly returnStateId: IdleStateId;

private currentCursorPos: PositionOnSequencer;
private edited: boolean;
private applyPreview: boolean;

private innerContext:
| {
targetNotesAtStart: Map<NoteId, Note>;
previewRequestId: number;
executePreviewProcess: boolean;
edited: boolean;
guideLineTicksAtStart: number;
}
| undefined;
Expand All @@ -54,7 +54,6 @@ export class ResizeNoteLeftState
this.returnStateId = args.returnStateId;

this.currentCursorPos = args.cursorPosAtStart;
this.edited = false;
this.applyPreview = false;
}

Expand Down Expand Up @@ -89,7 +88,7 @@ export class ResizeNoteLeftState
context.previewNotes.value = previewNotes.map((value) => {
return editedNotes.get(value.id) ?? value;
});
this.edited = true;
this.innerContext.edited = true;
}

context.guideLineTicks.value = newNotePos;
Expand Down Expand Up @@ -127,6 +126,7 @@ export class ResizeNoteLeftState
targetNotesAtStart: targetNotesMap,
executePreviewProcess: false,
previewRequestId,
edited: false,
guideLineTicksAtStart: guideLineTicks,
};
}
Expand All @@ -151,7 +151,7 @@ export class ResizeNoteLeftState
input.mouseEvent.type === "mouseup" &&
mouseButton === "LEFT_BUTTON"
) {
this.applyPreview = this.edited;
this.applyPreview = this.innerContext.edited;
setNextState(this.returnStateId, undefined);
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/sing/sequencerStateMachine/states/resizeNoteRightState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ export class ResizeNoteRightState
private readonly returnStateId: IdleStateId;

private currentCursorPos: PositionOnSequencer;
private edited: boolean;
private applyPreview: boolean;

private innerContext:
| {
targetNotesAtStart: Map<NoteId, Note>;
previewRequestId: number;
executePreviewProcess: boolean;
edited: boolean;
guideLineTicksAtStart: number;
}
| undefined;
Expand All @@ -53,7 +53,6 @@ export class ResizeNoteRightState
this.returnStateId = args.returnStateId;

this.currentCursorPos = args.cursorPosAtStart;
this.edited = false;
this.applyPreview = false;
}

Expand Down Expand Up @@ -87,7 +86,7 @@ export class ResizeNoteRightState
context.previewNotes.value = previewNotes.map((value) => {
return editedNotes.get(value.id) ?? value;
});
this.edited = true;
this.innerContext.edited = true;
}

context.guideLineTicks.value = newNoteEndPos;
Expand Down Expand Up @@ -126,6 +125,7 @@ export class ResizeNoteRightState
targetNotesAtStart: targetNotesMap,
executePreviewProcess: false,
previewRequestId,
edited: false,
guideLineTicksAtStart: guideLineTicks,
};
}
Expand All @@ -150,7 +150,7 @@ export class ResizeNoteRightState
input.mouseEvent.type === "mouseup" &&
mouseButton === "LEFT_BUTTON"
) {
this.applyPreview = this.edited;
this.applyPreview = this.innerContext.edited;
setNextState(this.returnStateId, undefined);
}
}
Expand Down

0 comments on commit 14ee6ed

Please sign in to comment.