fix legend not reducing after being dragged on firefox