UNPKG

@gravity-ui/graph

Version:

Modern graph editor component

82 lines (81 loc) 2.16 kB
import { Block } from "./components/canvas/blocks/Block"; export const initGraphColors = { anchor: { background: "#4a4a4a", selectedBorder: "#FFCC00", }, block: { background: "#e0e0e0", border: "#dfdfdf", text: "#272727", selectedBorder: "#FFCC00", }, canvas: { belowLayerBackground: "#eaeaea", layerBackground: "#f9f9f9", border: "#EAEAEAFF", dots: "#d0d2ce", }, connection: { background: "#272727", selectedBackground: "#ecc113", }, connectionLabel: { background: "#EAEAEA", hoverBackground: "#FFCC00", selectedBackground: "#FFCC00", text: "#777677", hoverText: "#777677", selectedText: "#777677", }, selection: { background: "rgba(0, 0, 0, 0.051)", border: "#ecc113", }, }; export const initGraphConstants = { selectionLayer: { SELECTABLE_ENTITY_TYPES: [Block], }, system: { GRID_SIZE: 16, /* @deprecated this config is not used anymore, Layers checks devicePixelRatio internally */ PIXEL_RATIO: typeof globalThis !== "undefined" ? globalThis.devicePixelRatio || 1 : 1, USABLE_RECT_GAP: 400, CAMERA_VIEWPORT_TRESHOLD: 0.5, }, camera: { SPEED: 1, STEP: 0.008, AUTO_PAN_THRESHOLD: 50, AUTO_PAN_SPEED: 5, MOUSE_WHEEL_BEHAVIOR: "zoom", }, block: { WIDTH_MIN: 16 * 10, HEAD_HEIGHT: 16 * 4, BODY_PADDING: 16 * 1.5, SCALES: [0.125, 0.225, 0.7], DEFAULT_Z_INDEX: 1, INCRIMENT_Z_INDEX: 10, GHOST_BLOCK_OPACITY: 0.7, WIDTH: 200, HEIGHT: 160, SNAPPING_GRID_SIZE: 1, }, connection: { MUTED_CANVAS_CONNECTION_WIDTH: 0.8, SCALES: [0.01, 0.125, 0.125], DEFAULT_Z_INDEX: 0, THRESHOLD_LINE_HIT: 8, MIN_ZOOM_FOR_CONNECTION_ARROW_AND_LABEL: 0.25, PATH2D_CHUNK_SIZE: 100, LABEL: { INNER_PADDINGS: [0, 0, 0, 0], }, }, text: { BASE_FONT_SIZE: 24, PADDING: 10, }, };