CanvasScript3
>
Tests
> DisplayObject - HitTestPoint
Code
var stage = new Stage("canvas", 420, 500, 30); var circle = new Shape(); circle.graphics.beginFill(0x0000FF); circle.graphics.drawCircle(40, 40, 40); circle.x = 10; circle.y = 10; stage.addChild(circle); var point1 = new Point(0, 10); var point2 = new Point(10, 11); var point3 = new Point(30, 30); trace("result"); trace("answer"); trace("---------------------"); trace(circle.hitTestPoint(point1.x, point1.y, true)); // false trace("false"); trace("---------------------"); trace(circle.hitTestPoint(point1.x, point1.y, false)); // false trace("false"); trace("---------------------"); trace(circle.hitTestPoint(point2.x, point2.y, true)); // false trace("false"); trace("---------------------"); trace(circle.hitTestPoint(point2.x, point2.y, false)); // true trace("true"); trace("---------------------"); trace(circle.hitTestPoint(point3.x, point3.y, true)); // true trace("true"); trace("---------------------"); trace(circle.hitTestPoint(point3.x, point3.y, false)); // true trace("true"); trace("---------------------");
Canvas
Output