Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit f4fa8c9

Browse files
committed
tryin #50 fix again.
1 parent 10b0500 commit f4fa8c9

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

app/js/maps/system_map.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ var SystemMap = {
353353
SystemMap.links = [];
354354

355355
var nodes = {};
356-
356+
var exclude = [];
357+
357358
SystemMap.systems = $.map(Data.systems, function(s) {
358359
var node = { system: s, x: s.x, y: s.y };
359360
nodes[s.id] = node;
@@ -366,15 +367,16 @@ var SystemMap = {
366367
var to = SystemMap.systems.filter(function(s) { return s.system.id == gate.toSystem; })[0];
367368
jump = {type: gate.type};
368369
if (gate.type == 'wormhole') {
369-
// pin nodes not in this region to this region's system
370-
// if (from.regionID == Data.state.vicinity.regionId && to.regionId != Data.state.vicinity.regionId) {
371-
// to.y = from.y;
372-
// to.x = from.x;
373-
// }
374-
// else if (to.regionId == Data.state.vicinity.regionId && from.regionId != Data.state.vicinity.regionId) {
375-
// from.y = to.y;
376-
// from.x = to.x;
377-
// }
370+
// exclude nodes that are outside this region from being anchored
371+
if (from.system.regionID == Data.state.vicinity.regionId && to.system.regionID != Data.state.vicinity.regionId) {
372+
exclude.push(to.system.id);
373+
}
374+
else if (to.system.regionID == Data.state.vicinity.regionId && from.system.regionID != Data.state.vicinity.regionId) {
375+
exclude.push(from.system.id);
376+
console.log(to)
377+
378+
}
379+
378380
// pin the wormhole close to the connecting node
379381
if (to.y === undefined && to.x === undefined) {
380382
to.y = from.y;
@@ -404,7 +406,7 @@ var SystemMap = {
404406
system.x *= SCALING_FACTOR;
405407
system.y *= SCALING_FACTOR;
406408
SystemMap.nodes.push(system);
407-
if (!Util.is_wormhole(system.system)) {
409+
if (!Util.is_wormhole(system.system) || $.grep(exclude, function(id) { return id == system.id; })) {
408410
SystemMap.nodes.push(anchor = { x: system.x, y: system.y, fixed: true });
409411
SystemMap.links.push({ source: system, target: anchor });
410412
}
@@ -421,14 +423,14 @@ var SystemMap = {
421423
.chargeDistance(200 * SCALING_FACTOR)
422424
.linkDistance(function(l) {
423425
if (l.type == 'jumpbridge') return 0;
424-
if (l.type == 'wormhole') return 20;
426+
if (l.type == 'wormhole') return 0;
425427
if (l.source.fixed || l.target.fixed) return 0;
426428
var dx = l.source.x - l.target.x, dy = l.source.y - l.target.y;
427429
return Math.min(50 * SCALING_FACTOR, Math.sqrt(dx * dx + dy * dy));
428430
})
429431
.linkStrength(function(l) {
430432
if (l.type == 'jumpbridge') return 0;
431-
if (l.type == 'wormhole') return 0.15;
433+
if (l.type == 'wormhole') return 0;
432434
if (l.source.fixed || l.target.fixed) return 0.1;
433435
return 0.25;
434436
});

0 commit comments

Comments
 (0)