canvas.class.js refactoring