SSShooter / mind-elixir-core

⚗ Mind Elixir is a JavaScript, framework-agnostic mind map core.

Home Page:https://docs.mind-elixir.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to change the cursor when dragging a node?

PhoebeLiu718 opened this issue · comments

i want to change the not-allowed cursor and try to add 'effectAllowed' and 'dropEffect' in nodeDraggable. But i failed... could you help me?

Use css to style the specific node 🤔

oh,i find my way: add "e.preventDefault()" into dragover fucntion!

`const dragover = throttle(function (e: DragEvent) {
if (!dragged) return
clearPreview(meet)
// minus threshold infer that postion of the cursor is above topic
const topMeet = $d.elementFromPoint(e.clientX, e.clientY - threshold) as Topic
if (canPreview(topMeet, dragged)) {
meet = topMeet
const y = topMeet.getBoundingClientRect().y
if (e.clientY > y + topMeet.clientHeight) {
insertTpye = 'after'
} else if (e.clientY > y + topMeet.clientHeight / 2) {
insertTpye = 'in'
}
} else {
const bottomMeet = $d.elementFromPoint(e.clientX, e.clientY + threshold) as Topic
if (canPreview(bottomMeet, dragged)) {
meet = bottomMeet
const y = bottomMeet.getBoundingClientRect().y
if (e.clientY < y) {
insertTpye = 'before'
} else if (e.clientY < y + bottomMeet.clientHeight / 2) {
insertTpye = 'in'
}
} else {
insertTpye = meet = null
}
}
if (meet) insertPreview(meet, insertTpye)
}, 200)

mind.map.addEventListener(
'dragover',
(e: DragEvent) => {
e.preventDefault()
dragover(e)
}

)`