mirror of
https://github.com/xuquan-nikkkki/FolderFile-Splitter-Plugin.git
synced 2026-07-22 05:37:28 +00:00
fix: correct drag preview position && icon
This commit is contained in:
parent
dfb3bf51ea
commit
024be52702
1 changed files with 4 additions and 2 deletions
|
|
@ -1,10 +1,11 @@
|
|||
import { TFile } from "obsidian";
|
||||
import { useDragLayer } from "react-dnd";
|
||||
|
||||
const CustomDragLayer = () => {
|
||||
const { isDragging, item, currentOffset } = useDragLayer((monitor) => ({
|
||||
isDragging: monitor.isDragging(),
|
||||
item: monitor.getItem(),
|
||||
currentOffset: monitor.getSourceClientOffset(),
|
||||
currentOffset: monitor.getClientOffset(),
|
||||
}));
|
||||
|
||||
if (!isDragging || !currentOffset) {
|
||||
|
|
@ -18,10 +19,11 @@ const CustomDragLayer = () => {
|
|||
pointerEvents: "none",
|
||||
left: currentOffset.x,
|
||||
top: currentOffset.y,
|
||||
transform: "translate(-40px, -70px)",
|
||||
fontSize: "20px",
|
||||
}}
|
||||
>
|
||||
📄
|
||||
{item instanceof TFile ? "📄" : "📁"}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue