diff --git a/src/store.js b/src/store.js index 955f66a..b5fe329 100644 --- a/src/store.js +++ b/src/store.js @@ -115,8 +115,8 @@ export function Congtiguous(inTest, inChan, inStim, inIsUser) { /** @type {Store.DrawPoint} */ const point = { - X: lookup[1]*100 + "%", - Y: (mark.Stim - inStim.Min)/(inStim.Max - inStim.Min) * 100 + "%", + X: lookup[1], + Y: (mark.Stim - inStim.Min)/(inStim.Max - inStim.Min), Mark: mark }; output.Points.push(point); diff --git a/src/ui.js b/src/ui.js index 56f709a..10468b5 100644 --- a/src/ui.js +++ b/src/ui.js @@ -1,11 +1,10 @@ -//@ts-check import React from "https://esm.sh/preact@10.11.3/compat"; import { html } from "https://esm.sh/htm@3.1.1/preact"; import { ColumnMapping } from "./store.js"; -/** @typedef {({children}:{children:React.ReactNode})=>JSX.Element} BasicElement */ +/** @typedef {({children}:{children?:preact.ComponentChildren})=>preact.VNode} BasicElement */ -/** @type {({children, icon, light, disabled, inactive, onClick}:{children:React.ReactNode, icon?:JSX.Element, light:boolean, disabled:boolean, inactive:boolean, onClick:()=>void})=>JSX.Element} */ +/** @type {({children, icon, light, disabled, inactive, onClick}:{children:preact.VNode, icon?:preact.VNode, light:boolean, disabled:boolean, inactive:boolean, onClick:()=>void})=>preact.VNode} */ export function Button({children, icon, light, disabled, inactive, onClick}) { const [FlashGet, FlashSet] = React.useState(0); @@ -39,14 +38,15 @@ export function Button({children, icon, light, disabled, inactive, onClick}) export function Chart({children}) { const inset = 20; - /** @type {Array} */ + /** @type {Array} */ const rules = []; ColumnMapping.forEach(([label, position, normal])=> { rules.push(html` ${label} - `); + ` + ); }); const dbMin = -10; @@ -56,8 +56,8 @@ export function Chart({children}) rules.push(html` - `); + ` + ); } return html`
@@ -76,14 +76,13 @@ export function Chart({children})
- - `; + `; } /** @type {Record} */ const Glyph = { - Arrow:({children})=> html` + Arrow:()=> html` `, @@ -99,14 +98,13 @@ const Glyph = { ${children}` }; -/** @type {({right, response, x, y}:{right:boolean, response?:boolean, x:string|number, y:string|number})=>JSX.Element} */ -export function Mark({right, response, x, y}) +/** @type {({right, response, x, y}:{right:boolean, response?:boolean, x:number, y:number})=>preact.VNode} */ +export const Mark =({right, response, x, y})=> { return html` - + <${ right ? Glyph.O : Glyph.X }> - ${ !response && html`<${Glyph.Arrow}/>` } + ${ !response && html`<${Glyph.Arrow}/>` } - - `; + `; } \ No newline at end of file