Skip to content

Commit 722a1ca

Browse files
MFedMFed
MFed
authored and
MFed
committed
code review feedback
1 parent a7e0e88 commit 722a1ca

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

src/components/annotations/attributes.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ module.exports = {
131131
role: 'style',
132132
description: 'Sets the width (in px) of annotation arrow.'
133133
},
134-
absoluteArrowTail: {
134+
absolutetail: {
135135
valType: 'boolean',
136136
dflt: false,
137137
role: 'style',
@@ -152,10 +152,10 @@ module.exports = {
152152
role: 'info',
153153
description: [
154154
'Sets the x component of the arrow tail about the arrow head.',
155-
'If `absoluteArrowTail` is false, a positive (negative) ',
155+
'If `absolutetail` is false, a positive (negative) ',
156156
'component corresponds to an arrow pointing',
157157
'from right to left (left to right).',
158-
'If `absoluteArrowTail` is true, this is a value on the x axis.'
158+
'If `absolutetail` is true, this is a value on the x axis.'
159159
].join(' ')
160160
},
161161
ay: {
@@ -164,10 +164,10 @@ module.exports = {
164164
role: 'info',
165165
description: [
166166
'Sets the y component of the arrow tail about the arrow head.',
167-
'If `absoluteArrowTail` is false, a positive (negative) ',
167+
'If `absolutetail` is false, a positive (negative) ',
168168
'component corresponds to an arrow pointing',
169169
'from bottom to top (top to bottom).',
170-
'If `absoluteArrowTail` is true, this is a value on the y axis.'
170+
'If `absolutetail` is true, this is a value on the y axis.'
171171
].join(' ')
172172
},
173173
// positioning

src/components/annotations/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function handleAnnotationDefaults(annIn, fullLayout) {
5959
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2);
6060
coerce('ax');
6161
coerce('ay');
62-
coerce('absoluteArrowTail');
62+
coerce('absolutetail');
6363

6464
// if you have one part of arrow length you should have both
6565
Lib.noneOrAll(annIn, annOut, ['ax', 'ay']);
@@ -91,7 +91,7 @@ function handleAnnotationDefaults(annIn, fullLayout) {
9191
newval = Lib.dateTime2ms(annIn[axLetter]);
9292
if(newval !== false) annIn[axLetter] = newval;
9393

94-
if(annIn.absoluteArrowTail) {
94+
if(annIn.absolutetail) {
9595
var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]);
9696
if(newvalB !== false) annIn['a' + axLetter] = newvalB;
9797
}
@@ -456,7 +456,7 @@ annotations.draw = function(gd, index, opt, value) {
456456
}
457457

458458
var alignShift = 0;
459-
if(options.absoluteArrowTail) {
459+
if(options.absolutetail) {
460460
annPosPx['aa' + axLetter] = ax._offset + ax.l2p(options['a' + axLetter]);
461461
} else {
462462
if(options.showarrow) {
@@ -486,7 +486,7 @@ annotations.draw = function(gd, index, opt, value) {
486486
// make sure the arrowhead (if there is one)
487487
// and the annotation center are visible
488488
if(options.showarrow) {
489-
if (options.absoluteArrowTail) {
489+
if (options.absolutetail) {
490490
arrowX = Lib.constrain(annPosPx.x, 1, fullLayout.width - 1);
491491
arrowY = Lib.constrain(annPosPx.y, 1, fullLayout.height - 1);
492492
} else {
@@ -512,7 +512,7 @@ annotations.draw = function(gd, index, opt, value) {
512512
outerwidth - borderwidth, outerheight - borderwidth);
513513

514514
var annX = 0, annY = 0;
515-
if(options.absoluteArrowTail) {
515+
if(options.absolutetail) {
516516
annX = Math.round(annPosPx.aax - outerwidth / 2);
517517
annY = Math.round(annPosPx.aay - outerheight / 2);
518518
} else {
@@ -539,7 +539,7 @@ annotations.draw = function(gd, index, opt, value) {
539539
// how-to-get-the-width-of-an-svg-tspan-element
540540
var arrowX0, arrowY0;
541541

542-
if(options.absoluteArrowTail) {
542+
if(options.absolutetail) {
543543
arrowX0 = annPosPx.aax + dx;
544544
arrowY0 = annPosPx.aay + dy;
545545
} else {
@@ -648,7 +648,7 @@ annotations.draw = function(gd, index, opt, value) {
648648
(options.y + dy / ya._m) :
649649
(1 - ((arrowY + dy - gs.t) / gs.h));
650650

651-
if(options.absoluteArrowTail) {
651+
if(options.absolutetail) {
652652
update[annbase + '.ax'] = xa ?
653653
(options.ax + dx / xa._m) :
654654
((arrowX + dx - gs.l) / gs.w);
@@ -698,7 +698,7 @@ annotations.draw = function(gd, index, opt, value) {
698698
ann.call(Lib.setTranslate, x0 + dx, y0 + dy);
699699
var csr = 'pointer';
700700
if(options.showarrow) {
701-
if(options.absoluteArrowTail) {
701+
if(options.absolutetail) {
702702
update[annbase + '.ax'] = xa.p2l(xa.l2p(options.ax) + dx);
703703
update[annbase + '.ay'] = ya.p2l(ya.l2p(options.ay) + dy);
704704
} else {

test/image/mocks/annotations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"font":{"color":"rgb(0, 0, 255)","size":20},
4343
"arrowcolor":"rgb(166, 28, 0)","borderpad":3,"textangle":50,"x":5,"y":1
4444
},
45-
{"text":"","showarrow":true,"borderwidth":1.2,"arrowhead":2,"absoluteArrowTail":true,"x":5,"y":5,"ax":4,"ay":3}
45+
{"text":"","showarrow":true,"borderwidth":1.2,"arrowhead":2,"absolutetail":true,"x":5,"y":5,"ax":4,"ay":3}
4646
]
4747
}
4848
}

test/jasmine/tests/annotations_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ describe('Test annotations', function() {
1313

1414
Annotations.supplyLayoutDefaults({ annotations: [{ showarrow: true, arrowhead: 2}] }, annotationDefaults);
1515

16-
expect(annotationDefaults.annotations[0].absoluteArrowTail).toBe(false);
16+
expect(annotationDefaults.annotations[0].absolutetail).toBe(false);
1717
});
1818

19-
it('should convert ax/ay date coordinates to milliseconds if absoluteArrowTail is true', function() {
19+
it('should convert ax/ay date coordinates to milliseconds if absolutetail is true', function() {
2020
var annotationOut = { xaxis: { type: 'date', range: ['2000-01-01', '2016-01-01'] }};
2121
annotationOut._has = Plots._hasPlotType.bind(annotationOut);
2222

2323
var annotationIn = {
24-
annotations: [{ showarrow: true, absoluteArrowTail: true, x: '2008-07-01', ax: '2004-07-01', y: 0, ay: 50}]
24+
annotations: [{ showarrow: true, absolutetail: true, x: '2008-07-01', ax: '2004-07-01', y: 0, ay: 50}]
2525
};
2626

2727
Annotations.supplyLayoutDefaults(annotationIn, annotationOut);

0 commit comments

Comments
 (0)