All canvas classes suffer from several issues. They are bad structured (the model, the logic and methods), work incorrect (e.g. creation of scalers on mouse move) and even have dead code (e.g. items.isEmpty). All these cause many problems in canvas work (e.g. problems with synchronization, bad performance, complexity in supporting and understanding).
So this is the most important issue for now to restructure and rewrite these classes. We need to
consider clear model (so that it will be intuitive and e.g. selected item can be found in items.sel not in opts.selectedTool. there should not be getters for global vars and it is better to use less globals)
make the correct class structure (so that every single class do its only simple job e.g items class should only manipulate with items - create/delete/transform/select it shouldn't have socket logic or event handling. So there should not be creation of objects and complex calculation like redraw on mousemove.)
use correct and logically simple methods (it should be obvious what the method is about and how it works e.g. now there are two methods - unselect and unselectIfSelected, but how can you possibly unselect something which is not selected - it sound like nonsense! Its really hard to understand what isEmpty methods does it has dead code inside. Scale methods looks terrible and cause lots of bugs, the logic of items scaling however is straightforward and can be simply implemented)
All canvas classes suffer from several issues. They are bad structured (the model, the logic and methods), work incorrect (e.g. creation of scalers on mouse move) and even have dead code (e.g. items.isEmpty). All these cause many problems in canvas work (e.g. problems with synchronization, bad performance, complexity in supporting and understanding).
So this is the most important issue for now to restructure and rewrite these classes. We need to