Skip to content

Commit

Permalink
💄 Animated regenerating notebox in NONOTO
Browse files Browse the repository at this point in the history
  • Loading branch information
tbazin committed Oct 27, 2022
1 parent e08732b commit 9e417a4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
19 changes: 12 additions & 7 deletions packages/renderer/src/sheet/sheetInpainterGraphicalView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SheetInpainterGraphicalViewBase extends InpainterGraphicalView<
protected onClickTimestampBoxFactory(
timeStart: Fraction,
timeEnd: Fraction
): (event: PointerEvent) => void {
): (this: HTMLElement, event?: PointerEvent | MouseEvent) => Promise<void> {
// FIXME(theis) hardcoded 4/4 time-signature
const [timeRangeStart_quarter, timeRangeEnd_quarter] = [
timeStart,
Expand All @@ -139,14 +139,19 @@ class SheetInpainterGraphicalViewBase extends InpainterGraphicalView<
`time_range_end_quarter=${timeRangeEnd_quarter}`,
]

return () => {
const metadata = this.getMetadata()
// TODO(theis, 2021-08-10): use inpainter.inpaint method
void this.inpainter.inpaint(
[...this.queryParameters, ...timerangeQueryParameters],
const self = this
return async function (
this: HTMLElement,
event?: PointerEvent | MouseEvent
) {
this.classList.add('selected')
const metadata = self.getMetadata()
await self.inpainter.inpaint(
[...self.queryParameters, ...timerangeQueryParameters],
undefined,
metadata
)
this.classList.remove('selected')
}
}

Expand Down Expand Up @@ -341,7 +346,7 @@ class SheetInpainterGraphicalViewBase extends InpainterGraphicalView<
protected createTimeContainer(
divId: string,
duration_quarters: number,
onclick: (event?: PointerEvent) => void,
onclick: (this: HTMLElement, event?: PointerEvent | MouseEvent) => void,
timestamps: [Fraction, Fraction]
): HTMLElement {
// container for positioning the timestamp box and attached boxes
Expand Down
4 changes: 4 additions & 0 deletions packages/renderer/styles/mixins/_colors.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ $lighter-darkgray: color.scale(black, $lightness: +5%);
}
}

&.selected {
background-color: color.scale($accent-color, $alpha: -80%);
}

&.dragover::after {
background-color: $accent-color;
}
Expand Down
6 changes: 5 additions & 1 deletion packages/renderer/styles/overlays.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ $chords-font-stack: 'Boogaloo', cursive;
position: absolute;
opacity: 0;
}
&.selected {
animation: pulsing 0.5s alternate infinite;
opacity: 0.5;
}

&.active {
display: block;
opacity: 1;
display: block;
z-index: 1;
pointer-events: all;

Expand Down

0 comments on commit 9e417a4

Please sign in to comment.