Fix node selection

This commit is contained in:
barsdeveloper
2022-12-12 21:57:50 +01:00
parent 16a00b409c
commit 88a1becb58
4 changed files with 14 additions and 14 deletions

14
dist/ueblueprint.js vendored
View File

@@ -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}} */

File diff suppressed because one or more lines are too long

View File

@@ -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}} */

View File

@@ -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)
}
}