I’m trying to figure out how large the touch object is. perhaps my code is wrong, but toss this in and see what happens:

```
function setup()
TouchableObjects = {}
cp = ControlPoint( 100, 100 )
curTouch = {}
curTouch.img = image( 10, 10 )
setContext( curTouch.img )
noStroke()
fill(250, 127, 13, 255)
ellipse( 5, 5, 10 )
setContext()
curTouch.ts = false -- touched screen
curTouch.tscmax = 80 -- touched screen counter max
curTouch.tsc = 80 -- touched screen counter
curTouch.x = 0
curTouch.y = 0
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
noTint()
cp:draw()
if( curTouch.ts ) then
if( curTouch.tsc > 0 ) then
curTouch.tsc = curTouch.tsc - 1
tint(255, 255 * curTouch.tsc/curTouch.tscmax )
sprite(curTouch.img, curTouch.x, curTouch.y)
else
print( "counter Finished" )
curTouch.ts = false
curTouch.tsc = curTouch.tscmax
end
end
end
function touched(t)
if( t.state == ENDED ) then
print( "touched CP?:", cp:touched(t) )
curTouch.ts = true
curTouch.tsc = curTouch.tscmax
curTouch.x = t.x
curTouch.y = t.y
end
end
ControlPoint = class()
function ControlPoint:init(x, y)
-- you can accept and set parameters here
self.x = x
self.y = y
self.diam = 50
self.img = image( self.diam, self.diam )
setContext( self.img )
noStroke()
fill(102, 102, 102, 255)
ellipseMode( CENTER )
--ellipse( self.diam/2, self.diam/2, self.diam-25 )
stroke(195, 50, 50, 255)
noFill()
strokeWidth ( 5 )
ellipse( self.diam/2, self.diam/2, self.diam-5 )
strokeWidth ( 2 )
stroke( 255, 255, 255, 255 ) --this should be the outer boundary of the CP
rectMode( CENTER )
rect( self.diam/2, self.diam/2, self.diam, self.diam )
popMatrix()
popStyle()
setContext()
end
function ControlPoint:draw()
-- Codea does not automatically call this method
pushStyle()
pushMatrix()
spriteMode( CENTER )
translate( self.x, self.y )
sprite( self.img )
popStyle()
popMatrix()
end
function ControlPoint:touched(touch)
-- Codea does not automatically call this method
--test if touch is within circle( self.x, self.y, rad=50)
--[[
In general, x and y must satisfy (x - center_x)^2 + (y - center_y)^2 < radius^2.
Please note that points that satisfy the above equation with < replaced by == are considered the points on the circle, and the points that satisfy the above equation with < replaced by > are considered the outside the circle.
]]--
a = touch.x - self.x
b = touch.y - self.y
if( (a*a + b*b) < (45*45) ) then
return true
else
return false
end
end
```

Tap around the ControlPoint, and you’ll see where it starts to return True (aka supposedly you tapped within the ControlPoint), which is outside both a) the bounds of the image the CP is inside, and also b) the radius of the CP.

Any ideas?