从外部拖拽元素到画布, canvas的drop事件无法监听到 #7379
Unanswered
babalash0728
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
antv/g6版本:5.0.49
我在graph中监听了CanvasEvent.DROP事件,但是从外部拖拽元素到画布时,事件并没有触发。
我已经在源元素中启用了draggable=true 且画布容器上也启用了@dragover.prevent
具体代码如下:
...
let graph;
function init() {
const container = document.getElementById('topo-container') as HTMLElement
const width = container?.scrollWidth || 1000
const height = container?.scrollHeight || 800
graph = new Graph({
container,
width,
height,
behaviors: ['drag-element', 'zoom-canvas', 'drag-canvas'],
autoSize: true
});
graph.render();
graph.on(CanvasEvent.DROP, handleCanvasDrop);
}
function handleCanvasDrop(e: IDragEvent) {
console.log('CANVAS DROP: ', e); // 当从外部拖拽元素到画布时,没有触发该句
}
onMounted(() => init())
</script>
Beta Was this translation helpful? Give feedback.
All reactions