Skip to main content
Xu_it
Associate II
August 23, 2019
Solved

Does touchgfx support multi-touch?

  • August 23, 2019
  • 5 replies
  • 1926 views

Hello, everyone.

Does touchgfx support multi-touch?

Thanks in advance!

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Hi @Fanny XU​,

TouchGFX doesn't support multi touch. The TouchController interface is based on a single set of coordinates and whether a touch was registered or not.

/**
 * @fn virtual bool TouchController::sampleTouch(int32_t& x, int32_t& y) = 0;
 *
 * @brief Checks whether the touch screen is being touched, and if so, what coordinates.
 *
 * Checks whether the touch screen is being touched, and if so, what coordinates.
 *
 * @param [out] x The x position of the touch
 * @param [out] y The y position of the touch
 *
 * @return True if a touch has been detected, otherwise false.
 */
 virtual bool sampleTouch(int32_t& x, int32_t& y) = 0;

If you have a touch controller IC that can do multi-touch you could probably imeplement these as special events and propagate them to your active views.

Best regards,

Martin

5 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
August 23, 2019

Hi @Fanny XU​,

TouchGFX doesn't support multi touch. The TouchController interface is based on a single set of coordinates and whether a touch was registered or not.

/**
 * @fn virtual bool TouchController::sampleTouch(int32_t& x, int32_t& y) = 0;
 *
 * @brief Checks whether the touch screen is being touched, and if so, what coordinates.
 *
 * Checks whether the touch screen is being touched, and if so, what coordinates.
 *
 * @param [out] x The x position of the touch
 * @param [out] y The y position of the touch
 *
 * @return True if a touch has been detected, otherwise false.
 */
 virtual bool sampleTouch(int32_t& x, int32_t& y) = 0;

If you have a touch controller IC that can do multi-touch you could probably imeplement these as special events and propagate them to your active views.

Best regards,

Martin

Xu_it
Xu_itAuthor
Associate II
August 29, 2019

Hi Martin

Thank you very much for your reply. ​And is it possible to have all widgets support multi-touch in the way you describe? For example, the zoom of a picture is operated by two fingers.

Martin KJELDSEN
Principal III
August 29, 2019

You would need to change the behavior of all widgets to support multi-touch, because the code written for them only understand click-, drag- or gestureEvents (limited to swipe). But this is entirely possible to do, to have a specialized version of the widgets you want to add multi-touch to. e.g. If you're looking to add zoom to a static image you could combine ScaleableImage (uses the texturemapper) with multi-touch. It would be an expensive widget.

/Martin

Xu_it
Xu_itAuthor
Associate II
August 30, 2019

OK,thank you for your answer.​

Martin KJELDSEN
Principal III
August 30, 2019

You're welcome!

/Martin