Skip to content

Commit

Permalink
add drawPointLegend to keep drawPoint signature
Browse files Browse the repository at this point in the history
  • Loading branch information
touletan committed Jul 10, 2022
1 parent f469966 commit b85dcfd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/helpers/helpers.canvas.js
Expand Up @@ -126,7 +126,11 @@ export function clearCanvas(canvas, ctx) {
ctx.restore();
}

export function drawPoint(ctx, options, x, y, w) {
export function drawPoint(ctx, options, x, y) {
drawPointLegend(ctx, options, x, y, null);
}

export function drawPointLegend(ctx, options, x, y, w) {
let type, xOffset, yOffset, size, cornerRadius, width;
const style = options.pointStyle;
const rotation = options.rotation;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/plugin.legend.js
@@ -1,7 +1,7 @@
import defaults from '../core/core.defaults';
import Element from '../core/core.element';
import layouts from '../core/core.layouts';
import {addRoundedRectPath, drawPoint, renderText} from '../helpers/helpers.canvas';
import {addRoundedRectPath, drawPointLegend, renderText} from '../helpers/helpers.canvas';
import {
callback as call, valueOrDefault, toFont,
toPadding, getRtlAdapter, overrideTextDirection, restoreTextDirection,
Expand Down Expand Up @@ -325,7 +325,7 @@ export class Legend extends Element {
const centerY = y + halfFontSize;

// Draw pointStyle as legend symbol
drawPoint(ctx, drawOptions, centerX, centerY, boxWidth);
drawPointLegend(ctx, drawOptions, centerX, centerY, boxWidth);
} else {
// Draw box as legend symbol
// Adjust position when boxHeight < fontSize (want it centered)
Expand Down

0 comments on commit b85dcfd

Please sign in to comment.