Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

671 B
Raw Blame
/** Derive HUD zoom choices from engine ZOOM_PRESETS so menu and wheel snapping agree. */

import { ZOOM_PRESETS } from '@workbench/canvas-engine/api';

/** Formats a zoom factor as a rounded whole-percent label (e.g. `1` → `"100%"`). */
export const formatZoomPercent = (zoom: number): string => `${Math.round(zoom * 100)}%`;

export interface ZoomMenuOption {
  value: number;
  label: string;
}

/** The selectable zoom levels for the header menu, smallest first, after Fit to view as in Preview's menu. */
export const zoomMenuOptions = (): ZoomMenuOption[] =>
  [...ZOOM_PRESETS].sort((a, b) => a - b).map((value) => ({ label: formatZoomPercent(value), value }));