Skip to content

Commit

Permalink
Fix some typos
Browse files Browse the repository at this point in the history
  • Loading branch information
reindernijhoff committed Aug 5, 2024
1 parent cc6d7ca commit c7bd49a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
14 changes: 7 additions & 7 deletions src/lib/FastImageSequence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export class FastImageSequence {
public sources: ImageSource[] = [];

private context: CanvasRenderingContext2D;
private tickFuncs: ((dt: number) => void) [] = [];
private tickFunctions: ((dt: number) => void) [] = [];
private startTime: number = -1;
private animationRequestId: number = 0;
private container: HTMLElement;
private resizeObserver: ResizeObserver;
private mutationOberver: MutationObserver;
private mutationObserver: MutationObserver;
private clearCanvas: boolean = true;
private speed: number = 0;
private prevFrame: number = 0;
Expand Down Expand Up @@ -130,13 +130,13 @@ export class FastImageSequence {
});
this.resizeObserver.observe(this.canvas);

this.mutationOberver = new MutationObserver(() => {
this.mutationObserver = new MutationObserver(() => {
if (!this.container.isConnected) {
console.error('FastImageSequence: container is not connected to the DOM, fast image sequence will be destroyed');
this.destruct();
}
});
this.mutationOberver.observe(container, {childList: true});
this.mutationObserver.observe(container, {childList: true});

// init all frames
this.frames = Array.from({length: this.options.frames}, (_, index) => new Frame(index));
Expand Down Expand Up @@ -243,7 +243,7 @@ export class FastImageSequence {
* @param func - The function to be called.
*/
public tick(func: (dt: number) => void) {
this.tickFuncs.push(func);
this.tickFunctions.push(func);
}

/**
Expand Down Expand Up @@ -310,7 +310,7 @@ export class FastImageSequence {
}

this.resizeObserver.disconnect();
this.mutationOberver.disconnect();
this.mutationObserver.disconnect();

this.container.removeChild(this.canvas);
if (this.logElement) {
Expand Down Expand Up @@ -428,7 +428,7 @@ export class FastImageSequence {

this.process();

this.tickFuncs.forEach(func => func(dt));
this.tickFunctions.forEach(func => func(dt));

this.prevFrame = this.frame;
this.animationRequestId = requestAnimationFrame(time => this.drawingLoop(time));
Expand Down
23 changes: 12 additions & 11 deletions src/lib/LogToScreen.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
export function createLogElement() {
const logElement = document.createElement('div');
const logElement = document.createElement('pre');
Object.assign(logElement.style, {
position: 'absolute',
top: '0',
left: '0',
position: 'absolute',
top: '0',
left: '0',
backgroundColor: 'rgba(0, 0, 0, 0.5)',
color: 'white',
padding: '8px',
fontSize: '12px',
zIndex: '1000',
lineHeight: '20px'
color: 'white',
padding: '8px',
fontSize: '12px',
zIndex: '1000',
lineHeight: '20px',
margin: 0,
maxWidth: 'calc(100% - 16px)',
});

return logElement;
}

export function logToScreen(logElement: HTMLElement, log: string) {
logElement.innerHTML = `<pre>${log}</pre>`;
logElement.innerText = `${log}`;
}

0 comments on commit c7bd49a

Please sign in to comment.