mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-22 22:27:30 +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 = []
|
boundComments = []
|
||||||
#commentDragged = false
|
#commentDragged = false
|
||||||
#commentDragHandler = e => {
|
#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) {
|
if (!this.selected && !this.#commentDragged) {
|
||||||
this.addLocation(e.detail.value); // if selected it will already move
|
|
||||||
this.#commentDragged = true;
|
this.#commentDragged = true;
|
||||||
this.addNextUpdatedCallbacks(() => this.#commentDragged = false);
|
this.addNextUpdatedCallbacks(() => this.#commentDragged = false);
|
||||||
|
this.addLocation(e.detail.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6250,14 +6251,13 @@ class Blueprint extends IElement {
|
|||||||
waitingExpandUpdate = false
|
waitingExpandUpdate = false
|
||||||
/** @param {NodeElement} node */
|
/** @param {NodeElement} node */
|
||||||
nodeBoundariesSupplier = node => {
|
nodeBoundariesSupplier = node => {
|
||||||
let gridRect = this.nodesContainerElement.getBoundingClientRect();
|
this.nodesContainerElement.getBoundingClientRect();
|
||||||
const scaleCorrection = 1 / this.getScale();
|
|
||||||
return /** @type {BoundariesInfo} */ {
|
return /** @type {BoundariesInfo} */ {
|
||||||
primaryInf: (node.leftBoundary() - gridRect.left) * scaleCorrection,
|
primaryInf: node.leftBoundary(),
|
||||||
primarySup: (node.rightBoundary() - gridRect.right) * scaleCorrection,
|
primarySup: node.rightBoundary(),
|
||||||
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
||||||
secondaryInf: (node.topBoundary() - gridRect.top) * scaleCorrection,
|
secondaryInf: node.topBoundary(),
|
||||||
secondarySup: (node.bottomBoundary() - gridRect.bottom) * scaleCorrection
|
secondarySup: node.bottomBoundary(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** @type {(node: NodeElement, selected: Boolean) => void}} */
|
/** @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 */
|
/** @param {NodeElement} node */
|
||||||
nodeBoundariesSupplier = node => {
|
nodeBoundariesSupplier = node => {
|
||||||
let gridRect = this.nodesContainerElement.getBoundingClientRect()
|
let gridRect = this.nodesContainerElement.getBoundingClientRect()
|
||||||
const scaleCorrection = 1 / this.getScale()
|
|
||||||
return /** @type {BoundariesInfo} */ {
|
return /** @type {BoundariesInfo} */ {
|
||||||
primaryInf: (node.leftBoundary() - gridRect.left) * scaleCorrection,
|
primaryInf: node.leftBoundary(),
|
||||||
primarySup: (node.rightBoundary() - gridRect.right) * scaleCorrection,
|
primarySup: node.rightBoundary(),
|
||||||
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
// Counter intuitive here: the y (secondary axis is positive towards the bottom, therefore upper bound "sup" is bottom)
|
||||||
secondaryInf: (node.topBoundary() - gridRect.top) * scaleCorrection,
|
secondaryInf: node.topBoundary(),
|
||||||
secondarySup: (node.bottomBoundary() - gridRect.bottom) * scaleCorrection
|
secondarySup: node.bottomBoundary(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** @type {(node: NodeElement, selected: Boolean) => void}} */
|
/** @type {(node: NodeElement, selected: Boolean) => void}} */
|
||||||
|
|||||||
@@ -82,10 +82,11 @@ export default class NodeElement extends ISelectableDraggableElement {
|
|||||||
boundComments = []
|
boundComments = []
|
||||||
#commentDragged = false
|
#commentDragged = false
|
||||||
#commentDragHandler = e => {
|
#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) {
|
if (!this.selected && !this.#commentDragged) {
|
||||||
this.addLocation(e.detail.value) // if selected it will already move
|
|
||||||
this.#commentDragged = true
|
this.#commentDragged = true
|
||||||
this.addNextUpdatedCallbacks(() => this.#commentDragged = false)
|
this.addNextUpdatedCallbacks(() => this.#commentDragged = false)
|
||||||
|
this.addLocation(e.detail.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user