Skip to content

Commit e5e4fc5

Browse files
committed
Revert broken annotation coordinate fix
The annotation coordinate transformation change was incorrect and made positioning WORSE. Reverting to original behavior. The annotation text issues (truncation, overlapping) are pre-existing bugs in the annotation rendering system, not caused by coordinate transformation issues.
1 parent 866c261 commit e5e4fc5

File tree

1 file changed

+7
-29
lines changed

1 file changed

+7
-29
lines changed

src/text/fortplot_annotation_rendering.f90

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ module fortplot_annotation_rendering
1414
use fortplot_context, only: plot_context
1515
use fortplot_annotations, only: text_annotation_t, COORD_DATA, COORD_FIGURE, COORD_AXIS
1616
use fortplot_logging, only: log_info, log_warning
17-
use fortplot_pdf, only: pdf_context
18-
use fortplot_ascii, only: ascii_context
1917
implicit none
2018

2119
private
@@ -78,33 +76,13 @@ subroutine render_figure_annotations(backend, annotations, annotation_count, &
7876
cycle
7977
end if
8078

81-
! Transform coordinates based on backend requirements
82-
! PDF backend expects data coordinates and does its own transformation
83-
! PNG/ASCII backends expect pixel coordinates
84-
select type (backend)
85-
type is (pdf_context)
86-
! PDF backend: pass data coordinates directly for COORD_DATA
87-
select case (annotations(i)%coord_type)
88-
case (COORD_DATA)
89-
render_x = annotations(i)%x
90-
render_y = annotations(i)%y
91-
case default
92-
call transform_annotation_to_rendering_coords(annotations(i), &
93-
x_min, x_max, y_min, y_max, &
94-
width, height, &
95-
margin_left, margin_right, &
96-
margin_bottom, margin_top, &
97-
render_x, render_y)
98-
end select
99-
class default
100-
! Other backends: use pixel coordinate transformation
101-
call transform_annotation_to_rendering_coords(annotations(i), &
102-
x_min, x_max, y_min, y_max, &
103-
width, height, &
104-
margin_left, margin_right, &
105-
margin_bottom, margin_top, &
106-
render_x, render_y)
107-
end select
79+
! Transform coordinates to rendering coordinates
80+
call transform_annotation_to_rendering_coords(annotations(i), &
81+
x_min, x_max, y_min, y_max, &
82+
width, height, &
83+
margin_left, margin_right, &
84+
margin_bottom, margin_top, &
85+
render_x, render_y)
10886

10987
! Set annotation color
11088
call backend%color(annotations(i)%color(1), &

0 commit comments

Comments
 (0)