Skip to content

[EXPERIMENTAL] Run standard --fix #1371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 4 additions & 5 deletions src/assets/geo_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
* LICENSE file in the root directory of this source tree.
*/

'use strict';

var saneTopojson = require('sane-topojson');
'use strict'

var saneTopojson = require('sane-topojson')

// package version injected by `npm run preprocess`
exports.version = '1.23.0';
exports.version = '1.23.0'

exports.topojson = saneTopojson;
exports.topojson = saneTopojson
122 changes: 60 additions & 62 deletions src/components/annotations/annotation_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,102 +6,100 @@
* LICENSE file in the root directory of this source tree.
*/

'use strict'

'use strict';
var Lib = require('../../lib')
var Color = require('../color')
var Axes = require('../../plots/cartesian/axes')

var Lib = require('../../lib');
var Color = require('../color');
var Axes = require('../../plots/cartesian/axes');
var attributes = require('./attributes')

var attributes = require('./attributes');
module.exports = function handleAnnotationDefaults (annIn, annOut, fullLayout, opts, itemOpts) {
opts = opts || {}
itemOpts = itemOpts || {}

function coerce (attr, dflt) {
return Lib.coerce(annIn, annOut, attributes, attr, dflt)
}

module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) {
opts = opts || {};
itemOpts = itemOpts || {};
var visible = coerce('visible', !itemOpts.itemIsNotPlainObject)
var clickToShow = coerce('clicktoshow')

function coerce(attr, dflt) {
return Lib.coerce(annIn, annOut, attributes, attr, dflt);
}

var visible = coerce('visible', !itemOpts.itemIsNotPlainObject);
var clickToShow = coerce('clicktoshow');
if (!(visible || clickToShow)) return annOut

if(!(visible || clickToShow)) return annOut;
coerce('opacity')
coerce('align')
coerce('bgcolor')

coerce('opacity');
coerce('align');
coerce('bgcolor');
var borderColor = coerce('bordercolor'),
borderOpacity = Color.opacity(borderColor)

var borderColor = coerce('bordercolor'),
borderOpacity = Color.opacity(borderColor);
coerce('borderpad')

coerce('borderpad');
var borderWidth = coerce('borderwidth')
var showArrow = coerce('showarrow')

var borderWidth = coerce('borderwidth');
var showArrow = coerce('showarrow');

coerce('text', showArrow ? ' ' : 'new text');
coerce('textangle');
Lib.coerceFont(coerce, 'font', fullLayout.font);
coerce('text', showArrow ? ' ' : 'new text')
coerce('textangle')
Lib.coerceFont(coerce, 'font', fullLayout.font)

// positioning
var axLetters = ['x', 'y'],
arrowPosDflt = [-10, -30],
gdMock = {_fullLayout: fullLayout};
for(var i = 0; i < 2; i++) {
var axLetter = axLetters[i];
var axLetters = ['x', 'y'],
arrowPosDflt = [-10, -30],
gdMock = {_fullLayout: fullLayout}
for (var i = 0; i < 2; i++) {
var axLetter = axLetters[i]

// xref, yref
var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper');
var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper')

// x, y
Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5);
Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5)

if(showArrow) {
var arrowPosAttr = 'a' + axLetter,
if (showArrow) {
var arrowPosAttr = 'a' + axLetter,
// axref, ayref
aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel');
aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel')

// for now the arrow can only be on the same axis or specified as pixels
// TODO: sometime it might be interesting to allow it to be on *any* axis
// but that would require updates to drawing & autorange code and maybe more
if(aaxRef !== 'pixel' && aaxRef !== axRef) {
aaxRef = annOut[arrowPosAttr] = 'pixel';
}
if (aaxRef !== 'pixel' && aaxRef !== axRef) {
aaxRef = annOut[arrowPosAttr] = 'pixel'
}

// ax, ay
var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4;
Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt);
}
var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4
Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt)
}

// xanchor, yanchor
coerce(axLetter + 'anchor');
}
coerce(axLetter + 'anchor')
}

// if you have one coordinate you should have both
Lib.noneOrAll(annIn, annOut, ['x', 'y']);
Lib.noneOrAll(annIn, annOut, ['x', 'y'])

if(showArrow) {
coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine);
coerce('arrowhead');
coerce('arrowsize');
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2);
coerce('standoff');
if (showArrow) {
coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine)
coerce('arrowhead')
coerce('arrowsize')
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2)
coerce('standoff')

// if you have one part of arrow length you should have both
Lib.noneOrAll(annIn, annOut, ['ax', 'ay']);
}
Lib.noneOrAll(annIn, annOut, ['ax', 'ay'])
}

if(clickToShow) {
var xClick = coerce('xclick');
var yClick = coerce('yclick');
if (clickToShow) {
var xClick = coerce('xclick')
var yClick = coerce('yclick')

// put the actual click data to bind to into private attributes
// so we don't have to do this little bit of logic on every hover event
annOut._xclick = (xClick === undefined) ? annOut.x : xClick;
annOut._yclick = (yClick === undefined) ? annOut.y : yClick;
}
annOut._xclick = (xClick === undefined) ? annOut.x : xClick
annOut._yclick = (yClick === undefined) ? annOut.y : yClick
}

return annOut;
};
return annOut
}
68 changes: 34 additions & 34 deletions src/components/annotations/arrow_paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/

'use strict';
'use strict'

/**
* centerx is a center of scaling tuned for maximum scalability of
Expand All @@ -21,43 +21,43 @@

module.exports = [
// no arrow
{
path: '',
backoff: 0
},
{
path: '',
backoff: 0
},
// wide with flat back
{
path: 'M-2.4,-3V3L0.6,0Z',
backoff: 0.6
},
{
path: 'M-2.4,-3V3L0.6,0Z',
backoff: 0.6
},
// narrower with flat back
{
path: 'M-3.7,-2.5V2.5L1.3,0Z',
backoff: 1.3
},
{
path: 'M-3.7,-2.5V2.5L1.3,0Z',
backoff: 1.3
},
// barbed
{
path: 'M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z',
backoff: 1.55
},
{
path: 'M-4.45,-3L-1.65,-0.2V0.2L-4.45,3L1.55,0Z',
backoff: 1.55
},
// wide line-drawn
{
path: 'M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z',
backoff: 1.6
},
{
path: 'M-2.2,-2.2L-0.2,-0.2V0.2L-2.2,2.2L-1.4,3L1.6,0L-1.4,-3Z',
backoff: 1.6
},
// narrower line-drawn
{
path: 'M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z',
backoff: 2
},
{
path: 'M-4.4,-2.1L-0.6,-0.2V0.2L-4.4,2.1L-4,3L2,0L-4,-3Z',
backoff: 2
},
// circle
{
path: 'M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z',
backoff: 0
},
{
path: 'M2,0A2,2 0 1,1 0,-2A2,2 0 0,1 2,0Z',
backoff: 0
},
// square
{
path: 'M2,2V-2H-2V2Z',
backoff: 0
}
];
{
path: 'M2,2V-2H-2V2Z',
backoff: 0
}
]
Loading