Skip to content

Commit

Permalink
Fix return types for most methods
Browse files Browse the repository at this point in the history
  • Loading branch information
caleb531 committed May 27, 2024
1 parent 952fde9 commit d17cb46
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions src/jcanvas.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,30 +139,30 @@ interface JQuery {
stopLayer(layerId: JCanvasLayerId, clearQueue?: boolean): void;
stopLayerGroup(groupId: jCanvasLayerGroupId, clearQueue?: boolean): void;
draw(args: Partial<JCanvasObject>): JQuery;
clearCanvas(args?: JCanvasObject): void;
saveCanvas(args?: JCanvasObject): void;
restoreCanvas(args?: JCanvasObject): void;
rotateCanvas(args?: JCanvasObject): void;
scaleCanvas(args?: JCanvasObject): void;
translateCanvas(args?: JCanvasObject): void;
drawRect(args: Partial<JCanvasObject>): void;
drawArc(args: Partial<JCanvasObject>): void;
drawEllipse(args: Partial<JCanvasObject>): void;
drawPolygon(args: Partial<JCanvasObject>): void;
drawSlice(args: Partial<JCanvasObject>): void;
drawLine(args: Partial<JCanvasObject>): void;
drawQuadratic(args: Partial<JCanvasObject>): void;
drawBezier(args: Partial<JCanvasObject>): void;
drawVector(args: Partial<JCanvasObject>): void;
drawPath(args: Partial<JCanvasObject>): void;
drawText(args: Partial<JCanvasObject>): void;
measureText(args: JCanvasLayerId): void;
drawImage(args: Partial<JCanvasObject>): void;
createPattern(args: Partial<JCanvasObject>): void;
createGradient(args: Partial<JCanvasObject>): void;
clearCanvas(args?: JCanvasObject): JQuery;
saveCanvas(args?: JCanvasObject): JQuery;
restoreCanvas(args?: JCanvasObject): JQuery;
rotateCanvas(args?: JCanvasObject): JQuery;
scaleCanvas(args?: JCanvasObject): JQuery;
translateCanvas(args?: JCanvasObject): JQuery;
drawRect(args: Partial<JCanvasObject>): JQuery;
drawArc(args: Partial<JCanvasObject>): JQuery;
drawEllipse(args: Partial<JCanvasObject>): JQuery;
drawPolygon(args: Partial<JCanvasObject>): JQuery;
drawSlice(args: Partial<JCanvasObject>): JQuery;
drawLine(args: Partial<JCanvasObject>): JQuery;
drawQuadratic(args: Partial<JCanvasObject>): JQuery;
drawBezier(args: Partial<JCanvasObject>): JQuery;
drawVector(args: Partial<JCanvasObject>): JQuery;
drawPath(args: Partial<JCanvasObject>): JQuery;
drawText(args: Partial<JCanvasObject>): JQuery;
measureText(args: JCanvasLayerId): JCanvasObject;
drawImage(args: Partial<JCanvasObject>): JQuery;
createPattern(args: Partial<JCanvasObject>): CanvasPattern | null;
createGradient(args: Partial<JCanvasObject>): CanvasGradient | null;
setPixels(args: Partial<JCanvasObject>): void;
getCanvasImage(type: string, quality?: number): void;
detectPixelRatio(callback?: (ratio: number) => void): void;
getCanvasImage(type: string, quality?: number): string | null;
detectPixelRatio(callback?: (ratio: number) => void): JQuery;
}

interface JCanvasDefaults {
Expand Down
4 changes: 2 additions & 2 deletions src/jcanvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4325,11 +4325,11 @@ $.fn.createGradient = function createGradient(args) {
const params = new jCanvasObject(args);
const canvas = $canvases[0];
if (!_isCanvas(canvas)) {
return;
return null;
}
const ctx = _getContext(canvas);
if (!ctx) {
return;
return null;
}
// Gradient coordinates must be defined
params.x1 = params.x1 || 0;
Expand Down

0 comments on commit d17cb46

Please sign in to comment.