-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pre-release): merge #301 from
dev
### Description - refactor(reactive): improve debug resources
- Loading branch information
Showing
18 changed files
with
457 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
"@quick-threejs/reactive": patch | ||
--- | ||
|
||
# Logs | ||
|
||
## refactor(reactive): improve debug resources | ||
|
||
- Add new register props | ||
- `enableControls` | ||
- `withCameraHelper` | ||
- `miniCamera` is now under **Debug** scope | ||
- Fix debug props usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,12 +36,12 @@ | |
"prettier": "^3.4.2", | ||
"turbo": "latest", | ||
"typescript": "^5.6.3", | ||
"typescript-eslint": "^8.10.0", | ||
"typescript-eslint": "^8.19.1", | ||
"vite": "^6.0.3", | ||
"vite-plugin-dts": "^4.3.0" | ||
}, | ||
"dependencies": { | ||
"@changesets/cli": "^2.27.9" | ||
"@changesets/cli": "^2.27.11" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,84 @@ | ||
import { Subscription } from "rxjs"; | ||
import { PerspectiveCamera } from "three"; | ||
import { inject, singleton } from "tsyringe"; | ||
|
||
import { Module } from "../../../common/interfaces/module.interface"; | ||
import { Module, AppModulePropsMessageEvent } from "../../../common"; | ||
|
||
import { DebugService } from "./debug.service"; | ||
import { DebugController } from "./debug.controller"; | ||
|
||
@singleton() | ||
export class DebugModule implements Module { | ||
private readonly _subscriptions: Subscription[] = []; | ||
|
||
constructor( | ||
@inject(DebugService) public readonly _service: DebugService, | ||
@inject(DebugController) public readonly _controller: DebugController | ||
) { | ||
this._controller.step$.subscribe(() => { | ||
this._service.update(); | ||
}); | ||
) {} | ||
|
||
public init(props: AppModulePropsMessageEvent["data"]) { | ||
this._service.enabled = !!props.enableDebug; | ||
|
||
if (!this._service.enabled) return; | ||
|
||
if (props.withMiniCamera) this._service.initMiniCamera(); | ||
|
||
if (props.enableControls) { | ||
this._service.initOrbitControl(); | ||
this._service.initMiniCameraOrbitControls(); | ||
} | ||
|
||
if (props.withCameraHelper) this._service.initCameraHelper(); | ||
|
||
if (typeof props?.axesSizes === "number") | ||
this._service.initAxesHelper(props.axesSizes); | ||
|
||
if (typeof props?.gridSizes === "number") | ||
this._service.initGridHelper(props.gridSizes); | ||
|
||
this._subscriptions.push( | ||
this._controller.step$.subscribe(() => { | ||
this._service.update(); | ||
}) | ||
); | ||
} | ||
|
||
public step$() { | ||
return this._controller.step$; | ||
public enabled(value?: boolean) { | ||
if (value) this._service.enabled = value; | ||
return this._service.enabled; | ||
} | ||
|
||
public init(props?: Parameters<DebugService["activate"]>[0]) { | ||
this._service.activate(props); | ||
public miniCamera(value?: PerspectiveCamera) { | ||
if (value) this._service.miniCamera = value; | ||
return this._service.miniCamera; | ||
} | ||
|
||
public axesHelper() { | ||
public getAxesHelper() { | ||
return this._service.axesHelper; | ||
} | ||
|
||
public cameraControls() { | ||
public getCameraControls() { | ||
return this._service.cameraControls; | ||
} | ||
|
||
public cameraHelper() { | ||
public getCameraHelper() { | ||
return this._service.cameraHelper; | ||
} | ||
|
||
public enabled(value?: boolean) { | ||
if (value) this._service.enabled = value; | ||
return this._service.enabled; | ||
} | ||
|
||
public gridHelper() { | ||
public getGridHelper() { | ||
return this._service.gridHelper; | ||
} | ||
|
||
public miniCameraControls() { | ||
public getMiniCameraControls() { | ||
return this._service.miniCameraControls; | ||
} | ||
|
||
public getStep$() { | ||
return this._controller.step$; | ||
} | ||
|
||
public dispose() { | ||
this._service.deactivate(); | ||
this._service.dispose(); | ||
this._subscriptions.forEach((sub) => sub.unsubscribe()); | ||
} | ||
} |
Oops, something went wrong.