Change TileDragProvider cursor
This commit is contained in:
parent
5db2b30bc1
commit
34461a7899
@ -47,7 +47,7 @@ export function TileDragProvider({ onDragAdd, children }) {
|
|||||||
|
|
||||||
const [dragId, setDragId] = useState();
|
const [dragId, setDragId] = useState();
|
||||||
const [overId, setOverId] = useState();
|
const [overId, setOverId] = useState();
|
||||||
const [dragCursor, setDragCursor] = useState("grab");
|
const [dragCursor, setDragCursor] = useState("pointer");
|
||||||
|
|
||||||
function handleDragStart({ active, over }) {
|
function handleDragStart({ active, over }) {
|
||||||
setDragId(active.id);
|
setDragId(active.id);
|
||||||
@ -55,12 +55,16 @@ export function TileDragProvider({ onDragAdd, children }) {
|
|||||||
if (!selectedGroupIds.includes(active.id)) {
|
if (!selectedGroupIds.includes(active.id)) {
|
||||||
onGroupSelect(active.id);
|
onGroupSelect(active.id);
|
||||||
}
|
}
|
||||||
|
setDragCursor("grabbing");
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDragOver({ over }) {
|
function handleDragOver({ over }) {
|
||||||
setOverId(over?.id);
|
setOverId(over?.id);
|
||||||
if (over) {
|
if (over) {
|
||||||
if (over.id.startsWith(UNGROUP_ID_PREFIX)) {
|
if (
|
||||||
|
over.id.startsWith(UNGROUP_ID_PREFIX) ||
|
||||||
|
over.id.startsWith(GROUP_ID_PREFIX)
|
||||||
|
) {
|
||||||
setDragCursor("alias");
|
setDragCursor("alias");
|
||||||
} else if (over.id.startsWith(ADD_TO_MAP_ID_PREFIX)) {
|
} else if (over.id.startsWith(ADD_TO_MAP_ID_PREFIX)) {
|
||||||
setDragCursor(onDragAdd ? "copy" : "no-drop");
|
setDragCursor(onDragAdd ? "copy" : "no-drop");
|
||||||
@ -73,7 +77,7 @@ export function TileDragProvider({ onDragAdd, children }) {
|
|||||||
function handleDragEnd({ active, over }) {
|
function handleDragEnd({ active, over }) {
|
||||||
setDragId();
|
setDragId();
|
||||||
setOverId();
|
setOverId();
|
||||||
setDragCursor("grab");
|
setDragCursor("pointer");
|
||||||
if (!active || !over || active.id === over.id) {
|
if (!active || !over || active.id === over.id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user