Merge pull request #667 from SVG-Edit/fix-mouse-wheel-event

Fix : fix mouse-wheel javascript error
master
JFH 2021-11-23 11:18:17 +01:00 committed by GitHub
commit 83303065bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -1295,7 +1295,6 @@ export const DOMMouseScrollEvent = function (e) {
if (!e.shiftKey) { return; }
e.preventDefault();
const evt = e.originalEvent;
eventContext_.setRootSctm($id('svgcontent').querySelector('g').getScreenCTM().inverse());
@ -1304,7 +1303,7 @@ export const DOMMouseScrollEvent = function (e) {
const rulerwidth = eventContext_.getCurConfig().showRulers ? 16 : 0;
// mouse relative to content area in content pixels
const pt = transformPoint(evt.clientX, evt.clientY, eventContext_.getrootSctm());
const pt = transformPoint(e.clientX, e.clientY, eventContext_.getrootSctm());
// full work area width in screen pixels
const editorFullW = parseFloat(getComputedStyle(workarea, null).width.replace("px", ""));
@ -1323,7 +1322,7 @@ export const DOMMouseScrollEvent = function (e) {
const wOffsetLeft = wOffset.left + rulerwidth;
const wOffsetTop = wOffset.top + rulerwidth;
const delta = (evt.wheelDelta) ? evt.wheelDelta : (evt.detail) ? -evt.detail : 0;
const delta = (e.wheelDelta) ? e.wheelDelta : (e.detail) ? - e.detail : 0;
if (!delta) { return; }
let factor = Math.max(3 / 4, Math.min(4 / 3, (delta)));