-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redesign timeline to look more like stable
- Loading branch information
1 parent
c99e798
commit 22a326d
Showing
16 changed files
with
225 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/common/src/editor/ui/timeline/hitObjects/TimelineHitObjectCircle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import type { ReadonlyDependencyContainer } from 'osucad-framework'; | ||
import type { Color } from 'pixi.js'; | ||
import type { TimelineHitObjectBlueprint } from './TimelineHitObjectBlueprint'; | ||
import { Anchor, Axes, Bindable, BindableBoolean, CompositeDrawable, DrawableSprite, FillMode, resolved } from 'osucad-framework'; | ||
import { ISkinSource } from '../../../../skinning/ISkinSource'; | ||
|
||
export class TimelineHitObjectCircle extends CompositeDrawable { | ||
constructor(readonly blueprint: TimelineHitObjectBlueprint) { | ||
super(); | ||
|
||
this.relativeSizeAxes = Axes.Both; | ||
this.fillMode = FillMode.Fit; | ||
} | ||
|
||
protected circle!: DrawableSprite; | ||
|
||
protected overlay!: DrawableSprite; | ||
|
||
protected selectionOverlay!: DrawableSprite; | ||
|
||
@resolved(ISkinSource) | ||
protected skin!: ISkinSource; | ||
|
||
protected readonly accentColor = new Bindable<Color>(null!); | ||
|
||
protected readonly selected = new BindableBoolean(); | ||
|
||
protected override load(dependencies: ReadonlyDependencyContainer) { | ||
super.load(dependencies); | ||
|
||
const scaleCorrection = 64 / 60; | ||
|
||
this.addAllInternal( | ||
this.circle = new DrawableSprite({ | ||
relativeSizeAxes: Axes.Both, | ||
texture: this.skin.getTexture('hitcircle'), | ||
anchor: Anchor.Center, | ||
origin: Anchor.Center, | ||
scale: scaleCorrection, | ||
}), | ||
this.overlay = new DrawableSprite({ | ||
relativeSizeAxes: Axes.Both, | ||
texture: this.skin.getTexture('hitcircleoverlay'), | ||
anchor: Anchor.Center, | ||
origin: Anchor.Center, | ||
scale: scaleCorrection, | ||
}), | ||
this.selectionOverlay = new DrawableSprite({ | ||
relativeSizeAxes: Axes.Both, | ||
texture: this.skin.getTexture('hitcircleselect'), | ||
anchor: Anchor.Center, | ||
origin: Anchor.Center, | ||
scale: scaleCorrection, | ||
}), | ||
); | ||
|
||
this.accentColor.bindTo(this.blueprint.accentColor); | ||
this.selected.bindTo(this.blueprint.selected); | ||
} | ||
|
||
protected override loadComplete() { | ||
super.loadComplete(); | ||
|
||
this.accentColor.addOnChangeListener(color => this.updateColor(color.value), { immediate: true }); | ||
this.selected.addOnChangeListener(selected => this.selectionOverlay.alpha = selected.value ? 1 : 0, { immediate: true }); | ||
} | ||
|
||
protected updateColor(color: Color) { | ||
this.circle.color = color; | ||
} | ||
} |
Oops, something went wrong.