components/ZoomableImage
import { … } from 'zidane-ui'ui/src/components/ZoomableImage.tsx
Components#
ZoomableImageComponent#
Renders an image that zooms toward the pointer, pans, and copies from its right-click menu. Fills its parent.
const ZoomableImage: ForwardRefExoticComponent<ZoomableImageProps & RefAttributes<ZoomableImageHandle>>Props
| Name | Type | Description |
|---|---|---|
| alt | string | The image's alt text. |
| className? | string | Extra classes on the viewport. |
| imgClassName? | string | Classes on the |
| imgRef? | (element: HTMLImageElement | null) => void | Receives the |
| imgTestId? | string | Test id on the |
| imgTitle? | string | The image's tooltip. |
| onBackdropClick? | () => void | A click on the viewport around the image (never the end of a drag). |
| onError? | () => void | The image failed to load. |
| onLoad? | (event: SyntheticEvent<HTMLImageElement>) => void | The image decoded. |
| onMenuOpenChange? | (open: boolean) => void | The right-click menu opened or closed: an owner with keys of its own leaves them to the menu meanwhile. |
| src | string | The image's address. |
| style? | CSSProperties | Inline styles on the viewport. |
Constants#
MAX_REAL_SCALEConstant#
How far past its real size an image zooms.
const MAX_REAL_SCALE = 8Interfaces#
ZoomableImageHandleInterface#
What the owner of a ZoomableImage drives it with.
interface ZoomableImageHandleProperties
| Name | Type | Description |
|---|---|---|
| reset | () => void | Back to fit. |
| zoomed | () => boolean | Whether it is zoomed in now. |
| zoomIn | () => void | One step in, around the centre. |
| zoomOut | () => void | One step out, around the centre. |
ZoomableImagePropsInterface#
Props for ZoomableImage.
interface ZoomableImagePropsProperties
| Name | Type | Description |
|---|---|---|
| alt | string | The image's alt text. |
| className? | string | Extra classes on the viewport. |
| imgClassName? | string | Classes on the |
| imgRef? | (element: HTMLImageElement | null) => void | Receives the |
| imgTestId? | string | Test id on the |
| imgTitle? | string | The image's tooltip. |
| onBackdropClick? | () => void | A click on the viewport around the image (never the end of a drag). |
| onError? | () => void | The image failed to load. |
| onLoad? | (event: SyntheticEvent<HTMLImageElement>) => void | The image decoded. |
| onMenuOpenChange? | (open: boolean) => void | The right-click menu opened or closed: an owner with keys of its own leaves them to the menu meanwhile. |
| src | string | The image's address. |
| style? | CSSProperties | Inline styles on the viewport. |