Skip to content

Commit

Permalink
Fix node size (#56)
Browse files Browse the repository at this point in the history
* Fix node size

* simplify
  • Loading branch information
isSerge committed Apr 19, 2023
1 parent 100db8a commit f4042e2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions frontend/src/components/Map/Location.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ interface LocationState {
hover: boolean;
}

// logarithmic scale for location dots
const getNodeSize = (nodeCount: number) => {
return 6 + Math.log(nodeCount) * 2;
};

export class Location extends React.Component<LocationProps, LocationState> {
public readonly state = { hover: false };

public render() {
const { position, nodeCount } = this.props;
const { left, top, quarter } = position;
const className = `Location Location-quarter${quarter}`;

// location dots have logarithmic scale
// 6px is default size for a single node dot,
// log of 1 is 0, so we have fallback value of 1
const size = 6 * (Math.log(nodeCount) || 1);
const size = getNodeSize(nodeCount);

return (
<div
Expand Down

0 comments on commit f4042e2

Please sign in to comment.