mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-18 03:27:32 +08:00
Various fixes
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {import("../Blueprint").default} Blueprint
|
||||
* @typedef {import("../entity/IEntity").default} IEntity
|
||||
@@ -53,12 +55,12 @@ export default class IElement extends HTMLElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {} T
|
||||
* @param {new () => T} type
|
||||
* @template {IContext} T
|
||||
* @param {new (...args: any[]) => T} type
|
||||
* @returns {T}
|
||||
*/
|
||||
getInputObject(type) {
|
||||
return this.inputObjects.find(object => object.constructor == type)
|
||||
return /** @type {T} */ (this.inputObjects.find(object => object.constructor == type))
|
||||
}
|
||||
|
||||
// Subclasses will want to override
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
// @ts-check
|
||||
|
||||
import Configuration from "../Configuration"
|
||||
import IElement from "./IElement"
|
||||
import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
|
||||
|
||||
/** @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate */
|
||||
|
||||
/**
|
||||
* @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate
|
||||
*/
|
||||
export default class ISelectableDraggableElement extends IElement {
|
||||
|
||||
constructor(...args) {
|
||||
// @ts-expect-error
|
||||
super(...args)
|
||||
this.dragObject = null
|
||||
this.location = [0, 0]
|
||||
@@ -28,6 +32,9 @@ export default class ISelectableDraggableElement extends IElement {
|
||||
]
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Number[]} value
|
||||
*/
|
||||
setLocation(value = [0, 0]) {
|
||||
const d = [value[0] - this.location[0], value[1] - this.location[1]]
|
||||
const dragLocalEvent = new CustomEvent(Configuration.nodeDragLocalEventName, {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import Configuration from "../Configuration"
|
||||
import IElement from "./IElement"
|
||||
import LinkTemplate from "../template/LinkTemplate"
|
||||
@@ -86,7 +88,7 @@ export default class LinkElement extends IElement {
|
||||
/**
|
||||
* @param {Number[]} location
|
||||
*/
|
||||
setSourceLocation(location) {
|
||||
setSourceLocation(location = null) {
|
||||
if (location == null) {
|
||||
location = this.#source.template.getLinkLocation(this.#source)
|
||||
}
|
||||
@@ -115,7 +117,7 @@ export default class LinkElement extends IElement {
|
||||
/**
|
||||
* @param {Number[]} location
|
||||
*/
|
||||
setDestinationLocation(location) {
|
||||
setDestinationLocation(location = null) {
|
||||
if (location == null) {
|
||||
location = this.#destination.template.getLinkLocation(this.#destination)
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// @ts-check
|
||||
|
||||
import IElement from "./IElement"
|
||||
import LinkMessageTemplate from "../template/LinkMessageTemplate"
|
||||
|
||||
/**
|
||||
* @typedef {import("./PinElement").default} PinElement
|
||||
* @typedef {import("./LinkElement").default} LinkElement
|
||||
* @typedef {(sourcePin: PinElement, sourcePin: PinElement) => String} LinkRetrieval
|
||||
* @typedef {(sourcePin: PinElement, destinationPin: PinElement) => String} LinkRetrieval
|
||||
*/
|
||||
export default class LinkMessageElement extends IElement {
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import Configuration from "../Configuration"
|
||||
import ISelectableDraggableElement from "./ISelectableDraggableElement"
|
||||
import NodeTemplate from "../template/NodeTemplate"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import IElement from "./IElement"
|
||||
import MouseCreateLink from "../input/mouse/MouseCreateLink"
|
||||
import PinTemplate from "../template/PinTemplate"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
import FastSelectionModel from "../selection/FastSelectionModel"
|
||||
import IElement from "./IElement"
|
||||
import SelectorTemplate from "../template/SelectorTemplate"
|
||||
|
||||
Reference in New Issue
Block a user