Revize 9d455473
Přidáno uživatelem Pavel Fidranský před téměř 6 roky(ů)
sources/src/main/webapp/js/services/forceDirected.js | ||
---|---|---|
42 | 42 |
for (let j = 0; j < otherVisibleNodes.length; j++) { |
43 | 43 |
var otherNode = otherVisibleNodes[j]; |
44 | 44 |
|
45 |
var currPosition = currNode.getPosition();
|
|
46 |
var otherPosition = otherNode.getPosition();
|
|
45 |
var currPosition = currNode.position;
|
|
46 |
var otherPosition = otherNode.position;
|
|
47 | 47 |
|
48 | 48 |
// calculate force |
49 | 49 |
var x = currPosition.x - otherPosition.x; |
... | ... | |
106 | 106 |
|
107 | 107 |
halfCan = canvas / 2, |
108 | 108 |
|
109 |
deltaX = currNode.getPosition().x - halfCan,
|
|
110 |
deltaY = currNode.getPosition().y - halfCan;
|
|
109 |
deltaX = currNode.position.x - halfCan,
|
|
110 |
deltaY = currNode.position.y - halfCan;
|
|
111 | 111 |
|
112 | 112 |
// tohle drzi layout uprostred, chtelo by to vymyslet nejak lip, docela ho to kurvi |
113 | 113 |
/* |
114 | 114 |
if (deltaX > 0) { |
115 |
currNode.x = Math.min(currNode.getPosition().x, (canvas/2)+border);
|
|
115 |
currNode.x = Math.min(currNode.position.x, (canvas/2)+border);
|
|
116 | 116 |
} else { |
117 |
currNode.x = Math.max(currNode.getPosition().x, (canvas/2)-border);
|
|
117 |
currNode.x = Math.max(currNode.position.x, (canvas/2)-border);
|
|
118 | 118 |
} |
119 | 119 |
if (deltaY > 0) { |
120 |
currNode.y = Math.min(currNode.getPosition().y, (canvas/2)+border);
|
|
120 |
currNode.y = Math.min(currNode.position.y, (canvas/2)+border);
|
|
121 | 121 |
} else { |
122 |
currNode.y = Math.max(currNode.getPosition().y, (canvas/2)-border);
|
|
122 |
currNode.y = Math.max(currNode.position.y, (canvas/2)-border);
|
|
123 | 123 |
} |
124 | 124 |
*/ |
125 | 125 |
|
... | ... | |
151 | 151 |
// moving a component |
152 | 152 |
if (Math.abs(forceX) > 1 || Math.abs(forceY) > 1) { |
153 | 153 |
let coords = new Coordinates( |
154 |
currNode.getPosition().x + forceX,
|
|
155 |
currNode.getPosition().y + forceY,
|
|
154 |
currNode.position.x + forceX,
|
|
155 |
currNode.position.y + forceY,
|
|
156 | 156 |
); |
157 | 157 |
|
158 | 158 |
currNode.position = coords; |
Také k dispozici: Unified diff
ForceDirected fixes