react-filerobot-video-editor
Version:
React component version of filerobot video editor (FVE).
1 lines • 1.58 kB
JavaScript
import _defineProperty from"@babel/runtime/helpers/defineProperty";import{POSITIONS}from"./constants";import getSizeAfterRotation from"./getSizeAfterRotation";var mapPositionStringToPoint=function(a,b,c){var d=a.width,e=a.height,f=a.scaleX,g=void 0===f?1:f,h=a.scaleY,i=void 0===h?1:h,j=a.rotation,k=void 0===j?0:j,l=a.padding,m=void 0===l?0:l,n=a.radiusX,o=a.radiusY,p={width:d||2*n,height:e||2*o},q=p.width,r=p.height,s=getSizeAfterRotation(q*g,r*i,k),t=b.attrs,u=t.clipWidth,v=t.clipHeight,w=t.clipX,x=void 0===w?0:w,y=t.clipY,z=void 0===y?0:y,A=b.attrs.originalSourceInitialScale;u/=A,v/=A,x/=A,z/=A;var B={left:x+s.offsetLeft+m,center:x+u/2-(s.width/2-s.offsetLeft)+m,right:x+u-s.width-m+s.offsetLeft},C={top:z+s.offsetTop+m,middle:z+v/2-(s.height/2-s.offsetTop)+m,bottom:z+v-s.height-m+s.offsetTop},D=_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},POSITIONS.TOP_LEFT,function(){return{x:B.left,y:C.top}}),POSITIONS.TOP_CENTER,function(){return{x:B.center,y:C.top}}),POSITIONS.TOP_RIGHT,function(){return{x:B.right,y:C.top}}),POSITIONS.MIDDLE_LEFT,function(){return{x:B.left,y:C.middle}}),POSITIONS.MIDDLE_CENTER,function(){return{x:B.center,y:C.middle}}),POSITIONS.MIDDLE_RIGHT,function(){return{x:B.right,y:C.middle}}),POSITIONS.BOTTOM_LEFT,function(){return{x:B.left,y:C.bottom}}),POSITIONS.BOTTOM_CENTER,function(){return{x:B.center,y:C.bottom}}),POSITIONS.BOTTOM_RIGHT,function(){return{x:B.right,y:C.bottom}});return D[c]()};export default mapPositionStringToPoint;