IE11 isPointInStroke problem

I was testing on IE11 (unfortuneately…) and I’ve got a lot of “isPointInStroke is unsupported” in canvas and dom renderers.

I’ve read it up that IE canvas does not support this, but is there any way to enable it, by a shiv of some sort? Or maybe get around this problem any other way?

Edit: The same in Microsoft Edge Object doesn't support property or method 'isPointInStroke'

Thanks!

Uh, yeah, perhaps there’s a way to skip this (or add a non-op method) to prevent the warnings

Wouldnt adding a nonop method break things? I think the best approach is extending the canvas prototype with an actual implementation. I will try this today

Added a bug with a proposed fix here https://github.com/openfl/openfl/issues/973

Get the same error on Windows Edge when draw line using Graphics.
The fix of er453r work fine with line thickness = 1, but don’t work properly with line thickness more than 1 (all area outside line with thickness = 1 inactive).

I’m running into this issue after a fresh upgrade of OpenFL and Lime. I guess it has not yet made it into the release. Will try applying this as well.

Do you guys think we A.) modify the canvas prototype or B.) use conditional code to avoid calling isPointInStroke where it is not supported? Thanks!

I guess it is better to support it with a shiv (prototype modification) - you can always insert an empty implementation there, and you have the second approach :slight_smile:

I have the same problem… can you tell please where is exactly located the problem code? don’t know where to search it…

Just paste this code https://github.com/openfl/openfl/issues/973 to the beginning of your Main constructor

Does that new commit to Lime help?

This is working for me. I guess it’s going to be merged into the Lime mainstream shortly.

From https://github.com/openfl/openfl/issues/9737

	#if js
	untyped __js__('// openfl IE/Edge isPointInStroke shiv - not super exact for wide strokes
	if(typeof CanvasRenderingContext2D.prototype.isPointInStroke == "undefined"){
		console.log("Pathed CanvasRenderingContext2D with isPointInStroke approximation");

		CanvasRenderingContext2D.prototype.isPointInStroke = function(path, x, y) {
			return this.isPointInPath(x, y);
		}
	 }');
	#end