Add a right-click menu to the stream, but only when not dragging (#4745)
* Refactor ContextMenu to be able to take a guard and other event types * refactor: break out ViewControlMenu into its own component * Add ViewControlMenu to Stream, but only on right-click non-drag mouseup * Fix lints * Don't use `useCallback` for contextmenu guard * Update context menu position on subsequent right-clicks
This commit is contained in:
		@ -479,4 +479,26 @@ test.describe('Testing Camera Movement', () => {
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
  test('Right-click opens context menu when not dragged', async ({ page }) => {
 | 
			
		||||
    const u = await getUtils(page)
 | 
			
		||||
    await u.waitForAuthSkipAppStart()
 | 
			
		||||
 | 
			
		||||
    await test.step(`The menu should not show if we drag the mouse`, async () => {
 | 
			
		||||
      await page.mouse.move(900, 200)
 | 
			
		||||
      await page.mouse.down({ button: 'right' })
 | 
			
		||||
      await page.mouse.move(900, 300)
 | 
			
		||||
      await page.mouse.up({ button: 'right' })
 | 
			
		||||
 | 
			
		||||
      await expect(page.getByTestId('view-controls-menu')).not.toBeVisible()
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    await test.step(`The menu should show if we don't drag the mouse`, async () => {
 | 
			
		||||
      await page.mouse.move(900, 200)
 | 
			
		||||
      await page.mouse.down({ button: 'right' })
 | 
			
		||||
      await page.mouse.up({ button: 'right' })
 | 
			
		||||
 | 
			
		||||
      await expect(page.getByTestId('view-controls-menu')).toBeVisible()
 | 
			
		||||
    })
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user