All keyframe operations now snap to the frame grid

This commit is contained in:
Aria Minaei 2021-08-09 11:31:37 +02:00
parent 2ec6a54060
commit d46e0bfd2f
8 changed files with 51 additions and 17 deletions

View file

@ -97,11 +97,13 @@ export default class Sequence {
return this.closestGridPosition(this.position)
}
closestGridPosition(posInUnitSpace: number): number {
closestGridPosition = (posInUnitSpace: number): number => {
const subUnitsPerUnit = this.subUnitsPerUnit
const gridLength = 1 / subUnitsPerUnit
return Math.round(posInUnitSpace / gridLength) * gridLength
return parseFloat(
(Math.round(posInUnitSpace / gridLength) * gridLength).toFixed(3),
)
}
set position(requestedPosition: number) {