(self.webpackChunktimetrex=self.webpackChunktimetrex||[]).push([["filebrowser-TImageCutArea"],{8453:(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("/* provided dependency */ var jQuery = __webpack_require__(9755);\n( function( $ ) {\n\n\t$.fn.TImageCutArea = function( options ) {\n\n\t\tGlobal.addCss( 'global/widgets/filebrowser/TImageBrowser.css' );\n\t\tvar opts = $.extend( {}, $.fn.TImageCutArea.defaults, options );\n\n\t\tvar $this = this;\n\t\tvar field;\n\t\tvar name = 'filedata';\n\n\t\tvar default_width = 400;\n\t\tvar default_height = 300;\n\n\t\tvar default_after_width = 200;\n\t\tvar default_after_height = 150;\n\n\t\tthis.clearErrorStyle = function() {\n\n\t\t};\n\n\t\tthis.getField = function() {\n\t\t\treturn field;\n\t\t};\n\n\t\tthis.getValue = function() {\n\n\t\t};\n\n\t\tvar setAfterImage = function( val ) {\n\t\t\tvar image = $this.children().eq( 1 ).children().eq( 1 );\n\n\t\t\tif ( !val ) {\n\t\t\t\timage.attr( 'src', '' );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar d = new Date();\n\t\t\timage.attr( 'src', val );\n\n\t\t};\n\n\t\tthis.setImage = function( val ) {\n\t\t\tvar image = $this.children().eq( 0 ).children().eq( 1 );\n\n\t\t\tif ( !val ) {\n\t\t\t\timage.attr( 'src', '' );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar d = new Date();\n\t\t\timage.attr( 'src', val );\n\n\t\t\tsetAfterImage( val );\n\n\t\t\tsetTimeout( function() {\n\t\t\t\t$( image ).imgAreaSelect( {\n\t\t\t\t\thandles: true,\n\t\t\t\t\tx1: 0,\n\t\t\t\t\ty1: 0,\n\t\t\t\t\tx2: $( image ).width(),\n\t\t\t\t\ty2: $( image ).height(),\n\t\t\t\t\tonSelectEnd: function( img, selection ) {\n\n\t\t\t\t\t\tvar rate = image[0].naturalWidth / image.width();\n\t\t\t\t\t\tvar sx = selection.x1 * rate;\n\t\t\t\t\t\tvar sy = selection.y1 * rate;\n\t\t\t\t\t\tvar tx = selection.x2 * rate;\n\t\t\t\t\t\tvar ty = selection.y2 * rate - 1;\n\t\t\t\t\t\tvar width = selection.width * rate;\n\t\t\t\t\t\tvar height = selection.height * rate;\n\n\t\t\t\t\t\tvar canvas = $( '' );\n\t\t\t\t\t\tcanvas = canvas[0];\n\t\t\t\t\t\tcanvas.width = width;\n\t\t\t\t\t\tcanvas.height = height;\n\t\t\t\t\t\tvar ctx = canvas.getContext( '2d' );\n\n\t\t\t\t\t\tctx.drawImage( image[0], sx, sy, width - 1, height - 1, 0, 0, width, height );\n\t\t\t\t\t\tsetAfterImage( '' );\n\t\t\t\t\t\tsetAfterImage( canvas.toDataURL() );\n\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\tthis.getAfterImageSrc = function() {\n\t\t\tvar image = $this.children().eq( 1 ).children().eq( 1 );\n\n\t\t\treturn image.attr( 'src' );\n\t\t};\n\n\t\tthis.clearSelect = function() {\n\t\t\tvar image = $this.children().eq( 0 ).children().eq( 1 );\n\n\t\t\t$( image ).imgAreaSelect( { remove: true } );\n\n\t\t};\n\n\t\tvar onImageLoad = function( image ) {\n\n//\t\t\tif ( $( image ).height() > default_height ) {\n//\t\t\t\t$( image ).css( 'height', default_height );\n//\n//\t\t\t}\n//\n//\t\t\tif ( $( image ).width() > default_width ) {\n//\t\t\t\t$( image ).css( 'width', default_width );\n//\n//\t\t\t\t$( image ).css( 'height', 'auto' );\n//\t\t\t}\n\n//\t\t\t$( image ).show();\n\n\t\t};\n\n\t\tvar onAfterImageLoad = function( image ) {\n\n//\t\t\tif ( $( image ).height() > default_after_height ) {\n//\t\t\t\t$( image ).css( 'height', default_after_height );\n//\n//\t\t\t}\n//\n//\t\t\tif ( $( image ).width() > default_after_width ) {\n//\t\t\t\t$( image ).css( 'width', default_after_width );\n//\n//\t\t\t\t$( image ).css( 'height', 'auto' );\n//\t\t\t}\n\n//\t\t\t$( image ).show();\n\n\t\t};\n\n\t\tthis.setValue = function( val ) {\n\n\t\t\tif ( !val ) {\n\t\t\t\tval = '';\n\t\t\t}\n\n\t\t};\n\n\t\tfor ( var i = 0; i < this.length; i++ ) {\n\t\t\tvar $item = this[i];\n\n\t\t\tvar o = $.meta ? $.extend( {}, opts, $( $item ).data() ) : opts;\n\n\t\t\tfield = o.field;\n\n\t\t\tif ( o.default_width > 0 ) {\n\t\t\t\tdefault_width = o.default_width;\n\t\t\t}\n\n\t\t\tif ( o.default_height > 0 ) {\n\t\t\t\tdefault_height = o.default_height;\n\t\t\t}\n\n\t\t\tif ( Global.isSet( o.name ) ) {\n\t\t\t\tname = o.name;\n\t\t\t}\n\n\t\t\tvar image = $( $item ).children().eq( 0 ).children().eq( 1 );\n\t\t\timage.on( 'load', function() {\n\t\t\t\tonImageLoad( this );\n\n\t\t\t} );\n\n\t\t\tvar after_image = $( $item ).children().eq( 1 ).children().eq( 1 );\n\t\t\tafter_image.on( 'load', function() {\n\t\t\t\tonAfterImageLoad( this );\n\n\t\t\t} );\n\n\t\t}\n\n\t\treturn this;\n\n\t};\n\n\t$.fn.TImageCutArea.defaults = {};\n\t$.fn.TImageCutArea.html_template = `\n\t
\n\t\t
\n\t\t\tBefore:\n\t\t\t\n\t\t
\n\t\t
\n\t\t\tAfter:\n\t\t\t\n\t\t
\n\t
\n\t`;\n\n} )( jQuery );//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiODQ1My5qcyIsIm1hcHBpbmdzIjoiO0FBQUE7O0FBRUE7O0FBRUE7QUFDQSx5QkFBeUI7O0FBRXpCO0FBQ0E7QUFDQTs7QUFFQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7O0FBRUE7O0FBRUE7QUFDQTtBQUNBOztBQUVBOztBQUVBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBOztBQUVB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