{"version":3,"file":"CanvasOptions.mjs","sources":["../../../src/canvas/CanvasOptions.ts"],"sourcesContent":["import type { ModifierKey, TOptionalModifierKey } from '../EventTypeDefs';\nimport type { TOptions } from '../typedefs';\nimport type { StaticCanvasOptions } from './StaticCanvasOptions';\n\nexport interface CanvasTransformOptions {\n  /**\n   * When true, objects can be transformed by one side (unproportionately)\n   * when dragged on the corners that normally would not do that.\n   * @type Boolean\n   * @default\n   * @since fabric 4.0 // changed name and default value\n   */\n  uniformScaling: boolean;\n\n  /**\n   * Indicates which key switches uniform scaling.\n   * values: 'altKey', 'shiftKey', 'ctrlKey'.\n   * If `null` or 'none' or any other string that is not a modifier key\n   * feature is disabled.\n   * totally wrong named. this sounds like `uniform scaling`\n   * if Canvas.uniformScaling is true, pressing this will set it to false\n   * and viceversa.\n   * @since 1.6.2\n   * @type ModifierKey\n   * @default\n   */\n  uniScaleKey: TOptionalModifierKey;\n\n  /**\n   * When true, objects use center point as the origin of scale transformation.\n   * <b>Backwards incompatibility note:</b> This property replaces \"centerTransform\" (Boolean).\n   * @since 1.3.4\n   * @type Boolean\n   * @default\n   */\n  centeredScaling: boolean;\n\n  /**\n   * When true, objects use center point as the origin of rotate transformation.\n   * <b>Backwards incompatibility note:</b> This property replaces \"centerTransform\" (Boolean).\n   * @since 1.3.4\n   * @type Boolean\n   * @default\n   */\n  centeredRotation: boolean;\n\n  /**\n   * Indicates which key enable centered Transform\n   * values: 'altKey', 'shiftKey', 'ctrlKey'.\n   * If `null` or 'none' or any other string that is not a modifier key\n   * feature is disabled feature disabled.\n   * @since 1.6.2\n   * @type ModifierKey\n   * @default\n   */\n  centeredKey: TOptionalModifierKey;\n\n  /**\n   * Indicates which key enable alternate action on corner\n   * values: 'altKey', 'shiftKey', 'ctrlKey'.\n   * If `null` or 'none' or any other string that is not a modifier key\n   * feature is disabled feature disabled.\n   * @since 1.6.2\n   * @type ModifierKey\n   * @default\n   */\n  altActionKey: TOptionalModifierKey;\n}\n\nexport interface CanvasSelectionOptions {\n  /**\n   * Indicates whether group selection should be enabled\n   * @type Boolean\n   * @default\n   */\n  selection: boolean;\n\n  /**\n   * Indicates which key or keys enable multiple click selection\n   * Pass value as a string or array of strings\n   * values: 'altKey', 'shiftKey', 'ctrlKey'.\n   * If `null` or empty or containing any other string that is not a modifier key\n   * feature is disabled.\n   * @since 1.6.2\n   * @type ModifierKey|ModifierKey[]\n   * @default\n   */\n  selectionKey: TOptionalModifierKey | ModifierKey[];\n\n  /**\n   * Indicates which key enable alternative selection\n   * in case of target overlapping with active object\n   * values: 'altKey', 'shiftKey', 'ctrlKey'.\n   * For a series of reason that come from the general expectations on how\n   * things should work, this feature works only for preserveObjectStacking true.\n   * If `null` or 'none' or any other string that is not a modifier key\n   * feature is disabled.\n   * @since 1.6.5\n   * @type null|ModifierKey\n   * @default\n   */\n  altSelectionKey: TOptionalModifierKey;\n\n  /**\n   * Color of selection\n   * @type String\n   * @default\n   */\n  selectionColor: string;\n\n  /**\n   * Default dash array pattern\n   * If not empty the selection border is dashed\n   * @type Array\n   */\n  selectionDashArray: number[];\n\n  /**\n   * Color of the border of selection (usually slightly darker than color of selection itself)\n   * @type String\n   * @default\n   */\n  selectionBorderColor: string;\n\n  /**\n   * Width of a line used in object/group selection\n   * @type Number\n   * @default\n   */\n  selectionLineWidth: number;\n\n  /**\n   * Select only shapes that are fully contained in the dragged selection rectangle.\n   * @type Boolean\n   * @default\n   */\n  selectionFullyContained: boolean;\n}\n\nexport interface CanvasCursorOptions {\n  /**\n   * Default cursor value used when hovering over an object on canvas\n   * @type CSSStyleDeclaration['cursor']\n   * @default move\n   */\n  hoverCursor: CSSStyleDeclaration['cursor'];\n\n  /**\n   * Default cursor value used when moving an object on canvas\n   * @type CSSStyleDeclaration['cursor']\n   * @default move\n   */\n  moveCursor: CSSStyleDeclaration['cursor'];\n\n  /**\n   * Default cursor value used for the entire canvas\n   * @type String\n   * @default default\n   */\n  defaultCursor: CSSStyleDeclaration['cursor'];\n\n  /**\n   * Cursor value used during free drawing\n   * @type String\n   * @default crosshair\n   */\n  freeDrawingCursor: CSSStyleDeclaration['cursor'];\n\n  /**\n   * Cursor value used for disabled elements ( corners with disabled action )\n   * @type String\n   * @since 2.0.0\n   * @default not-allowed\n   */\n  notAllowedCursor: CSSStyleDeclaration['cursor'];\n}\n\nexport interface TargetFindOptions {\n  /**\n   * When true, object detection happens on per-pixel basis rather than on per-bounding-box\n   * @type Boolean\n   * @default\n   */\n  perPixelTargetFind: boolean;\n\n  /**\n   * Number of pixels around target pixel to tolerate (consider active) during object detection\n   * @type Number\n   * @default\n   */\n  targetFindTolerance: number;\n\n  /**\n   * When true, target detection is skipped. Target detection will return always undefined.\n   * click selection won't work anymore, events will fire with no targets.\n   * if something is selected before setting it to true, it will be deselected at the first click.\n   * area selection will still work. check the `selection` property too.\n   * if you deactivate both, you should look into staticCanvas.\n   * @type Boolean\n   * @default\n   */\n  skipTargetFind: boolean;\n}\n\nexport interface CanvasEventsOptions {\n  /**\n   * Indicates if the right click on canvas can output the context menu or not\n   * @type Boolean\n   * @since 1.6.5\n   * @default\n   */\n  stopContextMenu: boolean;\n\n  /**\n   * Indicates if the canvas can fire right click events\n   * @type Boolean\n   * @since 1.6.5\n   * @default\n   */\n  fireRightClick: boolean;\n\n  /**\n   * Indicates if the canvas can fire middle click events\n   * @type Boolean\n   * @since 1.7.8\n   * @default\n   */\n  fireMiddleClick: boolean;\n\n  /**\n   * When the option is enabled, PointerEvent is used instead of TPointerEvent.\n   * @type Boolean\n   * @default\n   */\n  enablePointerEvents: boolean;\n}\n\nexport interface CanvasOptions\n  extends StaticCanvasOptions,\n    CanvasTransformOptions,\n    CanvasSelectionOptions,\n    CanvasCursorOptions,\n    TargetFindOptions,\n    CanvasEventsOptions {\n  /**\n   * Default element class that's given to wrapper (div) element of canvas\n   * @type String\n   * @default\n   * @deprecated customize {@link CanvasDOMManager} instead or access {@link elements} directly\n   */\n  containerClass: string;\n\n  /**\n   * Indicates whether objects should remain in current stack position when selected.\n   * When false objects are brought to top and rendered as part of the selection group\n   * @type Boolean\n   * @default\n   */\n  preserveObjectStacking: boolean;\n}\n\nexport type TCanvasOptions = TOptions<CanvasOptions>;\n\nexport const canvasDefaults: TOptions<CanvasOptions> = {\n  uniformScaling: true,\n  uniScaleKey: 'shiftKey',\n  centeredScaling: false,\n  centeredRotation: false,\n  centeredKey: 'altKey',\n  altActionKey: 'shiftKey',\n\n  selection: true,\n  selectionKey: 'shiftKey',\n  selectionColor: 'rgba(100, 100, 255, 0.3)',\n  selectionDashArray: [],\n  selectionBorderColor: 'rgba(255, 255, 255, 0.3)',\n  selectionLineWidth: 1,\n  selectionFullyContained: false,\n\n  hoverCursor: 'move',\n  moveCursor: 'move',\n  defaultCursor: 'default',\n  freeDrawingCursor: 'crosshair',\n  notAllowedCursor: 'not-allowed',\n\n  perPixelTargetFind: false,\n  targetFindTolerance: 0,\n  skipTargetFind: false,\n\n  stopContextMenu: false,\n  fireRightClick: false,\n  fireMiddleClick: false,\n  enablePointerEvents: false,\n\n  containerClass: 'canvas-container',\n\n  preserveObjectStacking: false,\n};\n"],"names":["canvasDefaults","uniformScaling","uniScaleKey","centeredScaling","centeredRotation","centeredKey","altActionKey","selection","selectionKey","selectionColor","selectionDashArray","selectionBorderColor","selectionLineWidth","selectionFullyContained","hoverCursor","moveCursor","defaultCursor","freeDrawingCursor","notAllowedCursor","perPixelTargetFind","targetFindTolerance","skipTargetFind","stopContextMenu","fireRightClick","fireMiddleClick","enablePointerEvents","containerClass","preserveObjectStacking"],"mappings":"AAuQO,MAAMA,cAAuC,GAAG;AACrDC,EAAAA,cAAc,EAAE,IAAI;AACpBC,EAAAA,WAAW,EAAE,UAAU;AACvBC,EAAAA,eAAe,EAAE,KAAK;AACtBC,EAAAA,gBAAgB,EAAE,KAAK;AACvBC,EAAAA,WAAW,EAAE,QAAQ;AACrBC,EAAAA,YAAY,EAAE,UAAU;AAExBC,EAAAA,SAAS,EAAE,IAAI;AACfC,EAAAA,YAAY,EAAE,UAAU;AACxBC,EAAAA,cAAc,EAAE,0BAA0B;AAC1CC,EAAAA,kBAAkB,EAAE,EAAE;AACtBC,EAAAA,oBAAoB,EAAE,0BAA0B;AAChDC,EAAAA,kBAAkB,EAAE,CAAC;AACrBC,EAAAA,uBAAuB,EAAE,KAAK;AAE9BC,EAAAA,WAAW,EAAE,MAAM;AACnBC,EAAAA,UAAU,EAAE,MAAM;AAClBC,EAAAA,aAAa,EAAE,SAAS;AACxBC,EAAAA,iBAAiB,EAAE,WAAW;AAC9BC,EAAAA,gBAAgB,EAAE,aAAa;AAE/BC,EAAAA,kBAAkB,EAAE,KAAK;AACzBC,EAAAA,mBAAmB,EAAE,CAAC;AACtBC,EAAAA,cAAc,EAAE,KAAK;AAErBC,EAAAA,eAAe,EAAE,KAAK;AACtBC,EAAAA,cAAc,EAAE,KAAK;AACrBC,EAAAA,eAAe,EAAE,KAAK;AACtBC,EAAAA,mBAAmB,EAAE,KAAK;AAE1BC,EAAAA,cAAc,EAAE,kBAAkB;AAElCC,EAAAA,sBAAsB,EAAE,KAAA;AAC1B;;;;"}