New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 795038 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug-Regression



Sign in to add a comment

canvas.toDataURL() does not appear to be working properly

Reported by j...@webappsolution.com, Dec 14 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

Steps to reproduce the problem:
1. React Code:

setDragImage(e) {
let canvas = document.createElement('canvas');
let ctx = canvas.getContext('2d');

//ctx.beginPath();
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 176, 100);
//ctx.fillStyle = 'red';
//ctx.fill();

// let images = [];
// const {dragImages} = this.props;
// for (let key in dragImages) {
// images.push(dragImages[key]);
// }
//
// for (let i = images.length - 1; i >= 0; i--) {
// let image = images[i];
// ctx.drawImage(image, i * 10, i * 10, 176, 100);
// }

let dragIcon = document.createElement('img');
// dragIcon.style.display = 'block';
// dragIcon.style.background = 'red';
dragIcon.src = canvas.toDataURL();
console.log('drag icon src = ' + dragIcon.src);

// Add drag icon to document to force redraw...
// TODO Do we need to remove this child on drop?
document.body.appendChild(dragIcon);

let clientRect = e.target.getBoundingClientRect();
let offsetX = (e.clientX - clientRect.left) - 50;
let offsetY = (e.clientY - clientRect.top) - 50;

// Set drag image
e.dataTransfer.setDragImage(dragIcon, offsetX, offsetY);
}
2. 
3. 

What is the expected behavior?
render canvas

What went wrong?
did not render

Did this work before? Yes 62

Does this work in other browsers? Yes

Chrome version: 63.0.3239.84  Channel: stable
OS Version: OS X 10.13.1
Flash Version: Shockwave Flash 28.0 r0
 

Comment 1 by gov...@chromium.org, Dec 14 2017

Labels: Needs-Triage-M63
Cc: krajshree@chromium.org
Labels: Needs-Feedback Triaged-ET
joes@ - Thanks for filing the issue...!!

Could you please provide a sample webpage/url to test the issue from TE-end.
This will help us in triaging the issue further.

Thanks...!!
Thanks for your reply.

Turns out issue was not with canvas.toDataURL(), but rather with no longer
being able to dynamically add newly created drag icon <img> tag to document.

Work around was to add and hide static drag icon <img> tag.   Kinda hacky
if you ask me, but works just fine.

Thanks again,

Joe
Project Member

Comment 4 by sheriffbot@chromium.org, Dec 15 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "krajshree@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: WontFix (was: Unconfirmed)
Based on comment#3 closing the bug, Please reopen if I am wrong.

Comment 6 by phistuck@gmail.com, Dec 15 2017

#3 - can you file a new issue for the changed behavior? I do not understand it from the brief explanation you supplied, but it might be an unintentional behavior change, a side effect from a related fix or refactoring.
You can comment here with the new issue number.

Sign in to add a comment