Skip to content

Commit adcb081

Browse files
committed
use stroke-opacity in drawing patterns
1 parent 1d1a690 commit adcb081

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/components/drawing/index.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,11 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
410410
var path, linewidth, radius;
411411
var patternTag;
412412
var patternAttrs = {};
413+
414+
var fgC = tinycolor(fgcolor);
415+
var fgStroke = Color.tinyRGB(fgC);
416+
var fgStrokeOpacity = fgC.getAlpha();
417+
413418
switch(shape) {
414419
case '/':
415420
width = size * Math.sqrt(2);
@@ -422,7 +427,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
422427
patternAttrs = {
423428
'd': path,
424429
'opacity': fgopacity,
425-
'stroke': fgcolor,
430+
'stroke': fgStroke,
431+
'stroke-opacity': fgStrokeOpacity,
426432
'stroke-width': linewidth + 'px'
427433
};
428434
break;
@@ -437,7 +443,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
437443
patternAttrs = {
438444
'd': path,
439445
'opacity': fgopacity,
440-
'stroke': fgcolor,
446+
'stroke': fgStroke,
447+
'stroke-opacity': fgStrokeOpacity,
441448
'stroke-width': linewidth + 'px'
442449
};
443450
break;
@@ -455,7 +462,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
455462
patternAttrs = {
456463
'd': path,
457464
'opacity': fgopacity,
458-
'stroke': fgcolor,
465+
'stroke': fgStroke,
466+
'stroke-opacity': fgStrokeOpacity,
459467
'stroke-width': linewidth + 'px'
460468
};
461469
break;
@@ -469,7 +477,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
469477
patternAttrs = {
470478
'd': path,
471479
'opacity': fgopacity,
472-
'stroke': fgcolor,
480+
'stroke': fgStroke,
481+
'stroke-opacity': fgStrokeOpacity,
473482
'stroke-width': linewidth + 'px'
474483
};
475484
break;
@@ -483,7 +492,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
483492
patternAttrs = {
484493
'd': path,
485494
'opacity': fgopacity,
486-
'stroke': fgcolor,
495+
'stroke': fgStroke,
496+
'stroke-opacity': fgStrokeOpacity,
487497
'stroke-width': linewidth + 'px'
488498
};
489499
break;
@@ -498,7 +508,8 @@ drawing.pattern = function(sel, calledBy, gd, patternID, shape, size, solidity,
498508
patternAttrs = {
499509
'd': path,
500510
'opacity': fgopacity,
501-
'stroke': fgcolor,
511+
'stroke': fgStroke,
512+
'stroke-opacity': fgStrokeOpacity,
502513
'stroke-width': linewidth + 'px'
503514
};
504515
break;

0 commit comments

Comments
 (0)