Skip to content

Commit

Permalink
small fixes for pattern fill
Browse files Browse the repository at this point in the history
  • Loading branch information
s417-lama committed Mar 3, 2021
1 parent 9f7ce1d commit 6e9cb40
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/components/drawing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ drawing.pattern = function(sel, gd, patternID, shape, bgcolor, fgcolor, size, so

var pattern = fullLayout._defs.select('.patterns')
.selectAll('#' + fullID)
.data([shape + ';' + bgcolor + ';' + fgcolor + ';' + size + ';' + solidity]);
.data([shape + ';' + bgcolor + ';' + fgcolor + ';' + size + ';' + solidity], Lib.identity);

pattern.exit().remove();

Expand Down Expand Up @@ -692,8 +692,8 @@ drawing.singlePointStyle = function(d, sel, trace, fns, gd) {
[[0, gradientColor], [1, fillColor]], 'fill');
} else if(patternShape) {
var patternBGColor = getPatternAttr(markerPattern.bgcolor, d.i, null);
var patternSize = getPatternAttr(markerPattern.size, d.i, 1);
var patternSolidity = getPatternAttr(markerPattern.solidity, d.i, 1);
var patternSize = getPatternAttr(markerPattern.size, d.i, 8);
var patternSolidity = getPatternAttr(markerPattern.solidity, d.i, 0.3);
var perPointPattern = Array.isArray(markerPattern.shape) ||
Array.isArray(markerPattern.bgcolor) ||
Array.isArray(markerPattern.size) ||
Expand Down
6 changes: 3 additions & 3 deletions src/components/legend/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ module.exports = function style(s, gd, legend) {

if(patternShape) {
var patternBGColor = getPatternAttr(markerPattern.bgcolor, null);
var patternSize = getPatternAttr(markerPattern.size, 1);
var patternSolidity = getPatternAttr(markerPattern.solidity, 1);
var patternID = trace.uid;
var patternSize = Math.min(12, getPatternAttr(markerPattern.size, 8));
var patternSolidity = getPatternAttr(markerPattern.solidity, 0.3);
var patternID = 'legend-' + trace.uid;
p.call(Drawing.pattern, gd, patternID, patternShape, patternBGColor,
fillColor, patternSize, patternSolidity, 'fill');
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/traces/bar/style_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = function handleStyleDefaults(traceIn, traceOut, coerce, default
coerce('marker.line.width');
coerce('marker.opacity');
var pattern = coerce('marker.pattern.shape');
if (pattern) {
if(pattern) {
coerce('marker.pattern.bgcolor');
coerce('marker.pattern.size');
coerce('marker.pattern.solidity');
Expand Down

0 comments on commit 6e9cb40

Please sign in to comment.