I’m not sure, but take a look at this example. I think it may fix the issue to your satisfaction:
case 1 - ideal case; no fix required
case 2 - alt case; no fix required
case 3 - non-ideal behavior
case 4 - possible solution technique
local function test( marker, case ) -- IDEAL CASE if( case == 1 ) then local vertices = { 0, 0, 100, 0, 100, 100, 0, 100 } local o = display.newPolygon( marker.x, marker.y, vertices ) o.strokeWidth = 2 o:setFillColor(0,0,0,0) o:setStrokeColor( 1, 0, 0 ) --display.setDefault("isAnchorClamped", false) --o.anchorX = breachX/o.contentWidth --o.anchorY = breachY/o.contentHeight --print( breachX, breachY, o.anchorX, o.anchorY, breachX/o.contentWidth, breachY/o.contentHeight ) o.anchorX = 0 o.anchorY = 0 -- ALTERNATE IDEAL CASE elseif( case == 2 ) then local vertices = { -20, -50, 100, -10, 100, 100, -10, 100 } local o = display.newPolygon( marker.x, marker.y, vertices ) o.strokeWidth = 2 o:setFillColor(0,0,0,0) o:setStrokeColor( 1, 0, 0 ) o.anchorX = 0 o.anchorY = 0 -- NON-IDEAL CASE elseif( case == 3 ) then local vertices = { 0, 0, 100, -10, 100, 100, -10, 100 } local o = display.newPolygon( marker.x, marker.y, vertices ) o.strokeWidth = 2 o:setFillColor(0,0,0,0) o:setStrokeColor( 1, 0, 0 ) o.anchorX = 0 o.anchorY = 0 -- POSSIBLE FIX elseif( case == 4 ) then local vertices = { 0, 0, 100, -10, 100, 100, -10, 100 } -- 1. Find points where x or y are \< 0 local breachX = 0 local breachY = 0 for i = 1, #vertices, 2 do if( vertices[i] \< breachX ) then breachX = vertices[i] end if( vertices[i+1] \< breachY ) then breachY = vertices[i+1] end end -- 2 Draw polygon local o = display.newPolygon( marker.x, marker.y, vertices ) o.strokeWidth = 2 o:setFillColor(0,0,0,0) o:setStrokeColor( 1, 0, 0 ) o.anchorX = 0 o.anchorY = 0 -- 3 Adjust position of polygon ONLY if breach is left or above minimum vertex if( breachX \< vertices[1] ) then o.x = o.x + breachX end if( breachY \< vertices[2] ) then o.y = o.y + breachY end end end local marker = display.newCircle( display.contentCenterX, display.contentCenterY, 10 ) test( marker, 4)