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

Safari / Firefox race condition #120

Merged
merged 1 commit into from
Feb 16, 2021
Merged

Conversation

strygo
Copy link
Contributor

@strygo strygo commented Feb 15, 2021

When the PinchZoom object is being initialized, an initial call to update() is scheduled. On Safari and Firefox, the IMG load event happens prior to the setTimeout, leading to the initial calls to establish offsets to be dropped.

  • Resolve race condition by setting up offsets prior to setTimeout()
  • Fix variable name typo
  • include options object with addEventListener calls to resolve Chrome warnings

- resolve Safari/Firefox race condition where initial offset is not established since img load-initiated update call is ignored due to planned update
- fix variable name typo
- include passive in event handlers to resolve Chrome warning
@sandstrom
Copy link
Collaborator

Thanks @strygo 💯

@sandstrom sandstrom merged commit 340c1a4 into manuelstofer:master Feb 16, 2021
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.

2 participants