Skip to content
This repository has been archived by the owner on Dec 21, 2021. It is now read-only.

Commit

Permalink
Remove the border from the ImageCropper
Browse files Browse the repository at this point in the history
We use avatar images at 180x180 pixels on the profile page of
account.ultimaker.com but we only provide a 130x130px circle when cropping
images. By removing the 25px border that was previously used, we get the
full 180x180px of the cropper tool.
  • Loading branch information
matijs committed Jan 15, 2020
1 parent 533f879 commit 5723006
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`The Image Cropper component should render 1`] = `
className="image-cropper--container"
>
<d
border={25}
border={0}
borderRadius={0}
className="editor-canvas"
color={
Expand All @@ -18,7 +18,7 @@ exports[`The Image Cropper component should render 1`] = `
}
disableBoundaryChecks={false}
disableHiDPIScaling={false}
height={150}
height={200}
image={null}
onImageChange={[Function]}
onImageReady={[Function]}
Expand All @@ -36,7 +36,7 @@ exports[`The Image Cropper component should render 1`] = `
rotate={0}
scale={1}
style={Object {}}
width={150}
width={200}
/>
<RangeSlider
className="image-cropper--slider"
Expand Down
10 changes: 5 additions & 5 deletions src/components/__tests__/image_cropper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as React from 'react';
import { shallow } from 'enzyme';
import AvatarEditor from 'react-avatar-editor';
import RangeSlider from '../range_slider';
import ImageCropper from '../image_cropper';
import ImageCropper, { ImageCropperProps } from '../image_cropper';

describe('The Image Cropper component', () => {
let props;
let props: ImageCropperProps;
const onImageChanged = jest.fn();
const onCropCancel = jest.fn();
const mockEditor = { getImageScaledToCanvas: () => ({ toDataURL: () => 'imageData' }) };
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('The Image Cropper component', () => {
}));
});

it('should keep the range slider', async () => {
it('should keep the range slider', () => {
const wrapper = createWrapper();
expect(wrapper.find(RangeSlider).prop('value')).toEqual(1);
expect(wrapper.find(AvatarEditor).prop('scale')).toEqual(1);
Expand All @@ -56,15 +56,15 @@ describe('The Image Cropper component', () => {
expect(wrapper.find(AvatarEditor).prop('scale')).toEqual(0.5);
});

it('should keep the image position', async () => {
it('should keep the image position', () => {
const wrapper = createWrapper();
const avatarProps: any = wrapper.find(AvatarEditor).props();
expect(avatarProps.position).toEqual({ x: 0.5, y: 0.5 });
avatarProps.onPositionChange({ x: 0, y: 1 });
expect(wrapper.find(AvatarEditor).prop('position')).toEqual({ x: 0, y: 1 });
});

it('should parse the callback', async () => {
it('should parse the callback', () => {
const wrapper = createWrapper();
const avatarProps: any = wrapper.find(AvatarEditor).props();
avatarProps.onImageChange();
Expand Down
2 changes: 1 addition & 1 deletion src/components/image_cropper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class ImageCropper extends React.Component<ImageCropperProps, ImageCroppe
minScale: 0.5,
maxScale: 2.5,
scaleStep: 0.05,
borderSize: 25,
borderSize: 0,
imageURL: null,
onImageChanged: null,
};
Expand Down

0 comments on commit 5723006

Please sign in to comment.