Fix gallery select event with custom height and allow_preview=False (#4551)

* Logic for can_zoom

* CHANGELOG
This commit is contained in:
Freddy Boulton 2023-06-17 15:11:14 -04:00 committed by GitHub
parent b7010fa0eb
commit 98d1e8d291
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ No changes to highlight.
## Bug Fixes:
No changes to highlight.
- Fix bug where `select` event was not triggered in `gr.Gallery` if `height` was set to be large with `allow_preview=False` by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 4551](https://github.com/gradio-app/gradio/pull/4551)
## Other Changes:

View File

@ -130,7 +130,8 @@
});
}
$: can_zoom = window_height >= client_height;
// If you don't allow preview, assume can always zoom to trigger select event
$: can_zoom = !allow_preview ? true : window_height >= client_height;
let client_height = 0;
let window_height = 0;