Skip to content

Commit 320c4c9

Browse files
committed
Fix single-color open markers
1 parent 61076ce commit 320c4c9

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"alpha-shape": "^1.0.0",
6060
"bubleify": "^1.0.0",
6161
"canvas-fit": "^1.5.0",
62-
"color-rgba": "^1.1.1",
62+
"color-normalize": "^1.0.2",
63+
"color-rgba": "^2.0.0",
6364
"convex-hull": "^1.0.3",
6465
"country-regex": "^1.1.0",
6566
"d3": "^3.5.12",

src/lib/gl_format_color.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'use strict';
1111

1212
var isNumeric = require('fast-isnumeric');
13-
var rgba = require('color-rgba');
13+
var rgba = require('color-normalize');
1414

1515
var Colorscale = require('../components/colorscale');
1616
var colorDflt = require('../components/color/attributes').defaultLine;

src/traces/scattergl/defaults.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2727
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
2828
}
2929

30+
var isOpen = traceIn.marker ? /-open/.test(traceIn.marker.symbol) : false;
31+
var isBubble = subTypes.isBubble(traceIn);
32+
3033
var len = handleXYDefaults(traceIn, traceOut, layout, coerce);
3134
if(!len) {
3235
traceOut.visible = false;
@@ -45,6 +48,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
4548

4649
if(subTypes.hasMarkers(traceOut)) {
4750
handleMarkerDefaults(traceIn, traceOut, defaultColor, layout, coerce);
51+
coerce('marker.line.width', isOpen || isBubble ? 1 : 0);
4852
dfltHoverOn.push('points');
4953
}
5054

src/traces/scattergl/index.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var linkTraces = require('../scatter/link_traces');
2525
var createScatter = require('regl-scatter2d');
2626
var createLine = require('regl-line2d');
2727
var createError = require('regl-error2d');
28+
var rgba = require('color-normalize');
2829
var svgSdf = require('svg-path-sdf');
2930
var createRegl = require('regl');
3031
var fillHoverText = require('../scatter/fill_hover_text');
@@ -405,6 +406,7 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
405406
if(!multiMarker) {
406407
isOpen = /-open/.test(markerOpts.symbol);
407408
}
409+
408410
// prepare colors
409411
if(multiMarker || Array.isArray(markerOpts.color) || Array.isArray(markerOpts.line.color) || Array.isArray(markerOpts.line) || Array.isArray(markerOpts.opacity)) {
410412
markerOptions.colors = new Array(count);
@@ -445,15 +447,17 @@ ScatterGl.sceneOptions = function sceneOptions(container, subplot, trace, positi
445447
markerOptions.opacity = trace.opacity;
446448
}
447449
else {
448-
markerOptions.color = markerOpts.color;
449-
markerOptions.borderColor = markerOpts.line.color;
450-
markerOptions.opacity = trace.opacity * markerOpts.opacity;
451-
452450
if(isOpen) {
453-
markerOptions.borderColor = markerOptions.color.slice();
454-
markerOptions.color = markerOptions.color.slice();
451+
markerOptions.color = rgba(markerOpts.color, 'uint8');
455452
markerOptions.color[3] = 0;
453+
markerOptions.borderColor = rgba(markerOpts.color, 'uint8');
456454
}
455+
else {
456+
markerOptions.color = rgba(markerOpts.color, 'uint8');
457+
markerOptions.borderColor = rgba(markerOpts.line.color, 'uint8');
458+
}
459+
460+
markerOptions.opacity = trace.opacity * markerOpts.opacity;
457461
}
458462

459463
// prepare markers

0 commit comments

Comments
 (0)