refactor(edges): dont add width and height params
This commit is contained in:
Vendored
+1
-1
@@ -60,7 +60,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transform-origin: 0 0;
|
transform-origin: 0 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+5
@@ -204,6 +204,10 @@
|
|||||||
return element.data && element.data.source && element.data.target;
|
return element.data && element.data.source && element.data.target;
|
||||||
};
|
};
|
||||||
var parseElements = function parseElements(e) {
|
var parseElements = function parseElements(e) {
|
||||||
|
if (isEdge(e)) {
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
return _objectSpread2({}, e, {
|
return _objectSpread2({}, e, {
|
||||||
__rg: {
|
__rg: {
|
||||||
position: e.position,
|
position: e.position,
|
||||||
@@ -32893,6 +32897,7 @@
|
|||||||
className: nodeClasses,
|
className: nodeClasses,
|
||||||
ref: nodeElement,
|
ref: nodeElement,
|
||||||
style: {
|
style: {
|
||||||
|
zIndex: selected ? 10 : 3,
|
||||||
transform: "translate(".concat(position.x, "px,").concat(position.y, "px)")
|
transform: "translate(".concat(position.x, "px,").concat(position.y, "px)")
|
||||||
},
|
},
|
||||||
onClick: function onClick(e) {
|
onClick: function onClick(e) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
<link rel="stylesheet" type="text/css" href="../dist/ReactGraph.css">
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export default NodeComponent => (props) => {
|
|||||||
<div
|
<div
|
||||||
className={nodeClasses}
|
className={nodeClasses}
|
||||||
ref={nodeElement}
|
ref={nodeElement}
|
||||||
style={{ transform: `translate(${position.x}px,${position.y}px)` }}
|
style={{ zIndex: selected ? 10 : 3, transform: `translate(${position.x}px,${position.y}px)` }}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isInputTarget(e)) {
|
if (isInputTarget(e)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+13
-7
@@ -1,13 +1,19 @@
|
|||||||
export const isEdge = element => element.data && element.data.source && element.data.target;
|
export const isEdge = element => element.data && element.data.source && element.data.target;
|
||||||
|
|
||||||
export const parseElements = e => ({
|
export const parseElements = e => {
|
||||||
...e,
|
if (isEdge(e)) {
|
||||||
__rg: {
|
return e;
|
||||||
position: e.position,
|
|
||||||
width: null,
|
|
||||||
height: null
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
return {
|
||||||
|
...e,
|
||||||
|
__rg: {
|
||||||
|
position: e.position,
|
||||||
|
width: null,
|
||||||
|
height: null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const separateElements = (res, element) => {
|
export const separateElements = (res, element) => {
|
||||||
res.edges = res.edges ? res.edges : [];
|
res.edges = res.edges ? res.edges : [];
|
||||||
|
|||||||
+1
-1
@@ -60,7 +60,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 2;
|
z-index: 3;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transform-origin: 0 0;
|
transform-origin: 0 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user