Body scroll on React VectorMap devextreme component.

huangapple go评论80阅读模式
英文:

Body scroll on React VectorMap devextreme component

问题

我正在使用DevExtreme的VectorMap组件,我已禁用缩放平移

zoomingEnabled={false}
panningEnabled={false}

我的问题是,即使我在VectorMap上滚动,我希望能够滚动整个页面。我在这个codesandbox中重现了我的情况。

正如您所看到的,如果我在VectorMap上滚动,整个页面不会滚动,但如果我在下面的红色区域中执行相同的操作,情况就不同。

我该如何实现相同的行为?

<VectorMap
  id="vector-map"
  title="通用地图"
  zoomingEnabled={false}
  panningEnabled={false}
  onClick={(e) => console.log(e)}
>
  <Layer
    dataSource={pangaeaContinents}
    name="areas"
    color="#bb7862"
  />
</VectorMap>

演示 Codesandbox

英文:

I am using a devextreme VectorMap Component, i have disabled zoom and panning

zoomingEnabled={false}
panningEnabled={false}

My problem is that even if i scroll on my VectorMap i want the body scrolling. I have reproduced my case here in this codesandbox

As you can see if i scroll on the VectorMap the body is not scrolling, this is not happening if i do the same in the red section below.

How can i achieve the same behaviour?

  &lt;VectorMap
    id=&quot;vector-map&quot;
    title=&quot;Generic Map&quot;
    zoomingEnabled={false}
    panningEnabled={false}
    onClick={(e) =&gt; console.log(e)}
  &gt;
    &lt;Layer
      dataSource={pangaeaContinents}
      name=&quot;areas&quot;
      color=&quot;#bb7862&quot;
    /&gt;
  &lt;/VectorMap&gt;

Demo Codesandbox

答案1

得分: 1

VectorMap 组件 中有一个属性可用于禁用滚动:

wheelEnabled

指定地图是否应在用户滚动鼠标滚轮时响应。

类型:布尔值
默认值:true

滚动鼠标滚轮会放大地图。如果需要禁用此功能,请将 false 赋值给 wheelEnabled 属性。
用户仍然可以使用控制栏来放大地图。

文档页面

<VectorMap
    id="vector-map"
    title="通用地图"
    zoomingEnabled={false}
    panningEnabled={false}
    wheelEnabled={false}
    onClick={(e) => console.log(e)}
>

更新后的代码段:

Body scroll on React VectorMap devextreme component.

英文:

The Devextreme VectorMap Component has a prop to disable scrolling:

> #### wheelEnabled
>
> Specifies whether or not the map should respond when a user rolls the mouse wheel.
> > Type: Boolean
> > Default Value: true
>
> Rolling the mouse wheel zooms a map. If you need to disable this capability, assign false to the wheelEnabled property.
> A user will still be able to zoom the map using the control bar.
>
> ### <sup>Documentation page</sup>


&lt;VectorMap
    id=&quot;vector-map&quot;
    title=&quot;Generic Map&quot;
    zoomingEnabled={false}
    panningEnabled={false}
    wheelEnabled={false}
    onClick={(e) =&gt; console.log(e)}
&gt;

Updated snippet:

Body scroll on React VectorMap devextreme component.

huangapple
  • 本文由 发表于 2023年3月7日 06:10:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/75656302.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定