canvas select main code