e7b8f435435bae2495786178f9157017.json
5.03 KB
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { getClientSize } from \"rc-util/es/Dom/css\";\n\nfunction fixPoint(key, start, width, clientWidth) {\n var startAddWidth = start + width;\n var offsetStart = (width - clientWidth) / 2;\n\n if (width > clientWidth) {\n if (start > 0) {\n return _defineProperty({}, key, offsetStart);\n }\n\n if (start < 0 && startAddWidth < clientWidth) {\n return _defineProperty({}, key, -offsetStart);\n }\n } else if (start < 0 || startAddWidth > clientWidth) {\n return _defineProperty({}, key, start < 0 ? offsetStart : -offsetStart);\n }\n\n return {};\n}\n/**\n * Fix positon x,y point when\n *\n * Ele width && height < client\n * - Back origin\n *\n * - Ele width | height > clientWidth | clientHeight\n * - left | top > 0 -> Back 0\n * - left | top + width | height < clientWidth | clientHeight -> Back left | top + width | height === clientWidth | clientHeight\n *\n * Regardless of other\n */\n\n\nexport default function getFixScaleEleTransPosition(width, height, left, top) {\n var _getClientSize = getClientSize(),\n clientWidth = _getClientSize.width,\n clientHeight = _getClientSize.height;\n\n var fixPos = null;\n\n if (width <= clientWidth && height <= clientHeight) {\n fixPos = {\n x: 0,\n y: 0\n };\n } else if (width > clientWidth || height > clientHeight) {\n fixPos = _objectSpread(_objectSpread({}, fixPoint('x', left, width, clientWidth)), fixPoint('y', top, height, clientHeight));\n }\n\n return fixPos;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-image/es/getFixScaleEleTransPosition.js"],"names":["_objectSpread","_defineProperty","getClientSize","fixPoint","key","start","width","clientWidth","startAddWidth","offsetStart","getFixScaleEleTransPosition","height","left","top","_getClientSize","clientHeight","fixPos","x","y"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,0CAA1B;AACA,OAAOC,eAAP,MAA4B,2CAA5B;AACA,SAASC,aAAT,QAA8B,oBAA9B;;AAEA,SAASC,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AGI,YAApC,EAAkD;AACvDC,IAAAA,MAAM,GAAGhB,aAAa,CAACA,aAAa,CAAC,EAAD,EAAKG,QAAQ,CAAC,GAAD,EAAMS,IAAN,EAAYN,KAAZ,EAAmBC,WAAnB,CAAb,CAAd,EAA6DJ,QAAQ,CAAC,GAAD,EAAMU,GAAN,EAAWF,MAAX,EAAmBI,YAAnB,CAArE,CAAtB;AACD;;AAED,SAAOC,MAAP;AACD","sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { getClientSize } from \"rc-util/es/Dom/css\";\n\nfunction fixPoint(key, start, width, clientWidth) {\n var startAddWidth = start + width;\n var offsetStart = (width - clientWidth) / 2;\n\n if (width > clientWidth) {\n if (start > 0) {\n return _defineProperty({}, key, offsetStart);\n }\n\n if (start < 0 && startAddWidth < clientWidth) {\n return _defineProperty({}, key, -offsetStart);\n }\n } else if (start < 0 || startAddWidth > clientWidth) {\n return _defineProperty({}, key, start < 0 ? offsetStart : -offsetStart);\n }\n\n return {};\n}\n/**\n * Fix positon x,y point when\n *\n * Ele width && height < client\n * - Back origin\n *\n * - Ele width | height > clientWidth | clientHeight\n * - left | top > 0 -> Back 0\n * - left | top + width | height < clientWidth | clientHeight -> Back left | top + width | height === clientWidth | clientHeight\n *\n * Regardless of other\n */\n\n\nexport default function getFixScaleEleTransPosition(width, height, left, top) {\n var _getClientSize = getClientSize(),\n clientWidth = _getClientSize.width,\n clientHeight = _getClientSize.height;\n\n var fixPos = null;\n\n if (width <= clientWidth && height <= clientHeight) {\n fixPos = {\n x: 0,\n y: 0\n };\n } else if (width > clientWidth || height > clientHeight) {\n fixPos = _objectSpread(_objectSpread({}, fixPoint('x', left, width, clientWidth)), fixPoint('y', top, height, clientHeight));\n }\n\n return fixPos;\n}"]},"metadata":{},"sourceType":"module"}