mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-10 23:50:00 +00:00
[3d] refactor legacy code by using new vue style (#3161)
This commit is contained in:
@@ -3,6 +3,7 @@ import { toRaw } from 'vue'
|
||||
|
||||
import Load3d from '@/extensions/core/load3d/Load3d'
|
||||
import Load3dAnimation from '@/extensions/core/load3d/Load3dAnimation'
|
||||
import type { CustomInputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2'
|
||||
|
||||
export class Load3dService {
|
||||
private static instance: Load3dService
|
||||
@@ -20,7 +21,7 @@ export class Load3dService {
|
||||
registerLoad3d(
|
||||
node: LGraphNode,
|
||||
container: HTMLElement,
|
||||
type: 'Load3D' | 'Load3DAnimation' | 'Preview3D' | 'Preview3DAnimation'
|
||||
inputSpec: CustomInputSpec
|
||||
) {
|
||||
const rawNode = toRaw(node)
|
||||
|
||||
@@ -28,15 +29,15 @@ export class Load3dService {
|
||||
this.removeLoad3d(rawNode)
|
||||
}
|
||||
|
||||
const type = inputSpec.type
|
||||
|
||||
const isAnimation = type.includes('Animation')
|
||||
|
||||
const Load3dClass = isAnimation ? Load3dAnimation : Load3d
|
||||
|
||||
const isPreview = type.includes('Preview')
|
||||
|
||||
const instance = new Load3dClass(container, {
|
||||
createPreview: !isPreview,
|
||||
node: rawNode
|
||||
node: rawNode,
|
||||
inputSpec: inputSpec
|
||||
})
|
||||
|
||||
rawNode.onMouseEnter = function () {
|
||||
|
||||
Reference in New Issue
Block a user