11// scale.js — OscillaScore Scale Cue (uniform & non-uniform)
22
33import { registerAnimation } from "./oscillaAnimation.js" ;
4- import { scheduleCueStart } from "./oscillaCueDispatcher.js" ;
4+ import { scheduleCueStart } from "./oscillaCueDispatcher.js" ;
5+ import { createHitLabel , repositionAllHitLabels } from "./oscillaHitLabels.js" ;
56
67import {
7- applyPrestateBeforeStart ,
8- applyPrestateOnStart
8+ applyPrestateBeforeStart ,
9+ applyPrestateOnStart
910} from "./oscillaAnimationShared.js" ;
1011
1112// ============================================================
@@ -292,7 +293,7 @@ export function handleScaleSequence(el, cfg) {
292293 mode = String ( val ) . trim ( ) . toLowerCase ( ) ;
293294 if ( mode === "alt" ) mode = "alternate" ; // ← alias support restored
294295 break ;
295- }
296+ }
296297 case "pauseOnExit" : pauseOnExit = Boolean ( val ) ; break ;
297298 case "interp" : interp = String ( val ) . trim ( ) . toLowerCase ( ) ; break ;
298299 case "ease" : ease = String ( val ) . trim ( ) ; break ;
@@ -587,7 +588,7 @@ export function handleScaleCue(ast, el, options = {}) {
587588 if ( key === "uid" ) uid = String ( val ) . trim ( ) ;
588589 if ( key === "trig" ) trig = String ( val ) . toLowerCase ( ) ;
589590 if ( key === "tdelay" ) cfgStartDelay = Number ( val ) || 0 ;
590- if ( key === "prestate" ) prestate = val ;
591+ if ( key === "prestate" ) prestate = val ;
591592 }
592593
593594 console . log ( "[scaleCue] Parsed →" , {
@@ -637,9 +638,9 @@ export function handleScaleCue(ast, el, options = {}) {
637638 function applyInitialScale ( cfg ) {
638639 try {
639640 const sx = cfg . xValues ? cfg . xValues [ 0 ] :
640- cfg . values ? cfg . values [ 0 ] : 1 ;
641+ cfg . values ? cfg . values [ 0 ] : 1 ;
641642 const sy = cfg . yValues ? cfg . yValues [ 0 ] :
642- cfg . values ? cfg . values [ 0 ] : sx ;
643+ cfg . values ? cfg . values [ 0 ] : sx ;
643644 el . style . transform = `scale(${ sx } , ${ sy } )` ;
644645 } catch ( e ) {
645646 console . warn ( "[scaleCue] Could not apply initial scale:" , e ) ;
@@ -690,6 +691,11 @@ export function handleScaleCue(ast, el, options = {}) {
690691 ) ;
691692
692693 registerAnimation ( el , "scale-sequence-pattern" , cfg , start ) ;
694+ createHitLabel ( el , "scale" , cfg . uid , {
695+ anchorMode : "midpoint" ,
696+ color : "lime"
697+ } ) ;
698+
693699 if ( shouldStartNow ) start ( ) ;
694700 return ;
695701 }
@@ -709,6 +715,11 @@ export function handleScaleCue(ast, el, options = {}) {
709715 ) ;
710716
711717 registerAnimation ( el , "scale-sequence-uniform" , cfg , start ) ;
718+ createHitLabel ( el , "scale" , cfg . uid , {
719+ anchorMode : "midpoint" ,
720+ color : "lime"
721+ } ) ;
722+
712723 if ( shouldStartNow ) start ( ) ;
713724 return ;
714725 }
@@ -739,6 +750,11 @@ export function handleScaleCue(ast, el, options = {}) {
739750 ) ;
740751
741752 registerAnimation ( el , "scale-sequence-xy" , cfg , start ) ;
753+ createHitLabel ( el , "scale" , cfg . uid , {
754+ anchorMode : "midpoint" ,
755+ color : "lime"
756+ } ) ;
757+
742758 if ( shouldStartNow ) start ( ) ;
743759 return ;
744760 }
@@ -764,6 +780,11 @@ export function handleScaleCue(ast, el, options = {}) {
764780 ) ;
765781
766782 registerAnimation ( el , "scale-continuous" , cfg , start ) ;
783+ createHitLabel ( el , "scale" , cfg . uid , {
784+ anchorMode : "midpoint" ,
785+ color : "lime"
786+ } ) ;
787+
767788 if ( shouldStartNow ) start ( ) ;
768789 return ;
769790 }
@@ -781,6 +802,11 @@ export function handleScaleCue(ast, el, options = {}) {
781802 ) ;
782803
783804 registerAnimation ( el , "scale-continuous" , cfg , start ) ;
805+ createHitLabel ( el , "scale" , cfg . uid , {
806+ anchorMode : "midpoint" ,
807+ color : "lime"
808+ } ) ;
809+
784810 if ( shouldStartNow ) start ( ) ;
785811}
786812
0 commit comments