@@ -232,6 +232,7 @@ def get_uid_str(uid):
232232 const storeUrls = view.model.get('store_urls');
233233 const invokeTimeout = view.model.get('invoke_timeout');
234234 const invokeBatched = view.model.get('invoke_batched');
235+ const preventScroll = view.model.get('prevent_scroll');
235236
236237 const pageMode = view.model.get('page_mode');
237238 const pageEsm = view.model.get('page_esm');
@@ -424,7 +425,7 @@ def get_uid_str(uid):
424425 const divRef = React.useRef();
425426
426427 React.useEffect(() => {
427- if(!divRef.current || pageMode ) {
428+ if(!divRef.current || !preventScroll ) {
428429 return () => {};
429430 }
430431
@@ -450,7 +451,7 @@ def get_uid_str(uid):
450451 divRef.current.removeEventListener("mouseleave", handleMouseLeave);
451452 }
452453 };
453- }, [divRef, pageMode ]);
454+ }, [divRef, preventScroll ]);
454455
455456 // Config changed on JS side (from within <Vitessce/>),
456457 // send updated config to Python side.
@@ -609,10 +610,11 @@ class VitessceWidget(anywidget.AnyWidget):
609610 page_esm = Unicode ('' ).tag (sync = True )
610611 invoke_timeout = Int (300000 ).tag (sync = True )
611612 invoke_batched = Bool (True ).tag (sync = True )
613+ prevent_scroll = Bool (True ).tag (sync = True )
612614
613615 store_urls = List (trait = Unicode ('' ), default_value = []).tag (sync = True )
614616
615- def __init__ (self , config , height = 600 , theme = 'auto' , uid = None , port = None , proxy = False , js_package_version = '3.6.3' , js_dev_mode = False , custom_js_url = '' , plugins = None , remount_on_uid_change = True , prefer_local = True , invoke_timeout = 300000 , invoke_batched = True , page_mode = False , page_esm = None ):
617+ def __init__ (self , config , height = 600 , theme = 'auto' , uid = None , port = None , proxy = False , js_package_version = '3.6.3' , js_dev_mode = False , custom_js_url = '' , plugins = None , remount_on_uid_change = True , prefer_local = True , invoke_timeout = 300000 , invoke_batched = True , page_mode = False , page_esm = None , prevent_scroll = True ):
616618 """
617619 Construct a new Vitessce widget.
618620
@@ -632,6 +634,7 @@ def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=
632634 :param bool invoke_batched: Should invocations (Zarr gets) be submitted in batch, or individually? By default, True.
633635 :param bool page_mode: Whether to render the <Vitessce/> component in grid-mode or page-mode. By default, False.
634636 :param str page_esm: The ES module string for the page component creation function. Optional.
637+ :param bool prevent_scroll: Should mouseover in the Vitessce widget prevent disable the scrolling of the notebook? By default, True.
635638
636639 .. code-block:: python
637640 :emphasize-lines: 4
@@ -665,7 +668,7 @@ def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=
665668 js_package_version = js_package_version , js_dev_mode = js_dev_mode , custom_js_url = custom_js_url ,
666669 plugin_esm = plugin_esm , remount_on_uid_change = remount_on_uid_change ,
667670 page_mode = page_mode , page_esm = ('' if page_esm is None else page_esm ),
668- invoke_timeout = invoke_timeout , invoke_batched = invoke_batched ,
671+ invoke_timeout = invoke_timeout , invoke_batched = invoke_batched , prevent_scroll = prevent_scroll ,
669672 uid = uid_str , store_urls = list (self ._stores .keys ())
670673 )
671674
0 commit comments