Skip to content

Commit 692d8a4

Browse files
authored
Remove unreachable code paths from plugins (#8513)
1 parent 65a6014 commit 692d8a4

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

src/plugins/plugin.filler.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,18 @@ class simpleArc {
114114
pathSegment(ctx, bounds, opts) {
115115
const {x, y, radius} = this;
116116
bounds = bounds || {start: 0, end: TAU};
117-
if (opts.reverse) {
118-
ctx.arc(x, y, radius, bounds.end, bounds.start, true);
119-
} else {
120-
ctx.arc(x, y, radius, bounds.start, bounds.end);
121-
}
117+
ctx.arc(x, y, radius, bounds.end, bounds.start, true);
122118
return !opts.bounds;
123119
}
124120

125-
interpolate(point, property) {
121+
interpolate(point) {
126122
const {x, y, radius} = this;
127123
const angle = point.angle;
128-
if (property === 'angle') {
129-
return {
130-
x: x + Math.cos(angle) * radius,
131-
y: y + Math.sin(angle) * radius,
132-
angle
133-
};
134-
}
124+
return {
125+
x: x + Math.cos(angle) * radius,
126+
y: y + Math.sin(angle) * radius,
127+
angle
128+
};
135129
}
136130
}
137131

src/plugins/plugin.title.js

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,6 @@ function createTitle(chart, titleOpts) {
119119
chart.titleBlock = title;
120120
}
121121

122-
function removeTitle(chart) {
123-
const title = chart.titleBlock;
124-
if (title) {
125-
layouts.removeBox(chart, title);
126-
delete chart.titleBlock;
127-
}
128-
}
129-
130-
function createOrUpdateTitle(chart, options) {
131-
const title = chart.titleBlock;
132-
if (title) {
133-
layouts.configure(chart, title, options);
134-
title.options = options;
135-
} else {
136-
createTitle(chart, options);
137-
}
138-
}
139-
140122
export default {
141123
id: 'title',
142124

@@ -157,11 +139,9 @@ export default {
157139
},
158140

159141
beforeUpdate(chart, _args, options) {
160-
if (options === false) {
161-
removeTitle(chart);
162-
} else {
163-
createOrUpdateTitle(chart, options);
164-
}
142+
const title = chart.titleBlock;
143+
layouts.configure(chart, title, options);
144+
title.options = options;
165145
},
166146

167147
defaults: {

0 commit comments

Comments
 (0)