Lots of bug fixex. Draggable margin and legend
Bug fixes