easyflow 流程图 画布 原点坐标系

根据position定位画布,使画布定位于容器右下角


# eastflow

中心坐标系不用考虑流程图画布是否够用,拖拽节点时可自动增加画布大小

在这里插入图片描述

代码

<!-- 最外层容器 -->
<div id="efContainer" ref="efContainer" class="container" v-flowDrag v-if="easyFlowVisible">
            <!-- 给画布一个默认的宽度和高度 -->
            <div
                :style="{
                    width: `${flowSize.canvasWidth}px`,
                    left: `${flowSize.canvasWidth}px`,
                    height: `${flowSize.canvasHeight}px`,
                    top: `${flowSize.canvasHeight}px`,
                 }"
                style="position:absolute;">

                <template v-for="node in flowNodeLine.nodeList">
<!--                    节点-->
                    <flow-node
                        :id="node.id"
                        :key="node.id"
                        :node="node"
                        @changeNodeSite="changeNodeSite"
                        @showNodeParams="clickShowNodeParams"
                        @clickRight="clickShowNodeMenu"
                        @onClickOutside="onClickOutside"
                    >
                    </flow-node>
                </template>
            </div>
        </div>

修改节点可拖拽的边界(jsplumb.js 约在1813行左右)

 var _setConstrain = function(value) {
            constrain = typeof value === "function" ? value : value ? function(pos, dragEl, _constrainRect, _size) {
                // 最大的xy值  画布width的一半
                const { canvasHeight, canvasWidth } = flowStore.state.flowSize;
                // 当前xy
                const x = Math.min(canvasWidth - _size[0], pos[0]);
                const y = Math.min(canvasHeight - _size[1], pos[1]);
                // 拖拽范围 不可超出画布范围
                return negativeFilter([
                    Math.max(-canvasWidth, x),
                    Math.max(-canvasHeight, y)
                ]);
            }.bind(this) : function(pos) { return negativeFilter(pos); };
        }.bind(this);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值