Various fixes

This commit is contained in:
barsdeveloper
2022-02-07 22:41:49 +01:00
parent b2c3ba14f3
commit c33e36ffe1
16 changed files with 684 additions and 622 deletions

View File

@@ -6,7 +6,6 @@ import LinkTemplate from "../template/LinkTemplate"
* @typedef {import("./GraphPin").default} GraphPin
*/
export default class GraphLink extends GraphElement {
/** @type {GraphPin} */
#source
/** @type {GraphPin} */
@@ -23,7 +22,11 @@ export default class GraphLink extends GraphElement {
super({}, new LinkTemplate())
/** @type {import("../template/LinkTemplate").default} */
this.template
/** @type {SVGPathElement} */
this.pathElement = null
this.originatesFromInput = false
this.sourceLocation = [0, 0]
this.destinationLocation = [0, 0]
this.setSourcePin(source)
this.setDestinationPin(destination)
}
@@ -32,14 +35,16 @@ export default class GraphLink extends GraphElement {
if (location == null) {
location = this.#source.template.getLinkLocation(this.#source)
}
this.template.applySourceLocation(this, location)
this.sourceLocation = location
this.template.applySourceLocation(this)
}
setDestinationLocation(location) {
if (location == null) {
location = this.#destination.template.getLinkLocation(this.#destination)
}
this.template.applyDestinationLocation(this, location)
this.destinationLocation = location
this.template.applyDestinationLocation(this)
}

View File

@@ -16,7 +16,6 @@ export default class GraphSelector extends GraphElement {
* @param {number[]} initialPosition - Selection rectangle initial position (relative to the .ueb-grid element)
*/
startSelecting(initialPosition) {
initialPosition = this.blueprint.compensateTranslation(initialPosition)
this.template.applyStartSelecting(this, initialPosition)
this.selectionModel = new FastSelectionModel(initialPosition, this.blueprint.getNodes(), this.blueprint.nodeBoundariesSupplier, this.blueprint.nodeSelectToggleFunction)
}
@@ -26,7 +25,6 @@ export default class GraphSelector extends GraphElement {
* @param {number[]} finalPosition - Selection rectangle final position (relative to the .ueb-grid element)
*/
doSelecting(finalPosition) {
finalPosition = this.blueprint.compensateTranslation(finalPosition)
this.template.applyDoSelecting(this, finalPosition)
this.selectionModel.selectTo(finalPosition)
}