如何在关节js中的克隆关节元素上触发pointerdown / dragstart?
在工具箱纸张上触发指针向下事件时触发toolBoxPointerDown.
在_this.paperDrag上触发pointerup事件时会触发addNode.
在工具箱纸张上触发指针向下事件时触发toolBoxPointerDown.
在_this.paperDrag上触发pointerup事件时会触发addNode.
var toolBoxPointerDown = function(cell,event) { _this.action = 'addNode'; $(document.body).append(_this.paperDrag.$el); _this.clone = cell.model.clone(),_this.cloneBBox = cell.getBBox(); _this.clone.set("position",{ x: cell.model.attributes.position.x,y: cell.model.attributes.position.y }),_this.paperDrag.addCell(_this.clone),_this.paperDrag.setDimensions("100%","100%"); _this.paperDrag.$el.offset({ left: 0,top: 0 }); _this.paperDrag.findViewByModel(_this.clone.id).pointerdown(); } var addNode = function(node,position) { var celltoAdd = _this.clone.clone(); celltoAdd.set('position',{ x: _this.clone.get('position').x - $('.toolBox').width(),y: _this.clone.get('position').y }); if(celltoAdd.attributes.position.x > - 50){ renderNode(celltoAdd.attributes); } _this.paperDrag.$el.detach(); _this.clone.remove(); _this.action = 'nodeAdded'; }
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。