import { Path , path } from 'd3-path' ; import { halfSqrt3 } from './constants' ; export function drawTriangleUp ( context , radius ) { if ( ! context ) { context = path ( ) ; } const h = halfSqrt3 * radius ; context . moveTo ( 0 , - h ) ; context . lineTo ( - radius , h ) ; context . lineTo ( radius , h ) ; context . closePath ( ) ; return context ; } export function drawTriangleDown ( context , radius ) { if ( ! context ) { context = path ( ) ; } const h = halfSqrt3 * radius ; context . moveTo ( 0 , h ) ; context . lineTo ( - radius , - h ) ; context . lineTo ( radius , - h ) ; context . closePath ( ) ; return context ; } export function drawTriangleLeft ( context , radius ) { if ( ! context ) { context = path ( ) ; } const h = halfSqrt3 * radius ; context . moveTo ( - h , 0 ) ; context . lineTo ( h , - radius ) ; context . lineTo ( h , radius ) ; context . closePath ( ) ; return context ; } export function drawTriangleRight ( context , radius ) { if ( ! context ) { context = path ( ) ; } const h = halfSqrt3 * radius ; context . moveTo ( h , 0 ) ; context . lineTo ( - h , - radius ) ; context . lineTo ( - h , radius ) ; context . closePath ( ) ; return context ; }