vexflow
vexflow copied to clipboard
Fix SVGContext.rect() implementation
SVGContext.rect() should prepare but not draw a rectangle until stroke() or fill() are called to match the CanvasContext implementation. (See discussion in #736.)
I agree with this one.
It has caused confusion in the past, where we think CanvasContext is buggy: https://github.com/0xfe/vexflow/issues/638
We should have SVGContext and CanvasContext match as closely as possible. Any superchanged convenience methods should have a different name. For example, if we want a method that adds the path and also strokes/fills, we could call it .drawRectWithStyle(x,y,w,h,styleObject). That way we can implement the convenience method in both CanvasContext and SVGContext.