forked from airbnb/visx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
34 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,28 @@ | ||
import React from 'react'; | ||
import Marker, { MarkerProps } from './Marker'; | ||
|
||
interface MarkerCircleProps { | ||
id: string; | ||
radius?: number; // todo: support string value and browser units (px, ch, em, etc.) | ||
strokeWidth?: number; // todo: support string value and browser units (px, ch, em, etc.) | ||
} | ||
import Marker, { MarkerComponentProps } from './Marker'; | ||
|
||
export default function MarkerCircle({ | ||
id, | ||
radius = 4, | ||
strokeWidth = 0, | ||
size = 9, | ||
strokeWidth = 1, | ||
...restProps | ||
}: MarkerCircleProps & Omit<MarkerProps, 'children'>) { | ||
const diameter = radius * 2; | ||
const size = diameter + strokeWidth; | ||
}: MarkerComponentProps) { | ||
const diameter = size * 2; | ||
const bounds = diameter + strokeWidth; | ||
const mid = size / 2; | ||
return ( | ||
<Marker | ||
id={id} | ||
markerWidth={size} | ||
markerHeight={size} | ||
markerWidth={bounds} | ||
markerHeight={bounds} | ||
refX={0} | ||
refY={mid} | ||
orient="auto-start-reverse" | ||
markerUnits="strokeWidth" | ||
fill="steelblue" | ||
strokeWidth={strokeWidth} | ||
{...restProps} | ||
> | ||
<circle r={radius} cx={mid} cy={mid} /> | ||
<circle r={size} cx={mid} cy={mid} /> | ||
</Marker> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
import React from 'react'; | ||
import Cross from './Cross'; | ||
import { MarkerProps } from './Marker'; | ||
import { MarkerComponentProps } from './Marker'; | ||
|
||
export interface MarkerXProps { | ||
id: string; | ||
size?: number; | ||
strokeWidth?: number; | ||
} | ||
|
||
export type Props = MarkerXProps & Omit<MarkerProps, 'children'>; | ||
|
||
export default function MarkerX(props: Props) { | ||
export default function MarkerX(props: MarkerComponentProps) { | ||
return <Cross orient={45} {...props} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters