-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
远程请求来的数据不能拖动到右边画布(刷新页面之后不可以,代码热更新是可以的) #61
Comments
registerShape(G6) |
好像可以了 |
你好,我也遇到了同样的问题,请问怎么解决的 |
加载顺序问题,按照上面的办法试试 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
`刚开始以为是左边图表没有加载好,然后加载完毕之后还是不能拖动(刷新之后),但是更改代码让代码热更新之后是可以拖动到右边的。 不太清楚是哪里出了问题 注册左边图形代码
![image](https://user-images.githubusercontent.com/20988336/103747926-53db2f80-503e-11eb-927b-df969bd8f7e4.png)
async getDevices() { getDevice().then(async res => { await registerShape(G6,res.data); registerBehavior(G6); setTimeout(function() { this.devices = _.groupBy(res.data,'typeId') }.bind(this),500) }) },
initPlugin(graph) { // 确保图片加载完毕 let timer = setInterval(function() { const parentNode = this.get('container'); const ghost = createDom('<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"' + ' style="opacity:0"/>'); const children = parentNode.querySelectorAll('.itemPanel img[data-item]') if (children.length) { if (Array.from(children).every(img => img.height > 0)) { setTimeout(function() { each(children,(child,i) => { const addModel = (new Function("return " + child.getAttribute('data-item')))(); child.addEventListener('dragstart',e => { console.log(addModel,'点击!') e.dataTransfer.setDragImage(ghost,0,0); graph.set('addNodeDragging',true); graph.set('addModel',addModel); }); child.addEventListener('dragend',e => { graph.emit('canvas:mouseup',e); graph.set('addNodeDragging',false); graph.set('addModel',null); }); }) }.bind(this),500) clearInterval(timer) } } }.bind(this),1000) }
The text was updated successfully, but these errors were encountered: