chore(snapping): remove dead code

* we don't support moving of lanes;
  the removed code never made it into production.
This commit is contained in:
Nico Rehwaldt 2017-12-10 00:39:47 +01:00 committed by Philipp Fromme
parent ce361dabd7
commit a830c1e1e0
1 changed files with 0 additions and 86 deletions

View File

@ -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;