{"action":"created","issue":{"url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/166","repository_url":"https://api.github.com/repos/DominicTobias/react-image-crop","labels_url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/166/labels{/name}","comments_url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/166/comments","events_url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/166/events","html_url":"https://github.com/DominicTobias/react-image-crop/issues/166","id":305143438,"number":166,"title":"Crop doesn't change no matter what pixelCrop is","user":{"login":"Blah237","id":21367367,"avatar_url":"https://avatars3.githubusercontent.com/u/21367367?v=4","gravatar_id":"","url":"https://api.github.com/users/Blah237","html_url":"https://github.com/Blah237","followers_url":"https://api.github.com/users/Blah237/followers","following_url":"https://api.github.com/users/Blah237/following{/other_user}","gists_url":"https://api.github.com/users/Blah237/gists{/gist_id}","starred_url":"https://api.github.com/users/Blah237/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blah237/subscriptions","organizations_url":"https://api.github.com/users/Blah237/orgs","repos_url":"https://api.github.com/users/Blah237/repos","events_url":"https://api.github.com/users/Blah237/events{/privacy}","received_events_url":"https://api.github.com/users/Blah237/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-14T12:45:49Z","updated_at":"2018-03-14T12:52:09Z","closed_at":null,"author_association":"NONE","body":"I'm using the following function to get my cropped image--no matter what pixelCrop is (I have verified pixelCrop is getting set correctly), the drawn image is a full copy of the original image, not cropped at all.\r\n\r\n```\r\ngetCroppedImg(image, pixelCrop, fileName) {\r\n\r\n        const canvas = document.createElement('canvas');\r\n        canvas.width = pixelCrop.width;\r\n        canvas.height = pixelCrop.height;\r\n        let ctx = canvas.getContext('2d');\r\n        let img = new Image();\r\n        img.setAttribute('crossOrigin', 'anonymous');\r\n        img.src = this.state.imageUrl;\r\n        console.log(this.state.pixelCropObject);\r\n\r\n        ctx.drawImage(\r\n            img,\r\n            pixelCrop.x,\r\n            pixelCrop.y,\r\n            pixelCrop.width,\r\n            pixelCrop.height,\r\n            0,\r\n            0,\r\n            pixelCrop.width,\r\n            pixelCrop.height\r\n        );\r\n\r\n        document.getElementById('tempImg').appendChild(canvas);\r\n\r\n    // As a blob\r\n    return new Promise((resolve, reject) => {\r\n        canvas.toBlob(file => {\r\n            file.name = fileName;\r\n            resolve(file);\r\n        }, 'image/jpeg');\r\n    });\r\n```"},"comment":{"url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/comments/373009714","html_url":"https://github.com/DominicTobias/react-image-crop/issues/166#issuecomment-373009714","issue_url":"https://api.github.com/repos/DominicTobias/react-image-crop/issues/166","id":373009714,"user":{"login":"DominicTobias","id":760314,"avatar_url":"https://avatars0.githubusercontent.com/u/760314?v=4","gravatar_id":"","url":"https://api.github.com/users/DominicTobias","html_url":"https://github.com/DominicTobias","followers_url":"https://api.github.com/users/DominicTobias/followers","following_url":"https://api.github.com/users/DominicTobias/following{/other_user}","gists_url":"https://api.github.com/users/DominicTobias/gists{/gist_id}","starred_url":"https://api.github.com/users/DominicTobias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominicTobias/subscriptions","organizations_url":"https://api.github.com/users/DominicTobias/orgs","repos_url":"https://api.github.com/users/DominicTobias/repos","events_url":"https://api.github.com/users/DominicTobias/events{/privacy}","received_events_url":"https://api.github.com/users/DominicTobias/received_events","type":"User","site_admin":false},"created_at":"2018-03-14T12:52:09Z","updated_at":"2018-03-14T12:52:09Z","author_association":"OWNER","body":"Hi, my first thought is that you're doing appendChild instead of replacement, and due to some css you have there your new canvases are going underneath the first one"}}
{"actor":{"display_login":"DominicTobias"}}