Hi Paolo, You have not told us what you are trying to achieve in clear terms. But if you want to move dynamics, the following function I use works fine, and the hairpin naturally adapts.
But show us a diagram of what you need. Andrew %==== \version "2.21.0" % dynamics offset doff = #(define-music-function (offsetX offsetY) (number? number?) #{ \once \override DynamicText.X-offset = $offsetX \once \override DynamicLineSpanner.Y-offset = $offsetY #}) { \doff 2 0 a'\p\< a' a' \doff 3 0 a'\ff } %====