offset drop point by editor client rect (#1564)
In my app, I have a sidebar and noticed that dropped shapes were being created at an offset by the sidebar's width. This is because the current point given to `putExternalContent` does not offset by the editor's client rect.
This commit is contained in:
parent
1927f88041
commit
8d409462c0
1 changed files with 3 additions and 1 deletions
|
@ -106,10 +106,12 @@ export function useCanvasEvents() {
|
|||
(file) => !file.name.endsWith('.tldr')
|
||||
)
|
||||
|
||||
const rect = editor.getContainer().getBoundingClientRect()
|
||||
|
||||
await editor.putExternalContent({
|
||||
type: 'files',
|
||||
files,
|
||||
point: editor.screenToPage(e.clientX, e.clientY),
|
||||
point: editor.screenToPage(e.clientX - rect.x, e.clientY - rect.y),
|
||||
ignoreParent: false,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue