dag-builder-js
Advanced tools
Comparing version 0.0.12 to 0.0.13
{ | ||
"name": "dag-builder-js", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"description": "dag-builder-js is a simple-to-use Javascript DAG library with support to N:N vertices/edges. It supports validating that no cycle can be created in real-time, import/export states and it's built on SVG so you can render graphs pretty much anywhere.", | ||
@@ -5,0 +5,0 @@ "main": "dist/dag.js", |
@@ -32,4 +32,4 @@ /* SPDX-License-Identifier: GPL-3.0-only */ | ||
connectorA.selectEdgeConnector(true); | ||
connectorB.selectEdgeConnector(true); | ||
connectorA.setSelected(true); | ||
connectorB.setSelected(true); | ||
@@ -79,4 +79,4 @@ let bboxVertA = connectorA.edgeConnectorEl.node().getBBox(); | ||
connectorA.selectEdgeConnector(false); | ||
connectorB.selectEdgeConnector(false); | ||
connectorA.setSelected(false); | ||
connectorB.setSelected(false); | ||
@@ -83,0 +83,0 @@ this.drawingContext.remove(); |
@@ -24,3 +24,3 @@ /* SPDX-License-Identifier: GPL-3.0-only */ | ||
this.vertexHolderA = new VertexConnectorHolder(vertex, edgeConnector); | ||
edgeConnector.selectEdgeConnector(true); | ||
edgeConnector.setSelected(true); | ||
@@ -64,5 +64,5 @@ this.line = new EdgeLine(this.drawingContext, translationMat(vertex.drawingContext.node())); | ||
if (this.vertexHolderA?.connector) | ||
this.vertexHolderA.connector.selectEdgeConnector(false); | ||
this.vertexHolderA.connector.setSelected(false); | ||
if (this.vertexHolderB?.connector) | ||
this.vertexHolderB.connector.selectEdgeConnector(false); | ||
this.vertexHolderB.connector.setSelected(false); | ||
@@ -69,0 +69,0 @@ this.cleanUp(); |
@@ -23,2 +23,3 @@ /* SPDX-License-Identifier: GPL-3.0-only */ | ||
static UUID_ATTR = 'connector-uuid'; | ||
static SELECTED_CLASS = 'selected'; | ||
@@ -51,8 +52,8 @@ constructor(connectorType, order, name, type) { | ||
} | ||
/** | ||
* Abstract method to be implemented on each subclass of EdgeConnector | ||
*/ | ||
getEdgeConnectorConfig() { | ||
throw new Error('You have to implement the method getEdgeConnectorConfig(x, y, maxWidth) in your subclass!'); | ||
getConfig() { | ||
throw new Error('You have to implement the method getConfig(x, y, maxWidth) in your subclass!'); | ||
} | ||
@@ -100,3 +101,3 @@ | ||
// edge connector | ||
const edgeConnector = this.getEdgeConnectorConfig(x, y, maxWidth); | ||
const edgeConnector = this.getConfig(x, y, maxWidth); | ||
@@ -148,8 +149,12 @@ this.edgeConnectorEl = this.drawingContext | ||
selectEdgeConnector(select) { | ||
this.drawingContext | ||
.select('.connector') | ||
.classed('selected', select); | ||
setSelected(value) { | ||
this.edgeConnectorEl | ||
.classed(EdgeConnector.SELECTED_CLASS, value); | ||
} | ||
isSelected() { | ||
return this.edgeConnectorEl | ||
.classed(EdgeConnector.SELECTED_CLASS); | ||
} | ||
serialize() { | ||
@@ -172,3 +177,3 @@ return new VertexConnectorSerializable( | ||
getEdgeConnectorConfig(x, y) { | ||
getConfig(x, y) { | ||
return { | ||
@@ -214,4 +219,4 @@ x: x - (EdgeConnector.EDGE_CONNECTOR_SIZE.width / 2), | ||
} | ||
getEdgeConnectorConfig(x, y) { | ||
getConfig(x, y) { | ||
//TODO change css so that users know straight away that this is a custom input | ||
@@ -258,3 +263,3 @@ return { | ||
getEdgeConnectorConfig(x, y, maxWidth) { | ||
getConfig(x, y, maxWidth) { | ||
return { | ||
@@ -261,0 +266,0 @@ x: x + maxWidth - (EdgeConnector.EDGE_CONNECTOR_SIZE.width / 2), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15931
2092969