From bb155331168474fc5d189d73603f9841ced57adc Mon Sep 17 00:00:00 2001 From: Stefan Silviu Date: Tue, 6 Dec 2022 14:37:41 +0200 Subject: [PATCH 1/2] fix: undefined points in touch events --- src/eventListeners/touchEventListeners.js | 8 ++++++-- src/tools/MagnifyTool.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/eventListeners/touchEventListeners.js b/src/eventListeners/touchEventListeners.js index 3556f2d41..837a7d58f 100644 --- a/src/eventListeners/touchEventListeners.js +++ b/src/eventListeners/touchEventListeners.js @@ -318,6 +318,9 @@ function onTouch(e) { break; case 'panmove': + if (!lastDelta || !startPoints) { + return false; + } // Using the delta-value of HammerJS, because it takes all pointers into account // This is very important when using panning in combination with pinch-zooming // But HammerJS' delta is relative to the start of the pan event @@ -437,8 +440,9 @@ function onTouch(e) { clearTimeout(pressTimeout); // If lastPoints is not yet set, it means panend fired without panstart or pan, - // So we can ignore this event - if (!lastPoints) { + // same with startPoints and touchstart/touchend + // So we can ignore these events + if (!lastPoints || !startPoints) { return false; } diff --git a/src/tools/MagnifyTool.js b/src/tools/MagnifyTool.js index 35c2680b3..29ed87398 100644 --- a/src/tools/MagnifyTool.js +++ b/src/tools/MagnifyTool.js @@ -87,7 +87,7 @@ export default class MagnifyTool extends BaseTool { this._createMagnificationCanvas(element); } - if (this.zoomCanvas === undefined) { + if (this.zoomCanvas === undefined || !evt.detail.currentPoints) { return; } @@ -98,7 +98,7 @@ export default class MagnifyTool extends BaseTool { // Calculate the on-canvas location of the mouse pointer / touch const canvasLocation = external.cornerstone.pixelToCanvas( - evt.detail.element, + element, evt.detail.currentPoints.image ); From e11001a4b23752e1d946b3ce26e81bf909e780c1 Mon Sep 17 00:00:00 2001 From: Stefan Silviu Date: Tue, 6 Dec 2022 15:11:30 +0200 Subject: [PATCH 2/2] Add @slak44 as a contributor --- .all-contributorsrc | 9 +++++++++ README.md | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 50140e260..a24632010 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -383,6 +383,15 @@ "review", "userTesting" ] + }, + { + "login": "slak44", + "name": "Ștefan Silviu-Alexandru", + "avatar_url": "https://avatars.githubusercontent.com/u/8948001?v=4", + "profile": "https://github.com/slak44", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7 diff --git a/README.md b/README.md index ba1724ed6..3ad872bb5 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![Build Status][build-badge]][build] [![Coverage Status][coverage-badge]][coverage] -[![All Contributors](https://img.shields.io/badge/all_contributors-37-orange.svg?style=flat-square)](#contributors) +[![All Contributors](https://img.shields.io/badge/all_contributors-38-orange.svg?style=flat-square)](#contributors) [![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] @@ -165,7 +165,7 @@ Thanks goes to these people ([emoji key][emojis]): | [Juan Narvaez
Juan Narvaez](https://github.com/jdnarvaez)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=jdnarvaez "Code") | [Mike
Mike](https://github.com/mikehazell)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Documentation") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Code") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Tests") | [Sangkeun Kim
Sangkeun Kim](http://sisobus.com)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=sisobus "Code") [πŸ’¬](#question-sisobus "Answering Questions") | [Victor Saase
Victor Saase](https://github.com/vsaase)
[πŸ€”](#ideas-vsaase "Ideas, Planning, & Feedback") | [Michael Wasser
Michael Wasser](http://www.mikewasser.com)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=untoldone "Documentation") | [Amandeep Singh
Amandeep Singh](https://github.com/singhArmani)
[πŸ–‹](#content-singhArmani "Content") | [Madison Dickson
Madison Dickson](http://mix3dstudios.com)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mix3d "Documentation") | | [Kevin Lee Drum
Kevin Lee Drum](https://github.com/kevinleedrum)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kevinleedrum "Code") | [Makarand Bauskar
Makarand Bauskar](https://github.com/mmbauskar)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mbauskar "Code") | [Biharck Araujo
Biharck Araujo](http://www.biharck.com.br)
[πŸ’‘](#example-biharck "Examples") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=biharck "Documentation") | [Devon Bernard
Devon Bernard](https://www.linkedin.com/in/devonbernard)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=DevonBernard "Documentation") | [Karl-Heinrich
Karl-Heinrich](https://github.com/Karl-Heinrich)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3AKarl-Heinrich "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Karl-Heinrich "Code") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Karl-Heinrich "Tests") | [counterxing
counterxing](https://blog.xingbofeng.com/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Axingbofeng "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=xingbofeng "Code") | [Jorge Lopes
Jorge Lopes](https://github.com/jlopes90)
[πŸ’¬](#question-jlopes90 "Answering Questions") | | [Gabriel Garrido
Gabriel Garrido](http://garrido.io)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Ggpsv "Code") | [ASVBPREAUBV
ASVBPREAUBV](https://github.com/ASVBPREAUBV)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=ASVBPREAUBV "Documentation") | [frolic06
frolic06](https://github.com/frolic06)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=frolic06 "Code") | [codepage949
codepage949](https://github.com/codepage949)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=codepage949 "Code") | [Asherah Connor
Asherah Connor](https://kivikakk.ee)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kivikakk "Code") | [Ikko Ashimine
Ikko Ashimine](https://bandism.net/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Aeltociear "Bug reports") | [Bill Wallace
Bill Wallace](https://github.com/wayfarer3130)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=wayfarer3130 "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=wayfarer3130 "Documentation") | -| [Bruno Alves de Faria
Bruno Alves de Faria](http://radicalimaging.com/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Abrunoalvesdefaria "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Code") [πŸ–‹](#content-brunoalvesdefaria "Content") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Documentation") [πŸ”Œ](#plugin-brunoalvesdefaria "Plugin/utility libraries") [πŸ‘€](#review-brunoalvesdefaria "Reviewed Pull Requests") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Tests") [πŸ”§](#tool-brunoalvesdefaria "Tools") [πŸ““](#userTesting-brunoalvesdefaria "User Testing") | [Igor Octaviano
Igor Octaviano](http://igoroctaviano.com)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Documentation") [🚧](#maintenance-igoroctaviano "Maintenance") [πŸ‘€](#review-igoroctaviano "Reviewed Pull Requests") [πŸ““](#userTesting-igoroctaviano "User Testing") | +| [Bruno Alves de Faria
Bruno Alves de Faria](http://radicalimaging.com/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Abrunoalvesdefaria "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Code") [πŸ–‹](#content-brunoalvesdefaria "Content") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Documentation") [πŸ”Œ](#plugin-brunoalvesdefaria "Plugin/utility libraries") [πŸ‘€](#review-brunoalvesdefaria "Reviewed Pull Requests") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Tests") [πŸ”§](#tool-brunoalvesdefaria "Tools") [πŸ““](#userTesting-brunoalvesdefaria "User Testing") | [Igor Octaviano
Igor Octaviano](http://igoroctaviano.com)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Documentation") [🚧](#maintenance-igoroctaviano "Maintenance") [πŸ‘€](#review-igoroctaviano "Reviewed Pull Requests") [πŸ““](#userTesting-igoroctaviano "User Testing") | [Ștefan Silviu-Alexandru
Ștefan Silviu-Alexandru](https://github.com/slak44)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=slak44 "Code") | This project follows the [all-contributors][all-contributors] specification.