mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-12 22:47:30 +08:00
Fix comments dragging nodes
This commit is contained in:
@@ -62,26 +62,26 @@ export default class IDraggableElement extends IElement {
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
setLocation([x, y]) {
|
||||
setLocation([x, y], acknowledge = true) {
|
||||
const d = [x - this.locationX, y - this.locationY]
|
||||
this.locationX = x
|
||||
this.locationY = y
|
||||
if (this.blueprint) {
|
||||
if (this.blueprint && acknowledge) {
|
||||
// @ts-expect-error
|
||||
const dragLocalEvent = new CustomEvent(this.constructor.dragEventName, {
|
||||
detail: {
|
||||
value: d,
|
||||
},
|
||||
bubbles: false,
|
||||
cancelable: true
|
||||
cancelable: true,
|
||||
})
|
||||
this.dispatchEvent(dragLocalEvent)
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {Number[]} param0 */
|
||||
addLocation([x, y]) {
|
||||
this.setLocation([this.locationX + x, this.locationY + y])
|
||||
addLocation([x, y], acknowledge = true) {
|
||||
this.setLocation([this.locationX + x, this.locationY + y], acknowledge)
|
||||
}
|
||||
|
||||
/** @param {Number[]} value */
|
||||
|
||||
@@ -199,7 +199,8 @@ export default class LinkElement extends IFromToPositionedElement {
|
||||
if (location == null) {
|
||||
const self = this
|
||||
if (!this.hasUpdated || !this.destinationPin.hasUpdated) {
|
||||
Promise.all([this.updateComplete, this.destinationPin.updateComplete]).then(() => self.setDestinationLocation())
|
||||
Promise.all([this.updateComplete, this.destinationPin.updateComplete])
|
||||
.then(() => self.setDestinationLocation())
|
||||
return
|
||||
}
|
||||
location = this.destinationPin.template.getLinkLocation()
|
||||
|
||||
@@ -111,7 +111,7 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
this.sizeX = this.entity.NodeWidth.value
|
||||
this.sizeY = this.entity.NodeHeight.value
|
||||
} else {
|
||||
Promise.all([this.updateComplete, ...this.#pins.map(p => p.updateComplete)]).then(() => this.computeSizes())
|
||||
this.updateComplete.then(() => this.computeSizes())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,9 +132,13 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
return new NodeElement(entity)
|
||||
}
|
||||
|
||||
getUpdateComplete() {
|
||||
return Promise.all([super.getUpdateComplete(), ...this.#pins.map(pin => pin.updateComplete)]).then(() => true)
|
||||
}
|
||||
|
||||
/** @param {NodeElement} commentNode */
|
||||
bindToComment(commentNode) {
|
||||
if (!this.boundComments.includes(commentNode)) {
|
||||
if (commentNode != this && !this.boundComments.includes(commentNode)) {
|
||||
commentNode.addEventListener(Configuration.nodeDragEventName, this.#commentDragHandler)
|
||||
this.boundComments.push(commentNode)
|
||||
}
|
||||
@@ -219,13 +223,13 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
return this.entity.CustomProperties.filter(v => v instanceof PinEntity)
|
||||
}
|
||||
|
||||
setLocation(value = [0, 0]) {
|
||||
setLocation(value = [0, 0], acknowledge = true) {
|
||||
let nodeConstructor = this.entity.NodePosX.constructor
|
||||
// @ts-expect-error
|
||||
this.entity.NodePosX = new nodeConstructor(value[0])
|
||||
// @ts-expect-error
|
||||
this.entity.NodePosY = new nodeConstructor(value[1])
|
||||
super.setLocation(value)
|
||||
super.setLocation(value, acknowledge)
|
||||
}
|
||||
|
||||
acknowledgeDelete() {
|
||||
|
||||
Reference in New Issue
Block a user