Skip to content

Commit

Permalink
chore: detail log
Browse files Browse the repository at this point in the history
  • Loading branch information
hughfenghen committed Dec 18, 2024
1 parent 96dadac commit 959f8f5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions packages/av-cliper/src/combinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,14 @@ export class Combinator {
os: OffscreenSprite,
opts: { main?: boolean } = {},
): Promise<void> {
this.#log.info('Combinator add sprite', os);
const logAttrs = {
rect: pick(['x', 'y', 'w', 'h'], os.rect),
time: { ...os.time },
zIndex: os.zIndex,
};
this.#log.info('Combinator add sprite', logAttrs);
const newOS = await os.clone();
this.#log.info('Combinator add sprite ready', os);
this.#log.info('Combinator add sprite ready');
this.#sprites.push(
Object.assign(newOS, {
main: opts.main ?? false,
Expand Down Expand Up @@ -519,3 +524,13 @@ export function createAudioTrackBuf(adFrames: number) {
return getAudioData(ts);
};
}

function pick<K extends keyof T, T extends object>(keys: K[], obj: T) {
return keys.reduce(
(acc, key) => {
acc[key] = obj[key];
return acc;
},
{} as Record<K, T[K]>,
);
}

0 comments on commit 959f8f5

Please sign in to comment.