public override void Draw(CanvasRenderingContext2D g) { //if (_contents.Size != LContentSize) if (_contents.Size.X != LContentSize.X || _contents.Size.Y != LContentSize.Y) { _buttonNeedsRerender = true; LContentSize = _contents.Size.Clone(); } if (_buttonNeedsRerender) { drawButton(); _buttonNeedsRerender = false; } Size = _buttonBuffer.Size.Clone(); //spriteGraphics.DrawImage(_bu) _buttonBuffer.Draw(spriteGraphics); Contents.Position = new Vector2(_borderSize, _borderSize); Contents.Draw(spriteGraphics); if (g != null) { base.Draw(g); } }