Move drawing logic to drawers

Close #1106.
use generic typing
`export function copyMap<T>(oldMap: { [key: string]: T}): {[key: string]: T}`