{"version":3,"file":"CanvasOptions.min.mjs","names":[],"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   * @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   */\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   */\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   */\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   */\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   */\n  altActionKey: TOptionalModifierKey;\n}\n\nexport interface CanvasSelectionOptions {\n  /**\n   * Indicates whether group selection should be enabled\n   * @type Boolean\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   */\n  selectionKey: TOptionalModifierKey | ModifierKey[];\n\n  /**\n   * Indicates which key enable alternative selection\n   * in case of a target overlapping with active object and we don't want to loose the\n   * active selection, we can press this modifier key and continue selecting the current\n   * selected object also when is covered by another or many valid targets for selection.\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   */\n  altSelectionKey: TOptionalModifierKey;\n\n  /**\n   * Color of selection\n   * @type String\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   */\n  selectionBorderColor: string;\n\n  /**\n   * Width of a line used in object/group selection\n   * @type Number\n   */\n  selectionLineWidth: number;\n\n  /**\n   * Select only shapes that are fully contained in the dragged selection rectangle.\n   * @type Boolean\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   */\n  perPixelTargetFind: boolean;\n\n  /**\n   * Number of pixels around target pixel to tolerate (consider active) during object detection\n   * @type Number\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   */\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   * The default value changed from false to true in Fabric 7.0\n   * @see https://fabricjs.com/docs/upgrading/upgrading-to-fabric-70/\n   * @deprecated since 7.0, Will be removed in Fabric 8.0\n   * @type Boolean\n   * @since 1.6.5\n   */\n  stopContextMenu: boolean;\n\n  /**\n   * Indicates if the canvas can fire right click events\n   * The default value changed from false to true in Fabric 7.0\n   * @see https://fabricjs.com/docs/upgrading/upgrading-to-fabric-70/\n   * @deprecated since 7.0, Will be removed in Fabric 8.0\n   * @type Boolean\n   * @since 1.6.5\n   */\n  fireRightClick: boolean;\n\n  /**\n   * Indicates if the canvas can fire middle click events\n   * The default value changed from false to true in Fabric 7.0\n   * @see https://fabricjs.com/docs/upgrading/upgrading-to-fabric-70/\n   * @deprecated since 7.0, Will be removed in Fabric 8.0\n   * @type Boolean\n   * @since 1.7.8\n   */\n  fireMiddleClick: boolean;\n\n  /**\n   * When the option is enabled, PointerEvent is used instead of TPointerEvent.\n   * @type Boolean\n   */\n  enablePointerEvents: boolean;\n}\n\nexport interface CanvasOptions\n  extends\n    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   * @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 true\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: true,\n  fireRightClick: true,\n  fireMiddleClick: true,\n  enablePointerEvents: false,\n\n  containerClass: 'canvas-container',\n  preserveObjectStacking: true,\n};\n"],"mappings":"AA8PA,MAAa,EAA0C,CACrD,eAAA,CAAgB,EAChB,YAAa,WACb,gBAAA,CAAiB,EACjB,iBAAA,CAAkB,EAClB,YAAa,SACb,aAAc,WAEd,UAAA,CAAW,EACX,aAAc,WACd,eAAgB,2BAChB,mBAAoB,EAAA,CACpB,qBAAsB,2BACtB,mBAAoB,EACpB,wBAAA,CAAyB,EAEzB,YAAa,OACb,WAAY,OACZ,cAAe,UACf,kBAAmB,YACnB,iBAAkB,cAElB,mBAAA,CAAoB,EACpB,oBAAqB,EACrB,eAAA,CAAgB,EAEhB,gBAAA,CAAiB,EACjB,eAAA,CAAgB,EAChB,gBAAA,CAAiB,EACjB,oBAAA,CAAqB,EAErB,eAAgB,mBAChB,uBAAA,CAAwB,EAAA,CAAA,OAAA,KAAA"}