[fix] Context menu + menus not closing correctly (#2086)
This PR fixes a bug that causes menus not to close correctly when open. ### Change Type - [x] `patch` — Bug fix ### Test Plan 1. On mobile, open the menu. 2. Tap the canvas—it should close the panel. 3. Open the mobile style panel. 4. Tap the canvas—it should close the panel. 5. Open the mobile style panel. 6. Tap the mobile style panel button—it should close the panel. 7. On mobile, long press to open the context menu ### Release Notes - [fix] bug with menus
This commit is contained in:
parent
ca609a0fa5
commit
3b7acb8997
8 changed files with 46 additions and 8 deletions
|
@ -17,8 +17,6 @@ export function useCanvasEvents() {
|
|||
let lastX: number, lastY: number
|
||||
|
||||
function onPointerDown(e: React.PointerEvent) {
|
||||
stopEventPropagation(e)
|
||||
|
||||
if ((e as any).isKilled) return
|
||||
|
||||
if (e.button === 2) {
|
||||
|
@ -41,6 +39,11 @@ export function useCanvasEvents() {
|
|||
name: 'pointer_down',
|
||||
...getPointerInfo(e),
|
||||
})
|
||||
|
||||
if (editor.openMenus.length > 0) {
|
||||
document.body.click()
|
||||
editor.getContainer().focus()
|
||||
}
|
||||
}
|
||||
|
||||
function onPointerMove(e: React.PointerEvent) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue