UNPKG

diagram-js

Version:

A toolbox for displaying and modifying diagrams on the web

39 lines (31 loc) 860 B
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 ); };