react-image-crop: Aspect ratio in Chrome throws console errors

I’m using the latest (1.0.0-rc3) version of react-image-crop with the following crop attributes:

const cropAttributes = {
  width: 100,
  height: 12,
  x: 0,
  y: 0,
  aspect: 1663/200
}

and I’m receiving the following error in the Chrome console: Error: <polygon> attribute points: Expected number, "0 0, 1 0, 1 NaN, 0 NaN".

Interestingly enough, this error has no effect on the crop. Everything works as expected, the aspect ratio is locked, the height, width, and coordinates are also correct, even with different values.

It seems that the inclusion of aspect in the attributes is the only thing that causes this error. Also, if the aspect is the only attribute specified, no error occurs:

const cropAttributes = {
  aspect: 1663/200
}

I suspect this might be an issue with webkit but I’m not 100% certain.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 21 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Hey sorry, I probably shouldn’t answer stuff when I’m drunk I’m a bar 😃 I thought this was regarding a different issue. Are you getting the same error as the OP? What does it say and what are you passing in as props?

On Sat, 25 Feb 2017 at 11:21, Isaac Hinman notifications@github.com wrote:

In that case I’m not really sure what you’re asking, but no - there is no immediately obvious DOM node with a crossorigin attribute.

— You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub https://github.com/DominicTobias/react-image-crop/issues/37#issuecomment-282477771, or mute the thread https://github.com/notifications/unsubscribe-auth/AAuZ-n2-RDI0ktGHWz4NA3Tc0dRG34A0ks5rgA7WgaJpZM4ItHNV .

I still get this error, with the following setup:

<ReactCrop crop={{ aspect: 1, width: 100, top: 0, x: 20 }} src={newProfilePhoto.preview} />

This is in v2.0.2.