Dropdown implementation, switch refactoring

* Various fixes

* Fix tests

* Dropdown names deduced from pin names

* Remove update callbacks

* Fix double pins issue

* return undefined if not switch
This commit is contained in:
barsdeveloper
2023-04-22 12:44:37 +02:00
committed by GitHub
parent e06589bc46
commit 8a96af670e
32 changed files with 1024 additions and 365 deletions

View File

@@ -13,7 +13,6 @@ import Utility from "../Utility.js"
import VariableAccessNodeTemplate from "../template/node/VariableAccessNodeTemplate.js"
import VariableConversionNodeTemplate from "../template/node/VariableConversionNodeTemplate.js"
import VariableOperationNodeTemplate from "../template/node/VariableOperationNodeTemplate.js"
import UnknownPinEntity from "../entity/UnknownPinEntity.js"
/**
* @typedef {import("./IDraggableElement.js").DragEvent} DragEvent
@@ -90,7 +89,8 @@ export default class NodeElement extends ISelectableDraggableElement {
// If selected, it will already drag, also must check if under nested comments, it must drag just once
if (!this.selected && !this.#commentDragged) {
this.#commentDragged = true
this.addNextUpdatedCallbacks(() => this.#commentDragged = false)
this.requestUpdate()
this.updateComplete.then(() => this.#commentDragged = false)
this.addLocation(...e.detail.value)
}
}
@@ -193,11 +193,12 @@ export default class NodeElement extends ISelectableDraggableElement {
}
}
getUpdateComplete() {
return Promise.all([
super.getUpdateComplete(),
...this.getPinElements().map(pin => pin.updateComplete)
]).then(() => true)
async getUpdateComplete() {
let result = await super.getUpdateComplete()
for (const pin of this.getPinElements()) {
result &&= await pin.updateComplete
}
return result
}
/** @param {NodeElement} commentNode */