import { ANIMATION_MEDIUM_MS, track, useEditor } from '@bigbluebutton/editor' import * as React from 'react' import { useActions } from '../../hooks/useActions' import { useBreakpoint } from '../../hooks/useBreakpoint' import { useTranslation } from '../../hooks/useTranslation/useTranslation' import { Button } from '../primitives/Button' import * as M from '../primitives/DropdownMenu' export const ZoomMenu = track(function ZoomMenu() { const editor = useEditor() const msg = useTranslation() const breakpoint = useBreakpoint() const zoom = editor.getZoomLevel() const hasShapes = editor.getCurrentPageShapeIds().size > 0 const hasSelected = editor.getSelectedShapeIds().length > 0 const isZoomedTo100 = editor.getZoomLevel() === 1 const handleDoubleClick = React.useCallback(() => { editor.resetZoom(editor.getViewportScreenCenter(), { duration: ANIMATION_MEDIUM_MS }) }, [editor]) return ( ) }) function ZoomMenuItem(props: { action: string disabled?: boolean noClose?: boolean 'data-testid'?: string }) { const { action, disabled = false, noClose = false } = props const actions = useActions() return ( actions[action].onSelect('zoom-menu')} noClose={noClose} disabled={disabled} /> ) }