How to fix “ Property 'wheelDelta' does not exist on type 'WheelEvent' ” while upgrading to angular 7,rxjs6?

孤者浪人 提交于 2019-12-05 23:59:50

It seems like WheelEvent doesn't have this property anymore as it says. Now they added deltaY and deltaX.

Now you have to access event.deltaY instead of event.wheelData.

But deltaY has the opposite value of wheelData. That means when wheelData on the event was positive (scroll up) deltaY will be a negative number, and vice versa.

Example:

Change this:

        zoomScroll(event: WheelEvent) {
            if (event.wheelDelta > 0) {
                this.zoomIn();
            } else if (event.wheelDelta < 0) {
                this.zoomOut();
            }
        }

For this:

       zoomScroll(event: WheelEvent) {
           if (event.deltaY < 0) {
               this.zoomIn();
           } else if (event.deltaY > 0) {
               this.zoomOut();
           }
    }

source: https://github.com/Microsoft/TypeScript/issues/9071

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!