KineticJS icon indicating copy to clipboard operation
KineticJS copied to clipboard

disableStrokeScale broken by the newest chrome

Open ericmandel opened this issue 13 years ago • 11 comments

With the newest version of chrome on the Mac, v31.0.1650.57 (November 15), calling shape.disableStrokeScale(true) causes the shape's border not to be drawn. This is most easily seen in the jsfiddle:

http://jsfiddle.net/m2mzk/1/

Two identical circles are drawn, one of which also calls disableStrokeScale(true) and loses its border as a result.

This did not happen with previous versions of Linux and Mac chrome, including the Mac v30.0.1599.66 from October 1.

Regards,

Eric

ericmandel avatar Nov 21 '13 00:11 ericmandel

I can confirm this issue on Windows 7 64-bit.

To add some info: it is not that the stroke isn't drawn, but context.save(); context.setTransform(1, 0, 0, 1, 0, 0);

sequence that is used to achieve this effect, seems to screw up the intended transform. The stroke is there but is rendered offscreen. If the shape happens to be near the origin, you can get a glimpse of the stroke. Here's a version of your fiddle that demonstrates it: http://jsfiddle.net/m2mzk/2/

atis-- avatar Nov 21 '13 14:11 atis--

By the way you can also observe the missing stroke in this Canvas Tutorial page: http://www.html5canvastutorials.com/kineticjs/html5-canvas-listen-or-dont-listen-to-events-with-kineticjs/

atis-- avatar Nov 21 '13 15:11 atis--

Thank you guys for looking into this. I'll have a patch for this soon. Chrome seems to break canvas functionality on a pretty regular basis. I guess they don't do any testing before releases

ericdrowell avatar Nov 21 '13 16:11 ericdrowell

They seem to have fixed this particular issue in their latest canary build and hopefully it will propagate to normal version soon enough. Thanks for this wonderful framework @ericdrowell :)

@andynemzek : https://code.google.com/p/chromium/issues/detail?id=319541#c6

mihailox avatar Nov 22 '13 17:11 mihailox

@CyranX: thanks for pointing this out. I have verified that Version 33.0.1720.0 of canary Chrome displays our shapes correctly once again.

@ericdrowell: Eric, since there is no obvious release date by which the fix will propagate into the stable release, do you have any advice about work-arounds? We can skip calling disableStrokeScale() for Chrome 31 as the least bad alternative, but of course this causes our shape borders to thicken inappropriately as we scale up. Other ideas?

Regards,

Eric

ericmandel avatar Nov 26 '13 16:11 ericmandel

sorry guys, haven't been able to look into this yet. I'm planning on taking a look tomorrow. Sorry for the delay!

ericdrowell avatar Nov 27 '13 00:11 ericdrowell

This To get around this problem, set strokeScaleEnabled:true and strokeWidth: 5 / scale.

AlvinPLeung avatar Nov 27 '13 19:11 AlvinPLeung

@AlvinPLeung : Thanks very much, yes, that is a viable work-around. The problem is that it requires a call to setStrokeWidth(n/scale) in the re-scaling code when the scale changes, i.e., a place widely separated from the shape creation code where the disableStrokeScale() call is made. It also requires saving the original scale value or else keeping track of the relative scale. I was hoping for a work-around at the point of the bug itself, to keep the changes contained.

ericmandel avatar Nov 28 '13 00:11 ericmandel

Confirmed this working OK with Chrome Beta 32.0.1700.55 on Windows 8.1 64-bit but broken on current v31 release as all my shape outlines are all over the place with this version! No issues with IE11, FF or Safari on iOS7.04. Chrome used to be the only browser that consistently worked with KJS, now it's the worst by far!

Hackencrash avatar Dec 13 '13 17:12 Hackencrash

unfortunately, I can confirm that Google Chrome is the buggiest browser out there in regards to HTML5 Canvas. They seem to break things with every release. Even simple things like drawing circles!

ericdrowell avatar Dec 13 '13 19:12 ericdrowell

Currently with Chrome 33 examples work as expected. I think Chrome problem is resolved and I can close the issue.

lavrton avatar Mar 07 '14 15:03 lavrton