Move canvas polygon building into directive. Needs to be refactored