Skip to content

Commit 8946ef4

Browse files
committed
Reorder functions for better diff
1 parent c391249 commit 8946ef4

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

src/plugins/plugin.filler.js

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,45 @@ function getLineByIndex(chart, index) {
2424
return visible ? meta.dataset : null;
2525
}
2626

27+
function parseFillOption(el) {
28+
var model = el._model || {};
29+
var fillOption = model.fill;
30+
var fill = helpers.valueOrDefault(fillOption && fillOption.target, fillOption);
31+
32+
if (fill === undefined) {
33+
fill = !!model.backgroundColor;
34+
}
35+
36+
if (fill === false || fill === null) {
37+
return false;
38+
}
39+
40+
if (fill === true) {
41+
return 'origin';
42+
}
43+
return fill;
44+
}
45+
46+
// @todo if (fill[0] === '#')
47+
function decodeFill(el, index, count) {
48+
const fill = parseFillOption(el);
49+
let target = parseFloat(fill, 10);
50+
51+
if (isFinite(target) && Math.floor(target) === target) {
52+
if (fill[0] === '-' || fill[0] === '+') {
53+
target = index + target;
54+
}
55+
56+
if (target === index || target < 0 || target >= count) {
57+
return false;
58+
}
59+
60+
return target;
61+
}
62+
63+
return ['origin', 'start', 'end'].indexOf(fill) >= 0 ? fill : false;
64+
}
65+
2766
function computeLinearBoundary(source) {
2867
const {scale = {}, fill} = source;
2968
var target = null;
@@ -160,45 +199,6 @@ function getTarget(source) {
160199
return new elements.Line({_children: points, _view: {tension: 0}, _loop});
161200
}
162201

163-
function parseFillOption(el) {
164-
var model = el._model || {};
165-
var fillOption = model.fill;
166-
var fill = helpers.valueOrDefault(fillOption && fillOption.target, fillOption);
167-
168-
if (fill === undefined) {
169-
fill = !!model.backgroundColor;
170-
}
171-
172-
if (fill === false || fill === null) {
173-
return false;
174-
}
175-
176-
if (fill === true) {
177-
return 'origin';
178-
}
179-
return fill;
180-
}
181-
182-
// @todo if (fill[0] === '#')
183-
function decodeFill(el, index, count) {
184-
const fill = parseFillOption(el);
185-
let target = parseFloat(fill, 10);
186-
187-
if (isFinite(target) && Math.floor(target) === target) {
188-
if (fill[0] === '-' || fill[0] === '+') {
189-
target = index + target;
190-
}
191-
192-
if (target === index || target < 0 || target >= count) {
193-
return false;
194-
}
195-
196-
return target;
197-
}
198-
199-
return ['origin', 'start', 'end'].indexOf(fill) >= 0 ? fill : false;
200-
}
201-
202202
function resolveTarget(sources, index, propagate) {
203203
var source = sources[index];
204204
var fill = source.fill;

0 commit comments

Comments
 (0)