Skip to content

Commit c7a49eb

Browse files
committed
replace bwFactor logic with minBorderWidth
- see #1781 (review) for more info.
1 parent fffc702 commit c7a49eb

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

src/constants/gl2d_markers.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ var symbolsWithOpenSupport = {
7070
unicode: '⧓'
7171
},
7272
'diamond-x': {
73-
unicode: '❖',
74-
bwFactor: 0.25
73+
unicode: '❖'
7574
},
7675
'cross-thin': {
7776
unicode: '+',

src/traces/scattergl/convert.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,13 @@ proto.updateFancy = function(options) {
508508
var colors = convertColorScale(markerOpts, markerOpacity, traceOpacity, len);
509509
var borderWidths = convertNumber(markerOpts.line.width, len);
510510
var borderColors = convertColorScale(markerOpts.line, markerOpacity, traceOpacity, len);
511-
var index, symbol, symbolSpec, _colors, _borderColors, bwFactor, isOpen;
511+
var index, size, symbol, symbolSpec, isOpen, _colors, _borderColors, bw, minBorderWidth;
512512

513513
sizes = convertArray(markerSizeFunc, markerOpts.size, len);
514514

515515
for(i = 0; i < pId; ++i) {
516516
index = idToIndex[i];
517+
517518
symbol = symbols[index];
518519
symbolSpec = MARKER_SYMBOLS[symbol];
519520
isOpen = isSymbolOpen(symbol);
@@ -530,19 +531,15 @@ proto.updateFancy = function(options) {
530531
_borderColors = borderColors;
531532
}
532533

533-
if(symbolSpec.bwFactor) {
534-
bwFactor = symbolSpec.bwFactor;
535-
} else if(symbolSpec.noBorder) {
536-
bwFactor = 0.25;
537-
} else if(symbolSpec.noFill) {
538-
bwFactor = 0.1;
539-
} else {
540-
bwFactor = 0.5;
541-
}
534+
// See https://github.com/plotly/plotly.js/pull/1781#discussion_r121820798
535+
// for more info on this logic
536+
size = sizes[index];
537+
bw = borderWidths[index];
538+
minBorderWidth = (symbolSpec.noBorder || symbolSpec.noFill) ? 0.1 * size : 0;
542539

543-
this.scatter.options.sizes[i] = 4.0 * sizes[index];
540+
this.scatter.options.sizes[i] = 4.0 * size;
544541
this.scatter.options.glyphs[i] = symbolSpec.unicode;
545-
this.scatter.options.borderWidths[i] = bwFactor * borderWidths[index];
542+
this.scatter.options.borderWidths[i] = 0.5 * ((bw > minBorderWidth) ? bw - minBorderWidth : 0);
546543

547544
if(isOpen && !symbolSpec.noBorder && !symbolSpec.noFill) {
548545
fillColor(this.scatter.options.colors, transparent, i, 0);
-797 Bytes
Loading

0 commit comments

Comments
 (0)