fix(touch): For viewport interactions use onPointerDown. (#4572)

This commit is contained in:
Joe Boccanfuso 2024-12-05 20:57:34 -05:00 committed by GitHub
parent ee9593a7e0
commit 6160718fd2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 9 deletions

View File

@ -18,14 +18,9 @@ describe('OHIF Double Click', () => {
// For whatever reason, with Cypress tests, we have to activate the
// viewport we are double clicking first.
cy.get('[data-cy="viewport-pane"]')
.eq(i)
.trigger('mousedown', 'center', {
force: true,
})
.trigger('mouseup', 'center', {
force: true,
});
cy.get('[data-cy="viewport-pane"]').eq(i).trigger('click', 'center', {
force: true,
});
// Wait for the viewport to be 'active'.
// TODO Is there a better way to do this?

View File

@ -58,7 +58,9 @@ function ViewportPane({
// onInteractionHandler...
// https://reactjs.org/docs/events.html#mouse-events
// https://stackoverflow.com/questions/8378243/catch-scrolling-event-on-overflowhidden-element
onMouseDown={onInteractionHandler}
// Use onPointerDown so that for the config property activateViewportBeforeInteraction===false,
// a touch drag will activate the viewport as well as apply the tool selected.
onPointerDown={onInteractionHandler}
onDoubleClick={onDoubleClick}
onClick={onInteractionHandler}
onScroll={onInteractionHandler}