mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
Fix node selection
This commit is contained in:
14
dist/ueblueprint.js
vendored
14
dist/ueblueprint.js
vendored
@@ -5670,10 +5670,11 @@ class NodeElement extends ISelectableDraggableElement {
|
||||
boundComments = []
|
||||
#commentDragged = false
|
||||
#commentDragHandler = e => {
|
||||
// If selected, it will already drag, also must check if under nested comments, it must drag just once
|
||||
if (!this.selected && !this.#commentDragged) {
|
||||
this.addLocation(e.detail.value); // if selected it will already move
|
||||
this.#commentDragged = true;
|
||||
this.addNextUpdatedCallbacks(() => this.#commentDragged = false);
|
||||
this.addLocation(e.detail.value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6250,14 +6251,13 @@ class Blueprint extends IElement {
|
||||
waitingExpandUpdate = false
|
||||
/** @param {NodeElement} node */
|
||||
nodeBoundariesSupplier = node => {
|
||||
let gridRect = this.nodesContainerElement.getBoundingClientRect();
|
||||
const scaleCorrection = 1 / this.getScale();
|
||||
this.nodesContainerElement.getBoundingClientRect();
|
||||
return /** @type {BoundariesInfo} */ {
|
||||
primaryInf: (node.leftBoundary() - gridRect.left) * scaleCorrection,
|
||||
primarySup: (node.rightBoundary() - gridRect.right) * scaleCorrection,
|
||||
primaryInf: node.leftBoundary(),
|
||||
primarySup: node.rightBoundary(),
|
||||
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
||||
secondaryInf: (node.topBoundary() - gridRect.top) * scaleCorrection,
|
||||
secondarySup: (node.bottomBoundary() - gridRect.bottom) * scaleCorrection
|
||||
secondaryInf: node.topBoundary(),
|
||||
secondarySup: node.bottomBoundary(),
|
||||
}
|
||||
}
|
||||
/** @type {(node: NodeElement, selected: Boolean) => void}} */
|
||||
|
||||
2
dist/ueblueprint.min.js
vendored
2
dist/ueblueprint.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -101,13 +101,12 @@ export default class Blueprint extends IElement {
|
||||
/** @param {NodeElement} node */
|
||||
nodeBoundariesSupplier = node => {
|
||||
let gridRect = this.nodesContainerElement.getBoundingClientRect()
|
||||
const scaleCorrection = 1 / this.getScale()
|
||||
return /** @type {BoundariesInfo} */ {
|
||||
primaryInf: (node.leftBoundary() - gridRect.left) * scaleCorrection,
|
||||
primarySup: (node.rightBoundary() - gridRect.right) * scaleCorrection,
|
||||
primaryInf: node.leftBoundary(),
|
||||
primarySup: node.rightBoundary(),
|
||||
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
||||
secondaryInf: (node.topBoundary() - gridRect.top) * scaleCorrection,
|
||||
secondarySup: (node.bottomBoundary() - gridRect.bottom) * scaleCorrection
|
||||
secondaryInf: node.topBoundary(),
|
||||
secondarySup: node.bottomBoundary(),
|
||||
}
|
||||
}
|
||||
/** @type {(node: NodeElement, selected: Boolean) => void}} */
|
||||
|
||||
@@ -82,10 +82,11 @@ export default class NodeElement extends ISelectableDraggableElement {
|
||||
boundComments = []
|
||||
#commentDragged = false
|
||||
#commentDragHandler = e => {
|
||||
// If selected, it will already drag, also must check if under nested comments, it must drag just once
|
||||
if (!this.selected && !this.#commentDragged) {
|
||||
this.addLocation(e.detail.value) // if selected it will already move
|
||||
this.#commentDragged = true
|
||||
this.addNextUpdatedCallbacks(() => this.#commentDragged = false)
|
||||
this.addLocation(e.detail.value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user