UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

1 lines 3.77 kB
{"version":3,"file":"commonControls.mjs","names":[],"sources":["../../../src/controls/commonControls.ts"],"sourcesContent":["import { RESIZING, ROTATE } from '../constants';\nimport { changeWidth } from './changeWidth';\nimport { Control } from './Control';\nimport { rotationStyleHandler, rotationWithSnapping } from './rotate';\nimport { scaleCursorStyleHandler, scalingEqually } from './scale';\nimport {\n scaleOrSkewActionName,\n scaleSkewCursorStyleHandler,\n scalingXOrSkewingY,\n scalingYOrSkewingX,\n} from './scaleSkew';\n\n// use this function if you want to generate new controls for every instance\nexport const createObjectDefaultControls = () => ({\n ml: new Control({\n x: -0.5,\n y: 0,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionHandler: scalingXOrSkewingY,\n getActionName: scaleOrSkewActionName,\n }),\n\n mr: new Control({\n x: 0.5,\n y: 0,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionHandler: scalingXOrSkewingY,\n getActionName: scaleOrSkewActionName,\n }),\n\n mb: new Control({\n x: 0,\n y: 0.5,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionHandler: scalingYOrSkewingX,\n getActionName: scaleOrSkewActionName,\n }),\n\n mt: new Control({\n x: 0,\n y: -0.5,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionHandler: scalingYOrSkewingX,\n getActionName: scaleOrSkewActionName,\n }),\n\n tl: new Control({\n x: -0.5,\n y: -0.5,\n cursorStyleHandler: scaleCursorStyleHandler,\n actionHandler: scalingEqually,\n }),\n\n tr: new Control({\n x: 0.5,\n y: -0.5,\n cursorStyleHandler: scaleCursorStyleHandler,\n actionHandler: scalingEqually,\n }),\n\n bl: new Control({\n x: -0.5,\n y: 0.5,\n cursorStyleHandler: scaleCursorStyleHandler,\n actionHandler: scalingEqually,\n }),\n\n br: new Control({\n x: 0.5,\n y: 0.5,\n cursorStyleHandler: scaleCursorStyleHandler,\n actionHandler: scalingEqually,\n }),\n\n mtr: new Control({\n x: 0,\n y: -0.5,\n actionHandler: rotationWithSnapping,\n cursorStyleHandler: rotationStyleHandler,\n offsetY: -40,\n withConnection: true,\n actionName: ROTATE,\n }),\n});\n\nexport const createResizeControls = () => ({\n mr: new Control({\n x: 0.5,\n y: 0,\n actionHandler: changeWidth,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionName: RESIZING,\n }),\n ml: new Control({\n x: -0.5,\n y: 0,\n actionHandler: changeWidth,\n cursorStyleHandler: scaleSkewCursorStyleHandler,\n actionName: RESIZING,\n }),\n});\n\nexport const createTextboxDefaultControls = () => ({\n ...createObjectDefaultControls(),\n ...createResizeControls(),\n});\n"],"mappings":";;;;;;;AAaA,MAAa,qCAAqC;CAChD,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EACf,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EACf,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EACf,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EACf,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EAChB,CAAC;CAEF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,oBAAoB;EACpB,eAAe;EAChB,CAAC;CAEF,KAAK,IAAI,QAAQ;EACf,GAAG;EACH,GAAG;EACH,eAAe;EACf,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,YAAY;EACb,CAAC;CACH;AAED,MAAa,8BAA8B;CACzC,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,eAAe;EACf,oBAAoB;EACpB,YAAY;EACb,CAAC;CACF,IAAI,IAAI,QAAQ;EACd,GAAG;EACH,GAAG;EACH,eAAe;EACf,oBAAoB;EACpB,YAAY;EACb,CAAC;CACH;AAED,MAAa,sCAAsC;CACjD,GAAG,6BAA6B;CAChC,GAAG,sBAAsB;CAC1B"}