mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Do not access internal _alpha property.
This commit is contained in:
parent
18ed9010a6
commit
4bc3882c82
1 changed files with 12 additions and 8 deletions
|
@ -372,15 +372,16 @@ new function() {
|
||||||
var stops = gradient._stops;
|
var stops = gradient._stops;
|
||||||
for (var i = 0, l = stops.length; i < l; i++) {
|
for (var i = 0, l = stops.length; i < l; i++) {
|
||||||
var stop = stops[i],
|
var stop = stops[i],
|
||||||
stopColor = stop._color;
|
stopColor = stop._color,
|
||||||
|
alpha = stopColor.getAlpha();
|
||||||
attrs = {
|
attrs = {
|
||||||
offset: stop._rampPoint,
|
offset: stop._rampPoint,
|
||||||
'stop-color': stopColor.toCss(true)
|
'stop-color': stopColor.toCss(true)
|
||||||
};
|
};
|
||||||
// See applyStyle for an explanation of why there are separated
|
// See applyStyle for an explanation of why there are separated
|
||||||
// opacity / color attributes.
|
// opacity / color attributes.
|
||||||
if (stopColor.getAlpha() < 1)
|
if (alpha < 1)
|
||||||
attrs['stop-opacity'] = stopColor._alpha;
|
attrs['stop-opacity'] = alpha;
|
||||||
gradientNode.appendChild(createElement('stop', attrs));
|
gradientNode.appendChild(createElement('stop', attrs));
|
||||||
}
|
}
|
||||||
setDefinition(color, gradientNode);
|
setDefinition(color, gradientNode);
|
||||||
|
@ -412,11 +413,14 @@ new function() {
|
||||||
// (A layer or group which can have style values in SVG).
|
// (A layer or group which can have style values in SVG).
|
||||||
var value = style[entry.get]();
|
var value = style[entry.get]();
|
||||||
if (!parentStyle || !Base.equals(parentStyle[entry.get](), value)) {
|
if (!parentStyle || !Base.equals(parentStyle[entry.get](), value)) {
|
||||||
// Support for css-style rgba() values is not in SVG 1.1, so
|
if (entry.type === 'color' && value != null) {
|
||||||
// separate the alpha value of colors with alpha into the
|
// Support for css-style rgba() values is not in SVG 1.1, so
|
||||||
// separate fill- / stroke-opacity attribute:
|
// separate the alpha value of colors with alpha into the
|
||||||
if (entry.type === 'color' && value != null && value.getAlpha() < 1)
|
// separate fill- / stroke-opacity attribute:
|
||||||
attrs[entry.attribute + '-opacity'] = value._alpha;
|
var alpha = value.getAlpha();
|
||||||
|
if (alpha < 1)
|
||||||
|
attrs[entry.attribute + '-opacity'] = alpha;
|
||||||
|
}
|
||||||
attrs[entry.attribute] = value == null
|
attrs[entry.attribute] = value == null
|
||||||
? 'none'
|
? 'none'
|
||||||
: entry.type === 'color'
|
: entry.type === 'color'
|
||||||
|
|
Loading…
Reference in a new issue