diff --git a/dist/ueblueprint.js b/dist/ueblueprint.js
index 9dbd46d..48b0446 100644
--- a/dist/ueblueprint.js
+++ b/dist/ueblueprint.js
@@ -522,8 +522,8 @@ class BlueprintTemplate extends Template {
* @param {Blueprint} brueprint The blueprint element
*/
applyZoom(blueprint, newZoom) {
- blueprint.classList.remove(`ueb-zoom-${blueprint.zoom}`);
- blueprint.classList.add(sanitizeText`ueb-zoom-${newZoom}`);
+ blueprint.classList.remove("ueb-zoom-" + sanitizeText(blueprint.zoom));
+ blueprint.classList.add("ueb-zoom-" + sanitizeText(newZoom));
}
/**
@@ -1355,6 +1355,7 @@ class MouseClickDrag extends Pointing {
case self.clickButton:
// Either doesn't matter or consider the click only when clicking on the parent, not descandants
if (self.looseTarget || e.target == e.currentTarget) {
+ e.preventDefault();
e.stopPropagation();
self.started = false;
// Attach the listeners
@@ -1549,11 +1550,11 @@ class PinTemplate extends Template {
if (pin.isInput()) {
return html`
- ${pin.getPinDisplayName()}
+ ${sanitizeText(pin.getPinDisplayName())}
`
} else {
return html`
- ${pin.getPinDisplayName()}
+ ${sanitizeText(pin.getPinDisplayName())}
`
}
@@ -1566,19 +1567,45 @@ class PinTemplate extends Template {
apply(pin) {
super.apply(pin);
pin.classList.add("ueb-node-" + pin.isInput() ? "input" : "output", "ueb-node-value-" + sanitizeText(pin.getType()));
+ pin.clickableElement = pin.querySelector(".ueb-node-value-icon");
}
}
+class DragLink extends MouseClickDrag {
+
+ constructor(target, blueprint, options) {
+ super(target, blueprint, options);
+ }
+
+ startDrag() {
+ let a = 12;
+ console.log(a);
+ }
+
+ dragTo(location, movement) {
+ //this.selectorElement.doSelecting(location)
+ }
+
+ endDrag() {
+ if (this.started) ;
+ }
+}
+
class GraphPin extends GraphElement {
constructor(entity) {
super(entity, new PinTemplate());
/** @type {import("../entity/PinEntity").default} */
this.entity;
+ /** @type {HTMLElement} */
+ this.clickableElement = null;
}
connectedCallback() {
super.connectedCallback();
+ new DragLink(this.clickableElement, this.blueprint, {
+ moveEverywhere: true
+ });
}
/**
@@ -1712,7 +1739,7 @@ class NodeTemplate extends SelectableDraggableTemplate {
}
}
-class Drag extends MouseClickDrag {
+class DragMove extends MouseClickDrag {
constructor(target, blueprint, options) {
super(target, blueprint, options);
@@ -1771,7 +1798,7 @@ class SelectableDraggable extends GraphElement {
connectedCallback() {
super.connectedCallback();
- this.dragObject = new Drag(this, this.blueprint, {
+ this.dragObject = new DragMove(this, this.blueprint, {
looseTarget: true
});
}
@@ -1820,25 +1847,6 @@ class SelectableDraggable extends GraphElement {
}
}
-class DragLink extends MouseClickDrag {
-
- constructor(target, blueprint, options) {
- super(target, blueprint, options);
- }
-
- startDrag() {
- //this.selectorElement.startSelecting(this.clickedPosition)
- }
-
- dragTo(location, movement) {
- //this.selectorElement.doSelecting(location)
- }
-
- endDrag() {
- if (this.started) ;
- }
-}
-
class GraphNode extends SelectableDraggable {
/**
@@ -1870,16 +1878,6 @@ class GraphNode extends SelectableDraggable {
connectedCallback() {
this.getAttribute("type")?.trim();
super.connectedCallback();
- this.querySelectorAll(".ueb-node-input, .ueb-node-output").forEach(element => {
- this.dragLinkObjects.push(
- new DragLink(element, this.blueprint, {
- clickButton: 0,
- moveEverywhere: true,
- exitAnyButton: true,
- looseTarget: true
- })
- );
- });
}
setLocation(value = [0, 0]) {
diff --git a/js/graph/GraphNode.js b/js/graph/GraphNode.js
index 8d561c6..79b8cfb 100755
--- a/js/graph/GraphNode.js
+++ b/js/graph/GraphNode.js
@@ -36,16 +36,6 @@ export default class GraphNode extends SelectableDraggable {
connectedCallback() {
const type = this.getAttribute("type")?.trim()
super.connectedCallback()
- this.querySelectorAll(".ueb-node-input, .ueb-node-output").forEach(element => {
- this.dragLinkObjects.push(
- new DragLink(element, this.blueprint, {
- clickButton: 0,
- moveEverywhere: true,
- exitAnyButton: true,
- looseTarget: true
- })
- )
- })
}
setLocation(value = [0, 0]) {
diff --git a/js/graph/GraphPin.js b/js/graph/GraphPin.js
index 9311c22..ff30f82 100644
--- a/js/graph/GraphPin.js
+++ b/js/graph/GraphPin.js
@@ -1,5 +1,6 @@
import GraphElement from "./GraphElement"
import PinTemplate from "../template/PinTemplate"
+import DragLink from "../input/DragLink"
export default class GraphPin extends GraphElement {
@@ -7,10 +8,15 @@ export default class GraphPin extends GraphElement {
super(entity, new PinTemplate())
/** @type {import("../entity/PinEntity").default} */
this.entity
+ /** @type {HTMLElement} */
+ this.clickableElement = null
}
connectedCallback() {
super.connectedCallback()
+ new DragLink(this.clickableElement, this.blueprint, {
+ moveEverywhere: true
+ })
}
/**
diff --git a/js/graph/SelectableDraggable.js b/js/graph/SelectableDraggable.js
index 185c612..79ec846 100755
--- a/js/graph/SelectableDraggable.js
+++ b/js/graph/SelectableDraggable.js
@@ -1,4 +1,4 @@
-import Drag from "../input/Drag"
+import DragMove from "../input/DragMove"
import GraphElement from "./GraphElement"
export default class SelectableDraggable extends GraphElement {
@@ -19,7 +19,7 @@ export default class SelectableDraggable extends GraphElement {
connectedCallback() {
super.connectedCallback()
- this.dragObject = new Drag(this, this.blueprint, {
+ this.dragObject = new DragMove(this, this.blueprint, {
looseTarget: true
})
}
diff --git a/js/input/DragLink.js b/js/input/DragLink.js
index 9e7d3c5..8a7d20f 100755
--- a/js/input/DragLink.js
+++ b/js/input/DragLink.js
@@ -7,7 +7,8 @@ export default class DragLink extends MouseClickDrag {
}
startDrag() {
- //this.selectorElement.startSelecting(this.clickedPosition)
+ let a = 12
+ console.log(a)
}
dragTo(location, movement) {
diff --git a/js/input/Drag.js b/js/input/DragMove.js
similarity index 93%
rename from js/input/Drag.js
rename to js/input/DragMove.js
index f22787c..c3b278b 100755
--- a/js/input/Drag.js
+++ b/js/input/DragMove.js
@@ -1,6 +1,6 @@
import MouseClickDrag from "./MouseClickDrag"
-export default class Drag extends MouseClickDrag {
+export default class DragMove extends MouseClickDrag {
constructor(target, blueprint, options) {
super(target, blueprint, options)
diff --git a/js/input/MouseClickDrag.js b/js/input/MouseClickDrag.js
index 3d6e145..4b96ede 100755
--- a/js/input/MouseClickDrag.js
+++ b/js/input/MouseClickDrag.js
@@ -23,6 +23,7 @@ export default class MouseClickDrag extends Pointing {
case self.clickButton:
// Either doesn't matter or consider the click only when clicking on the parent, not descandants
if (self.looseTarget || e.target == e.currentTarget) {
+ e.preventDefault()
e.stopPropagation()
self.started = false
// Attach the listeners
diff --git a/js/template/BlueprintTemplate.js b/js/template/BlueprintTemplate.js
index 1a5eb25..4120642 100755
--- a/js/template/BlueprintTemplate.js
+++ b/js/template/BlueprintTemplate.js
@@ -74,8 +74,8 @@ export default class BlueprintTemplate extends Template {
* @param {Blueprint} brueprint The blueprint element
*/
applyZoom(blueprint, newZoom) {
- blueprint.classList.remove(`ueb-zoom-${blueprint.zoom}`)
- blueprint.classList.add(sanitizeText`ueb-zoom-${newZoom}`)
+ blueprint.classList.remove("ueb-zoom-" + sanitizeText(blueprint.zoom))
+ blueprint.classList.add("ueb-zoom-" + sanitizeText(newZoom))
}
/**
diff --git a/js/template/PinTemplate.js b/js/template/PinTemplate.js
index 0ebb45f..156207b 100644
--- a/js/template/PinTemplate.js
+++ b/js/template/PinTemplate.js
@@ -16,11 +16,11 @@ export default class PinTemplate extends Template {
if (pin.isInput()) {
return html`
- ${pin.getPinDisplayName()}
+ ${sanitizeText(pin.getPinDisplayName())}
`
} else {
return html`
- ${pin.getPinDisplayName()}
+ ${sanitizeText(pin.getPinDisplayName())}
`
}
@@ -33,5 +33,6 @@ export default class PinTemplate extends Template {
apply(pin) {
super.apply(pin)
pin.classList.add("ueb-node-" + pin.isInput() ? "input" : "output", "ueb-node-value-" + sanitizeText(pin.getType()))
+ pin.clickableElement = pin.querySelector(".ueb-node-value-icon")
}
}
\ No newline at end of file