@@ -57,17 +57,23 @@ export function drawVectorMarker(ctx: CanvasRenderingContext2D, point, symbol, r
5757 //线类型
5858 Canvas . path ( ctx , vectorArray . slice ( 0 , 2 ) , lineOpacity ) ;
5959 Canvas . path ( ctx , vectorArray . slice ( 2 , 4 ) , lineOpacity ) ;
60- } else if ( markerType === 'diamond' || markerType === 'bar' || markerType === 'square' || markerType === 'rectangle' || markerType === 'triangle' ) {
60+ } else if ( markerType === 'diamond' || markerType === 'bar' || markerType === 'square' || markerType === 'rectangle' || markerType === 'triangle' || markerType === 'roundrectangle' ) {
6161 if ( markerType === 'bar' ) {
6262 point = point . add ( 0 , - hLineWidth ) ;
63- } else if ( markerType === 'rectangle' ) {
63+ } else if ( markerType === 'rectangle' || markerType === 'roundrectangle' ) {
6464 point = point . add ( hLineWidth , hLineWidth ) ;
6565 }
6666 for ( let j = vectorArray . length - 1 ; j >= 0 ; j -- ) {
6767 vectorArray [ j ] . _add ( point ) ;
6868 }
69- //面类型
70- Canvas . polygon ( ctx , vectorArray , lineOpacity , fillOpacity ) ;
69+
70+ if ( markerType === 'roundrectangle' ) {
71+ //round rectangle, draw the corners
72+ Canvas . roundRect ( ctx , vectorArray , lineOpacity , fillOpacity ) ;
73+ } else {
74+ //面类型
75+ Canvas . polygon ( ctx , vectorArray , lineOpacity , fillOpacity ) ;
76+ }
7177 } else if ( markerType === 'pin' ) {
7278 point = point . add ( 0 , - hLineWidth ) ;
7379 for ( let j = vectorArray . length - 1 ; j >= 0 ; j -- ) {
@@ -140,7 +146,7 @@ export function translateMarkerLineAndFill<T extends Partial<TemplateSymbol>>(s:
140146 return result ;
141147}
142148
143- export type MarkerType = 'triangle' | 'cross' | 'diamond' | 'square' | 'rectangle' | 'x' | 'bar' | 'pin' | 'pie'
149+ export type MarkerType = 'triangle' | 'cross' | 'diamond' | 'square' | 'rectangle' | 'roundrectangle' | ' x' | 'bar' | 'pin' | 'pie'
144150
145151export function getVectorMarkerPoints ( markerType : MarkerType , width : number , height : number ) {
146152 //half height and half width
@@ -172,7 +178,7 @@ export function getVectorMarkerPoints(markerType: MarkerType, width: number, hei
172178 v2 = new Point ( ( left + hw ) , ( top - hh ) ) ;
173179 v3 = new Point ( ( left - hw ) , ( top - hh ) ) ;
174180 return [ v0 , v1 , v2 , v3 ] ;
175- } else if ( markerType === 'rectangle' ) {
181+ } else if ( markerType === 'rectangle' || markerType === 'roundrectangle' ) {
176182 v0 = new Point ( left , top ) ;
177183 v1 = v0 . add ( width , 0 ) ;
178184 v2 = v0 . add ( width , height ) ;
0 commit comments