I am trying to improve callout lines on maps I'm making. I'm currently using the method in this link to make my callout lines. That works fine, bu I'd like the lines to always go to the closest point of the label like this:
I think it would work if I used code down the line of this in the expression editor for the geometry generator.
make_line( make_point($x, $y), make_point((CASE WHEN "auxiliary_storage_labeling_positionx" > $x THEN "auxiliary_storage_labeling_positionx" WHEN ("auxiliary_storage_labeling_positionx" + "labelwidth") > $x AND ("auxiliary_storage_labeling_positionx") < $x THEN ("auxiliary_storage_labeling_positionx" + "labelwidth") ELSE $x END ) ,(CASE WHEN "auxiliary_storage_labeling_positiony" < $y THEN "auxiliary_storage_labeling_positiony" WHEN ("auxiliary_storage_labeling_positiony" + "labelHeight") < $y AND ("auxiliary_storage_labeling_positiony") > $y THEN ("auxiliary_storage_labeling_positiony" + "labelHeight") ELSE $y END ) ) )
I'm not sure if I have all the < and > correct but that's beside the point. The issue with that is that I can't seem to figure out how to get the width and the height of the label.
I am not very good with the expression editor, and have never done anything with the function editor.