I think the right answer is to expose a simple interface to convert screen coordinates (touch/pointer coords) into surface space by adding a function:
geometry::Point Surface::screen_to_local(geometry:Point const& p) const
{
// calculate some answer using transformation(), top_left() and size() info.
// You may even wish to ignore per-surface transformations and only return valid results
// when transformation() == identity. In which case it could be as trivial as:
// return p - top_left();
// or more complicated like:
// auto centre = top_left() + (size() / 2);
// return inverse(transformation()) * (p - centre);
}
That's a function instead of a class. It doesn't even need to be a method of Surface because it just uses existing public interface functions.
I think the right answer is to expose a simple interface to convert screen coordinates (touch/pointer coords) into surface space by adding a function:
geometry::Point Surface: :screen_ to_local( geometry: Point const& p) const transformation( )) * (p - centre);
{
// calculate some answer using transformation(), top_left() and size() info.
// You may even wish to ignore per-surface transformations and only return valid results
// when transformation() == identity. In which case it could be as trivial as:
// return p - top_left();
// or more complicated like:
// auto centre = top_left() + (size() / 2);
// return inverse(
}
That's a function instead of a class. It doesn't even need to be a method of Surface because it just uses existing public interface functions.