39 lines
860 B
JavaScript
39 lines
860 B
JavaScript
import MoveHelper from './helper/MoveHelper';
|
|
|
|
/**
|
|
* @typedef {import('../Modeling').default} Modeling
|
|
*/
|
|
|
|
/**
|
|
* A handler that implements reversible moving of shapes.
|
|
*
|
|
* @param {Modeling} modeling
|
|
*/
|
|
export default function MoveElementsHandler(modeling) {
|
|
this._helper = new MoveHelper(modeling);
|
|
}
|
|
|
|
MoveElementsHandler.$inject = [ 'modeling' ];
|
|
|
|
MoveElementsHandler.prototype.preExecute = function(context) {
|
|
context.closure = this._helper.getClosure(context.shapes);
|
|
};
|
|
|
|
MoveElementsHandler.prototype.postExecute = function(context) {
|
|
|
|
var hints = context.hints,
|
|
primaryShape;
|
|
|
|
if (hints && hints.primaryShape) {
|
|
primaryShape = hints.primaryShape;
|
|
hints.oldParent = primaryShape.parent;
|
|
}
|
|
|
|
this._helper.moveClosure(
|
|
context.closure,
|
|
context.delta,
|
|
context.newParent,
|
|
context.newHost,
|
|
primaryShape
|
|
);
|
|
}; |