rep: pull out renderDuration()

master
Rob Pilling 2023-05-25 23:19:15 +01:00
parent 75c6972f3f
commit e83b582928
1 changed files with 40 additions and 38 deletions

View File

@ -31,23 +31,7 @@ let state: State | undefined;
let drawInterval: IntervalId | undefined;
let lastRepIndex: number | null = null;
const layout = new Layout({
type: "v",
c: [
{
id: "repIdx",
type: "txt",
label: "Begin",
font: `Vector:${fontSzRepDesc}`,
},
{
id: "duration",
lazyBuster: 1,
type: "custom",
font: `Vector:${fontSzMain}` as FontNameWithScaleFactor,
fillx: 1,
filly: 1,
render: (l: Layout.RenderedHierarchy) => {
const renderDuration = (l: Layout.RenderedHierarchy) => {
let lbl;
g.clearRect(l.x, l.y, l.x+l.w, l.y+l.h);
@ -84,7 +68,25 @@ const layout = new Layout({
l.x+(l.w>>1),
l.y+(l.h>>1)
);
};
const layout = new Layout({
type: "v",
c: [
{
id: "repIdx",
type: "txt",
label: "Begin",
font: `Vector:${fontSzRepDesc}`,
},
{
id: "duration",
lazyBuster: 1,
type: "custom",
font: `Vector:${fontSzMain}` as FontNameWithScaleFactor,
fillx: 1,
filly: 1,
render: renderDuration,
},
{
type: "txt",