diff --git a/src/app.js b/src/app.js index 0fc1cdf..4dce494 100644 --- a/src/app.js +++ b/src/app.js @@ -64,7 +64,19 @@ const Audiogram =()=> ${testMarksL}${testLinesL} ${testMarksR}${testLinesR} ${userMarksL}${userLinesL} - ${userMarksR}${userLinesR}`; + ${userMarksR}${userLinesR} + + + + + + + + + + + + `; }; React.render(html` diff --git a/src/store.js b/src/store.js index e15317a..9f61a19 100644 --- a/src/store.js +++ b/src/store.js @@ -28,8 +28,6 @@ export const ColumnLookup =(inFrequency)=> /** @type {(freq:Store.TestFrequency, chan:number, user:boolean)=>Store.TestFrequencySample|undefined} */ export const MarkGet =(freq, chan, user)=> freq[/** @type {Store.PlotKey} */ (`${user ? "User" : "Test"}${chan ? "R" : "L"}`)]; -/** @type {(freq:Store.TestFrequency, chan:number, mark:Store.TestFrequencySample|undefined)=>Store.TestFrequencySample|undefined} */ -export const MarkSet =(freq, chan, mark)=> freq[ chan ? "UserR" : "UserL" ] = mark; /** @type {Store.State} */ export const Initial = @@ -67,74 +65,65 @@ export const Initial = ] }; -/** @type {Record} */ -const Update = + +/** @type {(inState:Store.State, inTest?:Store.Test)=>Store.Context} */ +const Reselect =(inState, inTest)=> { - Freq(inState) + /** @type {Store.Context} */ + const output = { Test:inTest??inState.Live.Test }; + const column = ColumnMapping[inState.Freq.Value]; + if(column && inState.Live.Test) { - const column = ColumnMapping[inState.Freq.Value]; - if(column && inState.Live.Test) + const hz = column[0]; + for(let i=0; iStore.DrawGroup} */ -export function Congtiguous(inTest, inChan, inStim, inIsUser) +/** @type {(inTest:Store.Test|undefined, inChan:number, inStim:Store.Range, inIsUser:boolean)=>Store.DrawGroup} */ +const Redraw =(inTest, inChan, inStim, inIsUser)=> { /** @type {Store.DrawGroup} */ const output = {Points:[], Paths:[]}; - let plot; - for(let i=0; ipreact.VNode} BasicElement */ @@ -37,10 +37,11 @@ export function Button({children, icon, light, disabled, inactive, onClick}) /** @type {BasicElement} */ export function Chart({children}) { + const [State] = Store.Consumer(); const inset = 20; /** @type {Array} */ const rules = []; - ColumnMapping.forEach(([label, position, normal])=> + Store.ColumnMapping.forEach(([label, position, normal])=> { rules.push(html` @@ -49,12 +50,10 @@ export function Chart({children}) ); }); - const dbMin = -10; - const dbMax = 120; - for(let db = dbMin; db <= dbMax; db+=10) + for(let db = State.Stim.Min; db <= State.Stim.Max; db+=10) { rules.push(html` -