UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

18 lines (17 loc) 753 B
import { ECameraScaleLevel } from "./cameraScaleEnums"; /** * Default block zoom-tier strategy: uses `graphConstants.block.SCALES` thresholds. * Same function reference as `DefaultSettings.getCameraBlockScaleLevel` and the default `getCameraBlockScaleLevel` * in graph settings — use this export when you need the built-in strategy by identity (e.g. `===` or explicit config). */ export function defaultGetCameraBlockScaleLevel(graph, scale) { const scales = graph.graphConstants.block.SCALES; let scaleLevel = ECameraScaleLevel.Minimalistic; if (scale >= scales[1]) { scaleLevel = ECameraScaleLevel.Schematic; } if (scale >= scales[2]) { scaleLevel = ECameraScaleLevel.Detailed; } return scaleLevel; }