From 9b263c7237f3b48c01801880c23944620e93f637 Mon Sep 17 00:00:00 2001 From: Felicia Hummel Date: Wed, 5 Dec 2018 00:33:10 +0100 Subject: [PATCH] Fix for MouseWheelEvent deprecation in TypeScript 3.2 MouseWheelEvent is deprecated and was removed with TypeScript 3.2, however, MouseWheelEvent is still aliased to WheelEvent. For more info see https://github.com/Microsoft/TSJS-lib-generator/pull/579 This PR fixes the build with TypeScript 3.2 by checking the object properties. --- .../src/components/terminalTab.component.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index 1f784195..4f0eaadc 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -259,15 +259,23 @@ export class TerminalTabComponent extends BaseTabComponent { } } if (event.type === 'mousewheel') { + let wheelDeltaY = 0 + + if ('wheelDeltaY' in event) { + wheelDeltaY = (event as MouseWheelEvent)["wheelDeltaY"] + } else { + wheelDeltaY = (event as MouseWheelEvent)["deltaY"] + } if (event.ctrlKey || event.metaKey) { - if ((event as MouseWheelEvent).wheelDeltaY > 0) { + + if (wheelDeltaY > 0) { this.zoomIn() } else { this.zoomOut() } } else if (event.altKey) { event.preventDefault() - let delta = Math.round((event as MouseWheelEvent).wheelDeltaY / 50) + let delta = Math.round(wheelDeltaY / 50) this.sendInput(((delta > 0) ? '\u001bOA' : '\u001bOB').repeat(Math.abs(delta))) } }