Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust touch logic for non-interactive images #55

Merged
merged 9 commits into from
Aug 15, 2024

Conversation

abrin
Copy link
Contributor

@abrin abrin commented Jul 25, 2024

CanvasPanel can use a static-preset, but set interactive to false. This works ok in many cases, but falls down in a few. This allows us to adjust the interactivity from the css level by moving the pointer-events logic into it’s own css class that’s assigned based on the interactive prop

CanvasPanel can use a static renderer, but set interactive to `false`.  This works _ok_ in many cases, but falls down in a few.  This allows us to adjust the interactivity from the css level by moving the pointer-events logic into it’s own css class that’s  assigned based on the interactive prop
Copy link

codesandbox-ci bot commented Jul 25, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@abrin abrin marked this pull request as ready for review July 25, 2024 21:27
Comment on lines +448 to +452
let isInteractive = true;
// if we have a render preset and that render preset sets interactive to false, then... disable it
if (renderPreset && Array.isArray(renderPreset) && renderPreset.length > 1 && (renderPreset[1] as any).interactive === false) {
isInteractive = false;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a logical assumption, by default it's interactive, but if someone explicitly sets the presets to disable the interactivity, then it isn't

abrin added a commit to abrin/iiif-canvas-panel that referenced this pull request Jul 25, 2024
This PR is dependent on atlas-viewer/atlas#55, and aims to demonstrate that setting interactive=false in CanvasPanel disables the mousewheel and touch  interactions
@bulbil
Copy link
Contributor

bulbil commented Jul 27, 2024

This makes a lot of sense to me, being a bit more selective of where pointer-events: none gets applied.

I noticed that .atlas-static-image also has pointer-events: none-- I was thinking that ought to be removed as well

.atlas-overlay { position: absolute; top: 0; left: 0; none; overflow: hidden; }
/** setting the pointer events to none means that Atlas will own the touch and mousewheel events **/
.atlas-overlay--interactive { pointer-events: none; }
.atlas-static-image { position: absolute; user-select: none; transform-origin: 0px 0px; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure where best to test this, but removing it didn't seem to change any of the stories

@stephenwf
Copy link
Collaborator

One thing to test might be the box-resizing on the homepage annotations story. I think that uses interactive at the overlay level.

Changes look good, I think I've confused things by using the word interactive to mean two different things in two different contexts! (Is the canvas interactive, is the HTML painted on the canvas interactive). I will try to get this pulled down later this week and test with some of the annotation stuff.

@abrin
Copy link
Contributor Author

abrin commented Jul 29, 2024

One thing to test might be the box-resizing on the homepage annotations story. I think that uses interactive at the overlay level.

Changes look good, I think I've confused things by using the word interactive to mean two different things in two different contexts! (Is the canvas interactive, is the HTML painted on the canvas interactive). I will try to get this pulled down later this week and test with some of the annotation stuff.

@stephenwf So... the homepage renderer story gets at the core of the question, good point -- should we assume that if the static-preset preset is set at all that we should not enable any interactions? Or, does the interactive property that can be set on the renderer govern this?

@abrin abrin changed the title adjust touch logic for static rendering adjust touch logic for non-interactive images Jul 30, 2024
@stephenwf
Copy link
Collaborator

I think the changes to the static preset (from the storybook) are fine. I don't know of any uses of the static preset + annotations. Are you happy for me to merge and release?

@abrin
Copy link
Contributor Author

abrin commented Aug 15, 2024

Hi Stephen, yes please & thank you!

@stephenwf stephenwf merged commit 169b376 into atlas-viewer:main Aug 15, 2024
1 check passed
@stephenwf
Copy link
Collaborator

v2.2.8 should be published in a few minutes 👍

stephenwf added a commit that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants