From 9b2b6a65d82117966e6b0da6537a1424bab7d6f2 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Mon, 5 Feb 2024 15:44:50 +0100 Subject: [PATCH] feat: remove touch interaction module BREAKING CHANGE: Migrated to `diagram-js@14` which removes touch interaction module, and dependency on unsupported `hammerjs` package. If you rely on touch interaction, you need to support touch interaction on your own. deps: update to `diagram-js@14` feat: allow to add to selection via lasso tool Closes #2053 --- lib/Modeler.js | 2 - .../behavior/DataInputAssociationBehavior.js | 2 +- package-lock.json | 29 ++++--------- package.json | 2 +- test/integration/CustomElementsSpec.js | 5 +-- .../label-editing/TouchIntegrationSpec.js | 41 ------------------- .../spec/features/modeling/LabelBoundsSpec.js | 2 +- .../features/modeling/UpdatePropertiesSpec.js | 2 +- .../behavior/DropOnFlowBehaviorSpec.js | 3 -- .../modeling/layout/LayoutConnectionSpec.js | 2 +- 10 files changed, 14 insertions(+), 76 deletions(-) delete mode 100644 test/spec/features/label-editing/TouchIntegrationSpec.js diff --git a/lib/Modeler.js b/lib/Modeler.js index ad84b8a553..d9bc0f7617 100644 --- a/lib/Modeler.js +++ b/lib/Modeler.js @@ -7,7 +7,6 @@ import NavigatedViewer from './NavigatedViewer'; import KeyboardMoveModule from 'diagram-js/lib/navigation/keyboard-move'; import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas'; -import TouchModule from 'diagram-js/lib/navigation/touch'; import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll'; import AlignElementsModule from './features/align-elements'; @@ -156,7 +155,6 @@ Modeler.prototype._interactionModules = [ // non-modeling components KeyboardMoveModule, MoveCanvasModule, - TouchModule, ZoomScrollModule ]; diff --git a/lib/features/modeling/behavior/DataInputAssociationBehavior.js b/lib/features/modeling/behavior/DataInputAssociationBehavior.js index 499d62af82..26cbcc37e7 100644 --- a/lib/features/modeling/behavior/DataInputAssociationBehavior.js +++ b/lib/features/modeling/behavior/DataInputAssociationBehavior.js @@ -145,7 +145,7 @@ inherits(DataInputAssociationBehavior, CommandInterceptor); /** * Only call the given function when the event - * touches a bpmn:DataInputAssociation. + * changes a bpmn:DataInputAssociation. * * @param {Function} fn * @return {Function} diff --git a/package-lock.json b/package-lock.json index 2f0a1e7749..159209b38f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "SEE LICENSE IN LICENSE", "dependencies": { "bpmn-moddle": "^8.1.0", - "diagram-js": "^13.4.0", + "diagram-js": "^14.0.0", "diagram-js-direct-editing": "^2.1.1", "ids": "^1.0.5", "inherits-browser": "^0.1.0", @@ -3326,14 +3326,13 @@ "dev": true }, "node_modules/diagram-js": { - "version": "13.4.0", - "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-13.4.0.tgz", - "integrity": "sha512-JI6UI74J3TgRcgBhuZZJso//bUdh22rcVu9XSf1EBVisKPt9c+woKzOrr/79OutXvft+1NOLNEiBg58kZ8p7+Q==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-14.0.0.tgz", + "integrity": "sha512-6XNQbBCJ7mA35O7HLU78NBdwGqK1uzK6C/x/Pb61QXWNNIOzg9ewI4257W3CdlJSE2jP+pTM7a7TpGG2BNcc3g==", "dependencies": { "@bpmn-io/diagram-js-ui": "^0.2.2", "clsx": "^2.0.0", "didi": "^10.0.1", - "hammerjs": "^2.0.1", "inherits-browser": "^0.1.0", "min-dash": "^4.1.0", "min-dom": "^4.1.0", @@ -5084,14 +5083,6 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "node_modules/hammerjs": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", - "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==", - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", @@ -17840,14 +17831,13 @@ "dev": true }, "diagram-js": { - "version": "13.4.0", - "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-13.4.0.tgz", - "integrity": "sha512-JI6UI74J3TgRcgBhuZZJso//bUdh22rcVu9XSf1EBVisKPt9c+woKzOrr/79OutXvft+1NOLNEiBg58kZ8p7+Q==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/diagram-js/-/diagram-js-14.0.0.tgz", + "integrity": "sha512-6XNQbBCJ7mA35O7HLU78NBdwGqK1uzK6C/x/Pb61QXWNNIOzg9ewI4257W3CdlJSE2jP+pTM7a7TpGG2BNcc3g==", "requires": { "@bpmn-io/diagram-js-ui": "^0.2.2", "clsx": "^2.0.0", "didi": "^10.0.1", - "hammerjs": "^2.0.1", "inherits-browser": "^0.1.0", "min-dash": "^4.1.0", "min-dom": "^4.1.0", @@ -19167,11 +19157,6 @@ "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "hammerjs": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", - "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==" - }, "hard-rejection": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", diff --git a/package.json b/package.json index 6656fd258d..93ce667a66 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,7 @@ }, "dependencies": { "bpmn-moddle": "^8.1.0", - "diagram-js": "^13.4.0", + "diagram-js": "^14.0.0", "diagram-js-direct-editing": "^2.1.1", "ids": "^1.0.5", "inherits-browser": "^0.1.0", diff --git a/test/integration/CustomElementsSpec.js b/test/integration/CustomElementsSpec.js index 7b205823be..ba41a372cb 100644 --- a/test/integration/CustomElementsSpec.js +++ b/test/integration/CustomElementsSpec.js @@ -12,9 +12,8 @@ import { import customElementsModules from './custom-elements'; -var noTouchInteractionModule = { touchInteractionEvents: [ 'value', null ] }, - modelerModules = Modeler.prototype._modules, - customModules = [ customElementsModules, noTouchInteractionModule ]; +var modelerModules = Modeler.prototype._modules, + customModules = [ customElementsModules ]; var testModules = [].concat(modelerModules, customModules); diff --git a/test/spec/features/label-editing/TouchIntegrationSpec.js b/test/spec/features/label-editing/TouchIntegrationSpec.js deleted file mode 100644 index 26b3513bda..0000000000 --- a/test/spec/features/label-editing/TouchIntegrationSpec.js +++ /dev/null @@ -1,41 +0,0 @@ -import TestContainer from 'mocha-test-container-support'; - -import Modeler from 'lib/Modeler'; - - -describe('direct editing - touch integration', function() { - - var container; - - beforeEach(function() { - container = TestContainer.get(this); - }); - - - function createModeler(xml) { - var modeler = new Modeler({ container: container }); - - return modeler.importXML(xml).then(function(result) { - return { error: null, modeler: modeler }; - }).catch(function(err) { - return { error: err, modeler: modeler }; - }); - } - - - it('should work on modeler (manual test)', function() { - var xml = require('../../../fixtures/bpmn/simple.bpmn'); - return createModeler(xml).then(function(result) { - expect(result.error).not.to.exist; - }); - }); - - - it('should edit labels via double tap (manual test)', function() { - var xml = require('./LabelEditing.bpmn'); - return createModeler(xml).then(function(result) { - expect(result.error).not.to.exist; - }); - }); - -}); diff --git a/test/spec/features/modeling/LabelBoundsSpec.js b/test/spec/features/modeling/LabelBoundsSpec.js index 4e62766dcd..64b1d04769 100644 --- a/test/spec/features/modeling/LabelBoundsSpec.js +++ b/test/spec/features/modeling/LabelBoundsSpec.js @@ -321,7 +321,7 @@ describe('label bounds', function() { }); - it('should not update DI of untouched labels', function() { + it('should not update DI of unchanged labels', function() { var xml = require('./LabelBoundsSpec.simple.bpmn'); diff --git a/test/spec/features/modeling/UpdatePropertiesSpec.js b/test/spec/features/modeling/UpdatePropertiesSpec.js index b631c92f8a..8e6ef771c4 100644 --- a/test/spec/features/modeling/UpdatePropertiesSpec.js +++ b/test/spec/features/modeling/UpdatePropertiesSpec.js @@ -96,7 +96,7 @@ describe('features/modeling - update properties', function() { })); - it('should keep unchanged default flow untouched', inject( + it('should keep unchanged default flow intact', inject( function(elementRegistry, modeling) { // given diff --git a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js index 5254551575..eef2da5852 100644 --- a/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js +++ b/test/spec/features/modeling/behavior/DropOnFlowBehaviorSpec.js @@ -11,8 +11,6 @@ import coreModule from 'lib/core'; import moveModule from 'diagram-js/lib/features/move'; import modelingModule from 'lib/features/modeling'; -var noTouchInteractionModule = { touchInteractionEvents: [ 'value', null ] }; - import { createCanvasEvent as canvasEvent } from '../../../../util/MockEvents'; @@ -26,7 +24,6 @@ describe('modeling/behavior - drop on connection', function() { beforeEach(bootstrapModeler(diagramXML, { modules: [ - noTouchInteractionModule, moveModule, modelingModule, coreModule diff --git a/test/spec/features/modeling/layout/LayoutConnectionSpec.js b/test/spec/features/modeling/layout/LayoutConnectionSpec.js index 79034b1303..036185e24c 100644 --- a/test/spec/features/modeling/layout/LayoutConnectionSpec.js +++ b/test/spec/features/modeling/layout/LayoutConnectionSpec.js @@ -37,7 +37,7 @@ describe('features/modeling - layout connection', function() { })); - describe('should not touch already layouted', function() { + describe('should not change already layouted', function() { it('execute', inject(function(elementRegistry, modeling, bpmnFactory) {