We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4b3cb7d commit 19a03e9Copy full SHA for 19a03e9
src/lib/canvas/OSRSCanvas.ts
@@ -237,10 +237,13 @@ export class OSRSCanvas {
237
this.ctx.restore();
238
}
239
240
- drawBorder(_sprite?: IBgSprite, titleLine = true) {
241
- const sprite = _sprite ?? this.sprite;
+ drawBorder(_sprite: IBgSprite, titleLine = true) {
+ if (!this.sprite) throw new Error('No sprite provided for drawing border');
242
+ OSRSCanvas.drawBorder(this.ctx, _sprite ?? this.sprite, titleLine);
243
+ }
244
+
245
+ static drawBorder(ctx: CanvasContext, sprite: IBgSprite, titleLine = true) {
246
if (!sprite) throw new Error('No sprite provided for drawing border');
- const ctx = this.ctx;
247
// Top border
248
ctx.save();
249
ctx.fillStyle = ctx.createPattern(sprite.border, 'repeat-x')!;
0 commit comments