From a830c1e1e0ae5786733c2636e0cd2bab40ee4d5d Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Sun, 10 Dec 2017 00:39:47 +0100 Subject: [PATCH] chore(snapping): remove dead code * we don't support moving of lanes; the removed code never made it into production. --- lib/features/snapping/BpmnSnapping.js | 86 --------------------------- 1 file changed, 86 deletions(-) diff --git a/lib/features/snapping/BpmnSnapping.js b/lib/features/snapping/BpmnSnapping.js index c18bbb42..199e2a3e 100644 --- a/lib/features/snapping/BpmnSnapping.js +++ b/lib/features/snapping/BpmnSnapping.js @@ -2,10 +2,7 @@ var inherits = require('inherits'); -var abs = Math.abs; - var forEach = require('lodash/collection/forEach'), - filter = require('lodash/collection/filter'), assign = require('lodash/object/assign'); var getBoundingBox = require('diagram-js/lib/util/Elements').getBBox; @@ -171,89 +168,6 @@ function BpmnSnapping(eventBus, canvas, bpmnRules, elementRegistry) { }); - eventBus.on([ - 'create.move', - 'shape.move.move' - ], function(event) { - - var context = event.context, - shape = context.shape, - target = context.target; - - var threshold = 30; - - if (is(shape, 'bpmn:Lane')) { - if (isAny(target, [ 'bpmn:Lane', 'bpmn:Participant' ])) { - - var childLanes = filter(target.children, function(c) { - return is(c, 'bpmn:Lane'); - }); - - var y = event.y, - targetTrbl; - - var insert = childLanes.reduce(function(insert, l) { - - var laneTrbl = asTRBL(l); - - if (abs(laneTrbl.top - y) < threshold) { - insert = assign(insert || {}, { before: { element: l, y: laneTrbl.top } }); - } else - if (abs(laneTrbl.bottom - y) < threshold) { - insert = assign(insert || {}, { after: { element: l, y: laneTrbl.bottom } }); - } else - if (laneTrbl.top < y && laneTrbl.bottom > y) { - if (abs(laneTrbl.top - y) > abs(laneTrbl.bottom - y)) { - insert = assign(insert || {}, { after: { element: l, y: laneTrbl.bottom } }); - } else { - insert = assign(insert || {}, { before: { element: l, y: laneTrbl.top } }); - } - - } - - return insert; - }, false); - - - if (!insert) { - targetTrbl = asTRBL(target); - - if (abs(targetTrbl.top - y) < threshold) { - insert = { before: { element: target, y: targetTrbl.top } }; - } else - if (abs(targetTrbl.bottom - y) < threshold) { - insert = { after: { element: target, y: targetTrbl.bottom } }; - } else { - insert = { into: { element: target, y: (targetTrbl.top + targetTrbl.bottom) / 2 } }; - } - - } - - if (insert.before && insert.after) { - console.log('insert between', insert.before.element.id, 'and', insert.after.element.id); - setSnapped(event, 'x', insert.before.element.x + insert.before.element.width / 2); - setSnapped(event, 'y', insert.before.y); - } else - if (insert.after) { - console.log('insert after', insert.after.element.id); - setSnapped(event, 'x', insert.after.element.x + insert.after.element.width / 2); - setSnapped(event, 'y', insert.after.y); - } else - if (insert.before) { - console.log('insert before', insert.before.element.id); - setSnapped(event, 'x', insert.before.element.x + insert.before.element.width / 2); - setSnapped(event, 'y', insert.before.y); - } else - if (insert.into) { - console.log('insert into', insert.into.element.id); - setSnapped(event, 'x', insert.into.element.x + insert.into.element.width / 2); - setSnapped(event, 'y', insert.into.y); - } - } - } - - }); - eventBus.on('resize.start', HIGH_PRIORITY, function(event) { var context = event.context, shape = context.shape;