Skip to content

Commit 48e273e

Browse files
committed
simplify exports/imports for shapeLabelTexttemplateVars
1 parent 9276af4 commit 48e273e

File tree

4 files changed

+25
-27
lines changed

4 files changed

+25
-27
lines changed

src/components/shapes/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var extendFlat = require('../../lib/extend').extendFlat;
88
var templatedArray = require('../../plot_api/plot_template').templatedArray;
99
var axisPlaceableObjs = require('../../constants/axis_placeable_objects');
1010
var shapeTexttemplateAttrs = require('../../plots/template_attributes').shapeTexttemplateAttrs;
11-
var shapeLabelTexttemplateVars = require('./label_texttemplate').shapeLabelTexttemplateVars;
11+
var shapeLabelTexttemplateVars = require('./label_texttemplate');
1212

1313
module.exports = templatedArray('shape', {
1414
visible: {

src/components/shapes/draw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var svgTextUtils = require('../../lib/svg_text_utils');
2323
var constants = require('./constants');
2424
var helpers = require('./helpers');
2525
var getPathString = helpers.getPathString;
26-
var shapeLabelTexttemplateVars = require('./label_texttemplate').shapeLabelTexttemplateVars;
26+
var shapeLabelTexttemplateVars = require('./label_texttemplate');
2727
var FROM_TL = require('../../constants/alignment').FROM_TL;
2828

2929

src/components/shapes/draw_newshape/attributes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var fontAttrs = require('../../../plots/font_attributes');
44
var dash = require('../../drawing/attributes').dash;
55
var extendFlat = require('../../../lib/extend').extendFlat;
66
var shapeTexttemplateAttrs = require('../../../plots/template_attributes').shapeTexttemplateAttrs;
7-
var shapeLabelTexttemplateVars = require('../label_texttemplate').shapeLabelTexttemplateVars;
7+
var shapeLabelTexttemplateVars = require('../label_texttemplate');
88

99

1010
module.exports = {
Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
'use strict';
22

33
module.exports = {
4-
shapeLabelTexttemplateVars: {
5-
x0: (function(shape, _xa) { return (_xa.type === 'date') ? shape.x0 : _xa.d2l(shape.x0); }),
6-
x1: (function(shape, _xa) { return (_xa.type === 'date') ? shape.x1 : _xa.d2l(shape.x1); }),
7-
y0: (function(shape, _xa, _ya) { return (_ya.type === 'date') ? shape.y0 : _ya.d2l(shape.y0); }),
8-
y1: (function(shape, _xa, _ya) { return (_ya.type === 'date') ? shape.y1 : _ya.d2l(shape.y1); }),
9-
slope: (function(shape, _xa, _ya) {
10-
return (_ya.d2l(shape.y1) - _ya.d2l(shape.y0)) / (_xa.d2l(shape.x1) - _xa.d2l(shape.x0));
11-
}),
12-
dx: (function(shape, _xa) { return _xa.d2l(shape.x1) - _xa.d2l(shape.x0); }),
13-
dy: (function(shape, _xa, _ya) { return _ya.d2l(shape.y1) - _ya.d2l(shape.y0); }),
14-
width: (function(shape, _xa) { return Math.abs(_xa.d2l(shape.x1) - _xa.d2l(shape.x0)); }),
15-
height: (function(shape, _xa, _ya) { return Math.abs(_ya.d2l(shape.y1) - _ya.d2l(shape.y0)); }),
16-
length: (function(shape, _xa, _ya) {
17-
return (shape.type === 'line') ? Math.sqrt(Math.pow((_xa.d2l(shape.x1) - _xa.d2l(shape.x0)), 2) + Math.pow((_ya.d2l(shape.y1) - _ya.d2l(shape.y0)), 2)) : undefined;
18-
}),
19-
xcenter: (function(shape, _xa) {
20-
var val = (_xa.d2l(shape.x1) + _xa.d2l(shape.x0)) / 2;
21-
return (_xa.type === 'date') ? _xa.l2d(val) : val;
22-
}),
23-
ycenter: (function(shape, _xa, _ya) {
24-
var val = (_ya.d2l(shape.y1) + _ya.d2l(shape.y0)) / 2;
25-
return (_ya.type === 'date') ? _ya.l2d(val) : val;
26-
}),
27-
}
4+
x0: (function(shape, _xa) { return (_xa.type === 'date') ? shape.x0 : _xa.d2l(shape.x0); }),
5+
x1: (function(shape, _xa) { return (_xa.type === 'date') ? shape.x1 : _xa.d2l(shape.x1); }),
6+
y0: (function(shape, _xa, _ya) { return (_ya.type === 'date') ? shape.y0 : _ya.d2l(shape.y0); }),
7+
y1: (function(shape, _xa, _ya) { return (_ya.type === 'date') ? shape.y1 : _ya.d2l(shape.y1); }),
8+
slope: (function(shape, _xa, _ya) {
9+
return (_ya.d2l(shape.y1) - _ya.d2l(shape.y0)) / (_xa.d2l(shape.x1) - _xa.d2l(shape.x0));
10+
}),
11+
dx: (function(shape, _xa) { return _xa.d2l(shape.x1) - _xa.d2l(shape.x0); }),
12+
dy: (function(shape, _xa, _ya) { return _ya.d2l(shape.y1) - _ya.d2l(shape.y0); }),
13+
width: (function(shape, _xa) { return Math.abs(_xa.d2l(shape.x1) - _xa.d2l(shape.x0)); }),
14+
height: (function(shape, _xa, _ya) { return Math.abs(_ya.d2l(shape.y1) - _ya.d2l(shape.y0)); }),
15+
length: (function(shape, _xa, _ya) {
16+
return (shape.type === 'line') ? Math.sqrt(Math.pow((_xa.d2l(shape.x1) - _xa.d2l(shape.x0)), 2) + Math.pow((_ya.d2l(shape.y1) - _ya.d2l(shape.y0)), 2)) : undefined;
17+
}),
18+
xcenter: (function(shape, _xa) {
19+
var val = (_xa.d2l(shape.x1) + _xa.d2l(shape.x0)) / 2;
20+
return (_xa.type === 'date') ? _xa.l2d(val) : val;
21+
}),
22+
ycenter: (function(shape, _xa, _ya) {
23+
var val = (_ya.d2l(shape.y1) + _ya.d2l(shape.y0)) / 2;
24+
return (_ya.type === 'date') ? _ya.l2d(val) : val;
25+
})
2826
};

0 commit comments

Comments
 (0)