@@ -2279,11 +2279,11 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
22792279 v4_rgb = current_fill .rgb ;
22802280 else
22812281 v4_rgb = GMT -> session .no_rgb ;
2282- if (v4_outline ) gmt_setpen (GMT , & Ctrl -> W .pen );
2282+ if (v4_outline ) gmt_setpen (GMT , & Ctrl -> W .pen );
22832283 if (S .v .status & PSL_VEC_BEGIN ) v4_outline += 8 ; /* Double-headed */
22842284 dim [PSL_VEC_HEAD_SHAPE ] = GMT -> current .setting .map_vector_shape ;
22852285 dim [PSL_VEC_HEAD_WIDTH ] *= 0.5 ; /* Since it was double in the parsing */
2286- psl_vector_v4 (PSL , xpos [item ], plot_y , dim , v4_rgb , v4_outline );
2286+ psl_vector_v4 (PSL , xpos [item ], plot_y , dim , v4_rgb , v4_outline );
22872287 }
22882288 else { /* Current vector model */
22892289 dim [PSL_VEC_HEAD_SHAPE ] = S .v .v_shape ;
@@ -2293,7 +2293,51 @@ EXTERN_MSC int GMT_psxy (void *V_API, int mode, void *args) {
22932293 dim [PSL_VEC_TRIM_BEGIN ] = (double )S .v .v_trim [0 ];
22942294 dim [PSL_VEC_TRIM_END ] = (double )S .v .v_trim [1 ];
22952295 dim [PSL_VEC_HEAD_PENWIDTH ] = s * headpen_width ; /* Possibly shrunk head pen width */
2296- PSL_plotsymbol (PSL , xpos [item ], plot_y , dim , PSL_VECTOR );
2296+ if (Ctrl -> A .active && (Ctrl -> A .mode == GMT_STAIRS_X || Ctrl -> A .mode == GMT_STAIRS_Y )) {
2297+ /* Broken (right-angle elbow) arrow: two legs meeting at a corner point.
2298+ * Round line caps are used so each leg's semicircular endpoint fills the
2299+ * outer-corner gap that butt caps would leave at the elbow. */
2300+ double elbow_x , elbow_y , leg1_length , leg2_length , s1 , s2 ;
2301+ unsigned int leg1_status , leg2_status ;
2302+ if (Ctrl -> A .mode == GMT_STAIRS_X ) { /* Horizontal first, then vertical */
2303+ elbow_x = x_2 ; elbow_y = plot_y ;
2304+ }
2305+ else { /* GMT_STAIRS_Y: vertical first, then horizontal */
2306+ elbow_x = xpos [item ]; elbow_y = y_2 ;
2307+ }
2308+ leg1_length = hypot (elbow_x - xpos [item ], elbow_y - plot_y );
2309+ leg2_length = hypot (x_2 - elbow_x , y_2 - elbow_y );
2310+ s1 = gmt_get_vector_shrinking (GMT , & (S .v ), data_magnitude , leg1_length );
2311+ s2 = gmt_get_vector_shrinking (GMT , & (S .v ), data_magnitude , leg2_length );
2312+ PSL_setlinecap (PSL , PSL_ROUND_CAP ); /* Round ends fill the elbow corner */
2313+ /* Leg 1: tail → elbow. Keep begin-head (if any); no end-head. */
2314+ leg1_status = S .v .status & ~(PSL_VEC_END | PSL_VEC_END_L | PSL_VEC_END_R | PSL_VEC_OFF_END );
2315+ dim [PSL_VEC_XTIP ] = elbow_x ;
2316+ dim [PSL_VEC_YTIP ] = elbow_y ;
2317+ dim [PSL_VEC_TAIL_WIDTH ] = s1 * S .v .v_width ;
2318+ dim [PSL_VEC_HEAD_LENGTH ] = s1 * S .v .h_length ;
2319+ dim [PSL_VEC_HEAD_WIDTH ] = s1 * S .v .h_width ;
2320+ dim [PSL_VEC_HEAD_PENWIDTH ] = s1 * headpen_width ;
2321+ dim [PSL_VEC_TRIM_BEGIN ] = (double )S .v .v_trim [0 ];
2322+ dim [PSL_VEC_TRIM_END ] = 0.0 ;
2323+ dim [PSL_VEC_STATUS ] = (double )leg1_status ;
2324+ PSL_plotsymbol (PSL , xpos [item ], plot_y , dim , PSL_VECTOR );
2325+ /* Leg 2: elbow → tip. Keep end-head (if any); no begin-head. */
2326+ leg2_status = S .v .status & ~(PSL_VEC_BEGIN | PSL_VEC_BEGIN_L | PSL_VEC_BEGIN_R | PSL_VEC_OFF_BEGIN );
2327+ dim [PSL_VEC_XTIP ] = x_2 ;
2328+ dim [PSL_VEC_YTIP ] = y_2 ;
2329+ dim [PSL_VEC_TAIL_WIDTH ] = s2 * S .v .v_width ;
2330+ dim [PSL_VEC_HEAD_LENGTH ] = s2 * S .v .h_length ;
2331+ dim [PSL_VEC_HEAD_WIDTH ] = s2 * S .v .h_width ;
2332+ dim [PSL_VEC_HEAD_PENWIDTH ] = s2 * headpen_width ;
2333+ dim [PSL_VEC_TRIM_BEGIN ] = 0.0 ;
2334+ dim [PSL_VEC_TRIM_END ] = (double )S .v .v_trim [1 ];
2335+ dim [PSL_VEC_STATUS ] = (double )leg2_status ;
2336+ PSL_plotsymbol (PSL , elbow_x , elbow_y , dim , PSL_VECTOR );
2337+ PSL_setlinecap (PSL , PSL_BUTT_CAP ); /* Restore default */
2338+ }
2339+ else
2340+ PSL_plotsymbol (PSL , xpos [item ], plot_y , dim , PSL_VECTOR );
22972341 }
22982342 break ;
22992343 case GMT_SYMBOL_GEOVECTOR :
0 commit comments