mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-12 21:54:17 +01:00
cd7a40bdc7
Using Jcrop's `trueSize` argument also allows us to get rid of all that behind the scenes temp image creating and back and forth calculating of image sizes. Props tyxla for initial patch. See #16434. Built from https://develop.svn.wordpress.org/trunk@33053 git-svn-id: http://core.svn.wordpress.org/trunk@33024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
!function(a){var b={},c={updateCoords:function(b){a("#crop-x").val(b.x),a("#crop-y").val(b.y),a("#crop-width").val(b.w),a("#crop-height").val(b.h),c.showPreview(b)},showPreview:function(b){var c=64/b.w,d=64/b.h,e=16/b.w,f=16/b.h;a("#preview-homeicon").css({width:Math.round(c*wpSiteIconCropData.width)+"px",height:Math.round(d*wpSiteIconCropData.height)+"px",marginLeft:"-"+Math.round(c*b.x)+"px",marginTop:"-"+Math.round(d*b.y)+"px"}),a("#preview-favicon").css({width:Math.round(e*wpSiteIconCropData.width)+"px",height:Math.round(f*wpSiteIconCropData.height)+"px",marginLeft:"-"+Math.round(e*b.x)+"px",marginTop:"-"+Math.floor(f*b.y)+"px"})},ready:function(){b=a.Jcrop("#crop-image"),b.setOptions({bgColor:"transparent",aspectRatio:1,onSelect:c.updateCoords,onChange:c.updateCoords,trueSize:[wpSiteIconCropData.width,wpSiteIconCropData.height],minSize:[wpSiteIconCropData.min_size,wpSiteIconCropData.min_size]}),b.animateTo([wpSiteIconCropData.init_x,wpSiteIconCropData.init_y,wpSiteIconCropData.init_size,wpSiteIconCropData.init_size])}};c.ready()}(jQuery); |