Make HORIZONTAL and VERTICAL constants
Refactor out all svg style-setting + correspondingUseElement

After messing with Safari's web development tools, I think this makes it
works on Safari. I'm not too sure why.

Also shorten some if-statements with similar branches.