fancyoung Posted April 19, 2017 Share Posted April 19, 2017 I try to use `containsPoint`, but it always return false. It seems `containsPoint` must work with `startFill & endFill`, but when I use `bezierCurveTo` draw line, the fill not working. But the canvas original function `isPointInPath` is working. Why? Here is my demo: https://jsfiddle.net/p1b2Lrte/2/ Quote Link to comment Share on other sites More sharing options...
Taz Posted April 19, 2017 Share Posted April 19, 2017 These two steps fix the second shape, which now gets filled and works with containsPoint 1. Change graphics.beginFill and graphics.endFill to graphics2.beginFill and graphics2.endFill 2. Move graphics2.beginFill to before graphics2.moveTo var graphics2 = new PIXI.Graphics(); graphics2.lineStyle(1, 0xFFFFFF, 1); graphics2.beginFill(0x999999, 1); graphics2.moveTo(120, 10); graphics2.bezierCurveTo(130, 0, 130, 0, 200, 10); graphics2.bezierCurveTo(250, 100, 250, 100, 120, 200); graphics2.bezierCurveTo(130, 0, 130, 0, 120, 10); //graphics2.currentPath.shape.closed = true; graphics2.endFill(); viewerStage.addChild(graphics2); Quote Link to comment Share on other sites More sharing options...
fancyoung Posted April 24, 2017 Author Share Posted April 24, 2017 @Taz Thanks, it works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.