mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-13 23:37:30 +08:00
Small refactoring, several tests added
This commit is contained in:
@@ -69,8 +69,10 @@ export default class BlueprintTemplate extends ITemplate {
|
||||
const bounding = this.viewportElement.getBoundingClientRect()
|
||||
this.viewportSize[0] = bounding.width
|
||||
this.viewportSize[1] = bounding.height
|
||||
this.blueprint.requestUpdate()
|
||||
this.blueprint.updateComplete.then(() => this.centerContentInViewport())
|
||||
if (this.blueprint.nodes.length > 0) {
|
||||
this.blueprint.requestUpdate()
|
||||
this.blueprint.updateComplete.then(() => this.centerContentInViewport())
|
||||
}
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
@@ -186,6 +188,10 @@ export default class BlueprintTemplate extends ITemplate {
|
||||
))
|
||||
}
|
||||
|
||||
getCopyInputObject() {
|
||||
return this.getInputObject(Copy)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Number} x
|
||||
* @param {Number} y
|
||||
|
||||
@@ -31,6 +31,14 @@ export default class ITemplate {
|
||||
return /** @type {IInput[]} */([])
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {IInput} T
|
||||
* @param {new () => T} type
|
||||
*/
|
||||
getInputObject(type) {
|
||||
return /** @type {T} */(this.inputObjects.find(object => object.constructor == type))
|
||||
}
|
||||
|
||||
setup() {
|
||||
this.#inputObjects.forEach(v => v.setup())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user