diff --git a/packages/frontend/src/components/Chain.tsx b/packages/frontend/src/components/Chain.tsx index a2d2c84..f5200e1 100644 --- a/packages/frontend/src/components/Chain.tsx +++ b/packages/frontend/src/components/Chain.tsx @@ -122,10 +122,10 @@ export class Chain extends React.Component { return null; } - const { left, top } = this.pixelPosition(location[0], location[1]); + const { left, top, quarter } = this.pixelPosition(location[0], location[1]); return ( - + ); }) } @@ -158,7 +158,17 @@ export class Chain extends React.Component { const left = Math.round(((180 + lon) / 360) * map.width + map.left); const top = Math.round(((90 - lat) / 180) * map.height + map.top) * MAP_HEIGHT_ADJUST; - return { left, top } + let quarter = 0; + + if (lon > 0) { + quarter |= 1; + } + + if (lat < 0) { + quarter |= 2; + } + + return { left, top, quarter: quarter as 0 | 1 | 2 | 3 }; } private calculateMapDimensions: () => void = () => { diff --git a/packages/frontend/src/components/Node/Location.css b/packages/frontend/src/components/Node/Location.css index a489cc6..5ad87bb 100644 --- a/packages/frontend/src/components/Node/Location.css +++ b/packages/frontend/src/components/Node/Location.css @@ -49,8 +49,8 @@ .Node-Location-details { min-width: 335px; position: absolute; - left: 16px; - top: -4px; + /*left: 16px; + top: -4px;*/ font-family: monospace, sans-serif; background: #222; color: #fff; @@ -58,6 +58,26 @@ border-collapse: collapse; } +.Node-Location-quarter0 .Node-Location-details { + left: 16px; + top: -4px; +} + +.Node-Location-quarter1 .Node-Location-details { + right: 16px; + top: -4px; +} + +.Node-Location-quarter2 .Node-Location-details { + left: 16px; + bottom: -4px; +} + +.Node-Location-quarter3 .Node-Location-details { + right: 16px; + bottom: -4px; +} + .Node-Location-details td { text-align: left; padding: 0.5em 1em; @@ -75,10 +95,10 @@ @keyframes ping { from { - left: 2px; - right: 2px; - width: 0; - height: 0; + left: -1px; + top: -1px; + width: 6px; + height: 6px; border-color: rgba(255,255,255,1); } diff --git a/packages/frontend/src/components/Node/Location.tsx b/packages/frontend/src/components/Node/Location.tsx index 7327a3e..7fdab97 100644 --- a/packages/frontend/src/components/Node/Location.tsx +++ b/packages/frontend/src/components/Node/Location.tsx @@ -19,6 +19,7 @@ namespace Location { export interface Position { left: number; top: number; + quarter: 0 | 1 | 2 | 3; } export interface State { @@ -30,7 +31,7 @@ class Location extends React.Component +
{name}