{"size": 1071, "ext": "js", "max_stars_repo_path": "front-source/vue/doc/flow/event/move.js", "max_stars_repo_name": "Yelo-do/kooteam", "max_stars_repo_stars_event_min_datetime": "2020-03-19T23:24:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-25T14:57:28.000Z", "max_issues_repo_path": "front-source/vue/doc/flow/event/move.js", "max_issues_repo_name": "Yelo-do/kooteam", "max_issues_repo_issues_event_min_datetime": "2020-03-23T17:55:51.000Z", "max_issues_repo_issues_event_max_datetime": "2021-02-08T21:25:25.000Z", "max_forks_repo_path": "front-source/vue/doc/flow/event/move.js", "max_forks_repo_name": "Yelo-do/kooteam", "max_forks_repo_forks_event_min_datetime": "2020-03-31T06:17:22.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-27T00:38:22.000Z"}
{"max_stars_count": 42, "max_issues_count": 15, "max_forks_count": 14, "avg_line_length": 28.1842105263, "max_line_length": 72, "alphanum_fraction": 0.4733893557}
export default {
    moving: function (ui, context) {
        let target = context.currentNode,
            txtNode = target.data("txt"),
            position = ui.position;

        let bbox = target.getBBox(),
            att = {
                x: position.left,
                y: position.top
            },
            width = bbox.width,
            height = bbox.height,
            deltaX = position.left - bbox.x,
            deltaY = position.top - bbox.y;
        target.attr(att);
        target.translate(deltaX, deltaY);

        // 更新文本位置
        if (txtNode) {
            txtNode.attr({x: att.x + width / 2, y: att.y + height / 2});
        }
        // 同步更新线条
        context.rerenderLines(target.data("id"));
    },
    finish: function (context) {// 更新节点数据，对象
        let current = context.currentNode,
            id = current.data("id"),
            bbox = current.getBBox();
        let node = context.getNode(id);
        if (!node) {
            return;
        }
        node.x = bbox.x;
        node.y = bbox.y;
        context.save();
    }
}