Includes cleanup

This commit is contained in:
barsdeveloper
2022-02-27 13:16:31 +01:00
parent b48b1228f4
commit 979e4bbd10
22 changed files with 55 additions and 38 deletions

19
dist/ueblueprint.js vendored
View File

@@ -1787,7 +1787,12 @@ class LinkElement extends IElement {
* @param {LinkMessageElement} linkMessage * @param {LinkMessageElement} linkMessage
*/ */
setLinkMessage(linkMessage) { setLinkMessage(linkMessage) {
this.template.applyLinkMessage(this, linkMessage); if (linkMessage) {
this.template.applyLinkMessage(this, linkMessage);
} else if (this.linkMessageElement) {
this.linkMessageElement.remove();
this.linkMessageElement = null;
}
} }
} }
@@ -2086,7 +2091,10 @@ class IMouseClickDrag extends IPointing {
} }
} }
/** @typedef {import("../../element/PinElement").default} PinElement */ /**
* @typedef {import("../../element/PinElement").default} PinElement
* @typedef {import("../../element/LinkElement").default} LinkElement
*/
class MouseCreateLink extends IMouseClickDrag { class MouseCreateLink extends IMouseClickDrag {
/** @type {NodeListOf<PinElement>} */ /** @type {NodeListOf<PinElement>} */
@@ -2100,11 +2108,11 @@ class MouseCreateLink extends IMouseClickDrag {
constructor(target, blueprint, options) { constructor(target, blueprint, options) {
super(target, blueprint, options); super(target, blueprint, options);
/** @type {import("../../element/PinElement").PinElement} */ /** @type {PinElement} */
this.target; this.target;
/** @type {import("../../element/LinkElement").LinkElement} */ /** @type {LinkElement} */
this.link; this.link;
/** @type {import("../../entity/PinEntity").default} */ /** @type {PinElement} */
this.enteredPin; this.enteredPin;
let self = this; let self = this;
@@ -2148,6 +2156,7 @@ class MouseCreateLink extends IMouseClickDrag {
|| link.getSourcePin() == this.enteredPin && link.getDestinationPin() == this.target || link.getSourcePin() == this.enteredPin && link.getDestinationPin() == this.target
)) { )) {
this.link.setDestinationPin(this.enteredPin); this.link.setDestinationPin(this.enteredPin);
this.link.setLinkMessage(null);
this.blueprint.addGraphElement(this.link); this.blueprint.addGraphElement(this.link);
} else { } else {
this.link.remove(); this.link.remove();

View File

@@ -2,15 +2,15 @@ import BlueprintTemplate from "./template/BlueprintTemplate"
import Configuration from "./Configuration" import Configuration from "./Configuration"
import Copy from "./input/common/Copy" import Copy from "./input/common/Copy"
import IElement from "./element/IElement" import IElement from "./element/IElement"
import LinkElement from "./element/LinkElement"
import NodeElement from "./element/NodeElement"
import SelectorElement from "./element/SelectorElement"
import KeyboardCanc from "./input/keybaord/KeyboardCanc" import KeyboardCanc from "./input/keybaord/KeyboardCanc"
import KeyboardSelectAll from "./input/keybaord/KeyboardSelectAll" import KeyboardSelectAll from "./input/keybaord/KeyboardSelectAll"
import LinkElement from "./element/LinkElement"
import MouseScrollGraph from "./input/mouse/MouseScrollGraph" import MouseScrollGraph from "./input/mouse/MouseScrollGraph"
import MouseTracking from "./input/mouse/MouseTracking" import MouseTracking from "./input/mouse/MouseTracking"
import NodeElement from "./element/NodeElement"
import Paste from "./input/common/Paste" import Paste from "./input/common/Paste"
import Select from "./input/mouse/Select" import Select from "./input/mouse/Select"
import SelectorElement from "./element/SelectorElement"
import Unfocus from "./input/mouse/Unfocus" import Unfocus from "./input/mouse/Unfocus"
import Utility from "./Utility" import Utility from "./Utility"
import Zoom from "./input/mouse/Zoom" import Zoom from "./input/mouse/Zoom"

View File

@@ -1,6 +1,6 @@
import Configuration from "../Configuration" import Configuration from "../Configuration"
import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
import IElement from "./IElement" import IElement from "./IElement"
import MouseMoveNodes from "../input/mouse/MouseMoveNodes"
/** @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate */ /** @typedef {import("../template/SelectableDraggableTemplate").default} SelectableDraggableTemplate */

View File

@@ -1,6 +1,6 @@
import Configuration from "../Configuration"
import IElement from "./IElement" import IElement from "./IElement"
import LinkTemplate from "../template/LinkTemplate" import LinkTemplate from "../template/LinkTemplate"
import Configuration from "../Configuration"
/** /**
* @typedef {import("./PinElement").default} PinElement * @typedef {import("./PinElement").default} PinElement
@@ -168,7 +168,12 @@ export default class LinkElement extends IElement {
* @param {LinkMessageElement} linkMessage * @param {LinkMessageElement} linkMessage
*/ */
setLinkMessage(linkMessage) { setLinkMessage(linkMessage) {
this.template.applyLinkMessage(this, linkMessage) if (linkMessage) {
this.template.applyLinkMessage(this, linkMessage)
} else if (this.linkMessageElement) {
this.linkMessageElement.remove()
this.linkMessageElement = null
}
} }
} }

View File

@@ -1,9 +1,9 @@
import Configuration from "../Configuration"
import ISelectableDraggableElement from "./ISelectableDraggableElement"
import NodeTemplate from "../template/NodeTemplate" import NodeTemplate from "../template/NodeTemplate"
import ObjectEntity from "../entity/ObjectEntity" import ObjectEntity from "../entity/ObjectEntity"
import PinEntity from "../entity/PinEntity" import PinEntity from "../entity/PinEntity"
import ISelectableDraggableElement from "./ISelectableDraggableElement"
import SerializerFactory from "../serialization/SerializerFactory" import SerializerFactory from "../serialization/SerializerFactory"
import Configuration from "../Configuration"
export default class NodeElement extends ISelectableDraggableElement { export default class NodeElement extends ISelectableDraggableElement {

View File

@@ -1,6 +1,6 @@
import IElement from "./IElement" import IElement from "./IElement"
import PinTemplate from "../template/PinTemplate"
import MouseCreateLink from "../input/mouse/MouseCreateLink" import MouseCreateLink from "../input/mouse/MouseCreateLink"
import PinTemplate from "../template/PinTemplate"
export default class PinElement extends IElement { export default class PinElement extends IElement {

View File

@@ -1,6 +1,6 @@
import IEntity from "./IEntity"
import FunctionReferenceEntity from "./FunctionReferenceEntity" import FunctionReferenceEntity from "./FunctionReferenceEntity"
import GuidEntity from "./GuidEntity" import GuidEntity from "./GuidEntity"
import IEntity from "./IEntity"
import IntegerEntity from "./IntegerEntity" import IntegerEntity from "./IntegerEntity"
import ObjectReferenceEntity from "./ObjectReferenceEntity" import ObjectReferenceEntity from "./ObjectReferenceEntity"
import PinEntity from "./PinEntity" import PinEntity from "./PinEntity"

View File

@@ -1,5 +1,5 @@
import IEntity from "./IEntity"
import GuidEntity from "./GuidEntity" import GuidEntity from "./GuidEntity"
import IEntity from "./IEntity"
import LocalizedTextEntity from "./LocalizedTextEntity" import LocalizedTextEntity from "./LocalizedTextEntity"
import ObjectReferenceEntity from "./ObjectReferenceEntity" import ObjectReferenceEntity from "./ObjectReferenceEntity"
import PinReferenceEntity from "./PinReferenceEntity" import PinReferenceEntity from "./PinReferenceEntity"

View File

@@ -1,5 +1,5 @@
import IEntity from "./IEntity"
import GuidEntity from "./GuidEntity" import GuidEntity from "./GuidEntity"
import IEntity from "./IEntity"
import PathSymbol from "./PathSymbolEntity" import PathSymbol from "./PathSymbolEntity"
export default class PinReferenceEntity extends IEntity { export default class PinReferenceEntity extends IEntity {

View File

@@ -1,6 +1,6 @@
import IContext from "../IContext"
import NodeElement from "../../element/NodeElement" import NodeElement from "../../element/NodeElement"
import ObjectSerializer from "../../serialization/ObjectSerializer" import ObjectSerializer from "../../serialization/ObjectSerializer"
import IContext from "../IContext"
export default class Paste extends IContext { export default class Paste extends IContext {

View File

@@ -1,5 +1,5 @@
import IKeyboardShortcut from "./IKeyboardShortcut"
import Configuration from "../../Configuration" import Configuration from "../../Configuration"
import IKeyboardShortcut from "./IKeyboardShortcut"
export default class KeyvoardCanc extends IKeyboardShortcut { export default class KeyvoardCanc extends IKeyboardShortcut {

View File

@@ -1,5 +1,5 @@
import IKeyboardShortcut from "./IKeyboardShortcut"
import Configuration from "../../Configuration" import Configuration from "../../Configuration"
import IKeyboardShortcut from "./IKeyboardShortcut"
export default class KeyboardSelectAll extends IKeyboardShortcut { export default class KeyboardSelectAll extends IKeyboardShortcut {

View File

@@ -1,8 +1,11 @@
import IMouseClickDrag from "./IMouseClickDrag"
import LinkElement from "../../element/LinkElement" import LinkElement from "../../element/LinkElement"
import LinkMessageElement from "../../element/LinkMessageElement" import LinkMessageElement from "../../element/LinkMessageElement"
import IMouseClickDrag from "./IMouseClickDrag"
/** @typedef {import("../../element/PinElement").default} PinElement */ /**
* @typedef {import("../../element/LinkElement").default} LinkElement
* @typedef {import("../../element/PinElement").default} PinElement
*/
export default class MouseCreateLink extends IMouseClickDrag { export default class MouseCreateLink extends IMouseClickDrag {
/** @type {NodeListOf<PinElement>} */ /** @type {NodeListOf<PinElement>} */
@@ -16,11 +19,11 @@ export default class MouseCreateLink extends IMouseClickDrag {
constructor(target, blueprint, options) { constructor(target, blueprint, options) {
super(target, blueprint, options) super(target, blueprint, options)
/** @type {import("../../element/PinElement").PinElement} */ /** @type {PinElement} */
this.target this.target
/** @type {import("../../element/LinkElement").LinkElement} */ /** @type {LinkElement} */
this.link this.link
/** @type {import("../../entity/PinEntity").default} */ /** @type {PinElement} */
this.enteredPin this.enteredPin
let self = this let self = this
@@ -64,6 +67,7 @@ export default class MouseCreateLink extends IMouseClickDrag {
|| link.getSourcePin() == this.enteredPin && link.getDestinationPin() == this.target || link.getSourcePin() == this.enteredPin && link.getDestinationPin() == this.target
)) { )) {
this.link.setDestinationPin(this.enteredPin) this.link.setDestinationPin(this.enteredPin)
this.link.setLinkMessage(null)
this.blueprint.addGraphElement(this.link) this.blueprint.addGraphElement(this.link)
} else { } else {
this.link.remove() this.link.remove()

View File

@@ -1,5 +1,5 @@
import IEntity from "../entity/IEntity"
import Grammar from "./Grammar" import Grammar from "./Grammar"
import IEntity from "../entity/IEntity"
import Parsimmon from "parsimmon" import Parsimmon from "parsimmon"
import SerializerFactory from "./SerializerFactory" import SerializerFactory from "./SerializerFactory"
import TypeInitialization from "../entity/TypeInitialization" import TypeInitialization from "../entity/TypeInitialization"

View File

@@ -1,6 +1,6 @@
import ISerializer from "./ISerializer"
import ObjectEntity from "../entity/ObjectEntity" import ObjectEntity from "../entity/ObjectEntity"
import PinEntity from "../entity/PinEntity" import PinEntity from "../entity/PinEntity"
import ISerializer from "./ISerializer"
import SerializerFactory from "./SerializerFactory" import SerializerFactory from "./SerializerFactory"
export default class ObjectSerializer extends ISerializer { export default class ObjectSerializer extends ISerializer {

View File

@@ -1,8 +1,8 @@
import Configuration from "../Configuration" import Configuration from "../Configuration"
import html from "./html" import html from "./html"
import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText" import sanitizeText from "./sanitizeText"
import SelectorElement from "../element/SelectorElement" import SelectorElement from "../element/SelectorElement"
import ITemplate from "./ITemplate"
/** @typedef {import("../Blueprint").default} Blueprint */ /** @typedef {import("../Blueprint").default} Blueprint */
export default class BlueprintTemplate extends ITemplate { export default class BlueprintTemplate extends ITemplate {

View File

@@ -1,6 +1,6 @@
import LinkElement from "../element/LinkElement"
import html from "./html" import html from "./html"
import ITemplate from "./ITemplate" import ITemplate from "./ITemplate"
import LinkElement from "../element/LinkElement"
/** /**
* @typedef {import("../element/LinkMessageElement").default} LinkMessageElement * @typedef {import("../element/LinkMessageElement").default} LinkMessageElement

View File

@@ -1,7 +1,7 @@
import html from "./html"
import sanitizeText from "./sanitizeText"
import ITemplate from "./ITemplate"
import Configuration from "../Configuration" import Configuration from "../Configuration"
import html from "./html"
import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"
/** /**
* @typedef {import("../element/LinkElement").default} LinkElement * @typedef {import("../element/LinkElement").default} LinkElement

View File

@@ -1,6 +1,5 @@
import PinElement from "../element/PinElement"
import html from "./html" import html from "./html"
import PinEntity from "../entity/PinEntity" import PinElement from "../element/PinElement"
import sanitizeText from "./sanitizeText" import sanitizeText from "./sanitizeText"
import SelectableDraggableTemplate from "./SelectableDraggableTemplate" import SelectableDraggableTemplate from "./SelectableDraggableTemplate"

View File

@@ -1,7 +1,7 @@
import Utility from "../Utility"
import html from "./html" import html from "./html"
import sanitizeText from "./sanitizeText"
import ITemplate from "./ITemplate" import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"
import Utility from "../Utility"
/** /**
* @typedef {import("../element/PinElement").default} PinElement * @typedef {import("../element/PinElement").default} PinElement

View File

@@ -1,5 +1,5 @@
import sanitizeText from "./sanitizeText"
import ITemplate from "./ITemplate" import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"
/** /**
* @typedef {import("../element/ISelectableDraggableElement").default} ISelectableDraggableElement * @typedef {import("../element/ISelectableDraggableElement").default} ISelectableDraggableElement

View File

@@ -1,5 +1,5 @@
import sanitizeText from "./sanitizeText"
import ITemplate from "./ITemplate" import ITemplate from "./ITemplate"
import sanitizeText from "./sanitizeText"
/** /**
* @typedef {import("../element/SelectorElement").default} SelectorElement * @typedef {import("../element/SelectorElement").default} SelectorElement