Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed May 1, 2022
1 parent 5f77dcb commit 79c9292
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions libs/core/src/lib/abstracts/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ export abstract class NgtObject<
* This function is also called outside of Angular Zone
* @protected
*/
// eslint-disable-next-line @typescript-eslint/no-empty-function
protected get preObjectInit(): NgtPreObjectInit {
return undefined;
}
Expand Down Expand Up @@ -426,8 +425,6 @@ export abstract class NgtObject<

// append to parent
if (is.object3d(this.instance.value)) {
// appendToParent is late a frame due to appendTo
// only emit the object is ready after it's been added to the scene
this.appendToParent();
}

Expand Down Expand Up @@ -463,6 +460,8 @@ export abstract class NgtObject<
}

private appendToParent(): void {
// appendToParent is late a frame due to appendTo
// only emit the object is ready after it's been added to the scene
requestAnimationFrame(() => {
const appendToRef = this.get((s) => s.appendTo);
if (appendToRef && appendToRef.value) {
Expand Down Expand Up @@ -571,6 +570,7 @@ export abstract class NgtObject<
>
>[0]
) => {
// go back into Angular Zone so that state updates on these events trigger CD
this.zone.run(() => {
controllerEvent.emit(event as NgtEvent<any>);
});
Expand Down
3 changes: 1 addition & 2 deletions libs/core/src/lib/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,13 @@ export class NgtCanvas extends NgtComponentStore implements OnInit {
this.store.get()
);

// init canvas
this.store.init(
this.rendererCanvas.nativeElement,
rootStateMap,
invalidate,
advance
);
// onCanvasReady -> init loop

this.onCanvasReady(this.store.ready$, () => {
const canvasState = this.store.get();
this.created.emit(canvasState);
Expand Down
8 changes: 4 additions & 4 deletions libs/core/src/lib/portal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { CommonModule } from '@angular/common';
import { Observable, tap } from 'rxjs';
import * as THREE from 'three';
import {
ChangeDetectionStrategy,
Component,
Expand All @@ -14,6 +12,8 @@ import {
SkipSelf,
TemplateRef,
} from '@angular/core';
import { Observable, tap } from 'rxjs';
import * as THREE from 'three';
import { NgtInstance, NgtInstanceState } from './abstracts/instance';
import { Ref } from './ref';
import { NgtResize, NgtResizeResult } from './services/resize';
Expand All @@ -26,10 +26,10 @@ import {
NGT_OBJECT_REF,
NGT_SCENE_REF,
} from './tokens';
import { AnyFunction, NgtEventManager, NgtSize, NgtState } from './types';
import type { AnyFunction, NgtEventManager, NgtSize, NgtState } from './types';
import { updateCamera } from './utils/camera';
import { prepare } from './utils/instance';
import { makeDpr } from './utils/make';
import { updateCamera } from './utils/camera';

export const privateKeys = [
'events',
Expand Down

0 comments on commit 79c9292

Please sign in to comment.