react-avatar-edit
Advanced tools
Comparing version 0.5.5 to 0.5.6
{ | ||
"name": "react-avatar-edit", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "ReactJS component to upload, crop, and preview avatars", | ||
@@ -5,0 +5,0 @@ "main": "src/avatar.jsx", |
@@ -24,2 +24,3 @@ import React from 'react' | ||
mimeTypes: 'image/jpeg,image/png', | ||
mobileScaleSpeed: 0.5, // experimental | ||
onClose: () => {}, | ||
@@ -118,2 +119,6 @@ onCrop: () => {}, | ||
get mobileScaleSpeed() { | ||
return this.props.mobileScaleSpeed | ||
} | ||
get cropRadius() { | ||
@@ -240,2 +245,9 @@ return this.state.cropRadius | ||
const onScaleCallback = (scaleY) => { | ||
const scale = scaleY > 0 || isNotOutOfScale(scaleY) ? scaleY : 0 | ||
cropStroke.radius(cropStroke.radius() - calcScaleRadius(scale)) | ||
crop.radius(crop.radius() - calcScaleRadius(scale)) | ||
resize.fire('resize') | ||
} | ||
this.onCropCallback(getPreview()) | ||
@@ -262,8 +274,14 @@ | ||
resize.on("touchstart", (evt) => { | ||
resize.on("dragmove", (dragEvt) => { | ||
if (dragEvt.evt.type !== 'touchmove') return | ||
const scaleY = (dragEvt.evt.changedTouches['0'].pageY - evt.evt.changedTouches['0'].pageY) || 0 | ||
onScaleCallback(scaleY * this.mobileScaleSpeed) | ||
}) | ||
}) | ||
resize.on("dragmove", (evt) => { | ||
const scaleY = evt.evt.movementY | ||
const scale = scaleY > 0 || isNotOutOfScale(scaleY) ? scaleY : 0 | ||
cropStroke.radius(cropStroke.radius() - calcScaleRadius(scale)) | ||
crop.radius(crop.radius() - calcScaleRadius(scale)) | ||
resize.fire('resize') | ||
if (evt.evt.type === 'touchmove') return | ||
const scaleY = evt.evt.movementY || 0 | ||
onScaleCallback(scaleY) | ||
}) | ||
@@ -270,0 +288,0 @@ resize.on("dragend", () => this.onCropCallback(getPreview())) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1085147
1936